/* 골라줘 — 종이 위에 펜으로 긋는 사다리. 형광펜 노랑은 '뽑힌 것'에만 씀 */

:root {
  --paper: #F2F1F7;
  --sheet: #FFFFFF;
  --well: #F6F5FA;
  --ink: #1F1B33;
  --ink-2: #5E5977;
  --line: #DCD8E8;
  --rail: #C9C4DB;
  --pick: #5B3FE0;
  --pick-hover: #4A2FCC;
  --pick-soft: #ECE8FF;
  --on-pick: #FFFFFF;
  --marker: #FFD43B;
  --on-marker: #1F1B33;

  /* 사다리 펜: 사람마다 한 색. 흰 글씨와 4.5:1 이상 */
  --pen-0: #D33A2C; --pen-1: #B4530B; --pen-2: #9A6700; --pen-3: #1E8A4C;
  --pen-4: #0E7C84; --pen-5: #1F6BCB; --pen-6: #4F46E5; --pen-7: #8B3FC9;
  --pen-8: #BE2677; --pen-9: #7A5A44; --pen-10: #4D7C0F; --pen-11: #475569;

  /* 룰렛 칸: 진한 글씨(--wheel-ink)와 대비가 충분한 밝은 색 */
  --slice-0: #FFD43B; --slice-1: #B9A9FF; --slice-2: #86DEC4; --slice-3: #FFA3B8;
  --slice-4: #93CBFF; --slice-5: #FFB774; --slice-6: #CDEA74; --slice-7: #DDD7EE;
  --wheel-ink: #1F1B33;

  --display: "Pretendard Variable", Pretendard, sans-serif;
  --display-weight: 800;
  --ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --s-1: 0.875rem;  /* 14 */
  --s0: 1rem;       /* 16 */
  --s1: 1.125rem;   /* 18 */
  --s2: 1.375rem;   /* 22 */
  --s3: 1.75rem;    /* 28 */
  --s4: 2.5rem;     /* 40 */

  --r-sheet: 22px;
  --r-ctl: 12px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16141F;
    --sheet: #1F1C2B;
    --well: #282436;
    --ink: #EEECF6;
    --ink-2: #ABA6C2;
    --line: #363149;
    --rail: #4A4462;
    --pick: #9D8BFF;
    --pick-hover: #B3A5FF;
    --pick-soft: #2E2850;
    --on-pick: #16141F;
    --pen-0: #F2685B; --pen-1: #E98A3C; --pen-2: #D9A520; --pen-3: #3FBF74;
    --pen-4: #2BB3BB; --pen-5: #5B9BFF; --pen-6: #8A84FF; --pen-7: #BA7BF0;
    --pen-8: #F062A8; --pen-9: #C09A7E; --pen-10: #8CC63F; --pen-11: #94A3B8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16141F;
  --sheet: #1F1C2B;
  --well: #282436;
  --ink: #EEECF6;
  --ink-2: #ABA6C2;
  --line: #363149;
  --rail: #4A4462;
  --pick: #9D8BFF;
  --pick-hover: #B3A5FF;
  --pick-soft: #2E2850;
  --on-pick: #16141F;
  --pen-0: #F2685B; --pen-1: #E98A3C; --pen-2: #D9A520; --pen-3: #3FBF74;
  --pen-4: #2BB3BB; --pen-5: #5B9BFF; --pen-6: #8A84FF; --pen-7: #BA7BF0;
  --pen-8: #F062A8; --pen-9: #C09A7E; --pen-10: #8CC63F; --pen-11: #94A3B8;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--s0);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--pick); text-underline-offset: 3px; }
a:hover { color: var(--pick-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 3px solid var(--pick); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 머리 ---------- */
.top {
  max-width: 968px;
  margin: 0 auto;
  padding: 20px 24px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand img { display: block; border-radius: 8px; }

/* 화면 모드: 머리 오른쪽 끝, 도구 안의 .seg 를 작게 줄인 모양 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.theme { flex: none; display: inline-flex; padding: 3px; gap: 2px; background: var(--well); border: 1px solid var(--line); border-radius: 12px; }
.theme button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
}
.theme button:hover { color: var(--ink); }
.theme button[aria-checked="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

/* ---------- 프레임 (광고 레일은 실제 광고가 있을 때만) ---------- */
.frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
main { min-width: 0; width: 100%; max-width: 920px; margin: 0 auto; padding-bottom: 32px; }

/* 광고 칸: 주석 처리된 ins 만 있으면 자리도 차지하지 않음. ins.adsbygoogle 을 풀면 나타남 */
.ad { display: none; }
.ad-inline:has(ins.adsbygoogle) { display: block; }
@media (min-width: 1280px) {
  .frame:has(.ad-side ins.adsbygoogle) { grid-template-columns: 160px minmax(0, 1fr) 160px; gap: 40px; }
  .ad-side:has(ins.adsbygoogle) { display: block; }
  .ad-side .ad-slot { position: sticky; top: 24px; }
  /* 레일이 있으면 본문 광고는 생략 */
  .frame:has(.ad-side ins.adsbygoogle) .ad-inline { display: none; }
}
.ad-slot { overflow: hidden; }
.ad-160 { width: 160px; min-height: 600px; }
/* 버튼과 충분히 떨어지도록 참고 자료 아래에 크게 띄움 */
.ad-inline { min-height: 100px; margin: 120px 0 0; }

.intro {
  margin: 28px 0 20px;
  font-size: var(--s2);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 30em;
}

/* ---------- 탭: 종이 묶음의 색인처럼 아래 시트와 이어짐 ---------- */
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.tabs::-webkit-scrollbar { display: none; }
/* 좁은 화면에서 탭이 넘치면 오른쪽 끝을 흐리게 해서 더 있다는 걸 알림 */
.tabs.more { mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.tabs a {
  flex: none;
  padding: 11px 16px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--pick) 7%, transparent); }
.tabs a[aria-selected="true"] {
  background: var(--sheet);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--sheet);
}
.tabs a:focus-visible { outline-offset: -3px; }

.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r-sheet);
  padding: clamp(16px, 4vw, 32px);
}
.tabs:has(a:first-child[aria-selected="true"]) + .sheet { border-top-left-radius: 0; }

/* ---------- 입력 ---------- */
.inputs.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.inputs.nums { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label:not(.num) { font-weight: 700; font-size: 0.9375rem; display: flex; align-items: baseline; gap: 8px; }
.count { font-weight: 500; font-size: var(--s-1); color: var(--ink-2); }

textarea, input[type="number"], input[type="text"], select {
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font-size: 1rem; /* 16px 미만이면 iOS 가 확대함 */
}
textarea {
  width: 100%;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
  min-height: 84px;
}
input[type="number"], input[type="text"], select { height: 44px; padding: 0 12px; }
input[type="number"] { width: 5.5em; font-variant-numeric: tabular-nums; }
input[type="text"] { width: 7.5em; }
textarea:focus, input:focus, select:focus { border-color: var(--pick); }

.num { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9375rem; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--pick); margin: 0; }

.hint { margin: 10px 0 0; font-size: var(--s-1); color: var(--ink-2); }
.field .hint { margin: 0; }
.msg { margin: 12px 0 0; font-size: var(--s-1); color: var(--ink-2); }
.msg:empty { display: none; }
.msg.warn { color: var(--pen-0); font-weight: 600; }

/* ---------- 버튼 ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 20px; }
.actions.center { justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--sheet);
  font-weight: 650;
  font-size: 0.9375rem;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--pick); border-color: var(--pick); color: var(--on-pick); }
.btn.primary:hover { background: var(--pick-hover); border-color: var(--pick-hover); }
.btn.big { min-height: 56px; padding: 0 30px; font-size: var(--s1); border-radius: 16px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: var(--s-1); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--well); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--well); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px; max-width: 100%; overflow-x: auto; }
.seg button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  min-height: 38px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.field .seg { margin-bottom: 4px; align-self: flex-start; }

/* ---------- 사다리 ---------- */
.ladder { margin-top: 24px; --n: 5; }
.ladder-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.ladder-svg { display: block; width: 100%; overflow: visible; }
.ladder-svg .rail { stroke: var(--rail); stroke-width: 4; stroke-linecap: round; }
.ladder-svg .path { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.ladder-svg .dot { stroke: var(--sheet); stroke-width: 3; }

.who {
  margin: 0 2px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 4px 5px;
  border: 0;
  border-bottom: 4px solid var(--pen);
  border-radius: 10px 10px 4px 4px;
  background: var(--well);
  font-weight: 700;
  font-size: var(--s-1);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.who:hover { background: color-mix(in srgb, var(--pen) 14%, var(--well)); }
.who[aria-pressed="true"] { background: var(--pen); color: #fff; }
:root[data-theme="dark"] .who[aria-pressed="true"] { color: #16141F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .who[aria-pressed="true"] { color: #16141F; } }

.what {
  margin: 0 2px;
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 6px 4px;
  border-radius: 4px 4px 10px 10px;
  border-top: 4px solid var(--rail);
  background: var(--well);
  font-weight: 700;
  font-size: var(--s-1);
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
}
.what span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.what.masked {
  background: var(--pick-soft);
  border-top-color: var(--pick);
  color: var(--pick);
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: var(--s1);
}
.what.open { border-top-color: var(--pen); animation: land .45s cubic-bezier(.2, 1.4, .4, 1); }
.what.open.win { background: var(--marker); color: var(--on-marker); }
@keyframes land { from { transform: scale(.7); } to { transform: none; } }

.outcome { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.outcome-tip { margin: 0; flex: 1 1 100%; font-size: var(--s-1); color: var(--ink-2); }
.outcome-tip:empty { display: none; }
.pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.pairs:empty { display: none; }
.pairs li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--well);
  font-size: 0.9375rem;
}
.pairs li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--pen); flex: none; }
.pairs b { font-weight: 700; }
.pairs .win span { background: linear-gradient(transparent 52%, var(--marker) 52%); color: var(--ink); font-weight: 700; }
:root[data-theme="dark"] .pairs .win span { color: var(--on-marker); background: var(--marker); padding: 0 4px; border-radius: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pairs .win span { color: var(--on-marker); background: var(--marker); padding: 0 4px; border-radius: 4px; } }
.share { margin-left: auto; }

/* ---------- 룰렛 ---------- */
.wheel-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px 40px; align-items: center; }
.wheel-box { position: relative; width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto; padding-top: 6px; }
.wheel-spin { width: 100%; height: 100%; will-change: transform; }
.wheel { display: block; width: 100%; height: 100%; }
.wheel .slice { stroke: var(--wheel-ink); stroke-width: 1.2; stroke-linejoin: round; }
.wheel .slice.hit { stroke-width: 3.5; }
.wheel.landed .slice:not(.hit), .wheel.landed text:not(.hit) { opacity: .38; transition: opacity .4s; }
.wheel .rim { fill: none; stroke: var(--wheel-ink); stroke-width: 5; }
.wheel .hub { fill: var(--sheet); stroke: var(--wheel-ink); stroke-width: 4; }
.wheel text { fill: var(--wheel-ink); font-family: var(--ui); font-weight: 700; dominant-baseline: central; }
:root[data-theme="dark"] .wheel .rim, :root[data-theme="dark"] .wheel .hub { stroke: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wheel .rim, :root:not([data-theme="light"]) .wheel .hub { stroke: var(--ink); } }
.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 34px;
  transform: translateX(-50%);
  fill: var(--ink);
  stroke: var(--sheet);
  stroke-width: 3;
  filter: drop-shadow(0 2px 0 var(--sheet));
}
.wheel-side { min-width: 0; }
.wheel-side .actions { margin: 16px 0 28px; }

/* 뽑힌 결과: 형광펜을 그은 큰 글씨 */
.verdict {
  margin: 0;
  min-height: 1.3em;
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.verdict mark {
  background: linear-gradient(transparent 55%, var(--marker) 55%);
  color: var(--ink);
  padding: 0 .08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.verdict.pop mark { animation: swipe .5s ease-out both; }
@keyframes swipe { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
.verdict mark { background-repeat: no-repeat; background-size: 100% 100%; }
.verdict-wait { font-family: var(--ui); font-size: var(--s1); font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.verdict.small { font-size: clamp(2rem, 6vw, 2.75rem); text-align: center; }
:root[data-theme="dark"] .verdict mark { color: var(--on-marker); background-image: linear-gradient(var(--marker), var(--marker)); border-radius: 6px; padding: 0 .15em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .verdict mark { color: var(--on-marker); background-image: linear-gradient(var(--marker), var(--marker)); border-radius: 6px; padding: 0 .15em; } }

/* ---------- 제비 카드 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; margin-top: 20px; }
.card {
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: none;
  perspective: 600px;
  border-radius: 12px;
}
.card-in {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.3, 1.3, .5, 1);
}
.card.open .card-in { transform: rotateY(180deg); }
.card-back, .card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-back {
  background: var(--pick);
  color: var(--on-pick);
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: var(--s2);
  /* 접힌 쪽지 모서리 */
  background-image: linear-gradient(225deg, color-mix(in srgb, var(--sheet) 32%, transparent) 0 14px, transparent 14px);
}
.card:hover .card-back { background-color: var(--pick-hover); }
.card-face {
  transform: rotateY(180deg);
  background: var(--well);
  border: 1.5px solid var(--line);
  color: var(--ink-2);
  font-weight: 700;
  font-size: var(--s-1);
  padding: 6px;
  text-align: center;
  line-height: 1.2;
}
.card-face.win { background: var(--marker); border-color: var(--marker); color: var(--on-marker); font-family: var(--display); font-weight: var(--display-weight); font-size: var(--s1); }
.card-face small { position: absolute; top: 6px; left: 8px; font-family: var(--ui); font-weight: 600; font-size: 0.75rem; opacity: .7; }

.picked { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: pick; }
.picked:empty { display: none; }
.picked li {
  counter-increment: pick;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--well);
  border-radius: 12px;
  font-size: var(--s1);
  font-weight: 700;
  animation: rise .35s ease-out both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
.picked li::before {
  content: counter(pick);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pick);
  color: var(--on-pick);
  font-weight: 800;
  font-size: var(--s-1);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.picked li:first-child { background: var(--marker); color: var(--on-marker); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 팀 ---------- */
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 20px; }
.teams:empty { display: none; }
.team { background: var(--well); border-radius: 14px; padding: 14px 16px 16px; border-top: 5px solid var(--pen); animation: rise .35s ease-out both; animation-delay: calc(var(--i, 0) * 70ms); }
.team h3 { margin: 0 0 8px; font-family: var(--display); font-weight: var(--display-weight); font-size: var(--s2); display: flex; align-items: baseline; gap: 8px; }
.team h3 small { font-family: var(--ui); font-size: var(--s-1); font-weight: 600; color: var(--ink-2); }
.team ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.team li { background: var(--sheet); border-radius: 8px; padding: 4px 10px; font-weight: 600; font-size: 0.9375rem; }

/* ---------- 로또 ---------- */
.games { display: grid; gap: 10px; margin-top: 20px; }
.games:empty { display: none; }
.game { display: flex; align-items: center; gap: clamp(5px, 1.6vw, 10px); }
.game-tag { width: 1.4em; color: var(--ink-2); font-weight: 700; font-size: var(--s-1); flex: none; }
.ball {
  width: clamp(38px, 10vw, 48px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: clamp(0.9375rem, 3.6vw, 1.125rem);
  font-variant-numeric: tabular-nums;
  color: #1F1B33;
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, .12);
  animation: pop .4s cubic-bezier(.2, 1.5, .4, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  flex: none;
}
.ball.b1 { background: #FBC400; }
.ball.b2 { background: #69C8F2; }
.ball.b3 { background: #FF7272; }
.ball.b4 { background: #B4B4B4; }
.ball.b5 { background: #B0D840; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.note { margin: 24px 0 0; padding: 12px 16px; background: var(--well); border-radius: 12px; font-size: var(--s-1); color: var(--ink-2); }
.note b { color: var(--ink); white-space: nowrap; }

/* ---------- 숫자, 주사위, 동전 ---------- */
.numbers { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 24px; }
.numbers:empty { display: none; }
.numbers span {
  min-width: 2.2em;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--well);
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: var(--s3);
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  animation: pop .35s cubic-bezier(.2, 1.5, .4, 1) both;
  animation-delay: calc(min(var(--i, 0), 20) * 25ms);
}
.numbers.solo span { font-size: clamp(4rem, 16vw, 6rem); padding: 4px 28px; background: none; }
.numbers.solo span mark { background: linear-gradient(transparent 58%, var(--marker) 58%); color: var(--ink); }

.dice { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; min-height: 76px; }
.die {
  width: 76px;
  height: 76px;
  padding: 10px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  background: var(--sheet);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
}
.die i { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); place-self: center; }
.die.one i { background: var(--pen-0); width: 16px; height: 16px; }
.die.rolling { animation: tumble .55s cubic-bezier(.3, .7, .4, 1); animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes tumble {
  0% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-26px) rotate(-160deg); }
  60% { transform: translateY(0) rotate(-300deg); }
  80% { transform: translateY(-6px) rotate(-350deg); }
  100% { transform: translateY(0) rotate(-360deg); }
}
.dice-sum { margin: 16px 0 0; font-size: var(--s1); font-weight: 600; min-height: 1.6em; }
.dice-sum b { font-family: var(--display); font-weight: var(--display-weight); font-size: var(--s3); margin-left: 6px; }

.coin-stage { display: grid; place-items: center; padding: 28px 0 20px; perspective: 800px; }
.coin { position: relative; width: 140px; height: 140px; transform-style: preserve-3d; }
.coin-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: 3.25rem;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 6px double var(--ink);
}
.coin-face.front { background: var(--marker); color: var(--on-marker); }
.coin-face.back { background: var(--pick-soft); color: var(--pick); transform: rotateY(180deg); }
.coin.flipping { animation: toss 1s cubic-bezier(.3, .6, .4, 1); }
@keyframes toss { 0%, 100% { translate: 0 0; } 45% { translate: 0 -70px; } }
.tally { text-align: center; margin: 16px 0 0; font-size: var(--s-1); color: var(--ink-2); min-height: 1.6em; }

/* ---------- 공정성 한 줄, 최근 결과 ---------- */
.fair-note { display: flex; gap: 10px; align-items: flex-start; margin: 16px 4px 0; font-size: var(--s-1); color: var(--ink-2); }
.fair-note svg { flex: none; width: 18px; height: 18px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.history { margin-top: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.history summary { padding: 14px 4px; font-weight: 700; cursor: pointer; list-style-position: inside; }
.history ol { list-style: none; margin: 0; padding: 0 4px; display: grid; gap: 2px; }
.history li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: var(--s-1); }
.history li time { color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.history li b { flex: none; }
.history li span { color: var(--ink-2); min-width: 0; }
.history-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 12px; padding: 0 4px; font-size: var(--s-1); color: var(--ink-2); }
.history ol:empty::before { content: "아직 기록이 없어요. 무언가 뽑으면 여기에 남아요."; display: block; padding: 8px 0; font-size: var(--s-1); color: var(--ink-2); }

/* ---------- 안내 글 ---------- */
.guide { margin-top: 72px; max-width: 46rem; }
.guide + .guide { margin-top: 56px; }
.guide h2 { margin: 0 0 16px; font-family: var(--display); font-weight: var(--display-weight); font-size: 2rem; line-height: 1.25; letter-spacing: -0.01em; }
.guide h3 { margin: 32px 0 8px; font-size: var(--s1); line-height: 1.4; }
.guide p, .guide li { line-height: 1.8; }
.guide p { margin: 0 0 12px; }
.guide ol, .guide ul { margin: 0 0 12px; padding-left: 1.4em; }
.guide li { margin-bottom: 6px; }
.guide .lead { font-size: var(--s1); line-height: 1.75; }
.guide article { padding-top: 4px; }
.guide article + article { border-top: 1px solid var(--line); margin-top: 32px; }
.guide article h3 { margin-top: 28px; font-size: var(--s2); }
.guide code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .875em; background: var(--well); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }
.faq h3 { margin-top: 28px; }
.refs li { margin-bottom: 4px; }

/* ---------- 바닥 ---------- */
.foot {
  max-width: 920px;
  margin: 72px auto 0;
  padding: 28px 24px 56px;
  border-top: 1px solid var(--line);
  font-size: var(--s-1);
  color: var(--ink-2);
}
.foot p { margin: 0 0 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.foot-tools span { font-weight: 600; color: var(--ink); }
.foot a { color: var(--ink-2); }
.foot a:hover { color: var(--pick); }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 720px) {
  .wheel-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .wheel-box { width: min(100%, 360px); }
  .wheel-side { text-align: left; }
}
@media (max-width: 640px) {
  .top { padding: 16px 16px 0; }
  .theme button { padding: 6px 8px; }
  .frame { padding: 0 16px; }
  .intro { font-size: var(--s1); margin: 20px 0 14px; }
  .inputs.two { grid-template-columns: minmax(0, 1fr); }
  .tabs a { padding: 10px 12px 11px; font-size: 0.875rem; }
  .who, .what { font-size: 0.75rem; margin: 0 1px; padding-left: 2px; padding-right: 2px; }
  .what.masked { font-size: var(--s0); }
  .share { margin-left: 0; }
  .guide { margin-top: 56px; }
  .foot { padding: 24px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

a.btn { text-decoration: none; color: var(--ink); }
a.btn.primary, a.btn.primary:hover { color: var(--on-pick); }
