/* Colors. The Look window (js/theme.js) switches them with data-theme, data-board and
   data-stones on <html>, so changing the look needs no reload. */
:root {
  --bg: #302e2b;
  --panel: #262421;
  --panel-light: #3a3835;
  --text: #e8e6e3;
  --text-dim: #a09d99;
  --accent: #81b64c;
  --accent-dark: #5d8a32;
  --danger: #c0504d;
  --error-text: #ff8a80;
  --wood: #dcb35c;
  --line: #3b2a14;
  color-scheme: dark;
  /* Stones (used by board-view.js): two gradient colors each, and the shell lines. */
  --stone-black-1: #5a5a5a;
  --stone-black-2: #050505;
  --stone-white-1: #ffffff;
  --stone-white-2: #c8c8c8;
  --stone-white-edge: transparent;
  --shell-line: transparent;
  --stone-shine: transparent;
  --board-texture: transparent;
  --board-max: 720px;  /* how big the game board may get (Look window: Board size on screen) */
  --board-gap: 170px;  /* room left above and below the board on a short screen */
}

/* Light site colors: chosen, or "match my device" on a device set to light. */
:root[data-theme="light"] {
  --bg: #f3f0e9; --panel: #ffffff; --panel-light: #e6e2d9; --text: #2b2a28; --text-dim: #6b6862;
  --error-text: #b3261e; color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f3f0e9; --panel: #ffffff; --panel-light: #e6e2d9; --text: #2b2a28; --text-dim: #6b6862;
    --error-text: #b3261e; color-scheme: light;
  }
}

/* Boards */
:root[data-board="maple"] { --wood: #f0d9a3; --line: #4a3a22; }
:root[data-board="walnut"] { --wood: #a9743f; --line: #24160a; }
:root[data-board="green"] { --wood: #8fbf8a; --line: #1f3a1d; }
:root[data-board="bamboo"] { --wood: #d8c27c; --line: #3d2f10; --board-texture: url(#tex-bamboo); }
:root[data-board="marble"] { --wood: #dedbd5; --line: #3a3a44; --board-texture: url(#tex-marble); --board-stone-edge: rgba(0, 0, 0, 0.4); }
:root[data-board="ocean"] { --wood: #6fa8c9; --line: #0d2b40; }
:root[data-board="night"] { --wood: #3c3f45; --line: #c9ccd1; }
:root[data-board="paper"] { --wood: #fbfaf6; --line: #333333; --board-stone-edge: rgba(0, 0, 0, 0.5); }

/* Stones */
:root[data-stones="flat"] {
  --stone-black-1: #1c1c1c; --stone-black-2: #1c1c1c;
  --stone-white-1: #f4f2ec; --stone-white-2: #f4f2ec; --stone-white-edge: #555;
}
:root[data-stones="shell"] {
  --stone-black-1: #45484c; --stone-black-2: #15171a;
  --stone-white-1: #fffdf5; --stone-white-2: #e4dcc8; --shell-line: rgba(160, 140, 100, 0.5);
}
:root[data-stones="glass"] {
  --stone-black-1: #5d6b80; --stone-black-2: #0b1220;
  --stone-white-1: #ffffff; --stone-white-2: #bcd6e8; --stone-shine: rgba(255, 255, 255, 0.6);
}
:root[data-stones="jade"] {
  --stone-black-1: #4f9a72; --stone-black-2: #0e2b1d;
  --stone-white-1: #fffaf3; --stone-white-2: #e9d6d3; --stone-shine: rgba(255, 255, 255, 0.35);
}
:root[data-stones="yunzi"] {
  --stone-black-1: #343a34; --stone-black-2: #141814;
  --stone-white-1: #f5f1e1; --stone-white-2: #dcd4b8;
}

/* Accent color (buttons, highlights) */
:root[data-accent="blue"] { --accent: #4c8fd6; --accent-dark: #2f6aa8; }
:root[data-accent="purple"] { --accent: #9b6bd6; --accent-dark: #6f45a8; }
:root[data-accent="red"] { --accent: #d65a5a; --accent-dark: #a43838; }
:root[data-accent="orange"] { --accent: #e08a3c; --accent-dark: #b0621c; }

/* Page background */
:root[data-background="gradient"] body {
  background: radial-gradient(ellipse at top, var(--panel-light), var(--bg) 70%) fixed;
}
:root[data-background="wood"] body {
  background: repeating-linear-gradient(100deg, transparent 0 22px, rgba(150, 100, 40, 0.07) 22px 25px, transparent 25px 61px,
    rgba(150, 100, 40, 0.05) 61px 63px), var(--bg) fixed;
}
:root[data-background="pattern"] body {
  background:
    radial-gradient(circle, color-mix(in srgb, var(--text) 9%, transparent) 2px, transparent 2.5px) 0 0 / 40px 40px,
    linear-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--bg);
  background-attachment: fixed;
}

/* Text size: the panels, bars and pages grow or shrink, but never the board itself. */
:root[data-text="small"] :is(.top-bar, .side-panel, .player-card, .list-page, .text-page, dialog) { zoom: 0.9; }
:root[data-text="large"] :is(.top-bar, .side-panel, .player-card, .list-page, .text-page, dialog) { zoom: 1.15; }

/* Board size on screen */
:root[data-board-size="compact"] { --board-max: 520px; --board-gap: 260px; }
:root[data-board-size="big"] { --board-max: 1000px; --board-gap: 120px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 10px 20px;
  background: var(--panel);
}
.logo {
  display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700;
  color: var(--text); text-decoration: none;
}
.logo-mark { width: 30px; height: 30px; display: block; }
nav { display: flex; gap: 18px; }
.nav-item {
  color: var(--text-dim); font-weight: 600; font-size: 16px;
  background: none; border: none; padding: 0; font-family: inherit; cursor: pointer;
}
.nav-item.active { color: var(--text); }
a.nav-item { text-decoration: none; }
a.nav-item:hover, button.nav-item:hover { color: var(--text); }
.nav-item.soon { opacity: 0.5; cursor: default; }
.sound-toggle {
  margin-left: auto; padding: 6px 12px; border: none; border-radius: 6px;
  background: var(--panel-light); color: var(--text); font-weight: 600; font-family: inherit; cursor: pointer;
  white-space: nowrap;
}
.sound-toggle.off { color: var(--text-dim); }
.lang-select {
  padding: 6px 8px; border: none; border-radius: 6px; cursor: pointer;
  background: var(--panel-light); color: var(--text); font-weight: 600; font-family: inherit; font-size: 14px;
}
/* Pages without a sound button (privacy) push the menu to the right. */
.top-bar nav + .lang-select { margin-left: auto; }
.account-button {
  margin-left: auto; padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-family: inherit; white-space: nowrap;
  max-width: 45vw; overflow: hidden; text-overflow: ellipsis;
}
.account-button:not([hidden]) ~ .sound-toggle { margin-left: 0; }
.logout-button {
  padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; white-space: nowrap;
  background: var(--panel-light); color: var(--text); font-weight: 600; font-family: inherit;
}
.account-dialog .remember-row { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
.account-dialog .remember-row input { display: inline-block; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.account-dialog {
  width: min(380px, calc(100vw - 32px)); padding: 18px 20px; border: none; border-radius: 10px;
  background: var(--panel); color: var(--text); font-family: inherit;
}
.account-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.account-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.account-dialog p { color: var(--text-dim); font-size: 14px; line-height: 1.45; }
.account-dialog label { display: block; margin-bottom: 10px; font-size: 13px; color: var(--text-dim); }
.account-dialog input {
  display: block; width: 100%; margin-top: 4px; padding: 10px; border-radius: 6px;
  border: 2px solid var(--panel-light); background: var(--bg); color: var(--text); font-size: 16px; font-family: inherit;
}
.account-dialog input:focus { outline: none; border-color: var(--accent); }
.account-dialog .btn { width: 100%; margin-top: 4px; }
.account-view[hidden] { display: none; }
.dialog-close-row { margin: -8px -10px 0 0; text-align: right; }
.dialog-close { border: none; background: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.account-links { text-align: center; margin: 12px 0 0; }
.link-button {
  border: none; background: none; padding: 0; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 14px; text-decoration: underline;
}
.link-button.danger { color: var(--danger); }
.account-message { min-height: 1.2em; margin: 12px 0 0; }
.account-message:empty { display: none; }
.account-message.error { color: var(--error-text); }
.account-footer { margin: 12px 0 0; text-align: center; font-size: 12px; }
.account-footer a { color: var(--text-dim); }
.profile-stats { margin-bottom: 14px; }
.account-dialog [data-view="profile"] .btn { margin-bottom: 8px; }
.friend-add { margin-bottom: 4px; }
.friend-add input { margin-top: 0; letter-spacing: normal; text-transform: none; font-weight: 400; }
.friend-note { min-height: 0; margin: 4px 0 8px; }
.friend-note:empty { display: none; }
.friend-note.error { color: var(--error-text); }
.friend-section h3 { margin: 14px 0 6px; font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.friend-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--panel-light);
}
.friend-who { display: flex; flex-direction: column; min-width: 0; }
.friend-who b { overflow: hidden; text-overflow: ellipsis; }
.friend-detail { font-size: 12px; color: var(--text-dim); }
.friend-actions { display: flex; gap: 6px; flex: none; }
.account-dialog .small-btn { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.friend-empty { margin: 4px 0; }
.account-dialog { max-height: calc(100vh - 40px); overflow-y: auto; }
.profile-stats div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--panel-light); }

.game-layout {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 16px;
  flex-wrap: wrap;
}

.board-column {
  width: min(var(--board-max), 100%, calc(100vh - var(--board-gap)));
  min-width: 280px;
  display: flex;
  flex-direction: column;
}
/* You sit at the bottom of the board, like on chess.com. */
.board-column .top-seat { order: 0; }
.board-column .board { order: 1; }
.board-column .bottom-seat { order: 2; }

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  font-weight: 600;
  border-left: 4px solid transparent;
}
.player-card.to-move { border-left-color: var(--accent); padding-left: 10px; }
.player-info { margin-left: auto; color: var(--text-dim); font-weight: 400; }
.clock {
  min-width: 70px; padding: 4px 10px; border-radius: 6px; text-align: right;
  background: var(--panel); color: var(--text-dim); font-size: 18px; font-variant-numeric: tabular-nums;
}
.to-move .clock { background: var(--text); color: var(--bg); }
.to-move .clock.low { background: var(--danger); color: #fff; }
.choice-row.wrap { flex-wrap: wrap; }
.choice-row.wrap button { flex: 1 0 40px; }

.stone-icon { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.stone-icon.black { background: radial-gradient(circle at 35% 35%, #666, #000 70%); }
.stone-icon.white { background: radial-gradient(circle at 35% 35%, #fff, #ccc 80%); }

.board svg { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }

.spot { cursor: pointer; }
.spot .ghost { opacity: 0; pointer-events: none; }
.spot:hover .ghost { opacity: 0.45; }
.board.no-ghost .spot .ghost { display: none; }

.side-panel {
  width: 300px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel-block { background: var(--panel); border-radius: 8px; padding: 14px; }
.panel-block h2 { margin: 0 0 10px; font-size: 16px; }
.panel-block.small p { margin: 0; font-size: 14px; color: var(--text-dim); line-height: 1.45; }

.label { margin: 10px 0 6px; font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.label:first-of-type { margin-top: 0; }
#bot-options[hidden] { display: none; }

.choice-row { display: flex; gap: 6px; margin-bottom: 10px; }
.choice-row button, .bot-list button {
  flex: 1; padding: 8px 4px; border: none; border-radius: 6px;
  background: var(--panel-light); color: var(--text); font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.choice-row button.selected, .bot-list button.selected { outline: 2px solid var(--accent); }

.bot-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.bot-list button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; }
.bot-level {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--bg); font-size: 13px;
}
.bot-avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: block; }
.bot-level-tag { color: var(--text-dim); font-weight: 400; font-size: 12px; }
.card-avatar { width: 30px; height: 30px; border-radius: 50%; display: block; }
.bot-name { display: block; }
.bot-blurb { display: block; font-weight: 400; font-size: 12px; color: var(--text-dim); }

.label.spaced { margin-top: 14px; }
.rated-hint { margin: -4px 0 10px; font-size: 13px; color: var(--text-dim); }
.rated-hint:empty { display: none; }
.btn + .rated-hint { margin-top: 10px; }
.rated-note { margin: -6px 0 12px; color: var(--accent); font-weight: 600; }
.rated-note:empty { display: none; }
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1; min-width: 0; padding: 10px; border-radius: 6px; border: 2px solid var(--panel-light);
  background: var(--bg); color: var(--text); font-size: 16px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase; font-family: inherit;
}
.join-row input:focus { outline: none; border-color: var(--accent); }
.join-row .btn { flex: none; padding: 10px 18px; }

.invite-box { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.invite-box p { margin: 0; color: var(--text-dim); font-size: 14px; }
.invite-code {
  font-size: 30px; font-weight: 800; letter-spacing: .2em;
  background: var(--bg); border-radius: 8px; padding: 10px; user-select: all;
}
.online-status { margin: 10px 0 0; }
.online-status:empty { display: none; }

.chat-messages {
  height: 150px; overflow-y: auto; margin-bottom: 8px; padding: 8px;
  background: var(--bg); border-radius: 6px; font-size: 14px; line-height: 1.4;
  overflow-wrap: anywhere;
}
.chat-line { margin-bottom: 4px; }
.chat-line.mine b { color: var(--accent); }
.chat-line.note { color: var(--text-dim); font-style: italic; }
.chat-block .join-row input { letter-spacing: normal; text-transform: none; font-weight: 400; font-size: 15px; }

.move-list {
  position: relative; /* so the current move can be scrolled into view inside the list */
  max-height: 160px; overflow-y: auto; margin-bottom: 8px; padding: 4px;
  background: var(--bg); border-radius: 6px; font-size: 14px;
}
.move-row { display: grid; grid-template-columns: 40px 1fr 1fr; align-items: center; }
.move-number { color: var(--text-dim); text-align: right; padding-right: 6px; }
.move {
  border: none; background: none; color: var(--text); text-align: left; padding: 3px 8px;
  border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 14px;
}
.move:hover { background: var(--panel-light); }
.move.current { background: var(--accent); color: #fff; font-weight: 700; }
.move-empty { margin: 6px; color: var(--text-dim); }
.replay-row .btn { font-size: 20px; padding: 6px; }
.view-note { margin: 8px 0 0; }
.view-note:empty { display: none; }

.puzzle-prompt { margin: 0 0 12px; font-size: 16px; line-height: 1.45; }
.puzzle-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.puzzle-level { display: flex; justify-content: space-between; margin-top: 14px; }
.puzzle-level span { text-transform: none; }
.puzzle-chip.daily { box-shadow: inset 0 0 0 2px #e6b422; }
.daily-button { width: 100%; margin-bottom: 4px; }
.daily-puzzle-block .board { width: 150px; margin: 4px 0 10px; }
.daily-puzzle-row { display: flex; gap: 14px; align-items: center; }
.daily-puzzle-row p { margin: 0 0 6px; }
.daily-puzzle-row .btn { width: auto; }
.puzzle-chip {
  height: 40px; border: none; border-radius: 6px; cursor: pointer; font-family: inherit;
  background: var(--panel-light); color: var(--text); font-weight: 700; font-size: 15px;
}
.puzzle-chip.solved { background: var(--accent-dark); color: #fff; }
.puzzle-chip.current { outline: 2px solid var(--accent); }
.puzzle-progress { margin: 10px 0 0; }

.text-page { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; line-height: 1.6; }
.text-page h1 { font-size: 28px; }
.text-page h2 { font-size: 19px; margin-top: 28px; }
.text-page a { color: var(--accent); }
.text-page .back-link { display: inline-block; width: auto; margin-top: 16px; color: #fff; text-decoration: none; }

/* Dragon's Review */
:root { --rv-good: #81b64c; --rv-slip: #d6b13f; --rv-mistake: #e08a3c; --rv-big: #d9534f; }
.btn-review { background: #6b4fa0; color: #fff; }
.review-row { margin-top: 10px; }
.review-block h2 { margin-bottom: 8px; }
.review-summary { border-collapse: collapse; margin-bottom: 4px; font-size: 14px; }
.review-summary th, .review-summary td { padding: 3px 10px; text-align: center; }
.review-summary td:first-child { text-align: left; padding-left: 0; color: var(--text-dim); }
.review-legend { margin: 0 0 8px; font-size: 12px; color: var(--text-dim); }
.rv-good { color: var(--rv-good); }
.rv-slip { color: var(--rv-slip); }
.rv-mistake { color: var(--rv-mistake); }
.rv-big { color: var(--rv-big); font-weight: 700; }
.review-graph { position: relative; height: 96px; border-radius: 6px; overflow: hidden; background: var(--bg); cursor: pointer; }
.review-graph svg { display: block; width: 100%; height: 100%; }
.rv-black-half { fill: rgba(0, 0, 0, 0.18); }
.rv-mid { stroke: var(--text-dim); stroke-width: 0.5; stroke-dasharray: 3 3; }
.rv-area { fill: rgba(20, 20, 20, 0.45); }
.rv-line { fill: none; stroke: var(--text); stroke-width: 1.5; }
.rv-dot.rv-mistake { fill: var(--rv-mistake); }
.rv-dot.rv-big { fill: var(--rv-big); }
.rv-cursor { stroke: var(--accent); stroke-width: 2; }
.review-graph-labels span { position: absolute; left: 6px; font-size: 11px; color: var(--text-dim); pointer-events: none; }
.review-graph-labels span:first-child { top: 3px; }
.review-graph-labels span:last-child { bottom: 3px; }
.review-info { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
.move-mark { margin-left: 4px; font-weight: 700; font-size: 12px; }
.move.current .move-mark { color: #fff; }

/* Look window */
.look-button + .sound-toggle { margin-left: 0; }
.look-dialog .choice-row button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 0 auto; padding: 8px 10px; }
.look-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.35); flex: none; }
.look-preview { width: 150px; margin: 6px auto 14px; }

/* Daily games */
.nav-badge {
  display: inline-block; min-width: 18px; margin-left: 5px; padding: 1px 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; text-align: center; vertical-align: 2px;
}
.data-table tr.my-turn td { background: rgba(129, 182, 76, 0.15); }
.data-table tr.my-turn td:nth-child(4) { color: var(--accent); font-weight: 700; }
.data-table button.small-link { flex: none; padding: 4px 10px; font-size: 13px; }
.list-page .choice-row { max-width: 420px; }
.list-page .rated-hint { margin-top: 12px; }
.row-actions { display: inline-flex; gap: 6px; }
.friend-select {
  display: block; width: 100%; max-width: 420px; margin: -4px 0 10px; padding: 8px; border-radius: 6px;
  border: 2px solid var(--panel-light); background: var(--bg); color: var(--text); font-family: inherit; font-size: 15px;
}
.invite-line { font-size: 18px; margin: 4px 0 14px; }
.list-page .stat-row { margin-bottom: 14px; }
.list-page .panel-block > .btn-primary { max-width: 420px; }

/* Position editor */
.setup-button { width: 100%; margin-top: 14px; }
.editor-row { margin-top: 14px; }
#editor-message.error { color: var(--error-text); }

/* Leaderboard page */
.list-page { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.list-page h1 { margin: 6px 0 8px; font-size: 26px; overflow-wrap: anywhere; }
.list-page .message { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th { text-align: left; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; }
.data-table td { padding: 8px; border-top: 1px solid var(--panel-light); white-space: nowrap; }
.data-table a { color: var(--text); font-weight: 600; }
.data-table tr.me td { background: rgba(129, 182, 76, 0.15); }
.data-table tr.won td:nth-child(5) { color: var(--accent); font-weight: 600; }
.data-table tr.lost td:nth-child(5) { color: var(--error-text); }
.data-table .message { margin: 0; }
.data-table .small-link { display: inline-block; padding: 4px 10px; font-size: 13px; color: var(--text); text-decoration: none; }
.spaced-link { display: inline-block; margin-top: 12px; }
a.link-button { display: inline-block; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { flex: 1 0 110px; background: var(--bg); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: 20px; }
.stat span { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.account-dialog a.btn { display: block; text-align: center; text-decoration: none; margin-bottom: 8px; }

/* Phones and small windows: the panel drops under the board, so put the game
   buttons first instead of below the whole "New game" box. */
@media (max-width: 1000px) {
  .top-bar { gap: 14px; padding: 10px 12px; flex-wrap: wrap; row-gap: 8px; }
  /* The menu gets its own line on small screens so the account and sound buttons fit. */
  .top-bar nav { order: 3; width: 100%; gap: 16px; }
  /* One row you can swipe sideways, instead of words breaking or sticking out of the page. */
  .top-bar nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .top-bar nav::-webkit-scrollbar { display: none; }
  .nav-item { white-space: nowrap; flex: none; }
  .game-layout { gap: 12px; padding-top: 10px; }
  .side-panel { width: min(720px, 100%); }
  .editor-block, .controls-block, .review-block, .chat-block, .moves-block { order: -1; }
}

/* Phones: everything above the menu fits on one row. */
@media (max-width: 560px) {
  .top-bar { gap: 6px; padding: 8px 12px; }
  .logo { font-size: 0; gap: 0; } /* just the round logo, no name */
  .logo-mark { width: 32px; height: 32px; }
  .account-button { max-width: 30vw; padding: 6px 8px; font-size: 13px; }
  .logout-button, .sound-toggle { padding: 6px 8px; font-size: 13px; }
  .lang-select { padding: 6px 2px; font-size: 13px; }
  .list-page { padding: 12px 12px 30px; }
  .panel-block { padding: 12px; }
  .data-table { font-size: 14px; }
  .data-table td, .data-table th { padding: 6px; }
}

.thinking::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.btn {
  flex: 1; padding: 10px; border: none; border-radius: 6px;
  background: var(--panel-light); color: var(--text);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { background: var(--accent); box-shadow: 0 4px 0 var(--accent-dark); width: 100%; }
.btn-danger { background: var(--danger); }
.btn-hint { background: #2f6e8a; }
.button-row { display: flex; gap: 8px; }
.button-row[hidden] { display: none; }
.rematch-row { margin-top: 10px; }

.status { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.message { margin: 0 0 12px; min-height: 1.3em; color: var(--text-dim); font-size: 14px; }

/* Player profiles (js/profile-extras.js, js/avatars.js) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%;
  color: #fff; font-weight: 700; line-height: 1; overflow: hidden; user-select: none;
}
.player-link { display: inline-flex; align-items: center; gap: 8px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin: 10px 0 14px; }
.profile-head h1 { margin: 0; }
.profile-about { margin: 4px 0 0; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.profile-actions .btn { width: auto; padding: 8px 14px; text-decoration: none; }
.profile-actions .message { flex-basis: 100%; margin: 0; }
.friend-state { color: var(--accent); font-weight: 600; padding: 8px 4px; }
.rating-graph { display: block; width: 100%; height: auto; }
.rg-grid { stroke: var(--panel-light); stroke-width: 1; }
.rg-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.rg-area { fill: var(--accent); opacity: 0.12; }
.rg-dot { fill: var(--accent); }
.rg-label { fill: var(--text-dim); font-size: 15px; font-family: inherit; }
.size-stats { margin-top: 10px; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.avatar-grid button { padding: 3px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.avatar-grid button.selected { border-color: var(--accent); }
.about-input {
  display: block; width: 100%; padding: 8px; border-radius: 6px; border: 1px solid var(--panel-light);
  background: var(--bg); color: var(--text); font: inherit; resize: vertical;
}
.char-count { text-align: right; margin: 4px 0 10px; font-size: 12px; }
.profile-name-link { color: inherit; text-decoration: none; }
.profile-name-link:hover { text-decoration: underline; }
