/* うんこツール 共通スタイル（スマホ優先・ステージ風ダークテーマ） */
:root {
  --ink: #fff8e6;
  --muted: #b9b2cf;
  --line: rgba(246, 197, 68, .3);
  --line-soft: rgba(255, 255, 255, .12);
  --bg: #07060f;
  --panel: rgba(24, 20, 52, .78);
  --field: #0e0c20;
  --gold: #f6c544;
  --gold-hi: #fff1b8;
  --gold-deep: #b9861a;
  --gold-shadow: #8a6210;
  --on-gold: #1a1203;
  --violet: #c9a7ff;
  --error: #ffb4ab;
  --error-bg: rgba(179, 38, 30, .28);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
/* 会場の照明（固定背景） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 46% at 12% 0%, rgba(98, 66, 200, .36), transparent 70%),
    radial-gradient(56% 42% at 88% 0%, rgba(246, 197, 68, .16), transparent 70%),
    linear-gradient(180deg, #0f0b24 0%, #07060f 62%);
}

h1, h2, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: var(--gold); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 14px; }

/* ヘッダー */
.site-header { border-bottom: 1px solid var(--line-soft); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.logo-mark { flex: none; }
.header-tag { font-size: 12px; font-weight: 700; color: var(--gold-hi); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; line-height: 1.6; white-space: nowrap; }

/* タイトル */
.intro { padding: 14px 0 12px; text-align: center; }
h1 { font-size: clamp(38px, 11vw, 68px); line-height: 1.15; font-weight: 900; letter-spacing: .06em; }
.h1-main {
  display: inline-block;
  background: linear-gradient(180deg, #fff6d0 0%, #f6c544 48%, #c98f1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold);
  filter: drop-shadow(0 0 22px rgba(246, 197, 68, .35));
}
.h1-sub { display: block; margin-top: 4px; font-size: clamp(13px, 3.4vw, 17px); font-weight: 700; letter-spacing: .12em; color: var(--muted); }

/* ツール本体 */
.tool {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px 18px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 241, 184, .06);
  scroll-margin-top: 8px;
}
.tool-side { margin-top: 18px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.big-label { display: block; font-weight: 900; font-size: clamp(20px, 5.6vw, 26px); line-height: 1.3; letter-spacing: .03em; }

textarea {
  display: block;
  width: 100%;
  min-height: 210px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: var(--field);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  resize: vertical;
}
textarea::placeholder { color: #6f6890; font-weight: 500; }
textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(246, 197, 68, .16); }

.count-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-top: 8px; font-size: 14px; color: var(--muted); min-height: 40px; }
.count-row strong { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.count-row strong b { margin: 0 4px; font-size: 34px; font-weight: 900; color: var(--gold); line-height: 1; }

.link-btn { flex: none; border: 1px solid var(--line-soft); border-radius: 999px; background: none; padding: 4px 14px; font-size: 13px; font-weight: 700; color: var(--muted); }

.field-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 56px; height: 56px; border: 2px solid var(--line); border-radius: 14px; background: rgba(246, 197, 68, .1); color: var(--gold-hi); font-size: 28px; font-weight: 800; line-height: 1; padding: 0; }
.stepper button:active { background: rgba(246, 197, 68, .28); }
.stepper input, .stepper output { width: 84px; height: 56px; border: 2px solid rgba(255, 255, 255, .18); border-radius: 14px; background: var(--field); text-align: center; font-size: 30px; font-weight: 900; color: var(--gold); padding: 0 4px; }
.stepper output { display: grid; place-items: center; line-height: 1; overflow: hidden; }
.stepper input:focus { outline: none; border-color: var(--gold); }
.unit { font-size: 20px; font-weight: 800; margin-left: 2px; }
.stepper-sm { gap: 6px; }
.stepper-sm button { width: 46px; height: 46px; font-size: 24px; border-radius: 12px; }
.stepper-sm output { width: 62px; height: 46px; font-size: 24px; border-radius: 12px; }
.stepper-sm .unit { font-size: 16px; }

.error { margin-top: 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(255, 180, 171, .5); background: var(--error-bg); color: var(--error); font-size: 15px; font-weight: 700; line-height: 1.5; }

.btn-primary {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 20px 12px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff3c4 0%, #f6c544 42%, #d49a1c 100%);
  color: var(--on-gold);
  font-size: clamp(26px, 7.4vw, 38px);
  font-weight: 900;
  letter-spacing: .1em;
  line-height: 1.2;
  box-shadow: 0 6px 0 var(--gold-shadow), 0 0 44px rgba(246, 197, 68, .38);
  overflow: hidden;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 34%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: translateX(-140%) skewX(-18deg);
  animation: shine 3.4s ease-in-out infinite;
  pointer-events: none;
}
.btn-primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold-shadow), 0 0 30px rgba(246, 197, 68, .3); }
.btn-primary.is-busy:disabled { opacity: 1; animation: busy .5s ease-in-out infinite alternate; }
.btn-primary.is-busy::after { animation-duration: .7s; }


/* 結果（ステージ） */
.result { margin-top: 18px; scroll-margin-top: 8px; }
.round-label { margin-bottom: 8px; text-align: center; font-size: clamp(16px, 4.4vw, 22px); font-weight: 900; letter-spacing: .2em; color: var(--gold-hi); }

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(58vh, 560px);
  padding: 30px 14px;
  border-radius: 24px;
  border: 2px solid var(--line);
  background: radial-gradient(120% 82% at 50% 0%, #33247a 0%, #17113a 46%, #0a0818 100%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55), 0 0 60px rgba(246, 197, 68, .1), inset 0 0 0 1px rgba(255, 241, 184, .08);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  transition: border-color .3s ease, box-shadow .3s ease;
}
/* スポットライト */
.stage::before, .stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -12%;
  width: 52%;
  height: 135%;
  background: linear-gradient(180deg, rgba(255, 241, 184, .26), rgba(255, 241, 184, 0) 78%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
  pointer-events: none;
}
.stage::before { left: -6%; transform: rotate(-16deg); animation: beam-l 7s ease-in-out infinite alternate; }
.stage::after { right: -6%; transform: rotate(16deg); animation: beam-r 7s ease-in-out infinite alternate; }
.stage.is-spinning { cursor: pointer; }
.stage.is-spinning::before, .stage.is-spinning::after { animation-duration: .8s; }
.stage.is-won { border-color: var(--gold); box-shadow: 0 22px 60px rgba(0, 0, 0, .55), 0 0 90px rgba(246, 197, 68, .32), inset 0 0 0 1px rgba(255, 241, 184, .2); }

.stage-fx { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
/* きらめき */
.stage-fx::before, .stage-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 241, 184, .95) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, .8) 0 1px, transparent 2px);
  background-size: 150px 130px, 210px 190px;
  background-position: 20px 30px, 90px 110px;
  animation: twinkle 2.6s ease-in-out infinite alternate;
}
.stage-fx::after { background-size: 190px 160px, 130px 170px; background-position: 120px 60px, 40px 140px; animation-delay: -1.3s; }
.flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .95) 0%, rgba(255, 241, 184, .55) 30%, transparent 72%); animation: flash .75s ease-out forwards; }
.confetti { position: absolute; inset: 0; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; opacity: 0; animation: fall var(--t, 1.8s) cubic-bezier(.2, .6, .4, 1) var(--d, 0s) forwards; }
.confetti .c0 { background: var(--gold); }
.confetti .c1 { background: var(--gold-hi); }
.confetti .c2 { background: #ffffff; }
.confetti .c3 { background: var(--violet); }

.stage-body { width: 100%; }
.spin-label { font-size: clamp(18px, 5vw, 30px); font-weight: 900; letter-spacing: .4em; text-indent: .4em; color: var(--gold-hi); animation: blink .5s ease-in-out infinite alternate; }
.spin-name { margin-top: 12px; font-size: clamp(34px, 10vw, 92px); font-weight: 900; line-height: 1.3; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .82; }
.stage.is-holding .spin-label { animation: none; }
.stage.is-holding .spin-name { opacity: 1; color: var(--gold-hi); animation: hold .5s ease-in-out; }

.win-label { white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: clamp(20px, 5.6vw, 38px); font-weight: 900; letter-spacing: .34em; text-indent: .34em; color: var(--gold); line-height: 1.3; animation: rise .4s ease-out both; }
.win-label::before, .win-label::after { content: ""; flex: 0 1 90px; min-width: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.win-label::after { transform: scaleX(-1); }
.win-sub { margin-top: 2px; font-size: clamp(15px, 4vw, 22px); font-weight: 800; letter-spacing: .3em; text-indent: .3em; color: var(--ink); animation: rise .4s ease-out .05s both; }

.winners { width: 100%; margin-top: 16px; display: grid; gap: 10px; }
.winner { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 2px solid var(--line); text-align: left; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1) both; }
.winner-name { min-width: 0; font-weight: 900; font-size: clamp(21px, 5.6vw, 28px); line-height: 1.3; }
.winner-no { flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px; background: linear-gradient(180deg, #fff3c4, #f6c544 55%, #d49a1c); color: var(--on-gold); font-size: 17px; font-weight: 900; line-height: 1; }
.winners.is-few .winner { padding: 16px; }
.winners.is-few .winner-name { font-size: clamp(25px, 7vw, 44px); }
.winners.is-few .winner-no { min-width: 42px; height: 42px; border-radius: 21px; font-size: 21px; }

.winners.is-single { margin-top: 10px; }
.winners.is-single .winner { justify-content: center; text-align: center; padding: 14px 4px; background: none; border: 0; border-radius: 0; animation: zoom .6s cubic-bezier(.2, 1.5, .4, 1) both; }
.winners.is-single .winner-name {
  color: #ffeeb0;
  font-size: clamp(22px, 5vw, 46px);
  line-height: 1.2;
  text-shadow: 0 0 18px rgba(246, 197, 68, .7), 0 0 64px rgba(246, 197, 68, .4), 0 3px 0 rgba(122, 86, 12, .9);
}
.winners.is-single.sz-xl .winner-name { font-size: clamp(46px, 13.5vw, 136px); }
.winners.is-single.sz-l .winner-name { font-size: clamp(34px, 9.4vw, 100px); }
.winners.is-single.sz-m .winner-name { font-size: clamp(26px, 6.4vw, 68px); }

.result-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; }
.remain-note { font-size: 20px; font-weight: 900; line-height: 1.3; }
.remain-note b { margin: 0 4px; font-size: 30px; color: var(--gold); line-height: 1; }
.again-count { display: flex; align-items: center; gap: 10px; }
.again-count-label { font-size: 14px; font-weight: 800; color: var(--muted); }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.btn-secondary, .btn-ghost { width: 100%; min-height: 60px; padding: 10px 8px; border-radius: 16px; font-size: clamp(17px, 4.6vw, 22px); font-weight: 900; line-height: 1.25; letter-spacing: .02em; }
.btn-secondary { border: 2px solid var(--gold); background: rgba(246, 197, 68, .1); color: var(--gold-hi); }
.btn-again { grid-column: 1 / -1; min-height: 68px; border: 0; background: linear-gradient(180deg, #fff3c4 0%, #f6c544 42%, #d49a1c 100%); color: var(--on-gold); font-size: clamp(22px, 6vw, 28px); box-shadow: 0 5px 0 var(--gold-shadow); }
.btn-ghost { border: 2px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .05); color: var(--ink); }
.btn-secondary:active:not(:disabled), .btn-ghost:active:not(:disabled) { transform: translateY(2px); }
.btn-again:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-shadow); }

.history { margin-top: 14px; padding: 12px 16px; border: 1px solid var(--line-soft); border-radius: 16px; background: rgba(255, 255, 255, .04); }
.history-title { font-size: 16px; font-weight: 900; color: var(--gold-hi); letter-spacing: .06em; }
.history-list li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line-soft); font-size: 17px; font-weight: 700; }
.history-list li:first-child { border-top: 0; }
.history-round { flex: none; font-weight: 900; color: var(--gold); }
.history-names { min-width: 0; }

/* 説明セクション */
.docs { display: grid; gap: 12px; margin-top: 36px; }
.doc { margin-top: 0; }
.card { padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: 16px; background: rgba(255, 255, 255, .04); }
.doc h2 { font-size: 18px; line-height: 1.4; font-weight: 900; color: var(--gold-hi); margin-bottom: 8px; letter-spacing: .03em; }
.doc p { font-size: 15px; }

.checks li { position: relative; padding-left: 22px; font-size: 15px; line-height: 1.6; }
.checks li + li { margin-top: 4px; }
.checks li::before { content: ""; position: absolute; left: 3px; top: .5em; width: 11px; height: 6px; border-left: 3px solid var(--gold); border-bottom: 3px solid var(--gold); transform: rotate(-45deg); }

.faq-section { margin-top: 12px; }
.faq dt { font-weight: 800; font-size: 15px; padding-left: 26px; position: relative; }
.faq dt::before { content: "Q"; position: absolute; left: 0; top: 0; color: var(--gold); font-weight: 900; }
.faq dd { font-size: 14px; color: var(--muted); padding: 0 0 10px 26px; margin-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.faq dd:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.notice { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.7; }

/* 広告枠（将来用）。中身が入るまで高さを持たない */
.ad-slot:empty { display: none; }
.ad-slot { margin: 24px 0; text-align: center; overflow: hidden; }

/* 下層ページ */
.page { max-width: 760px; padding-top: 22px; padding-bottom: 8px; }
.page h1 { font-size: 26px; letter-spacing: .02em; margin-bottom: 12px; color: var(--gold-hi); }
.page h2 { font-size: 17px; font-weight: 800; margin: 22px 0 6px; color: var(--gold-hi); }
.page p, .page li { font-size: 15px; }
.page p + p { margin-top: 8px; }
.page ul { list-style: disc; padding-left: 22px; }
.page .date { margin-top: 24px; font-size: 13px; color: var(--muted); }
.back-link { display: inline-block; margin-top: 20px; font-weight: 700; }

/* フッター */
.site-footer { margin-top: 40px; padding: 20px 0 28px; border-top: 1px solid var(--line-soft); background: rgba(0, 0, 0, .3); text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 13px; }
.footer-nav a { padding: 4px 0; }
.copyright { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* 制作者クレジット */
.credit { margin-top: 20px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.credit-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .28em; }
.credit-link { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 7px; padding: 4px 6px; color: var(--gold); text-decoration: none; }
.credit-link:hover { color: var(--gold-hi); }
.credit-link svg { flex: none; }
.credit-name { font-weight: 800; letter-spacing: .14em; }
.credit-handle { color: var(--muted); letter-spacing: .04em; }

/* スクロールで軽くフェードアップ（reveal.js がクラスを付ける） */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s ease; }
  .reveal.is-in { opacity: 1; transform: none; }
}

.clipboard-helper { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }

@keyframes pop {
  0% { transform: scale(.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes zoom {
  0% { transform: scale(.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes rise {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes hold {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes blink {
  0% { opacity: .55; }
  100% { opacity: 1; }
}
@keyframes busy {
  0% { box-shadow: 0 6px 0 var(--gold-shadow), 0 0 24px rgba(246, 197, 68, .3); }
  100% { box-shadow: 0 6px 0 var(--gold-shadow), 0 0 70px rgba(246, 197, 68, .8); }
}
@keyframes shine {
  0%, 62% { transform: translateX(-140%) skewX(-18deg); }
  100% { transform: translateX(420%) skewX(-18deg); }
}
@keyframes beam-l {
  0% { transform: rotate(-20deg); }
  100% { transform: rotate(-4deg); }
}
@keyframes beam-r {
  0% { transform: rotate(20deg); }
  100% { transform: rotate(4deg); }
}
@keyframes twinkle {
  0% { opacity: .15; }
  100% { opacity: .75; }
}
@keyframes flash {
  0% { opacity: 0; }
  14% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate3d(var(--x), var(--y), 0) rotate(var(--r)); opacity: 0; }
}

/* スマホ：見出し中央・候補数と当選人数を2行の情報ブロックに整理 */
@media (max-width: 699px) {
  .intro { padding: 12px 0 10px; }
  .tool { padding: 14px 14px 24px; }
  .tool-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; }
  .field-head { display: contents; }
  .field-head .big-label { grid-area: 1 / 1 / 2 / -1; margin-bottom: 10px; text-align: center; }
  .tool-main textarea { grid-area: 2 / 1 / 3 / -1; min-height: 196px; }
  .count-row { grid-area: 3 / 1; align-items: center; margin-top: 6px; min-height: 48px; }
  .link-btn { grid-area: 3 / 2; margin-top: 6px; padding: 7px 14px; }
  .tool-side { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
  .field-count { flex-wrap: nowrap; }
  .field-count .big-label { flex: none; }
  .stepper { gap: 6px; }
  .stepper button { width: 52px; height: 52px; }
  .stepper input { width: 72px; height: 52px; }
  .btn-primary {
    width: calc(100% - 8px);
    margin: 18px auto 0;
    padding: 22px 12px;
    border: 3px solid var(--gold-shadow);
    border-radius: 20px;
    background: linear-gradient(180deg, #fff8dc 0%, #ffe07a 18%, #f6c544 50%, #d49a1c 100%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .8), inset 0 0 0 1px rgba(255, 241, 184, .7), 0 6px 0 #6b4a0a, 0 12px 18px rgba(0, 0, 0, .45), 0 0 30px rgba(246, 197, 68, .3);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  }
  .btn-primary:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 0 0 1px rgba(255, 241, 184, .6), 0 2px 0 #6b4a0a, 0 4px 10px rgba(0, 0, 0, .45), 0 0 22px rgba(246, 197, 68, .28); }
  .docs { margin-top: 28px; }
}

@media (max-width: 379px) {
  .stepper button { width: 48px; height: 48px; }
  .stepper input { width: 64px; height: 48px; font-size: 26px; }
  .again-count-label { font-size: 13px; }
}

@media (max-width: 339px) {
  .field-count { flex-direction: column; gap: 8px; }
  .count-row { justify-content: center; }
  .tool-main:has(.link-btn:not([hidden])) .count-row { justify-content: flex-start; }
}

@media (min-width: 700px) {
  .wrap { padding: 0 24px; }
  .header-inner { height: 54px; }
  .intro { padding: 18px 0 16px; }
  .tool { padding: 24px; }
  textarea { font-size: 20px; }
  .winners.is-multi { grid-template-columns: 1fr 1fr; }
  .result-actions { grid-template-columns: 1.3fr 1fr 1fr; }
  .btn-again { grid-column: auto; }
  .btn-secondary, .btn-ghost { min-height: 68px; }
  .stage { padding: 40px 28px; }
  .docs { grid-template-columns: 1fr 1fr 1fr; }
}

@media (min-width: 960px) {
  .tool { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 32px; padding: 28px 32px; }
  .tool-side { margin-top: 0; display: flex; flex-direction: column; justify-content: center; }
  textarea { height: clamp(220px, 40vh, 380px); }
  .field-count { flex-direction: column; align-items: stretch; gap: 12px; }
  .field-count .stepper { justify-content: center; }
  .field-count .big-label { text-align: center; }
  .stepper button { width: 68px; height: 68px; font-size: 34px; }
  .stepper input { width: 120px; height: 68px; font-size: 40px; }
  .field-count .unit { font-size: 24px; }
  .btn-primary { margin-top: 26px; padding: 30px 12px; font-size: 40px; }
  .winners.is-many { grid-template-columns: 1fr 1fr 1fr; }
  .stage { min-height: min(66vh, 620px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
