/* ============================================================
   Trampas de Apertura — estilos
   ============================================================ */

:root {
  --bg: #080b11;
  --bg-soft: #0c111a;
  --card: #121824;
  --card-2: #182131;
  --card-3: #1e293b;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9edf5;
  --muted: #91a0b8;
  --muted-2: #6d7b91;
  --gold: #e7b969;
  --gold-2: #f4d28e;
  --gold-soft: rgba(231, 185, 105, 0.13);
  --teal: #5ad1b6;
  --green: #72d39a;
  --red: #e66a6a;
  --blue: #7aa7ff;
  --board-light: #e9dfc8;
  --board-dark: #6f8f62;
  --radius: 16px;
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.6);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
h1, h2, h3, h4, p { margin: 0; }

::selection { background: rgba(231, 185, 105, 0.3); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; border: 2px solid var(--card); }
::-webkit-scrollbar-track { background: transparent; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(231, 185, 105, 0.11), transparent 60%),
    radial-gradient(900px 700px at 100% 10%, rgba(90, 209, 182, 0.07), transparent 55%),
    radial-gradient(800px 600px at 50% 110%, rgba(122, 167, 255, 0.06), transparent 60%),
    linear-gradient(180deg, #0b0f17 0%, #080b11 60%);
}

.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.only-mobile { display: none; }

/* ----------------------------- topbar ---------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: rgba(8, 11, 17, 0.82);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f4dfae, #d7b271);
  box-shadow: 0 4px 14px rgba(215, 178, 113, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.brand-mark img { width: 27px; height: 27px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-text strong { font-size: 0.98rem; letter-spacing: 0.01em; white-space: nowrap; }
.brand-text small { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.xp-widget { width: 176px; padding: 5px 10px 7px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.xp-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.67rem; color: var(--muted); margin-bottom: 4px; }
.xp-top #rankName { color: var(--gold-2); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.xp-track { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.xp-track i { display: block; height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, #c9974b, var(--gold-2)); transition: width 0.5s ease; box-shadow: 0 0 10px rgba(231, 185, 105, 0.5); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 1rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sound-off { display: none; }
body.muted .sound-on { display: none; }
body.muted .sound-off { display: block; }

.menu-btn { display: none; }

/* ----------------------------- layout ---------------------------- */
.layout {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 22px 56px;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 372px;
  gap: 20px;
  align-items: start;
}

/* ----------------------------- sidebar --------------------------- */
.sidebar {
  position: sticky;
  top: 78px;
  max-height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--card-2), var(--card) 40%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 11px 12px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 9, 14, 0.55);
}
.view-btn {
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.view-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.view-btn.active {
  background: linear-gradient(180deg, #f2cf8f, #d8ac62);
  color: #1c1508;
  box-shadow: 0 2px 8px rgba(231, 185, 105, 0.22);
}

.side-top { padding: 13px 14px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 11px; }
.side-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.side-progress { display: flex; align-items: center; gap: 12px; }
.ring {
  --p: 0;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0);
  transition: background 0.4s;
}
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #131a26; }
.ring span { position: relative; font-size: 0.66rem; font-weight: 800; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.side-progress-text { display: flex; flex-direction: column; line-height: 1.25; }
.side-progress-text strong { font-size: 0.9rem; }
.side-progress-text span { font-size: 0.71rem; color: var(--muted); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 9, 14, 0.55);
  color: var(--muted-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: rgba(231, 185, 105, 0.5); box-shadow: 0 0 0 3px rgba(231, 185, 105, 0.09); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 0.8rem; }
.search input::placeholder { color: var(--muted-2); }
.search input::-webkit-search-cancel-button { filter: invert(0.6); }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #1c1508; }

.side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-row > span { font-size: 0.71rem; }
.pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  transition: all 0.15s;
}
.pill:hover { color: var(--text); border-color: var(--line-strong); }
.pill[aria-pressed="true"] { background: rgba(231, 185, 105, 0.16); border-color: rgba(231, 185, 105, 0.45); color: var(--gold-2); }

.trap-list { flex: 1; overflow-y: auto; padding: 7px; min-height: 120px; }
.trap-group-label { padding: 10px 9px 5px; font-size: 0.61rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.trap-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 9px 9px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.trap-card:hover { background: rgba(255, 255, 255, 0.035); }
.trap-card.active { background: linear-gradient(90deg, rgba(231, 185, 105, 0.14), rgba(231, 185, 105, 0.02)); border-color: rgba(231, 185, 105, 0.26); }
.trap-card.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.trap-num { font-size: 0.65rem; color: var(--muted-2); font-variant-numeric: tabular-nums; text-align: center; }
.trap-main { min-width: 0; }
.trap-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trap-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 0.65rem; color: var(--muted); }
.trap-sub .eco { color: var(--muted-2); letter-spacing: 0.03em; }
.trap-sub .dot { opacity: 0.4; }
.trap-side { display: inline-flex; align-items: center; gap: 3px; }
.trap-side .piece-mini { width: 10px; height: 10px; opacity: 0.8; }
.pips { display: flex; flex-direction: column; gap: 3px; align-items: center; padding-right: 1px; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); position: relative; }
.pip.on.learned { background: var(--blue); box-shadow: 0 0 6px rgba(122, 167, 255, 0.5); }
.pip.on.executed { background: var(--gold); box-shadow: 0 0 6px rgba(231, 185, 105, 0.5); }
.pip.on.survived { background: var(--teal); box-shadow: 0 0 6px rgba(90, 209, 182, 0.5); }
.trap-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 0.78rem; }
.open-count.zero { color: var(--muted-2); border-color: var(--line); background: rgba(255, 255, 255, 0.025); }
.open-count {
  min-width: 34px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 7px;
  border: 1px solid rgba(231, 185, 105, 0.22);
  background: rgba(231, 185, 105, 0.08);
  color: var(--gold-2);
  font-size: 0.65rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.var-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.var-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.var-chip:hover { color: var(--text); border-color: var(--line-strong); }
.var-chip.active { background: var(--gold); border-color: var(--gold); color: #1c1508; }
.var-chip .tick { font-size: 0.62rem; opacity: 0.9; }

.practice-side-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 11px; }
.practice-side-wrap > span { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.practice-side { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(6, 9, 14, 0.5); }
.side-btn {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 650;
}
.side-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.side-btn.active { background: var(--gold); color: #1c1508; }

.quiz-card { margin: 10px 0 12px; padding: 11px 12px; border: 1px solid rgba(230, 106, 106, 0.3); border-radius: 11px; background: rgba(230, 106, 106, 0.07); }
.quiz-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.quiz-label { font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: #f0b3b3; font-weight: 700; }
.quiz-san { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: #ffd0d0; }
.quiz-card p { font-size: 0.73rem; color: var(--muted); line-height: 1.45; }
.quiz-bad { color: #ffb3b3; }

.about-opening { margin: 12px 0; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, 0.025); overflow: hidden; }
.about-opening summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-2);
}
.about-opening summary::-webkit-details-marker { display: none; }
.about-opening summary::after { content: '+'; color: var(--muted); font-size: 0.95rem; line-height: 1; }
.about-opening[open] summary::after { content: '−'; }
.about-opening .about-body { padding: 0 12px 12px; }
.about-opening p { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.about-opening h5 { font-size: 0.62rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--teal); margin: 10px 0 4px; }
.about-opening ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 3px; font-size: 0.73rem; color: #b9c6d8; }
.about-opening .about-key { margin: 8px 0; padding-left: 8px; border-left: 2px solid rgba(90, 209, 182, 0.55); color: #c3d3cf; font-size: 0.74rem; }
.about-opening .about-structure { margin-top: 9px; font-size: 0.69rem; color: var(--muted-2); }

.xp-sep { color: var(--muted-2); margin: 0 2px; }

.side-foot { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 0.63rem; color: var(--muted-2); }
.side-foot b { color: var(--muted); font-weight: 700; }
.side-dots { display: flex; gap: 4px; }
.side-dots i { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }

.scrim { position: fixed; inset: 0; background: rgba(3, 5, 9, 0.62); backdrop-filter: blur(2px); z-index: 55; }
.scrim[hidden] { display: none; }

/* ----------------------------- stage ----------------------------- */
.stage { min-width: 0; scroll-margin-top: 82px; }

.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 4px 2px 12px; }
.stage-title { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.eyebrow .sep { color: var(--muted-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); font-size: 0.62rem; letter-spacing: 0.06em; }
.badge.gold { border-color: rgba(231, 185, 105, 0.4); color: var(--gold-2); background: rgba(231, 185, 105, 0.09); }
.stars { color: var(--gold); font-size: 0.63rem; letter-spacing: 0.1em; opacity: 0.9; }
.stage-title h1 { margin: 7px 0 3px; font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.05rem); font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; }
.stage-title p { font-size: 0.85rem; color: var(--muted); max-width: 60ch; }
.stage-tools { display: flex; gap: 6px; flex: 0 0 auto; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 3px 8px;
  font-size: 0.76rem;
  color: var(--muted);
  transition: color 0.2s;
}
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035); transition: background 0.2s; }
.status-bar.ok { color: #b6e6c9; }
.status-bar.ok .status-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(114, 211, 154, 0.12); }
.status-bar.bad { color: #f0b3b3; }
.status-bar.bad .status-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(230, 106, 106, 0.12); }
.status-bar.gold { color: var(--gold-2); }
.status-bar.gold .status-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(231, 185, 105, 0.12); }
.status-bar.think .status-dot { background: var(--blue); animation: pulse-dot 1.1s ease-in-out infinite; }
.status-bar.warn { color: #f1d29a; }
.status-bar.warn .status-dot { background: #e3a94f; }

.board-shell {
  position: relative;
  width: 100%;
  max-width: min(640px, calc(100dvh - 300px));
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  border: 7px solid #1a2332;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #1a2332;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.board.interactive { cursor: pointer; }
.board.interactive .sq:hover { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.055); }
.board.no-touch { cursor: default; }

.board-squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; overflow: hidden; }
.sq.light { background: linear-gradient(135deg, #efe6d2 0%, #e5d9bd 100%); }
.sq.dark { background: linear-gradient(135deg, #789a6a 0%, #66855a 100%); }

.sq::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.sq.last::before { opacity: 1; background: rgba(240, 196, 90, 0.4); }
.sq.selected::before { opacity: 1; background: rgba(240, 196, 90, 0.55); box-shadow: inset 0 0 0 3px rgba(255, 224, 150, 0.85); }
.sq.check::before { opacity: 1; background: radial-gradient(circle at 50% 50%, rgba(220, 70, 70, 0.9) 0%, rgba(220, 70, 70, 0.35) 55%, rgba(220, 70, 70, 0) 78%); }
.sq.ghost-hover::before { opacity: 1; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.4); }
.sq.flash-bad::after { content: ""; position: absolute; inset: 0; background: rgba(220, 70, 70, 0.35); animation: flash 0.4s ease-out; }
.sq.flash-good::after { content: ""; position: absolute; inset: 0; background: rgba(114, 211, 154, 0.3); animation: flash 0.45s ease-out; }

.sq.legal::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  height: 26%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(18, 26, 18, 0.28);
  animation: dot-in 0.18s ease-out;
}
.sq.legal-capture::after {
  width: 82%;
  height: 82%;
  background: transparent;
  border: 4px solid rgba(18, 26, 18, 0.3);
  border-radius: 50%;
  animation: dot-in 0.18s ease-out;
}

.coord { position: absolute; font-size: clamp(7px, 1.25vw, 10px); font-weight: 700; opacity: 0.65; pointer-events: none; letter-spacing: 0.02em; }
.coord-file { right: 3px; bottom: 1px; }
.coord-rank { left: 3px; top: 1px; }
.sq.light .coord { color: #6d5b38; }
.sq.dark .coord { color: #e7efdf; }

.board-pieces { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.piece {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}
.piece img { width: 90%; height: 90%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); pointer-events: none; -webkit-user-drag: none; }
.piece.slide { animation: slide-in 0.19s ease-out; }
.piece.dragging { opacity: 0.2; }
.board.movable-turn .piece.movable:hover img { transform: scale(1.04); }
.piece.movable img { transition: transform 0.12s; }

.drag-ghost {
  position: fixed;
  z-index: 200;
  width: 11.5%;
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.55));
  opacity: 0.96;
}
.drag-ghost img { width: 100%; height: 100%; }

.board-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.arrow-line { stroke: #f2c65c; stroke-width: 2.6; stroke-linecap: round; opacity: 0.92; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }
.arrow-head { fill: #f2c65c; opacity: 0.95; }
.mark-circle { fill: rgba(242, 198, 92, 0.14); stroke: #f2c65c; stroke-width: 2.6; opacity: 0.9; vector-effect: non-scaling-stroke; }

.promo {
  position: absolute;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(18, 24, 36, 0.97);
  border: 1px solid rgba(231, 185, 105, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.16s ease-out;
}
.promo[hidden] { display: none; }
.promo button { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 8px; background: linear-gradient(145deg, #f2e8d2, #e2d3b5); padding: 3px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.promo button:hover { background: linear-gradient(145deg, #ffe9b8, #ecc97f); border-color: rgba(120, 80, 20, 0.55); transform: translateY(-1px); }
.promo img { width: 40px; height: 40px; }

.result-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 12px;
  background: rgba(5, 8, 13, 0.58);
  backdrop-filter: blur(7px);
  animation: fade-in 0.25s ease-out;
}
.result-layer[hidden] { display: none; }
.result-card {
  width: 100%;
  max-width: 340px;
  padding: 22px 20px 18px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(165deg, #1d2637, #111722 70%);
  border: 1px solid rgba(231, 185, 105, 0.32);
  box-shadow: 0 30px 60px -18px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.result-icon { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; background: radial-gradient(circle at 35% 30%, rgba(231, 185, 105, 0.3), rgba(231, 185, 105, 0.06)); border: 1px solid rgba(231, 185, 105, 0.35); }
.result-card.bad .result-icon { background: radial-gradient(circle at 35% 30%, rgba(230, 106, 106, 0.28), rgba(230, 106, 106, 0.04)); border-color: rgba(230, 106, 106, 0.4); }
.result-card.good .result-icon { background: radial-gradient(circle at 35% 30%, rgba(90, 209, 182, 0.26), rgba(90, 209, 182, 0.04)); border-color: rgba(90, 209, 182, 0.4); }
.result-kicker { font-size: 0.61rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.result-title { margin: 5px 0 7px; font-family: var(--serif); font-size: 1.5rem; line-height: 1.15; }
.result-text { font-size: 0.78rem; color: var(--muted); line-height: 1.55; }
.result-xp { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(231, 185, 105, 0.12); border: 1px solid rgba(231, 185, 105, 0.28); color: var(--gold-2); font-size: 0.7rem; font-weight: 700; }
.result-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 15px; }

.board-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding-top: 14px; }
.ctrl-group { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); }
.ctrl-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.ctrl-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.ctrl-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.ctrl-btn.primary { background: linear-gradient(180deg, rgba(231, 185, 105, 0.95), rgba(206, 158, 70, 0.95)); color: #1b1407; }
.ctrl-btn.primary:hover { filter: brightness(1.06); }
.ctrl-btn.active { background: rgba(231, 185, 105, 0.16); color: var(--gold-2); }
.ctrl-label { padding: 0 5px; font-size: 0.69rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctrl-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 3px; }

.hint-line { display: flex; align-items: flex-start; gap: 8px; margin: 10px auto 0; max-width: 640px; padding: 9px 12px; border-radius: 10px; background: rgba(231, 185, 105, 0.07); border: 1px solid rgba(231, 185, 105, 0.2); color: #e8cf9f; font-size: 0.76rem; animation: fade-in 0.2s; }
.hint-line[hidden] { display: none; }
.hint-line .bulb { flex: 0 0 auto; }

/* ----------------------------- panel ----------------------------- */
.panel {
  position: sticky;
  top: 78px;
  max-height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-2), var(--card) 45%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 7px; border-bottom: 1px solid var(--line); background: rgba(6, 9, 14, 0.35); }
.mode-tabs.two { grid-template-columns: repeat(2, 1fr); }
.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 650;
  transition: all 0.16s;
}
.mode-tab svg { opacity: 0.85; flex: 0 0 auto; }
.mode-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.mode-tab.active { background: linear-gradient(180deg, #f2cf8f, #d8ac62); color: #1c1508; box-shadow: 0 3px 12px rgba(231, 185, 105, 0.22); }
.mode-tab.active svg { opacity: 1; }

.panel-content { padding: 15px; overflow-y: auto; flex: 1; min-height: 0; }
.panel-foot { display: flex; gap: 8px; padding: 11px 15px; border-top: 1px solid var(--line); background: rgba(6, 9, 14, 0.28); }
.panel-foot:empty { display: none; }

.panel-kicker { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.panel-title { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 5px; }
.panel-text { font-size: 0.79rem; color: var(--muted); line-height: 1.55; }

.annotation {
  position: relative;
  padding: 12px 13px 12px 15px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  min-height: 70px;
}
.annotation::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); opacity: 0.75; }
.annotation.bad::before { background: var(--red); }
.annotation.good::before { background: var(--teal); }
.annot-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.annot-move { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--gold-2); }
.annot-badge { font-size: 0.62rem; font-weight: 800; padding: 1px 5px; border-radius: 4px; letter-spacing: 0.04em; }
.annot-badge.best { color: #1c1508; background: var(--gold); }
.annot-badge.trap { color: var(--gold-2); border: 1px solid rgba(231, 185, 105, 0.4); }
.annot-badge.blunder { color: #ffb3b3; background: rgba(230, 106, 106, 0.16); }
.annot-badge.only { color: var(--muted); border: 1px solid var(--line-strong); }
.annot-badge.book { color: var(--muted-2); }
.annot-note { font-size: 0.79rem; color: #c7d0de; line-height: 1.5; }
.annot-turn { font-size: 0.64rem; color: var(--muted-2); margin-left: auto; letter-spacing: 0.06em; text-transform: uppercase; }

.idea { margin-top: 12px; padding: 12px 13px; border-radius: 11px; background: linear-gradient(135deg, rgba(90, 209, 182, 0.075), rgba(90, 209, 182, 0.015)); border: 1px solid rgba(90, 209, 182, 0.16); }
.idea h4 { font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); margin-bottom: 5px; }
.idea p { font-size: 0.78rem; color: #c3d3cf; line-height: 1.5; }

.move-list { margin-top: 4px; }
.move-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.move-list-head span { font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.moves { display: grid; grid-template-columns: 26px 1fr 1fr; row-gap: 1px; font-variant-numeric: tabular-nums; }
.mv-num { display: flex; align-items: center; padding: 3px 0 3px 2px; font-size: 0.67rem; color: var(--muted-2); }
.mv {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 3px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c9d2e0;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.mv:hover { background: rgba(255, 255, 255, 0.06); }
.mv.current { background: rgba(231, 185, 105, 0.18); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(231, 185, 105, 0.3); }
.mv.future { color: var(--muted-2); }
.mv .v { font-size: 0.62rem; font-weight: 800; line-height: 1; }
.mv .v.best { color: var(--gold); }
.mv .v.trap { color: var(--gold); }
.mv .v.blunder { color: var(--red); }
.mv .v.good { color: var(--teal); }
.mv .v.only, .mv .v.book { color: var(--muted-2); }
.mv .mini-piece { width: 12px; height: 12px; opacity: 0.75; }

.progress-dots { display: flex; gap: 5px; flex-wrap: wrap; margin: 10px 0 4px; }
.pdot { height: 4px; flex: 1; min-width: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.pdot.done { background: var(--gold); box-shadow: 0 0 8px rgba(231, 185, 105, 0.35); }
.pdot.now { background: var(--gold-2); animation: pulse-bar 1.2s infinite; }

.mission { padding: 12px 13px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); margin-bottom: 11px; }
.mission-row { display: flex; align-items: center; gap: 9px; }
.mission-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: rgba(231, 185, 105, 0.12); border: 1px solid rgba(231, 185, 105, 0.25); }
.mission-icon img { width: 23px; height: 23px; }
.mission strong { display: block; font-size: 0.8rem; }
.mission small { display: block; font-size: 0.69rem; color: var(--muted); margin-top: 1px; }
.mission .progress-dots { margin-bottom: 0; }

.log { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; max-height: 166px; overflow-y: auto; padding-right: 3px; mask-image: linear-gradient(to bottom, transparent 0, #000 9px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9px); }
.log-row { display: grid; grid-template-columns: 30px 52px 1fr; gap: 6px; align-items: baseline; font-size: 0.72rem; padding: 3px 2px; border-radius: 5px; }
.log-row.you { background: rgba(231, 185, 105, 0.055); }
.log-num { color: var(--muted-2); font-size: 0.64rem; font-variant-numeric: tabular-nums; }
.log-san { font-weight: 700; color: #dbe3ee; }
.log-note { color: var(--muted); font-size: 0.67rem; line-height: 1.35; }

.attempt-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 0.68rem; color: var(--muted); }
.attempt-row .x { color: var(--red); letter-spacing: 0.1em; }
.attempt-row .ok { color: var(--green); }

.finish-card { padding: 13px; border-radius: 11px; border: 1px solid rgba(231, 185, 105, 0.28); background: linear-gradient(140deg, rgba(231, 185, 105, 0.1), rgba(231, 185, 105, 0.02)); margin-top: 12px; }
.finish-card h4 { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.finish-card p { font-size: 0.78rem; color: #d8ccb2; line-height: 1.5; }

.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.seal { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted-2); font-size: 0.66rem; font-weight: 650; }
.seal::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.seal.learned { color: #9db9ee; border-color: rgba(122, 167, 255, 0.25); background: rgba(122, 167, 255, 0.07); }
.seal.executed { color: var(--gold-2); border-color: rgba(231, 185, 105, 0.28); background: rgba(231, 185, 105, 0.07); }
.seal.survived { color: #8fe0cd; border-color: rgba(90, 209, 182, 0.25); background: rgba(90, 209, 182, 0.07); }
.seal.off { opacity: 0.55; filter: grayscale(1); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #f2cf8f, #d8ac62);
  color: #1b1407;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: filter 0.15s, transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: rgba(255, 255, 255, 0.045); border-color: var(--line-strong); color: var(--text); }
.btn.secondary:hover { background: rgba(255, 255, 255, 0.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.035); }
.btn.danger { color: #f0a8a8; }
.btn.danger:hover { border-color: rgba(230, 106, 106, 0.4); background: rgba(230, 106, 106, 0.08); }
.btn.sm { padding: 6px 11px; font-size: 0.72rem; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* ----------------------------- toast ----------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 300;
  transform: translate(-50%, 140%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(231, 185, 105, 0.3);
  background: rgba(20, 27, 39, 0.96);
  color: var(--gold-2);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.25s;
  opacity: 0;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ----------------------------- dialogs --------------------------- */
.dialog {
  width: min(600px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 20px;
  background: linear-gradient(165deg, #1a2231, #10161f 70%);
  color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
  overflow: auto;
}
.dialog::backdrop { background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(5px); }
.dialog-head { position: relative; padding: 22px 24px 0; }
.dialog-kicker { font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.dialog h2 { font-family: var(--serif); font-size: 1.65rem; line-height: 1.15; margin: 5px 0 0; }
.dialog-close { position: absolute; right: 16px; top: 16px; }
.dialog-body { padding: 18px 24px 6px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; flex-wrap: wrap; }
.dialog-foot.center { justify-content: center; }

.how-list { display: flex; flex-direction: column; gap: 13px; }
.how-item { display: flex; gap: 12px; }
.how-icon { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: rgba(231, 185, 105, 0.14); border: 1px solid rgba(231, 185, 105, 0.28); color: var(--gold-2); font-size: 0.75rem; font-weight: 800; }
.how-item strong { font-size: 0.86rem; }
.how-item p { font-size: 0.78rem; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.xp-explain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 8px; padding: 11px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); font-size: 0.72rem; color: var(--muted); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 0.71rem; color: var(--muted); }
.shortcuts span { display: inline-flex; align-items: center; gap: 4px; }
kbd { display: inline-block; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.05); color: var(--text); font-family: var(--font); font-size: 0.65rem; }
.credits { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.69rem; color: var(--muted-2); }

.welcome { text-align: center; padding-bottom: 4px; }
.welcome-mark { width: 72px; height: 72px; margin: 26px auto 14px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, #f4dfae, #d7b271); box-shadow: 0 12px 34px rgba(215, 178, 113, 0.3); }
.welcome-mark img { width: 52px; height: 52px; }
.welcome h2 { font-size: clamp(1.6rem, 5vw, 2.1rem); margin-top: 6px; }
.welcome h2 em { color: var(--gold-2); font-style: italic; }
.welcome-lead { max-width: 44ch; margin: 10px auto 0; padding: 0 24px; font-size: 0.83rem; color: var(--muted); line-height: 1.6; }
.welcome-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 20px 24px 2px; }
.welcome-mode { padding: 13px 8px 11px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.028); display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.mode-glyph { font-size: 1.35rem; color: var(--gold-2); line-height: 1.1; }
.mode-glyph-img { width: 30px; height: 30px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); }
.welcome-mode > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.welcome-mode strong { font-size: 0.78rem; }
.welcome-mode small { font-size: 0.66rem; color: var(--muted); line-height: 1.35; }
.welcome .dialog-foot { padding-top: 20px; }

.noscript { padding: 20px; text-align: center; color: var(--red); }

/* ----------------------------- animation -------------------------- */
@keyframes slide-in { from { transform: translate(calc(var(--dx) * 100%), calc(var(--dy) * 100%)); } }
@keyframes dot-in { from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes pulse-bar { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.93) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----------------------------- responsive ------------------------- */
@media (max-width: 1260px) {
  .layout { grid-template-columns: 264px minmax(0, 1fr); grid-template-areas: "side stage" "side panel"; }
  .sidebar { grid-area: side; }
  .stage { grid-area: stage; }
  .panel { grid-area: panel; position: static; max-height: none; width: 100%; max-width: 720px; margin: 2px auto 0; }
  .panel-content { max-height: none; }
  .board-shell { max-width: min(620px, calc(100dvh - 290px)); }
  .brand-text small { display: none; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); gap: 16px; padding: 16px 14px 48px; }
  .xp-widget { width: 142px; }
  .stage-title p { font-size: 0.8rem; }
  .board-shell { max-width: min(560px, calc(100dvh - 280px)); }
}

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .topbar { padding: 9px 13px; gap: 8px; }
  .brand-text strong { font-size: 0.86rem; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark img { width: 24px; height: 24px; }
  .xp-widget { width: 118px; padding: 4px 8px 6px; }
  .xp-top { font-size: 0.6rem; }
  .xp-top #rankName { display: none; }
  .xp-top { justify-content: flex-end; }

  .layout { display: block; padding: 12px 12px 44px; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 340px);
    max-height: none;
    z-index: 60;
    border-radius: 0 18px 18px 0;
    transform: translateX(-104%);
    transition: transform 0.26s cubic-bezier(0.3, 0.8, 0.3, 1);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .scrim { display: block; }
  .stage { padding-top: 4px; }
  .stage-head { padding-bottom: 8px; }
  .stage-title h1 { font-size: 1.55rem; }
  .stage-title p { font-size: 0.78rem; }
  .board-shell { max-width: min(100%, calc(100dvh - 230px)); margin: 0 auto; }
  .panel { position: static; max-height: none; margin-top: 16px; max-width: none; }
  .panel-content { max-height: none; }
  .mode-tab { font-size: 0.68rem; padding: 8px 2px; gap: 4px; }
  .mode-tab svg { width: 14px; height: 14px; }
  .board { border-width: 5px; }
  .coord { font-size: 8px; }
  .board-controls { padding-top: 12px; }
  .status-bar { font-size: 0.7rem; }
  .result-layer {
    position: fixed;
    inset: 0;
    z-index: 90;
    padding: 18px;
    border-radius: 0;
    background: rgba(4, 7, 12, 0.74);
    backdrop-filter: blur(9px);
  }
  .result-card { max-width: 370px; max-height: calc(100dvh - 36px); overflow-y: auto; }
  .welcome-modes { grid-template-columns: 1fr; gap: 6px; }
  .welcome-mode { flex-direction: row; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; }
  .welcome-mode > div { align-items: flex-start; }
  .mode-glyph-img { width: 24px; height: 24px; }
  .mode-glyph { font-size: 1.1rem; }
  .dialog-foot .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .topbar { padding: 8px 10px; }
  .brand-text { display: none; }
  .xp-widget { width: 108px; }
  .stage-title h1 { font-size: 1.35rem; }
  .board { border-width: 4px; border-radius: 9px; }
  .coord { display: none; }
  .mode-tab { flex-direction: column; gap: 2px; font-size: 0.62rem; }
  .mode-tab svg { width: 16px; height: 16px; }
  .btn { padding: 8px 12px; }
  .result-card { padding: 18px 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
