:root {
  --bg: #080a0f;
  --hud-bg: rgba(12, 15, 22, 0.88);
  --hud-border: rgba(212, 175, 55, 0.54);
  --gold: #d4af37;
  --gold-bright: #f5d76e;
  --gold-deep: #9e7a1c;
  --text: #f0ece1;
  --muted: #a5aab4;
  --accent-blue: #4ea8de;
  --danger: #e63946;
  --font-gothic: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

html,
body,
#root {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

#canvas-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#hud-top {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
}

/* Carved Obsidian & Forged Brass Plaques (Brand & Status) */
.brand-pill {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.2), transparent 72%),
    linear-gradient(180deg, rgba(18, 22, 33, 0.95) 0%, rgba(8, 10, 16, 0.98) 100%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--hud-border);
  padding: 7px 12px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 190, 0.24),
    inset 0 0 0 3px rgba(8, 10, 16, 0.92),
    inset 0 0 0 4px rgba(212, 175, 55, 0.22),
    0 10px 28px rgba(0, 0, 0, 0.85);
}

.brand-pill::before {
  content: "♛";
  font-size: 0.9rem;
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 12px rgba(245, 215, 110, 0.72);
}

.brand-title {
  font-family: var(--font-gothic);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6d1 0%, #f5d76e 52%, #c29222 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.status-pill {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.12), transparent 74%),
    linear-gradient(180deg, rgba(16, 20, 30, 0.94) 0%, rgba(8, 10, 16, 0.98) 100%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.42);
  padding: 7px 12px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-gothic);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.16),
    inset 0 0 0 3px rgba(8, 10, 16, 0.9),
    inset 0 0 0 4px rgba(212, 175, 55, 0.16),
    0 10px 28px rgba(0, 0, 0, 0.85);
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: #fff9e6;
  border: 1px solid var(--gold-bright);
  box-shadow: 0 0 10px rgba(255, 248, 220, 0.9);
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.turn-dot.black {
  background: #1e2330;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.55);
}

.mode-badge {
  font-family: var(--font-gothic);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.24), rgba(212, 175, 55, 0.08));
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.48);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-badge:hover {
  background: linear-gradient(180deg, rgba(245, 215, 110, 0.36), rgba(212, 175, 55, 0.16));
  border-color: var(--gold-bright);
}

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 3px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.14), transparent 74%),
    linear-gradient(180deg, rgba(16, 20, 30, 0.94) 0%, rgba(8, 10, 16, 0.98) 100%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.44);
  font-family: var(--font-gothic);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.16),
    0 10px 26px rgba(0, 0, 0, 0.85);
}

.clock-side {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 2px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.clock-side.active {
  color: #fff6d6;
  background: rgba(212, 175, 55, 0.2);
  border-color: rgba(245, 215, 110, 0.58);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.22);
}

.clock-side.low {
  color: #ff6b6b;
  border-color: rgba(230, 57, 70, 0.65);
  background: rgba(230, 57, 70, 0.16);
}

.clock-king {
  font-size: 0.82rem;
  color: var(--gold-bright);
  line-height: 1;
}

.clock-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.clock-sep {
  color: rgba(212, 175, 55, 0.45);
  font-size: 0.68rem;
}

/* Segmented Cathedral Console Dock (Desktop) */
.hud-console-group {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.14), transparent 75%),
    linear-gradient(180deg, rgba(15, 19, 28, 0.95) 0%, rgba(7, 9, 14, 0.98) 100%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.2),
    0 12px 30px rgba(0, 0, 0, 0.86),
    0 0 18px rgba(212, 175, 55, 0.08);
}

.hud-divider {
  width: 1px;
  align-self: stretch;
  margin: 3px 2px;
  background: linear-gradient(180deg, transparent, rgba(212, 175, 55, 0.55), transparent);
}

/* Carved Obsidian & Brass Plaque Button */
.hud-btn {
  position: relative;
  background: linear-gradient(180deg, rgba(24, 30, 44, 0.78) 0%, rgba(12, 15, 23, 0.88) 100%);
  border: 1px solid rgba(212, 175, 55, 0.22);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 2px;
  font-family: var(--font-gothic);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.hud-btn::before {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  line-height: 1;
  color: var(--gold);
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
  transition: color 0.18s ease, transform 0.18s ease;
}

#btn-side-toggle::before { content: "⇄"; }
#btn-undo::before { content: "↶"; }
#btn-hint::before { content: "✦"; }
#btn-ai-difficulty::before { content: "⚔"; }
#btn-ai-move::before { content: "✧"; }
#btn-reset::before { content: "↻"; }
#btn-cam-player::before { content: "♔"; }
#btn-cam-top::before { content: "❖"; }
#btn-cam-side::before { content: "◫"; }
#btn-cam-wide::before { content: "⛫"; }
#btn-settings::before { content: "⚙"; }
#btn-sound-toggle::before { content: "♫"; }
#btn-sound-toggle.muted::before {
  content: "♪";
  opacity: 0.42;
  filter: none;
}
#btn-sound-toggle.muted {
  color: var(--muted);
}
#btn-hide-ui::before,
#btn-mobile-show-ui::before { content: "◈"; }
#btn-mobile-controls::before { content: "⚜"; }

.hud-btn:hover:not(:disabled) {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 215, 110, 0.28), rgba(212, 175, 55, 0.06) 76%),
    linear-gradient(180deg, rgba(38, 31, 18, 0.94) 0%, rgba(18, 15, 10, 0.97) 100%);
  border-color: rgba(245, 215, 110, 0.72);
  color: var(--gold-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 204, 0.36),
    inset 0 -2px 0 var(--gold-bright),
    0 4px 14px rgba(0, 0, 0, 0.65);
}

.hud-btn:hover:not(:disabled)::before {
  color: var(--gold-bright);
  transform: scale(1.08);
}

.hud-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.hud-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.4);
}

.hud-btn.active,
.hud-btn.primary {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 215, 110, 0.38), rgba(184, 137, 30, 0.15) 78%),
    linear-gradient(180deg, rgba(50, 39, 18, 0.96) 0%, rgba(22, 18, 10, 0.98) 100%);
  border-color: var(--gold-bright);
  color: #fff4c8;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 210, 0.48),
    inset 0 -2px 0 var(--gold-bright),
    0 0 16px rgba(212, 175, 55, 0.28);
}

.hud-btn.active::before,
.hud-btn.primary::before {
  color: #fff4c8;
  filter: drop-shadow(0 0 8px rgba(245, 215, 110, 0.85));
}

/* Bottom HUD Plaques */
#hud-bottom {
  position: fixed;
  bottom: 14px;
  left: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  gap: 12px;
  flex-wrap: wrap;
}

.hud-bottom-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  max-width: min(580px, calc(100vw - 260px));
}

.move-history-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.14), transparent 75%),
    linear-gradient(180deg, rgba(15, 19, 28, 0.92), rgba(8, 10, 16, 0.96));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.42);
  padding: 6px 12px;
  border-radius: 3px;
  font-family: var(--font-gothic);
  font-size: 0.68rem;
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.14),
    inset 0 0 0 3px rgba(8, 10, 15, 0.85),
    inset 0 0 0 4px rgba(212, 175, 55, 0.12),
    0 8px 22px rgba(0, 0, 0, 0.82);
}

.mh-label {
  color: var(--gold-bright);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-right: 6px;
  border-right: 1px solid rgba(212, 175, 55, 0.32);
}

.mh-scroll {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  max-width: 440px;
}

.mh-scroll::-webkit-scrollbar {
  display: none;
}

.mh-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.16);
}

.mh-num {
  color: var(--muted);
  font-size: 0.62rem;
}

.mh-w,
.mh-b {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 1px 4px;
  font-family: var(--font-gothic);
  font-size: 0.68rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.mh-w:hover,
.mh-b:hover {
  background: rgba(212, 175, 55, 0.18);
  border-color: rgba(245, 215, 110, 0.45);
  color: var(--gold-bright);
}

.mh-w.latest,
.mh-b.latest,
.mh-w.active-ply,
.mh-b.active-ply {
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.22);
  border-color: rgba(245, 215, 110, 0.62);
  text-shadow: 0 0 8px rgba(245, 215, 110, 0.55);
}

.mh-w.future-ply,
.mh-b.future-ply {
  opacity: 0.38;
}

.mh-nav {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 6px;
  border-left: 1px solid rgba(212, 175, 55, 0.32);
}

.mh-nav-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.32);
  color: var(--gold-bright);
  border-radius: 2px;
  padding: 2px 5px;
  font-size: 0.62rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mh-nav-btn:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.24);
  border-color: var(--gold-bright);
}

.mh-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.mh-resume-btn {
  appearance: none;
  font-family: var(--font-gothic);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.36), rgba(168, 120, 22, 0.24));
  border: 1px solid var(--gold-bright);
  color: #fff6d6;
  border-radius: 2px;
  padding: 2px 7px;
  margin-left: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 215, 110, 0.35);
  transition: all 0.16s ease;
}

.mh-resume-btn:hover {
  background: linear-gradient(180deg, rgba(245, 215, 110, 0.5), rgba(196, 146, 32, 0.34));
  transform: translateY(-1px);
}

.mh-q-badge {
  display: inline-block;
  margin-left: 3px;
  padding: 0 3px;
  border-radius: 2px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.15;
  vertical-align: baseline;
  letter-spacing: 0.01em;
}

.mh-q-badge.q-brilliant {
  color: #2ce5d0;
  background: rgba(44, 229, 208, 0.16);
  border: 1px solid rgba(44, 229, 208, 0.45);
  text-shadow: 0 0 6px rgba(44, 229, 208, 0.6);
}

.mh-q-badge.q-good {
  color: #5ce68b;
  background: rgba(92, 230, 139, 0.14);
  border: 1px solid rgba(92, 230, 139, 0.38);
}

.mh-q-badge.q-inaccuracy {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.38);
}

.mh-q-badge.q-mistake {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.16);
  border: 1px solid rgba(251, 146, 60, 0.42);
}

.mh-q-badge.q-blunder {
  color: #ff5c6c;
  background: rgba(255, 92, 108, 0.18);
  border: 1px solid rgba(255, 92, 108, 0.48);
  text-shadow: 0 0 6px rgba(255, 92, 108, 0.5);
}

.move-quality-toast {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-gothic);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(12, 16, 24, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.48);
  pointer-events: none;
  white-space: nowrap;
}

.move-quality-toast.visible {
  display: inline-flex;
}

.move-quality-toast .mqt-move {
  color: var(--text);
  font-weight: 700;
}

.move-quality-toast .mqt-sep {
  color: rgba(212, 175, 55, 0.5);
}

.move-quality-toast.q-brilliant {
  border-color: rgba(44, 229, 208, 0.72);
  box-shadow: 0 0 16px rgba(44, 229, 208, 0.28), 0 8px 22px rgba(0, 0, 0, 0.85);
}
.move-quality-toast.q-brilliant .mqt-label,
.move-quality-toast.q-brilliant .mqt-icon {
  color: #2ce5d0;
  text-shadow: 0 0 8px rgba(44, 229, 208, 0.55);
}

.move-quality-toast.q-good {
  border-color: rgba(92, 230, 139, 0.62);
}
.move-quality-toast.q-good .mqt-label,
.move-quality-toast.q-good .mqt-icon {
  color: #5ce68b;
}

.move-quality-toast.q-inaccuracy {
  border-color: rgba(251, 191, 36, 0.62);
}
.move-quality-toast.q-inaccuracy .mqt-label,
.move-quality-toast.q-inaccuracy .mqt-icon {
  color: #fbbf24;
}

.move-quality-toast.q-mistake {
  border-color: rgba(251, 146, 60, 0.68);
}
.move-quality-toast.q-mistake .mqt-label,
.move-quality-toast.q-mistake .mqt-icon {
  color: #fb923c;
}

.move-quality-toast.q-blunder {
  border-color: rgba(255, 92, 108, 0.78);
  box-shadow: 0 0 16px rgba(255, 92, 108, 0.32), 0 8px 22px rgba(0, 0, 0, 0.85);
}
.move-quality-toast.q-blunder .mqt-label,
.move-quality-toast.q-blunder .mqt-icon {
  color: #ff5c6c;
  text-shadow: 0 0 8px rgba(255, 92, 108, 0.5);
}

.eval-bar-wrap {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  user-select: none;
}

.eval-bar-track {
  width: 14px;
  height: min(300px, 44vh);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, #10141f 0%, #1c2233 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.68);
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.85),
    0 8px 24px rgba(0, 0, 0, 0.82),
    0 0 14px rgba(212, 175, 55, 0.18);
  position: relative;
}

.eval-bar-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1.5px;
  background: rgba(245, 215, 110, 0.72);
  pointer-events: none;
}

.eval-fill-w {
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #fffdf7 0%, #e7dcc6 55%, #cbbba0 100%);
  box-shadow: 0 0 10px rgba(255, 244, 214, 0.45);
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.eval-score {
  font-family: var(--font-gothic);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(12, 15, 23, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.48);
  color: var(--gold-bright);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.eval-score.white-adv {
  color: #fff5d6;
}

.eval-score.black-adv {
  color: #d4af37;
}

.hint-pill {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.1), transparent 75%),
    linear-gradient(180deg, rgba(14, 18, 26, 0.88), rgba(8, 10, 15, 0.94));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.36);
  padding: 7px 15px;
  border-radius: 3px;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.12),
    inset 0 0 0 3px rgba(8, 10, 15, 0.85),
    inset 0 0 0 4px rgba(212, 175, 55, 0.12),
    0 8px 22px rgba(0, 0, 0, 0.8);
}

.hint-pill strong {
  font-family: var(--font-gothic);
  color: var(--gold-bright);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 4px;
}

.captured-pill {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(212, 175, 55, 0.16), transparent 75%),
    linear-gradient(180deg, rgba(16, 20, 30, 0.94), rgba(8, 10, 16, 0.98));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.48);
  padding: 9px 12px 8px;
  border-radius: 3px;
  font-family: var(--font-gothic);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  display: inline-flex;
  align-items: stretch;
  gap: 10px;
  pointer-events: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.18),
    inset 0 0 0 3px rgba(8, 10, 15, 0.85),
    inset 0 0 0 4px rgba(212, 175, 55, 0.14),
    0 10px 26px rgba(0, 0, 0, 0.85);
}

.captured-pill:empty {
  display: none;
}

.cap-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 82px;
  gap: 6px;
}

.cap-list {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  overflow: visible;
}

.cap-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.09), rgba(255, 238, 186, 0.02));
  border: 1px solid rgba(212, 175, 55, 0.22);
}

.cap-name {
  font-family: var(--font-gothic);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  white-space: nowrap;
}

.cap-qty {
  color: var(--gold-bright);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.cap-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(212, 175, 55, 0.34);
}

.cap-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cap-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffdf7, #c9bfa8);
  border: 1px solid rgba(255, 238, 186, 0.7);
  box-shadow: 0 0 5px rgba(255, 238, 186, 0.45);
}

.cap-dot.black {
  background: radial-gradient(circle at 35% 35%, #3a4254, #0d1018);
  border: 1px solid rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.35);
}

.cap-figs-black .cap-fig {
  color: #d4af37;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(212, 175, 55, 0.38);
}

.cap-figs-white .cap-fig {
  color: #f3ead6;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(255, 245, 220, 0.35);
}

.cap-fig {
  display: inline-block;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", serif;
  font-size: 0.96rem;
  line-height: 1;
}

.cap-none {
  font-family: var(--font-gothic);
  font-size: 0.72rem;
  color: rgba(169, 155, 124, 0.42);
  text-align: center;
  padding: 2px 0;
}

.cap-adv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  border: 1px solid rgba(245, 215, 110, 0.55);
  color: var(--gold-bright);
  font-family: var(--font-gothic);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
}

.cap-divider {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(180deg, transparent, rgba(212, 175, 55, 0.55), transparent);
}


body.cinematic-ui-hidden #hud-top,
body.cinematic-ui-hidden #hud-bottom,
body.cinematic-ui-hidden #eval-bar-wrap {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.25s ease;
}

body.cinematic-ui-hidden .mobile-only-restore-ui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 35;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 3px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 215, 110, 0.25), transparent 75%),
    linear-gradient(180deg, rgba(18, 22, 33, 0.95), rgba(8, 10, 16, 0.98));
  border: 1px solid var(--hud-border);
  color: var(--gold-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 186, 0.25),
    0 10px 28px rgba(0, 0, 0, 0.85);
  pointer-events: auto;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.cinematic-ui-hidden .mobile-only-restore-ui:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Checkmate Banner */
#checkmate-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 78px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-12px) scale(0.97);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

#checkmate-overlay.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#checkmate-overlay.visible .checkmate-banner {
  pointer-events: auto;
}

.checkmate-banner {
  pointer-events: none;
  position: relative;
  min-width: 480px;
  max-width: 92vw;
  padding: 22px 44px 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.24), transparent 72%),
    linear-gradient(180deg, #0e111af0, #080a10f5);
  border: 1.5px solid rgba(212, 175, 55, 0.78);
  border-radius: 6px;
  box-shadow: 0 24px 64px #000000e0, 0 0 42px #d4af3740, inset 0 0 24px #d4af371f;
  text-align: center;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.checkmate-banner:before {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 3px;
  pointer-events: none;
}

.checkmate-ornament {
  font-family: var(--font-gothic);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #d4af37d9;
  margin-bottom: 4px;
}

.checkmate-crown {
  font-size: 1.85rem;
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(245, 215, 110, 0.75);
  margin-bottom: 4px;
}

.checkmate-title {
  font-family: var(--font-gothic);
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6d1, #f5d76e 48%, #b8891e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.85));
  margin: 2px 0 6px;
}

.checkmate-rule {
  width: 72%;
  height: 1px;
  margin: 8px auto 10px;
  background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.85) 50%, transparent 100%);
}

.checkmate-subtitle {
  font-family: var(--font-gothic);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0ece1;
  margin-bottom: 14px;
}

.checkmate-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.checkmate-btn {
  font-family: var(--font-gothic);
  background: #d4af3729;
  border: 1px solid rgba(212, 175, 55, 0.62);
  color: var(--gold-bright);
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
}

.checkmate-btn:hover {
  background: #d4af374d;
  border-color: var(--gold-bright);
  transform: translateY(-1px);
}

.checkmate-btn.secondary {
  background: #ffffff0f;
  border-color: #ffffff38;
  color: var(--muted);
}

.checkmate-btn.secondary:hover {
  color: var(--text);
  border-color: #ffffff73;
}

/* Promotion Modal */
#promotion-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 36;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
}

#promotion-modal.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.promotion-card {
  position: relative;
  width: min(440px, calc(100vw - 28px));
  padding: 24px 26px 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.28), transparent 70%),
    linear-gradient(180deg, rgba(14, 18, 28, 0.98), rgba(8, 10, 16, 0.99));
  border: 1.5px solid rgba(212, 175, 55, 0.85);
  border-radius: 6px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.92), 0 0 42px rgba(212, 175, 55, 0.28), inset 0 0 24px rgba(212, 175, 55, 0.12);
  text-align: center;
}

.promotion-title {
  font-family: var(--font-gothic);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 4px 0;
}

.promotion-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.promotion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.promotion-choice-btn {
  font-family: var(--font-gothic);
  background: linear-gradient(180deg, rgba(28, 34, 48, 0.95), rgba(16, 20, 30, 0.96));
  border: 1px solid rgba(212, 175, 55, 0.62);
  color: var(--text);
  padding: 14px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.promotion-choice-btn:hover {
  background: linear-gradient(180deg, rgba(62, 50, 24, 0.96), rgba(36, 28, 14, 0.98));
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  transform: translateY(-2px);
}

.promotion-choice-icon {
  font-size: 1.85rem;
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 12px rgba(245, 215, 110, 0.55);
}

.promotion-choice-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Settings Modal */
#settings-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 36;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
}

#settings-modal.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.settings-card {
  position: relative;
  width: min(500px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 18px 22px 16px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.25), transparent 70%),
    linear-gradient(180deg, rgba(14, 18, 28, 0.98), rgba(8, 10, 16, 0.99));
  border: 1.5px solid rgba(212, 175, 55, 0.82);
  border-radius: 6px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.92),
    0 0 42px rgba(212, 175, 55, 0.25),
    inset 0 0 24px rgba(212, 175, 55, 0.1);
  text-align: center;
}

.settings-card::before {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 3px;
  pointer-events: none;
}

.settings-section {
  margin-top: 11px;
  text-align: left;
  transition: opacity 0.2s ease;
}

.settings-section.disabled-sec {
  opacity: 0.4;
  pointer-events: none;
}

.settings-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.settings-label {
  font-family: var(--font-gothic);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 5px;
}

.settings-label-row .settings-label {
  margin-bottom: 0;
}

.settings-soon-badge {
  font-family: var(--font-gothic);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.26), rgba(212, 175, 55, 0.1));
  border: 1px solid rgba(245, 215, 110, 0.52);
  color: var(--gold-bright);
}

.settings-grid {
  display: grid;
  gap: 6px;
}

.settings-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.settings-opt-btn {
  position: relative;
  font-family: var(--font-gothic);
  background: linear-gradient(180deg, rgba(24, 30, 44, 0.88), rgba(12, 15, 23, 0.94));
  border: 1px solid rgba(212, 175, 55, 0.34);
  color: var(--text);
  padding: 7px 6px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.settings-opt-btn:hover:not(:disabled) {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 215, 110, 0.24), transparent 76%),
    linear-gradient(180deg, rgba(38, 31, 18, 0.94), rgba(18, 15, 10, 0.97));
  border-color: rgba(245, 215, 110, 0.72);
  color: var(--gold-bright);
}

.settings-opt-btn.active {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 215, 110, 0.36), rgba(184, 137, 30, 0.14) 78%),
    linear-gradient(180deg, rgba(50, 39, 18, 0.96), rgba(22, 18, 10, 0.98));
  border-color: var(--gold-bright);
  color: #fff4c8;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 210, 0.45),
    inset 0 -2px 0 var(--gold-bright),
    0 0 14px rgba(212, 175, 55, 0.25);
}

.settings-opt-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.settings-opt-icon {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(245, 215, 110, 0.45);
}

.settings-opt-main {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-opt-sub {
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.settings-opt-btn.active .settings-opt-sub {
  color: #f3e4b2;
}

.settings-footer {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  background: radial-gradient(circle at center, #111622, #06080d);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.45s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-title {
  font-family: var(--font-gothic);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.loader-bar-wrap {
  width: 260px;
  height: 6px;
  background: #ffffff14;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.38);
}

.loader-bar {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 0.25s ease;
}

#loader-text {
  font-family: var(--font-gothic);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.mobile-controls-trigger,
.mobile-sheet-backdrop,
.mobile-sheet-handle-wrap,
.mobile-sheet-header,
.mobile-sheet-section-label,
.mobile-sheet-hint,
.mobile-only-restore-ui {
  display: none;
}

/* Responsive Desktop Compacting for Medium Screens (769px - 1340px) */
@media (min-width: 769px) and (max-width: 1340px) {
  .hud-btn {
    padding: 6px 9px;
    font-size: 0.67rem;
    letter-spacing: 0.04em;
  }
  .brand-pill,
  .status-pill {
    padding: 7px 11px;
  }
  .brand-title {
    font-size: 0.78rem;
  }
  .status-pill {
    font-size: 0.72rem;
  }
}

/* Mobile Layout & Gothic Bottom Sheet */
@media (max-width: 768px) {
  #hud-top {
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 30;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
  }

  #hud-left {
    position: relative;
    z-index: 31;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .brand-pill {
    padding: 6px 10px;
    flex-shrink: 0;
  }

  .brand-pill::before {
    font-size: 0.82rem;
  }

  .brand-title {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .status-pill {
    padding: 6px 10px;
    font-size: 0.68rem;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
  }

  #turn-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mode-badge {
    display: none;
  }

  .clock-pill {
    font-size: 0.64rem;
    padding: 4px 7px;
    gap: 4px;
  }

  .mobile-controls-trigger {
    position: relative;
    z-index: 31;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    flex-shrink: 0;
    min-height: 36px;
    padding: 6px 11px;
    border-radius: 3px;
    font-family: var(--font-gothic);
    font-size: 0.7rem;
    font-weight: 700;
    background:
      radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.22), transparent 75%),
      linear-gradient(180deg, rgba(18, 22, 33, 0.96), rgba(8, 10, 16, 0.99));
    border: 1px solid var(--hud-border);
    color: var(--gold-bright);
    box-shadow:
      inset 0 1px 0 rgba(255, 238, 186, 0.22),
      0 8px 20px rgba(0, 0, 0, 0.85);
    white-space: nowrap;
  }

  body.cinematic-ui-hidden .mobile-only-restore-ui {
    top: 12px;
    right: 12px;
    padding: 7px 14px;
    opacity: 1;
  }

  .mobile-sheet-backdrop {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 28;
    background: #04060b94;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  .mobile-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .hud-console-group {
    display: contents;
  }

  #hud-right {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 32;
    background:
      radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.16), transparent 70%),
      linear-gradient(180deg, #0e121cf7, #07090efa);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1.5px solid rgba(212, 175, 55, 0.62);
    border-radius: 14px 14px 0 0;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -16px 48px #000000d9, inset 0 1px 0 rgba(255, 238, 186, 0.22);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    max-height: 82vh;
    overflow-y: auto;
    pointer-events: none;
    transform: translateY(105%);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  }

  #hud-right.mobile-sheet-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sheet-handle-wrap {
    grid-column: span 6;
    display: flex;
    justify-content: center;
    padding: 6px 0;
    cursor: pointer;
    pointer-events: auto;
  }

  .mobile-sheet-handle {
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.75), transparent);
  }

  .mobile-sheet-header {
    grid-column: span 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
    pointer-events: auto;
  }

  .mobile-sheet-title {
    font-family: var(--font-gothic);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-bright);
  }

  .mobile-sheet-close {
    font-family: var(--font-gothic);
    min-height: 36px;
    padding: 6px 14px;
    border-radius: 3px;
    border: 1px solid rgba(212, 175, 55, 0.52);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.08));
    color: var(--gold-bright);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 2;
  }

  .mobile-sheet-section-label {
    grid-column: span 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-gothic);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 6px 2px 2px;
  }

  .mobile-sheet-section-sub {
    font-family: var(--font-body);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--muted);
  }

  #hud-right .hud-divider {
    display: none;
  }

  #hud-right .hud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 44px;
    padding: 10px 8px;
    border-radius: 3px;
    border: 1px solid rgba(212, 175, 55, 0.36);
    box-shadow:
      inset 0 1px 0 rgba(255, 238, 186, 0.14),
      0 6px 16px rgba(0, 0, 0, 0.6);
    font-size: 0.72rem;
    width: 100%;
    white-space: nowrap;
  }

  #btn-undo,
  #btn-hint,
  #btn-ai-move,
  #btn-reset {
    grid-column: span 3;
  }

  #btn-cam-player,
  #btn-cam-top,
  #btn-cam-side,
  #btn-cam-wide {
    grid-column: span 3;
  }

  #btn-settings,
  #btn-hide-ui {
    grid-column: span 3;
  }

  #btn-download-zip {
    grid-column: span 6;
  }

  .mobile-sheet-hint {
    grid-column: span 6;
    display: block;
    margin-top: 2px;
    padding: 9px 12px;
    border-radius: 3px;
    background: rgba(18, 22, 32, 0.75);
    border: 1px solid rgba(212, 175, 55, 0.24);
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--muted);
    text-align: center;
  }

  .mobile-sheet-hint strong {
    font-family: var(--font-gothic);
    color: var(--gold-bright);
    font-weight: 700;
  }

  #hud-bottom {
    bottom: 12px;
    left: 12px;
    right: 12px;
    z-index: 8;
    justify-content: space-between;
  }

  .hud-bottom-left {
    max-width: calc(100vw - 175px);
  }

  .mh-scroll {
    max-width: calc(100vw - 310px);
  }

  .eval-bar-wrap {
    left: 10px;
  }

  .eval-bar-track {
    width: 11px;
    height: min(210px, 34vh);
  }

  .eval-score {
    font-size: 0.56rem;
    padding: 1px 4px;
  }

  #controls-hint {
    display: none;
  }

  .captured-pill {
    font-size: 0.68rem;
    padding: 7px 10px 6px;
    gap: 8px;
  }

  .cap-col {
    min-width: 72px;
  }

  .settings-grid.cols-4,
  .settings-grid.cols-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #checkmate-overlay {
    padding-top: 64px;
  }

  .checkmate-banner {
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: 420px;
    padding: 18px 18px 16px;
  }

  .checkmate-title {
    font-size: 1.65rem;
    letter-spacing: 0.16em;
  }

  .checkmate-subtitle {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
  }

  .checkmate-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .brand-pill {
    padding: 5px 8px;
  }
  .brand-title {
    font-size: 0.62rem;
  }
  .status-pill {
    padding: 5px 8px;
    font-size: 0.64rem;
  }
  .mobile-controls-trigger {
    padding: 5px 9px;
    font-size: 0.66rem;
  }
}
