:root {
  color-scheme: dark;
  --bg: #151a18;
  --panel: #1d2421;
  --surface: #242e28;
  --line: #36453c;
  --text: #f3f7ee;
  --muted: #afbeb3;
  --lime: #dff579;
  --green: #a8e7ac;
  --red: #ffc1b6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: radial-gradient(ellipse at top center, #243129 0%, transparent 57%), var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
a { color: inherit; text-underline-offset: 3px; }
p { margin: 0; }
h1, h2 { line-height: 1.05; margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); }
h2 { font-size: 1.65rem; }
.frame { width: min(100% - 2rem, 980px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: #151a18b8; }
.topbar-inner, .footer, .workspace-heading, .deck-caption, .card-top, .account-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar-inner { min-height: 4.1rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 900; font-size: 1.2rem; letter-spacing: -.04em; text-decoration: none; }
.brand-accent { color: var(--lime); margin-left: .12em; }
.edition, .eyebrow, .source-line { font-size: .74rem; letter-spacing: .09em; font-weight: 760; color: var(--muted); }
.eyebrow { color: var(--lime); margin-bottom: .75rem; }
.eyebrow i { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--lime); margin-right: .24rem; }
.account-bar { gap: .7rem; min-width: 0; }
.account-bar span { font-size: .87rem; overflow: hidden; text-overflow: ellipsis; }
.muted, .quiet { color: var(--muted); }
.quiet { border: 0; background: none; padding: .35rem 0; font-size: .88rem; font-weight: 650; white-space: nowrap; }
.quiet:hover:not(:disabled) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.panel { border: 1px solid var(--line); border-radius: 1.2rem; background: var(--panel); padding: 1.35rem; }
.primary {
  border: 0; background: var(--lime); color: #222b17; border-radius: .7rem;
  min-height: 2.85rem; padding: .65rem 1.05rem; font-weight: 800;
}
.primary:hover:not(:disabled) { background: #e9ffa2; }
.notice { margin-block: 1rem; color: var(--muted); }
.notice.error, .form-error { color: var(--red); }
.footer { margin-block: 1.9rem 1.2rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .77rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.auth-layout { display: grid; grid-template-columns: 1.14fr 1fr; gap: clamp(1.5rem, 6vw, 5.25rem); align-items: center; margin-block: clamp(2rem, 9vw, 7rem); }
.intro h1 { font-size: clamp(3.1rem, 8vw, 6rem); font-weight: 870; margin-bottom: 1rem; }
.intro h1 em { font-style: normal; color: var(--lime); }
.intro > p:last-child { max-width: 29rem; color: var(--muted); font-size: 1.05rem; }
.auth-panel { padding: clamp(1.2rem, 3vw, 2rem); }
.auth-panel .muted { margin-top: .55rem; }
form { display: grid; gap: .45rem; margin-top: 1.1rem; }
form label { font-weight: 730; font-size: .9rem; }
form small { color: var(--muted); margin-bottom: .5rem; font-size: .76rem; }
form .primary { margin-top: .35rem; }
.auth-toggle { display: block; margin: .55rem auto -.2rem; white-space: normal; }
input, select {
  min-width: 0; width: 100%; min-height: 2.65rem; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: .55rem; padding: .52rem .65rem;
}
input::placeholder { color: var(--muted); }

.workspace-heading { align-items: end; flex-wrap: wrap; margin-block: 2.15rem 1.2rem; }
.source-line { letter-spacing: .02em; padding-bottom: .3rem; }
.nav { display: flex; gap: .45rem; margin-bottom: 1.1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.nav button, .review-tab {
  color: var(--muted); border: 1px solid transparent; background: transparent; border-radius: .68rem;
  padding: .56rem .78rem; min-height: 2.65rem; font-size: .88rem; font-weight: 720;
}
.nav button[aria-pressed="true"], .review-tab[aria-pressed="true"] { color: var(--lime); border-color: var(--line); background: var(--surface); }
.nav button:hover, .review-tab:hover { background: var(--surface); }
.nav button span, .review-tab span { font-size: .73rem; margin-inline-start: .15rem; font-variant-numeric: tabular-nums; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(12rem, 1fr); align-items: start; gap: 1rem; }
.deck { padding: .35rem clamp(0rem, 5vw - 1rem, 2rem) 0; min-width: 0; }
.deck-caption { color: var(--muted); font-size: .87rem; font-weight: 650; }
progress {
  appearance: none; display: block; width: 100%; height: .35rem; border: 0; border-radius: 10px;
  overflow: hidden; background: var(--line); margin: .3rem 0 .85rem; color: var(--lime);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--lime); }
progress::-moz-progress-bar { background: var(--lime); }
.player-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem;
  background: repeating-linear-gradient(-48deg, transparent 0 24px, #b2d59f0a 25px 26px), radial-gradient(ellipse at 10% 0%, #364a39, #202822 73%);
  border: 1px solid #566d56; border-radius: 1.3rem; padding: clamp(.85rem, 3.4vw, 1.45rem);
  min-height: 18.5rem; box-shadow: 0 6px 0 -3px #28372d, 0 11px 0 -6px #3e5142, 0 18px 25px -14px #000a;
  touch-action: pan-y; user-select: none; cursor: grab;
  transform: translateX(var(--dx, 0px)) rotate(var(--rotation, 0deg));
  transition: transform .14s ease;
}
.player-card.dragging { transition: none; cursor: grabbing; z-index: 1; }
.server-tag, .power-rank { font-size: .74rem; letter-spacing: .065em; border-radius: .45rem; padding: .35rem .55rem; font-weight: 800; }
.server-tag { color: #202a17; background: var(--lime); }
.power-rank { color: var(--text); background: #151a188a; }
.identity { text-align: center; min-width: 0; }
.initials {
  display: grid; place-items: center; margin: 0 auto .7rem; width: 3.9rem; height: 3.9rem;
  border-radius: 1rem; background: #aec2a024; border: 1px solid #adc4a36b; color: var(--lime);
  font-size: 1.4rem; font-weight: 850;
}
.identity h2 { font-size: clamp(1.7rem, 5vw, 2.7rem); overflow-wrap: anywhere; }
.identity p { margin-top: .42rem; color: var(--muted); overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; text-align: center; gap: .45rem; }
.stats div { min-width: 0; padding: .5rem .2rem; border-radius: .65rem; background: #151a18a0; }
.stats dt { text-transform: uppercase; color: var(--muted); font-size: .67rem; letter-spacing: .07em; font-weight: 700; }
.stats dd { margin: .12rem 0 0; font-size: clamp(.95rem, 3.1vw, 1.4rem); font-weight: 780; }
.stamp { opacity: 0; position: absolute; top: 3.5rem; padding: .13rem .5rem; border: 2px solid; border-radius: .38rem; font-size: clamp(1rem, 4vw, 1.5rem); font-weight: 900; background: var(--bg); }
.stamp-like { left: 1.25rem; color: var(--green); transform: rotate(-12deg); opacity: var(--like-stamp, 0); }
.stamp-dislike { right: 1.25rem; color: var(--red); transform: rotate(12deg); opacity: var(--dislike-stamp, 0); }
.controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: 1.1rem; }
.pick-button {
  display: flex; align-items: center; justify-content: center; gap: .36rem; padding: .28rem .36rem;
  min-height: 3rem; border-radius: .72rem; background: var(--panel); color: var(--text); border: 1px solid var(--line); font-weight: 730;
}
.pick-button b { font-size: 1.35rem; line-height: 1; }
.pick-button.like { color: var(--green); background: #293e2b; border-color: #486850; }
.pick-button.dislike { color: var(--red); background: #392a26; border-color: #64433b; }
.pick-button:hover:not(:disabled) { filter: brightness(1.24); }
.gesture-hint { text-align: center; font-size: .8rem; margin-top: .7rem; }
.empty { text-align: center; min-height: 14rem; display: grid; align-content: center; justify-items: center; gap: .8rem; }
.summary .eyebrow { margin-bottom: .5rem; }
.summary dl { margin: 0; }
.summary dl div { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .52rem 0; }
.summary dl dd { margin: 0; font-weight: 780; font-variant-numeric: tabular-nums; }
.summary .muted { margin-top: .75rem; font-size: .82rem; }
.summary-icon { display: inline-grid; place-items: center; width: 1.5em; color: var(--muted); font-size: 1.15rem; }
.summary-icon.green { color: var(--green); }
.summary-icon.red { color: var(--red); }
.feedback { min-height: 1.35rem; font-size: .84rem; margin-bottom: 0; }

.review > .muted { margin-top: .52rem; font-size: .9rem; }
.review-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-block: .8rem; }
.review-tab { padding-inline: .6rem; }
.review-list { list-style: none; margin: .55rem 0 0; padding: 0; }
.review-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line); padding: .65rem 0; }
.review-list li:last-child { border: 0; }
.review-list strong { display: block; overflow-wrap: anywhere; }
.review-list small { color: var(--muted); overflow-wrap: anywhere; }
.review-list select { width: auto; max-width: 9.3rem; font-size: .85rem; }
.review-empty { padding: .9rem 0 0; }

@media (max-width: 700px) {
  .auth-layout, .workspace-grid { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
  .auth-layout { gap: 1.35rem; margin-top: 1.8rem; }
  .auth-panel { max-width: 30rem; }
  .workspace-heading { margin-top: 1.4rem; gap: .4rem; }
  .summary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
  .summary dl div { gap: .25rem; font-size: .86rem; }
  .summary { padding: .85rem; }
}
@media (max-width: 380px) {
  .frame { width: calc(100% - 1.35rem); }
  .controls { gap: .4rem; }
  .pick-button { font-size: .78rem; }
  .review { padding: .8rem; }
  .summary dl div { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .player-card { transition: none; }
}
