:root {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
  --paper: #fff9ee;
  --surface: #fffdf8;
  --ink: #183a40;
  --quiet: #486168;
  --line: #dfd7c6;
  --subtle: #f0e8d7;
  --accent: #0e665c;
  --accent-text: #fff;
  --selected: #d8efe4;
  --focus: #a23f16;
  --gold: #ffe3a9;
  --gold-text: #603d13;
  --lift: #4f422412;
  --sky: #d8eee6;
  --sea: #8bc8bb;
  --sand: #f6d393;
  --horizon: #309887;
  color: var(--ink); background: var(--paper);
}
:root[data-skin="night"] {
  color-scheme: dark;
  --paper: #152530;
  --surface: #20333e;
  --ink: #f5eee0;
  --quiet: #c2d2d6;
  --line: #4a626d;
  --subtle: #334955;
  --accent: #a4e2cc;
  --accent-text: #183a35;
  --selected: #344e58;
  --focus: #ffd98f;
  --gold: #584531;
  --gold-text: #ffe2a8;
  --lift: #0003;
  --sky: #263e58;
  --sea: #3e667a;
  --sand: #46576d;
  --horizon: #67a2a9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: fixed; left: 16px; top: -100px; z-index: 10; background: var(--surface); padding: 8px; }
.skip:focus { top: 12px; }
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.topin, .shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.topin { min-height: 70px; display: flex; align-items: center; gap: 28px; }
.brand { font-size: 20px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand span { background: var(--accent); color: var(--accent-text); padding: 5px 8px; border-radius: 9px; margin-right: 7px; }
.nav { display: flex; gap: 7px; margin-right: auto; }
.nav a, .footnav a { padding: 10px 15px; color: var(--quiet); text-decoration: none; border-radius: 10px; }
.nav a[aria-current], .footnav a[aria-current] { color: var(--ink); background: var(--selected); font-weight: 700; }
.session { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.session span { overflow: hidden; text-overflow: ellipsis; max-width: 180px; white-space: nowrap; }
.shell { padding: 36px 0 84px; }
.pagehead { margin-bottom: 24px; }
.pagehead h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.25; margin: 5px 0 8px; overflow-wrap: anywhere; }
.pagehead p, .muted { color: var(--quiet); margin: 0; }
.back { display: inline-block; margin-bottom: 8px; color: var(--quiet); }
.split, .row, .actions { display: flex; align-items: center; gap: 12px; }
.split, .row { justify-content: space-between; }
.actions { flex-wrap: wrap; }
.btn, .chip { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; text-align: center; border-radius: 11px; padding: 10px 15px; font-weight: 650; }
.btn.dark, .chip[aria-pressed="true"] { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.btn:disabled, fieldset:disabled .btn { cursor: not-allowed; opacity: .58; }
.btn.small { padding: 7px 11px; font-size: 13px; }
.full { width: 100%; }
.tools { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.search { flex: 1 1 220px; min-width: 0; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { border-radius: 30px; padding: 8px 14px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card, .panel { border-radius: 17px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; overflow-wrap: anywhere; }
.card { display: block; text-decoration: none; }
.card:hover { box-shadow: 0 8px 24px var(--lift); }
.cover { position: relative; height: 158px; background: #26363d; display: flex; align-items: flex-end; padding: 14px; overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover > span { z-index: 1; }
.detail-cover { height: clamp(150px, 25vw, 230px); border-radius: 17px; }
.tag { display: inline-block; padding: 5px 10px; border-radius: 30px; font-size: 12px; font-weight: 700; background: var(--selected); color: var(--ink); }
.tag.gray { background: var(--subtle); color: var(--ink); }
.tag.gold { background: var(--gold); color: var(--gold-text); }
.card-body, .panel { padding: 20px; }
.card h2, .panel h2 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; }
.card .row { padding-bottom: 0; margin-top: 10px; font-size: 13px; }
.columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.stack { display: grid; gap: 15px; }
.center { max-width: 510px; margin: 20px auto; }
.row { padding: 12px 0; border-bottom: 1px solid var(--subtle); }
.row:last-child { border: 0; }
.field { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
textarea { resize: vertical; }
label > span { display: block; margin-bottom: 4px; font-weight: 650; }
.hint { color: var(--quiet); font-size: 13px; margin: 4px 0; }
.empty { text-align: center; grid-column: 1/-1; padding: 34px 20px; color: var(--quiet); background: var(--surface); border-radius: 16px; }
.description { white-space: pre-wrap; }
.wheel { width: min(200px, 70vw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; margin: 20px auto; border: 6px solid var(--line); }
.wheel span { background: var(--surface); border-radius: 50%; display: grid; place-items: center; width: 48px; height: 48px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.result { background: var(--selected); color: var(--ink); border-radius: 12px; padding: 15px; }
.feedback { position: fixed; bottom: 24px; left: 50%; z-index: 9; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; }
.feedback:not(:empty) { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 10px; }
.footnav { display: none; }
@media (max-width: 760px) {
  .topin, .shell { width: calc(100% - 32px); }
  .topin { min-height: 58px; gap: 12px; }
  .session span { max-width: 125px; }
  .nav { display: none; }
  .shell { padding-top: 24px; }
  .grid, .columns { grid-template-columns: minmax(0, 1fr); }
  .cover { height: 145px; }
  .split { align-items: flex-start; }
  .split > .btn { flex-shrink: 0; }
  .footnav { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
  .footnav a { font-size: 13px; }
  .feedback { bottom: 72px; }
}

.refresh { margin-top: 8px; }
.wheel.spinning { animation: wheel-turn 460ms cubic-bezier(.2,.55,.3,1) forwards; }
@keyframes wheel-turn { to { transform: rotate(1080deg); } }
@media (prefers-reduced-motion: reduce) {
  .wheel.spinning { animation: none; }
}

.emoji { display: inline-block; }
.brand span { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 12px; }
.skin { gap: 6px; white-space: nowrap; border-radius: 100px; min-height: 38px; }
.skin:hover, .chip:hover, .btn:not(.dark):hover { border-color: var(--accent); }
.nav a:hover, .footnav a:hover { background: var(--subtle); }
.card, .panel { border-radius: 20px; box-shadow: 0 4px 0 var(--lift); }
.card:hover { border-color: var(--accent); }
.cover { background: var(--sea); }
#crewCover .cover { border-radius: 12px; }
#content:focus { outline: none; }
.skip, .field { background: var(--surface); }
.crew-player .tag, .member-row .tag { white-space: nowrap; }
.member-identity { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.member-row { flex-wrap: wrap; }
.member-row .actions .field { padding: 7px 10px; }
.member-row .actions { gap: 8px; }

.auth-layout { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 6vw, 78px); width: min(940px, 100%); margin: min(6vh, 60px) auto 0; align-items: center; }
.dock-welcome, .dock-hero {
  background: radial-gradient(circle at 78% 24%, var(--sand) 0 30px, transparent 31px),
    linear-gradient(174deg, var(--sky) 0 65%, var(--sea) 65.4% 84%, var(--sky) 84.4%);
  border: 1px solid var(--line);
  border-radius: 30px;
  position: relative;
  overflow: hidden;
}
.dock-welcome { display: grid; place-items: center; min-height: 410px; }
.dock-welcome > .mascot { transform: scale(1.6); }
.dock-hero { display: flex; align-items: center; min-height: 205px; padding: 22px 32px; margin-bottom: 24px; }
.dock-hero .pagehead { width: 100%; margin: 0; position: relative; z-index: 1; gap: 20px; }
.dock-hero .pagehead h1 { font-size: clamp(26px, 4vw, 44px); }
.dock-hero > .mascot { flex: none; margin-inline: 14px 0; transform: rotate(7deg); }
.mascot { position: relative; width: 140px; height: 132px; }
.mascot-star { position: absolute; right: 6px; top: 3px; color: var(--ink); font-size: 26px; }
.mascot-body, .mascot-ear, .mascot-face, .mascot-hat { position: absolute; border: 2px solid #533e2a; }
.mascot-body { width: 61px; height: 44px; left: 39px; top: 75px; border-radius: 46%; background: #245953; }
.mascot-ear { width: 26px; height: 28px; top: 31px; border-radius: 50%; background: #d9915b; }
.mascot-ear.left { left: 26px; }
.mascot-ear.right { right: 26px; }
.mascot-face { width: 77px; height: 65px; top: 35px; left: 31px; border-radius: 46% 46% 51% 51%; background: #ecb181; }
.mascot-eye { position: absolute; top: 24px; width: 6px; height: 8px; background: #382c24; border-radius: 50%; box-shadow: 0 10px 0 1px #e99686; }
.mascot-eye.left { left: 16px; }
.mascot-eye.right { right: 16px; }
.mascot-muzzle { position: absolute; top: 33px; left: 21px; width: 29px; height: 19px; border-radius: 50%; background: #ffe4be; }
.mascot-muzzle::after { content: ""; position: absolute; top: 2px; left: 10px; width: 9px; height: 6px; border-radius: 50%; background: #4a352a; }
.mascot-hat { top: 11px; left: 47px; width: 48px; height: 31px; border-radius: 24px 24px 8px 8px; background: #fdf4e0; box-shadow: inset 0 -5px #73ac9d; display: grid; place-items: center; color: #275950; font-size: 12px; transform: rotate(-11deg); }
.mascot-water { position: absolute; left: 19px; top: 108px; width: 102px; height: 15px; border: 2px solid var(--horizon); border-top: 0; border-radius: 0 0 50% 50%; }

@media (max-width: 760px) {
  .footnav .emoji { display: block; text-align: center; }
  .session { gap: 8px; }
  .session .session-name { max-width: 100px; }
  .auth-layout { grid-template-columns: 1fr; gap: 22px; width: min(440px, 100%); margin-top: 0; }
  .dock-welcome { min-height: 130px; }
  .dock-welcome > .mascot { transform: scale(.92); }
  .dock-hero { min-height: 148px; padding: 17px 16px; }
  .dock-hero .pagehead { flex-direction: column; gap: 10px; }
  .dock-hero .pagehead h1 { font-size: 25px; }
  .dock-hero > .mascot { position: absolute; right: -12px; bottom: -12px; transform: scale(.69) rotate(7deg); margin: 0; }
}
@media (max-width: 365px) {
  .session .session-name { display: none; }
  .dock-hero > .mascot { opacity: .75; }
}

.game-results { display: grid; gap: 8px; }
.game-results:empty, #crewCover:empty, #capacityHint:empty, #gameSearchStatus:empty { display: none; }
.game-choice { display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; }
.game-choice img { width: 78px; aspect-ratio: 231 / 87; object-fit: cover; border-radius: 6px; flex: none; }
.game-choice span { overflow-wrap: anywhere; }

.wheel { position: relative; }
.wheel-marker { position: absolute; transform: translate(-50%, -50%); color: #203237; background: #fff; padding: 2px 7px; border-radius: 99px; font-size: .85rem; }
.wheel-candidates { display: grid; gap: 10px; }
.wheel-game { display: grid; grid-template-columns: minmax(0, 100px) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.wheel-game img { width: 100%; aspect-ratio: 460 / 215; object-fit: cover; border-radius: 6px; }
.wheel-game p { margin: 4px 0 0; overflow-wrap: anywhere; }
.wheel-game strong { overflow-wrap: anywhere; }

.wheel-rich { width: min(330px, 100%); }
.wheel-marker-rich { width: 28%; min-width: 50px; padding: 4px; text-align: center; border-radius: 8px; box-shadow: 0 1px 5px #0003; }
.wheel-marker-rich img { display: block; width: 100%; aspect-ratio: 460 / 215; object-fit: cover; border-radius: 4px; }
.wheel-marker-rich strong, .wheel-marker-rich small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .68rem; }

.manual-cover { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; font-size: .78rem; color: var(--ink); }
