:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d1b18;
  --muted: #6b665d;
  --line: #e3ded4;
  --faint: #ebe7de;
  --accent: #1d1b18;
  --good: #2b8a3e;
  --bad: #c92a2a;
  --t-none: #868e96;
  --t-free: #74c0fc;
  --t-paid: #1c7ed6;
  --t-premium: #6741d9;
  --t-corporate: #e8590c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f; --surface: #1f1d18; --ink: #f1ede4; --muted: #a39d90; --line: #34312a;
    --faint: #2a2822; --accent: #f1ede4; --good: #69db7c; --bad: #ff8787;
    --t-none: #adb5bd; --t-free: #a5d8ff; --t-paid: #4dabf7; --t-premium: #9775fa; --t-corporate: #ff922b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15140f; --surface: #1f1d18; --ink: #f1ede4; --muted: #a39d90; --line: #34312a;
  --faint: #2a2822; --accent: #f1ede4; --good: #69db7c; --bad: #ff8787;
  --t-none: #adb5bd; --t-free: #a5d8ff; --t-paid: #4dabf7; --t-premium: #9775fa; --t-corporate: #ff922b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  word-break: keep-all; overflow-x: hidden;
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px 64px; }
b { font-weight: 700; }

.hero { padding: 48px 0 8px; }
.kicker { margin: 0; color: var(--muted); font-size: 14px; }
h1 { margin: 6px 0 12px; font-size: 32px; line-height: 1.25; letter-spacing: -.02em; }
.lede { margin: 0; color: var(--muted); }
.lede b { color: var(--ink); }

section { padding: 28px 0 8px; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 24px 0 8px; }
.note { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 15px; padding: 8px 14px; border-radius: 99px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
}
.chip[aria-checked="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.world-desc { color: var(--muted); font-size: 14px; margin: 10px 0 0; min-height: 3em; }
.world-desc b { color: var(--ink); }

details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.mine { margin: 8px 0 16px; }
.mine-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mine-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.mine-grid select {
  font: inherit; font-size: 14px; padding: 8px 6px; border-radius: 10px; width: 100%;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
}

button.primary {
  width: 100%; padding: 15px; border: 0; border-radius: 12px; font: inherit; font-weight: 700; font-size: 17px;
  background: var(--accent); color: var(--bg); cursor: pointer; margin-top: 8px;
}
button.ghost {
  width: 100%; padding: 13px; border-radius: 12px; font: inherit; cursor: pointer; margin-top: 8px;
  background: transparent; color: var(--ink); border: 1.5px solid var(--line);
}

.profile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.profile-tag { margin: 0; font-size: 13px; color: var(--muted); }
.profile-main { margin: 4px 0 6px; font-size: 22px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
.profile-agent { margin: 0; font-size: 14px; color: var(--muted); }
.profile-agent b { color: var(--ink); }
.tier-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

.race { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 10px; }
.race-head { display: flex; justify-content: space-between; align-items: end; }
.race-head .right { text-align: right; }
.race-label { display: block; font-size: 12px; color: var(--muted); }
.race-head b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#counter { font-size: 32px; }
.race-sub { margin: 2px 0 10px; font-size: 13px; color: var(--muted); min-height: 1.6em; }

.stage { position: relative; }
#stage-canvas { display: block; width: 100%; border-radius: 12px; background: var(--faint); touch-action: none; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px;
  border-radius: 12px; background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.press[hidden] { display: none; }
.overlay-text { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; text-align: center; }
.overlay-text.small { font-size: 18px; font-weight: 700; }
.overlay-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; min-height: 1.5em; }
.press {
  width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--bad); color: #fff; font: inherit; font-size: 26px; font-weight: 800;
  box-shadow: 0 10px 28px rgba(201, 42, 42, .35); transition: transform .08s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.press:active { transform: scale(.9); }
.press:disabled { background: var(--muted); box-shadow: none; cursor: default; }
.press.hot { animation: pulse .5s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tiers { display: grid; gap: 4px; margin-top: 10px; }
.tier-row { display: grid; grid-template-columns: 7.5em 1fr 4.5em; align-items: center; gap: 8px; font-size: 13px; }
.tier-row .bar-track { height: 10px; }
.tier-row .bar-val { font-size: 13px; }

.verdict { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; }
.mark { font-size: 64px; font-weight: 800; line-height: 1; width: 64px; text-align: center; flex: none; }
.mark.yes { color: var(--good); }
.mark.no { color: var(--bad); }
#verdict-text { margin: 0; font-size: 16px; }

.odds { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.odds-label { margin: 0; font-size: 14px; color: var(--muted); }
.odds-big { margin: 2px 0; font-size: 56px; font-weight: 800; line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.odds-sub { margin: 0; font-size: 13px; color: var(--muted); }
.odds-mine { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--faint); font-size: 14px; }

.bars { display: grid; gap: 6px; }
.bar {
  display: grid; grid-template-columns: 6.5em 1fr 3.2em; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; padding: 2px 0; text-align: left;
}
button.bar { cursor: pointer; }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.current .bar-name { font-weight: 700; }
.bar-track { display: block; height: 14px; background: var(--faint); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--muted); transition: width .4s; }
.bar.current .bar-fill { background: var(--accent); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

.close { border-top: 1px solid var(--line); margin-top: 28px; }
.close p { margin: 0 0 14px; }
.assume table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; font-variant-numeric: tabular-nums; }
.assume th, .assume td { padding: 4px 2px; border-bottom: 1px solid var(--line); text-align: right; }
.assume th:first-child, .assume td:first-child { text-align: left; }
.assume ul { font-size: 13px; color: var(--muted); padding-left: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--accent); color: var(--bg); padding: 8px 14px; border-radius: 99px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .toast, .press { transition: none; animation: none; }
}
