/* ============================================================================
   GetYourMogOnChess — clean, calm, slightly unhinged.
   Warm cream palette, sage-green board, soft shadows. Light + dark themes.
   ============================================================================ */

:root {
  --bg: #f4efe4;
  --bg-2: #ece5d6;
  --surface: #fffdf8;
  --surface-2: #f4eee2;
  --ink: #2f2a24;
  --ink-soft: #5f574b;
  --muted: #978d7d;
  --line: #e7decd;
  --line-strong: #d8ccb6;

  --primary: #7c9a6d;
  --primary-strong: #6b8a5d;
  --primary-ink: #fbfdf8;
  --accent: #d98e73;
  --gold: #e8c07d;
  --win: #6f9d6a;
  --loss: #cf7b6b;
  --draw: #b9a36a;

  /* board */
  --sq-light: #ece8d6;
  --sq-dark: #9aaf84;
  --hl-last: rgba(232, 192, 90, .50);
  --hl-sel: rgba(124, 154, 109, .55);
  --hint: rgba(47, 42, 36, .20);
  --check: rgba(207, 96, 78, .9);

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(60, 50, 35, .05), 0 12px 30px -12px rgba(60, 50, 35, .22);
  --shadow-sm: 0 1px 2px rgba(60, 50, 35, .06), 0 6px 16px -10px rgba(60, 50, 35, .25);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}

html[data-theme="dark"] {
  --bg: #1b1915;
  --bg-2: #211e19;
  --surface: #26221c;
  --surface-2: #2e2920;
  --ink: #ece6da;
  --ink-soft: #c2b9a8;
  --muted: #978d7b;
  --line: #36302705;
  --line: #3a3328;
  --line-strong: #4a4234;
  --primary: #8aa878;
  --primary-strong: #9bb98a;
  --primary-ink: #16180f;
  --sq-light: #d7cdb3;
  --sq-dark: #7f9568;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 16px 40px -16px rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 20px -12px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
a { color: inherit; }
.muted { color: var(--muted); }
code { background: var(--surface-2); padding: .15em .45em; border-radius: 6px; font-size: .9em; }

/* ---- buttons ---- */
.btn {
  font-family: var(--font); font-weight: 700; font-size: .95rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: .6em 1.1em; border-radius: 999px; cursor: pointer;
  transition: transform .08s ease, background .15s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn--primary { background: var(--primary); border-color: var(--primary-strong); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-strong); }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { display: block; width: 100%; }
.btn--lg { padding: .8em 1.3em; font-size: 1.05rem; }
.btn--sm { padding: .4em .8em; font-size: .85rem; }
.linkish { background: none; border: 0; color: var(--primary-strong); font-weight: 700; cursor: pointer; font-family: var(--font); padding: 0 .3em; }
.linkish:hover { text-decoration: underline; }

/* ---- fields ---- */
.field {
  width: 100%; font-family: var(--font); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: .7em .9em; transition: border-color .15s, box-shadow .15s;
}
.field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.field--lg { font-size: 1.2rem; padding: .8em 1em; }
.field--sm { padding: .5em .7em; font-size: .92rem; }
textarea.field { resize: vertical; }
.lbl { display: block; font-weight: 700; font-size: .85rem; color: var(--ink-soft); margin: .8rem 0 .3rem; }

/* ---- layout helpers ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.pad-lg { padding: 1.8rem; }
.pad { padding: 1rem; }
.row { display: flex; align-items: center; }
.gap { gap: .6rem; }
.wrap { flex-wrap: wrap; }
.centered { display: grid; place-items: center; min-height: 60vh; }
.centered-narrow { max-width: 520px; margin: 8vh auto; padding: 0 1rem; }
.ta-r { text-align: right; }
.hide-sm { } /* toggled in media query */
.fineprint { font-size: .8rem; color: var(--muted); text-align: center; margin: .6rem 0; }
.hint { font-size: .85rem; margin: .5rem 0 0; }
.hint.is-error { color: var(--loss); font-weight: 700; }
.section-title { font-size: 1.1rem; margin-bottom: .8rem; }
.page-head { margin: .5rem 0 1.2rem; }

/* ---- avatars ---- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar--gen { display: grid; place-items: center; color: #fff; font-weight: 800; font-family: var(--font); text-transform: uppercase; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

/* ---- spinner / skeleton ---- */
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spinner--lg { width: 46px; height: 46px; border-width: 4px; }
.spinner--sm { width: 18px; height: 18px; border-width: 2.5px; margin: .4rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-row { height: 38px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--bg-2), var(--surface-2)); background-size: 200% 100%; animation: sk 1.3s infinite; margin: .4rem 0; }
@keyframes sk { to { background-position: -200% 0; } }
.splash { display: grid; place-items: center; gap: 1rem; min-height: 80vh; }

/* ---- toasts ---- */
.toast-host { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: .7em 1.1em; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; max-width: 90vw; cursor: pointer; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--primary-strong); color: #fff; }
.toast--error { background: var(--loss); color: #fff; }

/* ---- modal ---- */
.modal-overlay { position: fixed; inset: 0; z-index: 8000; display: grid; place-items: center; padding: 1rem; background: rgba(30, 24, 18, .42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.modal-overlay.is-in { opacity: 1; }
.modal { width: min(440px, 94vw); }
.modal__title { font-size: 1.4rem; }
.modal__body { margin-bottom: 1rem; }
.modal__actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }

/* ============================== NAV ============================== */
.nav { position: sticky; top: 0; z-index: 500; display: flex; align-items: center; gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2.2rem); background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 0; cursor: pointer; font-family: var(--display); }
.brand__mark { color: var(--primary-strong); font-size: 1.5em; line-height: 1; }
.brand__name { font-weight: 600; color: var(--ink); font-size: 1.15rem; }
.brand__name em { color: var(--primary-strong); font-style: normal; }
.brand--xl .brand__name { font-size: 2rem; }
.brand--xl .brand__mark { font-size: 2.4rem; }
.brand--nav { font-size: 1rem; }
.nav__links { display: flex; gap: .2rem; margin-left: .5rem; }
.nav__link { background: none; border: 0; font-family: var(--font); font-weight: 700; color: var(--ink-soft); padding: .5em .9em; border-radius: 999px; cursor: pointer; }
.nav__link:hover { background: var(--surface-2); color: var(--ink); }
.nav__right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.nav__icon { background: var(--surface-2); border: 1px solid var(--line); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.nav__chip { display: inline-flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem .25rem .25rem; cursor: pointer; font-family: var(--font); font-weight: 700; color: var(--ink); }
.nav__chip:hover { border-color: var(--primary); }
.nav__chip-mr { background: var(--primary); color: var(--primary-ink); border-radius: 999px; padding: .1em .55em; font-size: .82rem; }
.nav__menu { position: absolute; top: calc(100% + .4rem); right: clamp(1rem, 4vw, 2.2rem); width: 200px; padding: .4rem; display: flex; flex-direction: column; gap: .1rem; }
.nav__menu-item { text-align: left; background: none; border: 0; padding: .6em .8em; border-radius: 10px; cursor: pointer; font-family: var(--font); font-weight: 700; color: var(--ink); }
.nav__menu-item:hover { background: var(--surface-2); }
.nav__menu-item--danger { color: var(--loss); }
.nav__menu-sep { height: 1px; background: var(--line); margin: .3rem 0; }

.view { max-width: 1080px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }

/* ============================== WELCOME ============================== */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; min-height: calc(100vh - 4rem); max-width: 1180px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 3rem); }
.hero__tagline { font-family: var(--display); font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--primary-strong); margin: .2rem 0 1rem; min-height: 1.4em; }
.hero__blurb { color: var(--ink-soft); font-size: 1.05rem; max-width: 46ch; }
.hero__points { list-style: none; padding: 0; margin: 1rem 0 1.5rem; display: grid; gap: .4rem; color: var(--ink-soft); font-weight: 600; }
.hero__board { display: grid; place-items: center; }
.cb--deco { width: min(440px, 80vw); pointer-events: none; filter: drop-shadow(0 30px 50px -25px rgba(60,50,35,.5)); }
.auth-card { margin-top: 1.4rem; max-width: 420px; }
.auth-tabs { display: flex; gap: .3rem; background: var(--surface-2); padding: .3rem; border-radius: 999px; margin-bottom: 1rem; }
.auth-tab { flex: 1; background: none; border: 0; padding: .55em; border-radius: 999px; font-family: var(--font); font-weight: 800; color: var(--muted); cursor: pointer; }
.auth-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: grid; gap: .6rem; }
.auth-divider { text-align: center; position: relative; margin: 1rem 0; color: var(--muted); font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ""; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--line); }
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.auth-card .btn--ghost { margin-top: .5rem; border: 1px solid var(--line-strong); }

/* ============================== LOBBY ============================== */
.lobby-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.lobby-hero__id { display: flex; align-items: center; gap: .9rem; }
.lobby-hero__hello { color: var(--muted); font-weight: 700; font-size: .9rem; }
.lobby-hero__name { font-family: var(--display); font-size: 1.6rem; }
.lobby-hero__stats { display: flex; gap: 1.4rem; }
.kpi { text-align: center; }
.kpi__value { font-size: 1.5rem; font-weight: 800; font-family: var(--display); }
.kpi__label { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi--win .kpi__value { color: var(--win); } .kpi--loss .kpi__value { color: var(--loss); } .kpi--draw .kpi__value { color: var(--draw); }

.lobby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; align-items: start; }
.lobby-col { display: grid; gap: 1.1rem; align-content: start; }
.lobby-card__title { font-size: 1.2rem; margin-bottom: .2rem; }
.lobby-card__head { display: flex; align-items: center; justify-content: space-between; }
.lobby-card .muted { margin-top: 0; margin-bottom: .8rem; font-size: .92rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: flex; flex-direction: column; align-items: center; min-width: 74px; gap: .05rem; padding: .5rem .6rem; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; cursor: pointer; font-family: var(--font); transition: border-color .15s, transform .08s, background .15s; }
.chip:hover { transform: translateY(-1px); }
.chip.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.chip__emoji { font-size: 1.1rem; }
.chip__label { font-weight: 800; }
.chip__bucket { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chips--bots .chip--bot { min-width: 96px; }
.bot-blurb { min-height: 2.6em; font-size: .9rem; }

.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: .25rem; gap: .2rem; margin-bottom: 1rem; }
.seg__opt { flex: 1; background: none; border: 0; padding: .5em; border-radius: 9px; cursor: pointer; font-family: var(--font); font-weight: 700; color: var(--ink-soft); }
.seg__opt.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.mini-board { display: grid; gap: .2rem; }
.mini-board__row { display: flex; align-items: center; gap: .6rem; background: none; border: 0; width: 100%; padding: .4rem .5rem; border-radius: 10px; cursor: pointer; font-family: var(--font); }
.mini-board__row:hover { background: var(--surface-2); }
.mini-board__name { font-weight: 700; flex: 1; text-align: left; }
.mini-board__mr { font-weight: 800; color: var(--primary-strong); }
.rank { width: 1.5em; text-align: center; font-weight: 800; color: var(--muted); }
.rank--1 { color: var(--gold); } .rank--2 { color: #b9b3a3; } .rank--3 { color: var(--accent); }

.queue-modal { text-align: center; display: grid; gap: .8rem; place-items: center; }
.queue-modal .spinner { margin: .4rem auto; }

/* ============================== BOARD ============================== */
.cb { position: relative; width: 100%; aspect-ratio: 1 / 1; container-type: size; user-select: none; touch-action: none; }
.cb-board { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.cb-sq { position: relative; }
.cb-sq--light { background: var(--sq-light); }
.cb-sq--dark { background: var(--sq-dark); }
.cb-sq::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: transparent; transition: background .12s; }
.cb-sq--last::after { background: var(--hl-last); }
.cb-sq--sel::after { background: var(--hl-sel); }
.cb-sq--check::after { background: radial-gradient(circle at center, var(--check) 0%, color-mix(in srgb, var(--check) 50%, transparent) 30%, transparent 72%); }
.cb-sq--target::before { content: ""; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); background: var(--hint); border-radius: 50%; }
.cb-sq--capture::before { content: ""; position: absolute; inset: 7%; border: .9cqmin solid var(--hint); border-radius: 50%; }
.cb-coord { position: absolute; font-size: 2.5cqmin; font-weight: 800; opacity: .5; pointer-events: none; }
.cb-coord--file { right: .4cqmin; bottom: .2cqmin; }
.cb-coord--rank { left: .5cqmin; top: .1cqmin; }
.cb-sq--light .cb-coord { color: var(--sq-dark); }
.cb-sq--dark .cb-coord { color: var(--sq-light); }

.cb-pieces { position: absolute; inset: 0; pointer-events: none; }
.cb-piece {
  position: absolute; top: 0; left: 0; width: 12.5%; height: 12.5%;
  display: grid; place-items: center; font-size: 10.5cqmin; line-height: 1;
  cursor: grab; pointer-events: auto; will-change: transform;
  transition: transform .17s cubic-bezier(.3, .8, .35, 1), opacity .18s;
  filter: drop-shadow(0 .35cqmin .35cqmin rgba(35, 28, 20, .35));
}
.cb-piece--w { color: #f6f2e8; -webkit-text-stroke: .5cqmin #45402f; }
.cb-piece--b { color: #322f29; -webkit-text-stroke: .32cqmin #14120e; }
.cb-piece.is-dragging { transition: none; z-index: 30; cursor: grabbing; filter: drop-shadow(0 1.4cqmin 1.4cqmin rgba(20, 16, 10, .45)); }
.cb-piece.is-moved { animation: place .22s ease; }
.cb-piece.is-captured { opacity: 0; }
@keyframes place { 0% { filter: drop-shadow(0 0 0 transparent) brightness(1.15); } 100% {} }

.cb-fx { position: absolute; inset: 0; pointer-events: none; }
.cb-promo { position: absolute; z-index: 31; display: flex; flex-direction: column; width: 12.5%; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; pointer-events: auto; }
.cb-promo__opt { aspect-ratio: 1; border: 0; background: var(--surface); font-size: 8.5cqmin; display: grid; place-items: center; cursor: pointer; line-height: 1; }
.cb-promo__opt:hover { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); }
.cb-promo__veil { position: absolute; inset: 0; z-index: 30; background: rgba(20, 16, 10, .28); pointer-events: auto; }

/* result stamp on the board */
.mog-stamp {
  position: absolute; left: 50%; top: 50%; z-index: 40;
  transform: translate(-50%, -50%) rotate(-11deg) scale(1.5); opacity: 0;
  font-family: var(--display); font-weight: 600; font-size: 8.5cqmin; letter-spacing: .04em;
  padding: .25em .55em; border: .6cqmin solid currentColor; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); white-space: nowrap; pointer-events: none;
  transition: transform .45s cubic-bezier(.2, 1.5, .4, 1), opacity .3s;
}
.mog-stamp.is-in { opacity: 1; transform: translate(-50%, -50%) rotate(-11deg) scale(1); }
.mog-stamp--win { color: var(--win); }
.mog-stamp--loss { color: var(--loss); }
.mog-stamp--draw { color: var(--draw); }

/* ============================== GAME SCREEN ============================== */
.game { display: flex; gap: 1.2rem; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.game__main { flex: 1 1 440px; max-width: min(72vh, 620px); display: grid; gap: .55rem; }
.game__side { flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: .6rem; min-width: 0; align-self: stretch; }
.game-loading { display: grid; place-items: center; gap: 1rem; min-height: 50vh; }

.player-strip { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .35rem .2rem; }
.player-strip__id { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.player-strip__name { font-weight: 800; display: flex; align-items: baseline; gap: .3rem; }
.player-strip__mr { color: var(--muted); font-weight: 700; font-size: .85rem; }
.captured { display: flex; align-items: center; gap: 1px; min-height: 1.2em; margin-top: 1px; flex-wrap: wrap; }
.cap { font-size: 1rem; line-height: 1; opacity: .85; }
.cap--w { color: #cfc7b4; -webkit-text-stroke: .5px #756c57; }
.cap--b { color: #4a463d; }
.cap__adv { font-size: .78rem; font-weight: 800; color: var(--muted); margin-left: .25rem; }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .15em .55em; min-width: 2.6em; text-align: center; color: var(--ink-soft); }
.clock.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.clock.is-low.is-active { background: var(--loss); border-color: var(--loss); color: #fff; }

.game__side.card { padding: .8rem; }
.game__movehead { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.game__movehead h3 { margin: 0; font-size: 1.1rem; }
.game__controls { display: flex; gap: .3rem; flex-wrap: wrap; }
.movelist { background: var(--surface-2); border-radius: 10px; padding: .4rem .2rem; max-height: 230px; overflow-y: auto; min-height: 60px; }
.movelist__grid { display: grid; grid-template-columns: 2.2em 1fr 1fr; gap: .1rem .3rem; align-items: center; font-size: .95rem; }
.movelist__no { color: var(--muted); text-align: right; font-weight: 700; font-size: .85rem; }
.movelist__san { padding: .15em .4em; border-radius: 6px; font-weight: 700; }
.movelist__san.is-last { background: color-mix(in srgb, var(--primary) 22%, transparent); }

.game__status { min-height: 1.5em; }
.pill { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .3em .8em; font-weight: 700; font-size: .9rem; }
.pill--soft { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); border-color: transparent; }
.pill--warn { background: color-mix(in srgb, var(--gold) 28%, var(--surface)); border-color: transparent; }
.pill--xs { font-size: .72rem; padding: .1em .5em; margin-left: .4rem; }

.chat { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-height: 90px; }
.chat__list { flex: 1; overflow-y: auto; max-height: 160px; display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; padding: .2rem; }
.chat__msg { background: var(--surface-2); padding: .3em .6em; border-radius: 9px; word-break: break-word; }
.chat__msg b { color: var(--primary-strong); }
.chat__form { display: flex; gap: .3rem; }
.chat__form .field { flex: 1; }

.result-modal { text-align: center; display: grid; gap: .3rem; }
.result-modal__title { font-family: var(--display); font-size: 1.7rem; font-weight: 600; }
.result-modal__sub { color: var(--muted); font-weight: 700; }
.result-modal__delta { font-size: 1.6rem; font-weight: 800; margin: .3rem 0; }
.result-modal__delta.is-up { color: var(--win); } .result-modal__delta.is-down { color: var(--loss); }
.result-modal .modal__actions { justify-content: center; }
.result-modal--win { box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--win) 40%, transparent); }

/* ============================== PROFILE ============================== */
.profile-head { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; position: relative; margin-bottom: 1.1rem; }
.profile-head__main { display: flex; gap: 1.1rem; align-items: center; }
.profile__name { font-size: 1.8rem; margin: 0; }
.profile__handle { color: var(--muted); font-weight: 700; }
.profile__bio { margin: .5rem 0 .3rem; color: var(--ink-soft); max-width: 50ch; }
.profile__meta { font-size: .85rem; }
.profile__rating { text-align: center; padding-left: 1rem; border-left: 1px solid var(--line); }
.profile__rating-num { font-family: var(--display); font-size: 2.6rem; font-weight: 600; color: var(--primary-strong); line-height: 1; }
.profile__rating-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.profile__peak { font-size: .8rem; margin-top: .3rem; }
.profile__edit { position: absolute; top: 1rem; right: 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem; text-align: center; box-shadow: var(--shadow-sm); }
.stat-tile__value { font-size: 1.6rem; font-weight: 800; font-family: var(--display); }
.stat-tile__label { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile--win .stat-tile__value { color: var(--win); } .stat-tile--loss .stat-tile__value { color: var(--loss); } .stat-tile--draw .stat-tile__value { color: var(--draw); }

.games-list { display: grid; gap: .25rem; }
.game-row { display: grid; grid-template-columns: 2em 1fr auto auto auto; gap: .7rem; align-items: center; background: none; border: 0; border-radius: 10px; padding: .5rem .6rem; cursor: pointer; font-family: var(--font); text-align: left; color: inherit; }
.game-row:hover { background: var(--surface-2); }
.result-badge { width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 7px; font-weight: 800; font-size: .85rem; color: #fff; }
.result-badge--win { background: var(--win); } .result-badge--loss { background: var(--loss); } .result-badge--draw { background: var(--draw); } .result-badge--live { background: var(--muted); }
.game-row__delta.is-up { color: var(--win); font-weight: 800; } .game-row__delta.is-down { color: var(--loss); font-weight: 800; }
.game-row__when { font-size: .82rem; }

.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: var(--shadow-sm); }
.swatch.is-active { border-color: var(--ink); transform: scale(1.1); }

/* ============================== LEADERBOARD ============================== */
.board-table { display: grid; gap: .15rem; }
.board-table__head, .board-table__row { display: grid; grid-template-columns: 2.4em 1fr 4em 4em 5em; gap: .6rem; align-items: center; padding: .55rem .7rem; }
.board-table__head { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; }
.board-table__row { background: none; border: 0; border-radius: 10px; cursor: pointer; font-family: var(--font); color: inherit; text-align: left; }
.board-table__row:hover { background: var(--surface-2); }
.board-table__row.is-me { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.board-table__player { display: flex; align-items: center; gap: .6rem; font-weight: 700; min-width: 0; }
.board-table__player > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-table__mr { font-weight: 800; color: var(--primary-strong); }

/* ============================== SETUP ============================== */
.setup { text-align: center; }
.setup__steps { text-align: left; max-width: 360px; margin: 1rem auto; display: grid; gap: .5rem; color: var(--ink-soft); }

/* ============================== RESPONSIVE ============================== */
@media (min-width: 681px) { .hide-sm { display: inline-flex; } }
@media (max-width: 680px) {
  .hide-sm { display: none !important; }
  .hero { grid-template-columns: 1fr; text-align: center; min-height: auto; }
  .hero__board { order: -1; }
  .hero__points { justify-items: center; }
  .auth-card { margin: 1.2rem auto 0; }
  .lobby-hero { justify-content: center; }
  .profile-head { grid-template-columns: 1fr; text-align: center; }
  .profile-head__main { flex-direction: column; }
  .profile__rating { border-left: 0; border-top: 1px solid var(--line); padding: 1rem 0 0; }
  .profile__edit { position: static; margin-top: .8rem; }
  .board-table__head, .board-table__row { grid-template-columns: 2em 1fr 4em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
