:root {
  --bg: #14161b; --panel: #1d2027; --line: #2c303a; --text: #e8e9ed; --dim: #8b90a0;
  --accent: #6aa8ff; --win: #4cc38a; --loss: #ef6461;
  --light: #e9dcc0; --dark: #a07c55; --sel: #f5d76e; --last: rgba(255, 220, 90, .35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
a { color: var(--accent); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, sans-serif; }
main { max-width: 1000px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 16px; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 15px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, button { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
input[type=number] { width: 100px; }
input[type=text], select { flex: 1; min-width: 120px; }
button { cursor: pointer; background: var(--line); }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #0b0d12; border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.rank.Grandmaster { background: #b8860b; color: #000; }
.rank.Master { background: #8e5cd9; }
.rank.Advanced { background: #2f6fd6; }
.rank.Intermediate { background: #2d8a5f; }
.up { color: var(--win); } .down { color: var(--loss); }
.x { background: none; border: none; color: var(--dim); padding: 2px 6px; }
.empty, .dim { color: var(--dim); }
.err { color: var(--loss); min-height: 1.4em; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* profile */
.me { display: flex; gap: 16px; align-items: center; }
.me .elo { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* bot picker */
.bots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.bot { text-align: left; display: grid; gap: 4px; padding: 10px; }
.bot b { font-size: 16px; }
.bot .rank { justify-self: start; }
.bot.on { border-color: var(--accent); background: #22324a; }
.ollama { font-size: 13px; }
.ollama .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--loss); margin-right: 6px; }
.ollama.ok .dot { background: var(--win); }

/* game */
.game { display: grid; grid-template-columns: minmax(0, 520px) 1fr; gap: 16px; align-items: start; }
.board { display: grid; grid-template: repeat(8, minmax(0, 1fr)) / repeat(8, minmax(0, 1fr)); aspect-ratio: 1; border-radius: 6px; overflow: hidden; user-select: none; }
.sq { position: relative; display: grid; place-items: center; cursor: pointer; overflow: hidden;
      font: clamp(24px, 5.5vw, 48px)/1 "Segoe UI Symbol", "DejaVu Sans", serif; }
.sq.l { background: var(--light); } .sq.d { background: var(--dark); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: var(--last); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(245, 215, 110, .6); }
.sq.target::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(0, 0, 0, .25); }
.sq.check { box-shadow: inset 0 0 0 4px var(--loss); }
.pc { position: relative; z-index: 1; font-variant-emoji: text; }
.pc.w { color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 2px #000; }
.pc.b { color: #111; }
.coord { position: absolute; font: 10px system-ui; opacity: .6; color: #000; }
.coord.f { right: 3px; bottom: 2px; } .coord.r { left: 3px; top: 2px; }
.side { display: grid; gap: 12px; }
.speech { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 64px; }
.speech .who { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.status { font-weight: 600; }
.moves { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; max-height: 240px; overflow-y: auto;
         font-variant-numeric: tabular-nums; display: grid; grid-template-columns: 32px 1fr 1fr; gap: 2px 8px; font-size: 14px; }
.thinking::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

@media (max-width: 760px) {
  .grid2, .game { grid-template-columns: 1fr; }
}

/* links styled as buttons */
a.btn { display: inline-block; text-decoration: none; font: inherit; color: var(--text); background: var(--line); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
a.btn.primary { background: var(--accent); color: #0b0d12; border-color: var(--accent); }
a.btn:hover { border-color: var(--accent); }

/* online play */
.player { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.player .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.player .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--win); }
.dot.busy { background: #e0a030; }
.clock { font: 600 20px/1 ui-monospace, Consolas, monospace; padding: 6px 10px; border-radius: 6px; background: var(--line); font-variant-numeric: tabular-nums; }
.clock.run { background: var(--text); color: var(--bg); }
.clock.low { background: var(--loss); color: #fff; }
.boardcol { display: grid; gap: 8px; }
.chat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; height: 160px; overflow-y: auto; font-size: 14px; }
.chat p { margin: 0 0 4px; overflow-wrap: anywhere; }
.list { display: grid; gap: 6px; }
.seek { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.banner { padding: 10px 12px; border-radius: 8px; background: #22324a; border: 1px solid var(--accent); }
/* quick play */
.tcs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tc { display: grid; gap: 2px; padding: 14px 10px; text-align: center; }
.tc b { font-size: 20px; }
.tc:hover { background: #22324a; }
.small { font-size: 12px; }
@media (max-width: 520px) { .tcs { grid-template-columns: repeat(2, 1fr); } }
/* phone QR */
.phone { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; margin-top: 12px; }
.phone ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.qr { display: block; background: #fff; border-radius: 10px; padding: 6px; aspect-ratio: 1; }
.qr svg { display: block; width: 100%; height: 100%; }
@media (max-width: 600px) { .phone { grid-template-columns: 1fr; } .qr { max-width: 240px; } }

/* phones */
@media (max-width: 600px) {
  main { padding: 12px 10px; gap: 12px; }
  h1 { font-size: 20px; }
  section { padding: 12px; }
  .me .elo { font-size: 26px; }
  .moves { max-height: 120px; }
  .chat { height: 110px; }
  .clock { font-size: 18px; }
}
/* friends */
#challengeIn .banner { flex-wrap: wrap; }
.seek .who { display: block; }

/* admin */
.admin { display: grid; grid-template-columns: 240px 1fr; gap: 16px; margin-top: 12px; align-items: start; }
.admin .list { max-height: 520px; overflow-y: auto; }
.seek.pick { text-align: left; cursor: pointer; width: 100%; }
.seek.pick.on { border-color: var(--accent); background: #22324a; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 99px; background: var(--line); margin-left: 4px; white-space: nowrap; }
.tag.bad { background: var(--loss); color: #fff; }
.tag.warn { background: #e0a030; color: #000; }
.tag.ok { background: #2d8a5f; color: #fff; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 12px 0; }
.kv > div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; }
#adminDetail h3 { margin: 16px 0 6px; font-size: 14px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
#adminDetail .actions { display: grid; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.scroll { max-height: 260px; overflow-y: auto; }
button.danger { background: var(--loss); border-color: var(--loss); color: #fff; }
body.is-admin .pname { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
@media (max-width: 760px) { .admin { grid-template-columns: 1fr; } .admin .list { max-height: 200px; } }
/* AI reports */
.reports { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; }
.reports .list { max-height: 360px; overflow-y: auto; }
.report { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 10px; background: var(--panel); }
.report.high { border-left-color: var(--loss); }
.report.medium { border-left-color: #e0a030; }
/* live updates */
.update-bar { position: sticky; top: 0; z-index: 50; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 16px; background: #22324a; border-bottom: 1px solid var(--accent); color: var(--text); }
.update-modal { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; }
.update-card { background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 20px; max-width: 460px; width: 100%; }
.update-card ul { padding-left: 20px; display: grid; gap: 6px; margin: 0 0 16px; }.update-card h2 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 20px; }

/* training */
.bar { display: block; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; background: var(--win); border-radius: 99px; }
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.course { display: grid; grid-template-columns: 56px 1fr; gap: 12px; text-align: left; padding: 14px; align-items: start; }
.course .icon { font: 40px/1 "Segoe UI Symbol", serif; text-align: center; }
.course b { display: block; font-size: 17px; margin-bottom: 4px; }
.course .dim { display: block; }
.course:hover { background: #22324a; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.lesson { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; text-align: left; padding: 10px; }
.lesson .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 700; }
.lesson .dim { display: block; }
.lesson.next { border-color: var(--accent); }
.lesson.done .num { background: #2d8a5f; }
.lesson.perfect .num { background: #b8860b; color: #000; }
.lesson:hover { background: #22324a; }
.dots { display: flex; gap: 6px; }
.dotx { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dotx.now { background: var(--accent); }
.dotx.good { background: var(--win); }
.dotx.bad { background: #e0a030; }
.feedback { min-height: 1.5em; font-weight: 600; }
.feedback.good { color: var(--win); }
.feedback.bad { color: var(--loss); }
button.promo { font: 40px/1 "Segoe UI Symbol", serif; width: 64px; height: 64px; }.update-bar.building { background: #2b2a1c; border-bottom-color: #e0a030; }
.update-bar.building button { background: none; border: none; color: var(--dim); padding: 4px 8px; }

/* square names */
.coord { font: 700 11px system-ui; opacity: .85; z-index: 2; }
.sq.l .coord { color: #8a6a45; } .sq.d .coord { color: #f3e7cf; }
.sqname { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 600 clamp(9px, 1.6vw, 13px)/1 system-ui;
  letter-spacing: .02em; pointer-events: none; z-index: 0; }
.sq.l .sqname { color: rgba(110, 80, 45, .55); } .sq.d .sqname { color: rgba(255, 245, 225, .5); }
.sq:has(.pc) .sqname { top: auto; bottom: 3px; left: auto; right: 4px; transform: none; font-size: clamp(8px, 1.2vw, 10px); }
.sq.ping { box-shadow: inset 0 0 0 4px #4cc3ff; }
.sq.ping::after { content: ""; position: absolute; inset: 0; background: rgba(76, 195, 255, .35); }
.sqref, .mv { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.sqref:hover, .mv:hover { color: #4cc3ff; }
.notation p { margin: 0 0 10px; }
.notation-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.notation-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.notation-table td:first-child { white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
.update-card.notation { max-width: 560px; max-height: 90vh; overflow-y: auto; }
/* ---------- board, v2: themes, frame, depth, animation ---------- */
:root { --frame: #6b4423; --board-glow: rgba(255, 210, 120, .35); --pc-b: #141414; --pc-b-glow: 0 2px 2px rgba(255, 255, 255, .25); --pc-w-glow: 0 0 2px #000, 0 0 2px #000, 0 2px 3px rgba(0, 0, 0, .6); }
.board {
  border-radius: 10px;
  box-shadow: 0 0 0 7px var(--frame), 0 0 0 9px rgba(255, 255, 255, .08), 0 22px 50px rgba(0, 0, 0, .55), 0 0 60px var(--board-glow);
  margin: 9px;
}
.sq.l { background: linear-gradient(135deg, color-mix(in srgb, var(--light) 100%, #fff 0%), color-mix(in srgb, var(--light) 88%, #000)); }
.sq.d { background: linear-gradient(135deg, color-mix(in srgb, var(--dark) 92%, #fff), color-mix(in srgb, var(--dark) 85%, #000)); }
.sq { font-size: clamp(28px, 6.2vw, 54px); transition: filter .15s; }
.pc { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; transition: transform .15s ease; will-change: transform; }
.pc.w { color: #fff; text-shadow: var(--pc-w-glow); }
.pc.b { color: var(--pc-b); text-shadow: var(--pc-b-glow); }
.pc { filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.sq:hover > .pc { transform: translateY(-3px) scale(1.07); }
.pc.slide { z-index: 6; animation: pcSlide .24s cubic-bezier(.2, .8, .3, 1); }
@keyframes pcSlide { from { transform: translate(calc(var(--dx) * 100%), calc(var(--dy) * 100%)); } }
.sq.last::before { background: color-mix(in srgb, var(--board-glow) 100%, transparent); }
.sq.sel::before { background: rgba(255, 230, 120, .55); box-shadow: inset 0 0 0 3px rgba(255, 240, 160, .9); }
.sq.target::after { width: 30%; height: 30%; background: radial-gradient(circle, rgba(0, 0, 0, .35) 55%, transparent 60%); }
.sq.target:has(.pc)::after { width: 92%; height: 92%; border-radius: 50%; background: none; box-shadow: inset 0 0 0 5px rgba(0, 0, 0, .3); }
.sq.check { box-shadow: inset 0 0 22px 6px rgba(255, 40, 40, .85); }
@media (prefers-reduced-motion: reduce) { .pc.slide { animation: none; } .pc { transition: none; } }

/* theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-pick { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; font-size: 13px; }
.theme-pick.on { border-color: var(--accent); background: #22324a; }
.mini { position: relative; display: grid; grid-template: repeat(4, 1fr) / repeat(4, 1fr); width: 72px; height: 72px; border-radius: 6px; overflow: hidden;
  box-shadow: 0 0 0 3px var(--frame), 0 6px 14px rgba(0, 0, 0, .5); }
.mini i.l { background: var(--light); } .mini i.d { background: var(--dark); }
.mini .pc { font-size: 34px; font-weight: 400; }
@media (max-width: 520px) { .theme-grid { grid-template-columns: repeat(2, 1fr); } }:root[data-board-theme="neon"] .sq .sqname { color: rgba(127, 246, 255, .45); }
:root[data-board-theme="neon"] .sq .coord { color: #7ff6ff; }

/* ---------- Update 6: menu, ranks, cup, unlocks ---------- */
body.app { background: radial-gradient(1000px 600px at 10% -10%, #24205a 0%, transparent 60%), radial-gradient(900px 600px at 100% 0%, #0f3b55 0%, transparent 55%), #0f1118; background-attachment: fixed; }
.glass { background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(14px); border-radius: 18px; }
.topnav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: rgba(12, 14, 24, .78); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.nav-brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 800; white-space: nowrap; }
.nav-brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 4px 16px rgba(123, 92, 255, .55); }
.nav-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-tab { position: relative; display: flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 12px; color: #c8cbe0; text-decoration: none; font-weight: 600; transition: background .15s, color .15s; }
.nav-tab:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-tab.active { color: #fff; background: linear-gradient(135deg, rgba(123, 92, 255, .45), rgba(255, 92, 177, .3)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.nav-ico { font-size: 18px; line-height: 1; }
.nav-badge { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); color: #ffd36b; }
.nav-badge.live { background: #ff3b5c; color: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 59, 92, 0); } 0% { box-shadow: 0 0 0 0 rgba(255, 59, 92, .7); } }
.nav-profile { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 99px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.nav-profile:hover { background: rgba(255, 255, 255, .13); }
.avatar-sm, .avatar-lg { display: grid; place-items: center; border-radius: 50%; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 70%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 45%, #000)); }
.avatar-sm { width: 32px; height: 32px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 30px; box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 50%, transparent); }
.nav-who { display: grid; text-align: left; line-height: 1.15; }
.nav-who b { font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-who span { font-size: 11px; color: #a9adc8; }
.nav-who i { font-style: normal; font-weight: 700; }
.tabbar { display: none; }
@media (max-width: 860px) {
  .nav-tabs { display: none; }
  .topnav { justify-content: space-between; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12, 14, 24, .92); backdrop-filter: blur(16px); border-top: 1px solid rgba(255, 255, 255, .1); }
  .tab-item { position: relative; display: grid; justify-items: center; gap: 2px; padding: 4px 6px; color: #9da1bd; text-decoration: none; font-size: 10.5px; font-weight: 600; min-width: 58px; }
  .tab-item .nav-ico { font-size: 21px; }
  .tab-item.active { color: #fff; }
  .tab-item.active .nav-ico { filter: drop-shadow(0 0 8px rgba(123, 92, 255, .9)); }
  .tab-item .nav-badge { position: absolute; top: -9px; left: 50%; transform: translateX(4px); font-size: 9px; padding: 1px 5px; white-space: nowrap; }
  body.has-nav main { padding-bottom: 90px; }
  .nav-who span { display: none; }
}

/* toasts */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 70; display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-radius: 14px; background: linear-gradient(135deg, #2a2160, #183a5a); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: toastIn .35s ease; transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translate(-50%, 20px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 30px) scale(.95); } }

/* locked boards */
.theme-pick.locked { opacity: .55; cursor: not-allowed; }
.theme-pick.locked .mini { filter: grayscale(.7) brightness(.7); }
.theme-pick small { color: #ffd36b; font-size: 11px; line-height: 1.3; }
:root[data-board-theme="galaxy"] .sq.d { background: radial-gradient(1px 1px at 22% 30%, rgba(255,255,255,.7), transparent 60%), radial-gradient(1px 1px at 72% 66%, rgba(255,255,255,.55), transparent 60%), radial-gradient(1.5px 1.5px at 45% 82%, rgba(200,180,255,.6), transparent 60%), var(--dark); }
:root[data-board-theme="galaxy"] .sq .sqname, :root[data-board-theme="galaxy"] .sq .coord { color: rgba(220, 205, 255, .55); }

/* profile box */
.profile-card { max-width: 520px; max-height: 92vh; overflow-y: auto; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-name { font-size: 22px; font-weight: 800; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.profile-stats > div { display: grid; text-align: center; padding: 10px 4px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.profile-stats b { font-size: 20px; }
.profile-stats span { font-size: 11px; color: var(--dim); }
.profile-boards, .profile-trophies { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); margin-top: 8px; }
.trophy { display: inline-flex; gap: 4px; align-items: center; margin: 6px 8px 0 0; font-size: 20px; }
.trophy small { font-size: 11px; color: var(--dim); }

/* shared big button */
.cta-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; border-radius: 14px; border: none; cursor: pointer;
  font: 800 17px system-ui, sans-serif; color: #fff; background: linear-gradient(135deg, #7b5cff, #ff5cb1); box-shadow: 0 10px 28px rgba(123, 92, 255, .45); transition: transform .15s; }
.cta-btn:hover { transform: translateY(-2px); }
.cta-btn:disabled { opacity: .6; transform: none; }

/* ranked */
.rank-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: center; padding: 26px; }
.emblem { --tc: #9aa0c0; width: 120px; height: 136px; display: grid; place-items: center; font: 58px/1 "Segoe UI Symbol", serif; color: #fff;
  clip-path: polygon(50% 0, 100% 18%, 100% 62%, 50% 100%, 0 62%, 0 18%);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 85%, #fff), var(--tc) 45%, color-mix(in srgb, var(--tc) 40%, #000));
  filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--tc) 60%, transparent)); text-shadow: 0 3px 8px rgba(0, 0, 0, .45); }
.emblem.unranked { --tc: #59607f; }
.rank-name { font-size: 34px; font-weight: 900; letter-spacing: -.02em; }
.rank-elo b { font-size: 22px; }
.rank-stats { display: flex; gap: 16px; margin-top: 8px; color: #c9cbe0; }
.queue { display: grid; gap: 8px; min-width: 220px; }
.ladder { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.rung { --tc: #888; display: grid; justify-items: center; gap: 4px; padding: 12px 4px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); text-align: center; }
.rung.mine { border-color: var(--tc); box-shadow: 0 0 24px color-mix(in srgb, var(--tc) 40%, transparent); }
.mini-emblem { width: 42px; height: 48px; display: grid; place-items: center; font: 22px/1 "Segoe UI Symbol", serif; color: #fff;
  clip-path: polygon(50% 0, 100% 18%, 100% 62%, 50% 100%, 0 62%, 0 18%); background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 85%, #fff), var(--tc)); }
.match-label { font-weight: 700; color: #ffd36b; }
.result-card { display: grid; justify-items: center; gap: 10px; padding: 26px; text-align: center; }
.result-big { font-size: clamp(36px, 7vw, 60px); font-weight: 900; letter-spacing: .04em; }
.result-big.win { background: linear-gradient(90deg, #ffe27a, #ffb347); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-big.loss { color: #ff6b7d; }
.result-big.draw { color: #c9d1dc; }
.result-change { font-size: 22px; }
@media (max-width: 860px) {
  .rank-hero { grid-template-columns: auto 1fr; }
  .queue { grid-column: 1 / -1; }
  .ladder { grid-template-columns: repeat(4, 1fr); }
  .emblem { width: 90px; height: 102px; font-size: 44px; }
}

/* sunday cup */
.cup-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 26px;
  background: linear-gradient(135deg, rgba(255, 200, 60, .14), rgba(255, 255, 255, .04)); }
.cup-trophy { font-size: 92px; filter: drop-shadow(0 10px 30px rgba(255, 200, 60, .6)); animation: bob2 4s ease-in-out infinite; }
@keyframes bob2 { 50% { transform: translateY(-8px) rotate(-4deg); } }
.cup-title { font-size: clamp(36px, 6vw, 56px); margin: 2px 0 6px; font-weight: 900;
  background: linear-gradient(90deg, #fff3c4, #ffcf40, #ff9f2e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cup-state { margin-top: 14px; display: grid; gap: 10px; justify-items: start; }
.live-pill { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; background: #ff3b5c; color: #fff; margin-right: 8px; }
.countdown { display: flex; gap: 10px; }
.countdown span { display: grid; justify-items: center; min-width: 70px; padding: 10px 8px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 207, 64, .3); font-size: 12px; color: var(--dim); }
.countdown b { font-size: 30px; color: #ffcf40; font-variant-numeric: tabular-nums; }
.standings tr.me-row td { background: rgba(123, 92, 255, .2); font-weight: 700; }
.rd { display: inline-block; width: 20px; text-align: center; border-radius: 4px; margin-left: 2px; font-size: 12px; font-weight: 700; }
.rd.w { background: #2d8a5f; } .rd.l { background: #8a2d3b; } .rd.d { background: #555a6e; }
.cabinet { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cab-item { display: grid; justify-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.cab-item.top { border-color: rgba(255, 207, 64, .5); box-shadow: 0 0 24px rgba(255, 207, 64, .2); }
.cab-medal { font-size: 40px; }
@media (max-width: 600px) { .cup-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } .cup-state { justify-items: center; } .countdown span { min-width: 56px; } .countdown b { font-size: 22px; } .hide-sm { display: none; } }
/* ---------- Update 7: ELO button, Elo Test, replays ---------- */
.nav-elo { padding: 8px 14px; border-radius: 99px; font-weight: 800; letter-spacing: .03em; color: #fff; border: none;
  background: linear-gradient(135deg, #18c48f, #0ea5e9); box-shadow: 0 6px 18px rgba(14, 165, 233, .4); white-space: nowrap; }
.nav-elo:hover { filter: brightness(1.1); }
@media (max-width: 860px) { .topnav { gap: 8px; } .nav-elo { margin-left: auto; padding: 7px 11px; } }
.elo-panel { max-width: 560px; max-height: 92vh; overflow-y: auto; }
.elo-test-btn { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, rgba(123, 92, 255, .5), rgba(255, 92, 177, .35)); border: 1px solid rgba(255, 255, 255, .18); margin-bottom: 12px; }
.elo-test-btn > span:first-child { font-size: 30px; }
.elo-test-btn:hover { filter: brightness(1.15); }
.elo-cards { display: grid; gap: 8px; }
.elo-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.elo-ico { font: 26px/1 "Segoe UI Symbol", "Segoe UI Emoji", serif; text-align: center; }
.elo-num { font-size: 26px; font-weight: 900; }
.test-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 26px;
  background: linear-gradient(135deg, rgba(24, 196, 143, .16), rgba(255, 255, 255, .04)); }
.test-ico { font-size: 84px; filter: drop-shadow(0 10px 26px rgba(24, 196, 143, .6)); animation: bob2 4s ease-in-out infinite; }
.test-title { font-size: clamp(36px, 6vw, 56px); margin: 2px 0 6px; font-weight: 900;
  background: linear-gradient(90deg, #b6ffe4, #18c48f, #0ea5e9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.test-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tstep { display: grid; gap: 2px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.tstep span { color: var(--dim); }
.tstep.now { border-color: #18c48f; box-shadow: 0 0 18px rgba(24, 196, 143, .35); }
.tstep.w { border-color: #2d8a5f; background: rgba(45, 138, 95, .25); }
.tstep.l { border-color: #8a2d3b; background: rgba(138, 45, 59, .25); }
.tstep.d { border-color: #555a6e; }
.spark { width: min(100%, 340px); height: 110px; }
.past-run { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.past-run summary { cursor: pointer; }
.replay-card { max-width: 520px; width: 100%; max-height: 95vh; overflow-y: auto; }
.replay-board { margin: 12px auto; width: min(100%, 420px); }
.replay-board .sq { font-size: clamp(24px, 6vw, 44px); cursor: default; }
.replay-move { text-align: center; font-weight: 700; font-family: ui-monospace, Consolas, monospace; margin: 4px 0 8px; }
.replay-controls { justify-content: center; }
.replay-controls button { min-width: 48px; font-size: 18px; }
.replay-moves { margin-top: 10px; max-height: 120px; }
.mv.cur { background: var(--accent); color: #0b0d12; border-radius: 4px; padding: 0 3px; text-decoration: none; }
@media (max-width: 600px) { .test-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } .test-steps { grid-template-columns: repeat(2, 1fr); } }
/* chat safety */
.chat-safety { gap: 6px; }
.chat-safety button { font-size: 13px; padding: 6px 10px; }

/* Quick match */
.qm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qm-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; }
.qm-grid button b { font-size: 13px; }
.qm-grid button span { font-size: 13px; opacity: 0.8; }
.qm-spinner { font-size: 56px; margin: 10px auto; width: 72px; animation: qm-spin 1.4s ease-in-out infinite; }
@keyframes qm-spin { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-10px) rotate(8deg); } }
.qm-cup { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 8px; padding: 10px; text-decoration: none; }
.qm-cup span { opacity: 0.8; font-size: 13px; }

/* First-time setup */
.setup-card { max-height: 92vh; overflow-y: auto; }
.setup-card input { width: 100%; box-sizing: border-box; }
.setup-label { display: block; font-weight: 700; margin: 14px 0 6px; }
.setup-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.setup-levels button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 10px; }
.setup-levels button span { font-size: 12px; opacity: 0.75; }
.setup-levels button.on { outline: 2px solid #ffd166; background: rgba(255, 209, 102, 0.15); }

/* Quick messages (quick match chat) */
.chat-presets { flex-wrap: wrap; gap: 6px; }
.chat-presets button { padding: 6px 10px; font-size: 13px; }
#chatToggle { margin-top: 6px; font-size: 13px; }

/* Ready up (there is no chat) */
.ready-box { margin: 10px 0; padding: 12px; border-radius: 12px; background: rgba(46, 204, 113, 0.08); border: 1px solid rgba(46, 204, 113, 0.35); text-align: center; }
.ready-box button { font-size: 18px; padding: 10px 28px; margin-bottom: 6px; }
