/* 맛도리 뺑뺑이 — 동네 식당 주문 전표 느낌. 왼쪽 조건표, 오른쪽 돌림판과 결과 전표. 좁으면 한 줄로 쌓임 */
:root {
  --bg: #EDF0F3;
  --surface: #FFFFFF;
  --sunk: #E3E7EC;
  --ink: #16202E;
  --muted: #5A6574;
  --line: #CDD4DC;
  --accent: #D23A1F;      /* 고추장 */
  --accent-ink: #FFFFFF;
  --hi: #F0B323;          /* 참기름 */
  --ok: #2E7D4F;
  --c-han: #D9432B; --c-il: #3159C9; --c-jung: #B7861E;
  --c-yang: #2E8B57; --c-oe: #0E8F9B; --c-gi: #7D5BA6;
  --f-display: "Black Han Sans", "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, "Consolas", monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151B; --surface: #1A2028; --sunk: #232A34; --ink: #ECEFF3; --muted: #9AA5B2;
    --line: #2F3843; --accent: #FF5B3D; --accent-ink: #1A0A06; --hi: #F5C04A; --ok: #58C287;
    --c-han: #E5543B; --c-il: #4C74E0; --c-jung: #C99A2E; --c-yang: #3C9F69; --c-oe: #1FA5B1; --c-gi: #9273BD;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151B; --surface: #1A2028; --sunk: #232A34; --ink: #ECEFF3; --muted: #9AA5B2;
  --line: #2F3843; --accent: #FF5B3D; --accent-ink: #1A0A06; --hi: #F5C04A; --ok: #58C287;
  --c-han: #E5543B; --c-il: #4C74E0; --c-jung: #C99A2E; --c-yang: #3C9F69; --c-oe: #1FA5B1; --c-gi: #9273BD;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* 로컬 파일로 열 때도 화면 전환이 되도록 */
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; }

/* 머리 */
header.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding-block: 24px 16px; }
.brand h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(34px, 6vw, 52px); line-height: 1; margin: 0; letter-spacing: -0.01em; }
.brand h1 b { color: var(--accent); font-weight: 400; }
.brand p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
nav.tabs { display: flex; gap: 4px; background: var(--sunk); padding: 4px; border-radius: 999px; }
nav.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 500; color: var(--muted); }
nav.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }

/* 본문 그리드 */
.spin-layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 880px) { .spin-layout { grid-template-columns: minmax(0, 1fr); } }

/* 조건표 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 18px; }
.group h2 { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.group h2 button { border: 0; background: none; color: var(--accent); font-size: 12px; letter-spacing: 0; padding: 0; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 500; line-height: 1.3; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.cat[aria-pressed="true"] { background: var(--cc); border-color: var(--cc); color: #fff; }
.chip .n { font-family: var(--f-num); font-size: 11px; opacity: .7; margin-left: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.row label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
select, input[type="search"] { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 10px; }
input[type="range"] { accent-color: var(--accent); width: 160px; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* 돌림판 영역 */
.stage { display: grid; gap: 16px; }
.wheel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; justify-items: center; }
.pool-line { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pool-line strong { font-family: var(--f-display); font-weight: 400; font-size: 26px; }
.pool-line strong .num { font-family: var(--f-display); color: var(--accent); }
.wheel-box { position: relative; width: min(100%, 440px); aspect-ratio: 1; max-width: 100%; }
.wheel-box canvas { width: 100%; height: 100%; display: block; }
.pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--hi);
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / .35)); z-index: 2; }
.hub { position: absolute; inset: 0; margin: auto; width: 22%; height: 22%; border-radius: 50%; background: var(--surface);
  border: 4px solid var(--ink); display: grid; place-items: center; font-family: var(--f-display); font-size: clamp(14px, 3.4vw, 20px); z-index: 1; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; background: var(--sunk); }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-family: var(--f-display); font-weight: 400; font-size: 22px; padding: 12px 40px; letter-spacing: .02em; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* 결과 전표 */
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ticket-head { padding: 18px 18px 14px; border-bottom: 2px dashed var(--line); display: grid; gap: 8px; }
.ticket-head .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.ticket-head h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 5vw, 38px); line-height: 1.1; margin: 0; text-wrap: balance; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: #fff; background: var(--cc, var(--muted)); }
.badge.soft { background: var(--sunk); color: var(--ink); font-weight: 500; }
.badge.award { background: var(--hi); color: #2A1E00; }
.badge.fav { background: #03A94D; color: #fff; }
.ticket-body { padding: 14px 18px 18px; display: grid; gap: 14px; }
.scorebox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.big-score { font-family: var(--f-num); font-weight: 600; font-size: 40px; line-height: 1; }
.big-score small { display: block; font-family: var(--f-body); font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 4px; letter-spacing: .04em; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 34px minmax(0, 1fr) 30px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.bar i { display: block; height: 8px; border-radius: 4px; background: var(--sunk); position: relative; overflow: hidden; }
.bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--ink); border-radius: 4px; }
.bar .num { text-align: right; color: var(--ink); }
dl.facts { margin: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.quote { margin: 0; padding: 10px 12px; background: var(--sunk); border-radius: 8px; font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.links a:hover { border-color: var(--ink); }
.ticket-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 18px; }
.ticket-foot .btn { padding: 9px 16px; font-size: 14px; }
.ticket-foot .btn.go { background: var(--ok); color: #fff; }
.toast { color: var(--ok); font-size: 13px; font-weight: 700; align-self: center; }

/* 3곳 비교 */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .trio { grid-template-columns: minmax(0, 1fr); } }
.trio-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.trio-card:hover { border-color: var(--ink); }
.trio-pick { text-align: left; width: 100%; background: transparent; border: 0; padding: 12px; display: grid; gap: 6px; align-content: start; flex: 1; overflow-wrap: anywhere; }
.trio-actions { padding: 0 12px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.trio-card.is-excluded .trio-pick { opacity: .55; }
.trio-pick:disabled { cursor: not-allowed; }
.result-caption { margin: 0 0 8px; }
.result-notice { padding: 10px 12px; background: var(--sunk); border-radius: 8px; }
.trio .badge { justify-self: start; }
.trio .t-name { font-family: var(--f-display); font-size: 21px; line-height: 1.15; }
.trio .t-sub { font-size: 13px; color: var(--muted); }

/* 목록 */
.list-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.list-tools input[type="search"] { flex: 1 1 200px; min-width: 0; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--sunk); }
.rank { font-family: var(--f-num); font-size: 13px; color: var(--muted); text-align: center; line-height: 1.1; }
.rank b { display: block; font-size: 18px; color: var(--ink); }
.item .nm { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item .sc { font-family: var(--f-num); font-weight: 600; font-size: 18px; text-align: right; }
.item .sc small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.more { display: block; margin: 12px auto 0; }

/* 기록 */
.hist { display: grid; gap: 8px; }
.hist li { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; }
.hist ul { padding: 0; margin: 0; display: grid; gap: 8px; }
.hist .when { font-family: var(--f-num); font-size: 12px; color: var(--muted); }
.decided { color: var(--ok); font-weight: 700; font-size: 13px; }

dialog { border: 0; padding: 0; border-radius: var(--r); background: transparent; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgb(10 14 20 / .55); }
.dlg-close { position: absolute; right: 10px; top: 10px; border: 0; background: var(--sunk); border-radius: 999px; width: 34px; height: 34px; font-size: 18px; z-index: 1; }
footer.note { color: var(--muted); font-size: 12.5px; margin-top: 28px; max-width: 75ch; }
footer.note p { margin: 4px 0; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* 서버 연결 상태 띠 */
.net { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 500; }
.net button { margin-left: 8px; border: 0; border-radius: 999px; padding: 3px 12px; background: var(--surface); color: var(--ink); font-size: 13px; }
.loading { text-align: center; color: var(--muted); padding: 48px 8px; }

/* 안 나오게 한 집 · 바퀴 */
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.go { background: var(--ok); color: #fff; }
.btn.warn { background: var(--ink); color: var(--bg); }
.hidden-list { display: grid; gap: 8px; margin-top: 10px; }
.hidden-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hidden-item > span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.hidden-item button { flex-shrink: 0; }
.hidden-list .chip { font-size: 13px; padding: 3px 10px; }
.excluded-panel { background: var(--surface); padding: 24px; }
.excluded-panel h2 { margin: 0 40px 8px 0; font-size: 22px; }
.excluded-panel > .hint { margin-bottom: 16px; }
button:disabled { cursor: not-allowed; }
