:root {
  --paper: #f4f1e8;
  --paper-2: #ebe7db;
  --ink: #17283d;
  --muted: #6f7c8c;
  --navy: #17324d;
  --navy-2: #24507a;
  --amber: #c8952f;
  --amber-2: #e0b65a;
  --line: #d8d2c3;
  --green: #3f6b4f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(200, 149, 47, 0.10), transparent 60%),
    radial-gradient(700px 500px at 90% 20%, rgba(36, 80, 122, 0.08), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: var(--amber-2);
  font-size: 22px;
}
.brand strong { display: block; font-size: 22px; letter-spacing: 0.08em; }
.brand small { display: block; font-size: 10px; letter-spacing: 0.22em; color: var(--muted); margin-top: 2px; }
.top-tag { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ghost {
  background: transparent; color: var(--navy);
  border: 1px solid var(--line); border-radius: 2px;
  padding: 7px 12px; font: inherit; font-size: 12px;
  letter-spacing: 0.06em; cursor: pointer;
}
.ghost:hover { border-color: var(--navy-2); background: rgba(23, 50, 77, .04); }
.ghost:disabled { opacity: .35; cursor: not-allowed; }

main { max-width: 1280px; margin: 0 auto; padding: 34px 28px 60px; }

.eyebrow {
  font-size: 11px; letter-spacing: 0.2em; color: var(--amber);
  text-transform: uppercase; margin-bottom: 14px;
}
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.15; margin: 0 0 18px; font-weight: 800; letter-spacing: -0.02em; }
h1 em { font-style: normal; color: var(--navy-2); }
.lead { color: var(--muted); line-height: 1.9; max-width: 640px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.start { padding: 8vh 0 10vh; max-width: 760px; }
.motto { max-width: 980px; margin: 0 auto; padding: 4vh 0 6vh; }
.motto h1 { font-size: clamp(32px, 4vw, 48px); }
.motto .lead { max-width: 680px; }
.motto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 26px 0 20px; }
.motto-card { text-align: left; background: rgba(255, 255, 255, .5); border: 1px solid var(--line); padding: 18px 20px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .2s, background .2s, transform .2s; }
.motto-card:hover { border-color: var(--navy-2); transform: translateY(-1px); }
.motto-card.selected { border-color: var(--amber); background: rgba(200, 149, 47, .08); box-shadow: inset 3px 0 0 var(--amber); }
.motto-card blockquote { margin: 0 0 12px; font-size: 15px; line-height: 1.8; }
.motto-card small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.motto-card strong { color: var(--navy); font-weight: 700; }
.motto-custom { display: flex; gap: 8px; margin: 0 0 14px; }
.motto-custom input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); background: rgba(255,255,255,.65); color: var(--ink); font: inherit; font-size: 13px; outline: none; }
.motto-custom input:focus { border-color: var(--navy-2); }
#mottoConfirm { width: 100%; }
.draft { max-width: 760px; margin: 0 auto; padding: 2vh 0 4vh; }
.draft h1 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 12px; }
.draft .lead { margin-bottom: 0; }
.draft-stage { margin-top: 18px; min-height: 0; padding: 18px 24px 22px; }
.draft .question { margin-top: 14px; }
.draft .question h2 { font-size: 26px; margin: 12px 0 6px; }
.draft .wheel-wrap { width: 300px; height: 300px; margin: 18px auto 14px; }
.draft .wheel-label { font-size: 11px; }
.start-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.start-note { margin-top: 18px; font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }

input[type="number"] {
  width: 150px; padding: 14px 16px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65); border-radius: 2px; color: var(--ink);
  font-size: 14px; outline: none;
}
input[type="number"]:focus { border-color: var(--navy-2); }

button.primary {
  border: 0; background: var(--navy); color: #f7f3e8;
  padding: 15px 26px; font-size: 15px; font-weight: 700;
  letter-spacing: 0.04em; cursor: pointer; border-radius: 2px;
  transition: background .2s, transform .2s;
}
button.primary:hover { background: var(--navy-2); }
button.primary:disabled { opacity: .55; cursor: wait; transform: none; }

.mobile-tabs { display: none; }
.game { display: grid; grid-template-columns: 250px minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.panel { background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); padding: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.panel-heading.sub { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.tag { border: 1px solid var(--line); padding: 2px 6px; font-size: 10px; letter-spacing: 0.08em; color: var(--green); }

.avatar {
  margin-top: 16px; height: 132px; background: linear-gradient(145deg, #17324d, #0f2133);
  color: rgba(255,255,255,.7); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  font-size: 22px; letter-spacing: 0.12em; position: relative; overflow: hidden;
}
.avatar::before, .avatar::after {
  content: ""; position: absolute; border: 1px solid rgba(224, 182, 90, .22); border-radius: 50%;
}
.avatar::before { width: 180px; height: 180px; }
.avatar::after { width: 100px; height: 100px; }
.avatar span { font-size: 10px; letter-spacing: 0.18em; color: rgba(255,255,255,.55); }
.avatar b { color: var(--amber-2); font-weight: 400; }

.profile h2 { margin: 16px 0 4px; font-size: 26px; }
.player-sub { font-size: 12px; }
.team-box { margin: 16px 0; padding: 10px 12px; background: rgba(23, 50, 77, .05); border-left: 2px solid var(--amber); }
.team-box small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.team-box strong { display: block; margin-top: 4px; font-size: 15px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0 0 16px; }
.facts div { border-top: 1px solid var(--line); padding-top: 8px; }
.facts dt { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; }
.facts dd { margin: 3px 0 0; font-size: 13px; }

.roster small { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.ability-box { margin: 0 0 16px; }
.ability-box small { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.ability-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ability-list span { border: 1px solid var(--line); padding: 3px 6px; font-size: 11px; color: var(--muted); }
.ability-list b { color: var(--navy); font-weight: 700; }
.roster ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; line-height: 1.9; }
.roster li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line); }
.roster li span:last-child { color: var(--muted); }

.stage { min-height: 660px; position: relative; padding: 26px 30px 24px; }
.stage-top { display: flex; justify-content: space-between; font-size: 12px; }
.chapter { border: 1px solid var(--line); padding: 3px 8px; color: var(--green); letter-spacing: 0.08em; }
.question { text-align: center; margin-top: 26px; }
.round { display: inline-block; border: 1px solid var(--line); padding: 4px 12px; font-size: 11px; letter-spacing: 0.18em; color: var(--muted); }
.question h2 { font-size: 30px; margin: 16px 0 8px; }
.question p { margin: 0; font-size: 13px; }

.wheel-wrap { position: relative; width: 340px; height: 340px; margin: 30px auto 18px; }
.wheel {
  width: 100%; height: 100%; border-radius: 50%;
  border: 6px solid var(--navy);
  background: conic-gradient(var(--amber) 0 40%, var(--navy-2) 40% 65%, #7fa6c9 65% 82%, #b9c7d6 82% 94%, #e6e0d2 94% 100%);
  box-shadow: 0 14px 40px rgba(23, 50, 77, .18);
  transform: rotate(0deg);
  position: relative;
}
.wheel-label {
  position: absolute; left: 50%; top: 50%;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.wheel-label-inner { display: inline-block; white-space: nowrap; }
.wheel-hole {
  position: absolute; inset: 50% auto auto 50%; width: 82px; height: 82px;
  transform: translate(-50%, -50%); background: var(--paper); border: 4px solid var(--navy);
  border-radius: 50%; display: grid; place-items: center; color: var(--navy);
  font-size: 26px;
}
.wheel-pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 22px solid var(--navy); filter: drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend b { color: var(--ink); font-weight: 700; }

.spin-button { display: block; width: 100%; margin-top: 20px; }
.result { margin-top: 18px; font-size: 13px; line-height: 1.9; min-height: 20px; transition: opacity .25s ease, transform .25s ease; }
.result.leaving { opacity: 0; transform: translateY(5px); }
.result .season-title { font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.result .ev { color: var(--muted); }
.result .ev b { color: var(--ink); }
.legacy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.legacy-grid > div { padding: 10px 8px; background: rgba(23, 50, 77, .04); text-align: center; }
.legacy-grid small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.legacy-grid strong { display: block; color: var(--navy); font-size: 16px; margin-top: 4px; }
.legacy-grid em { display: block; color: var(--amber); font-style: normal; font-size: 10px; margin-top: 2px; }
.legacy-summary { margin-top: 12px; color: var(--ink); font-size: 13px; line-height: 1.8; }
.legacy-highlights { margin-top: 6px; color: var(--muted); font-size: 11px; }
.legacy-moments { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.legacy-moments small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .08em; margin-bottom: 4px; }
.legacy-moments ul { list-style: none; margin: 0; padding: 0; }
.legacy-moments li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 11px; }
.legacy-moments b { color: var(--navy); }
.legacy-moments span { color: var(--muted); }
.legacy-ending { margin: 18px 0 8px; text-align: left; }
.legacy-ending .legacy-grid { text-align: center; }
.legacy-ending .legacy-summary { color: var(--muted); }
.growth-list { margin-top: 8px; border-top: 1px solid var(--line); }
.growth-row { display: grid; grid-template-columns: 1fr 32px 18px 40px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 11px; }
.growth-row span { color: var(--muted); }
.growth-row b { color: var(--muted); font-weight: 500; text-align: right; }
.growth-row em { color: var(--amber); font-style: normal; text-align: center; }
.growth-row strong { color: var(--navy); text-align: right; }
.match-meta { margin-top: 8px; font-size: 10px; color: var(--muted); letter-spacing: .04em; }
.match-list { margin-top: 4px; border-top: 1px solid var(--line); }
.match-row { display: grid; grid-template-columns: 54px 1fr 42px 26px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 11px; }
.match-row span { color: var(--muted); }
.match-row span:nth-child(2) { color: var(--ink); }
.match-row b { color: var(--navy); font-weight: 700; text-align: right; }
.match-row em { font-style: normal; text-align: right; font-weight: 700; }
.match-row .win { color: var(--green); }
.match-row .loss { color: #a3533b; }
.accept-hint { margin-top: 8px; font-size: 11px; color: var(--muted); }
.accepted {
  display: inline-block; margin-top: 8px; padding: 2px 8px;
  border: 1px solid var(--green); color: var(--green);
  font-size: 10px; letter-spacing: 0.08em;
}

.honors .honor-big { text-align: center; padding: 22px 0 14px; border-bottom: 1px solid var(--line); }
.honor-big strong { display: block; font-size: 46px; color: var(--navy); line-height: 1; }
.honor-big small { display: block; margin-top: 6px; font-size: 10px; color: var(--muted); letter-spacing: .12em; }
.honor-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; margin-top: 14px; }
.honor-row b { display: block; font-size: 20px; }
.honor-row small { font-size: 10px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat-grid > div { padding: 8px 0; text-align: center; background: rgba(23, 50, 77, .035); }
.stat-grid b { display: block; font-size: 16px; color: var(--navy); }
.stat-grid small { display: block; margin-top: 2px; font-size: 9px; color: var(--muted); }
.history-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 210px; overflow-y: auto; font-size: 11px; line-height: 1.55; }
.history-list li { display: grid; grid-template-columns: 34px 1fr; gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.history-list .hist-year { color: var(--amber); font-size: 10px; letter-spacing: .04em; }
.history-list b { display: block; color: var(--ink); font-weight: 600; }
.history-list em { display: block; color: var(--muted); font-style: normal; }
.event-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 11px; line-height: 1.7; color: var(--muted); }
.event-list li { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.event-list b { color: var(--ink); font-weight: 600; }
.quote { margin-top: 24px; color: var(--muted); font-size: 11px; line-height: 1.8; border-left: 2px solid var(--amber); padding-left: 10px; }
.quote small { display: block; margin-top: 6px; font-size: 9px; letter-spacing: .04em; }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(10, 25, 40, .42); padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); padding: 26px; box-shadow: 0 24px 80px rgba(10, 25, 40, .28); }
.modal-card h3 { margin: 4px 0 8px; font-size: 24px; color: var(--navy); }
.modal-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.ending { max-width: 760px; padding: 10vh 0; }
.ending h1 { font-size: clamp(38px, 6vw, 64px); }
.ending-stats { display: flex; gap: 42px; margin: 28px 0; }
.ending-stats strong { display: block; font-size: 42px; color: var(--navy); }
.ending-stats small { font-size: 10px; color: var(--muted); letter-spacing: .1em; }

.footer { max-width: 1280px; margin: 0 auto; padding: 18px 28px 30px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .game { grid-template-columns: 1fr; gap: 12px; }
  main { padding: 16px 12px 36px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 8px; }
  .top-tag { display: none; }
  .top-right { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
  .top-actions { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .ghost { min-height: 38px; padding: 8px 2px; font-size: 10px; }
  .mobile-tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
    grid-column: 1 / -1; position: sticky; top: 0; z-index: 5;
    background: rgba(245, 241, 231, .96); padding: 4px 0;
  }
  .mobile-tab {
    border: 1px solid var(--line); background: rgba(255, 255, 255, .5);
    color: var(--muted); font: inherit; font-size: 12px; min-height: 42px; cursor: pointer;
  }
  .mobile-tab.active { background: var(--navy); color: #f7f3e8; border-color: var(--navy); }
  .profile, .honors { display: none; }
  .game[data-mobile-tab="stage"] .stage { display: block; }
  .game[data-mobile-tab="profile"] .profile { display: block; }
  .game[data-mobile-tab="honors"] .honors { display: block; }
  .game[data-mobile-tab="profile"] .stage,
  .game[data-mobile-tab="honors"] .stage { display: none; }
  .motto-grid { grid-template-columns: 1fr; }
  .motto-custom { flex-direction: column; }
  .motto-custom .ghost { min-height: 40px; }
  .stage { min-height: 0; padding: 18px 14px; }
  .wheel-wrap { width: min(290px, 78vw); height: min(290px, 78vw); }
  .draft .wheel-wrap { width: min(280px, 78vw); height: min(280px, 78vw); }
  .question h2 { font-size: 24px; }
  .result { font-size: 12px; }
  .match-row { grid-template-columns: 44px 1fr 36px 24px; gap: 4px; font-size: 10px; }
  .ending { padding: 6vh 0; }
  .ending-stats { gap: 24px; flex-wrap: wrap; }
}
