/* ============================================================
   Chess Coach — Modern Theme ("Tournament Hall at Midnight")
   ------------------------------------------------------------
   Loaded alongside style.css but only active when
   body has class `design-modern`. style.css stays untouched.
   ============================================================ */

/* ----- Design tokens ----- */
body.design-modern {
  --m-ink-900:   #0a0d0e;
  --m-ink-850:   #0e1314;
  --m-ink-800:   #131a1c;
  --m-ink-750:   #1a2326;
  --m-ink-700:   #232e31;
  --m-ink-600:   #2f3c40;
  --m-ink-500:   #4a5a5e;

  --m-bone-50:   #f6efde;
  --m-bone-100:  #ede4cc;
  --m-bone-200:  #d4cab1;
  --m-bone-300:  #a39c87;
  --m-bone-400:  #767060;

  --m-amber-500: #f0b340;
  --m-amber-400: #f5c66a;
  --m-amber-300: #f9d896;
  --m-amber-tint: rgba(240, 179, 64, 0.12);

  --m-coral-500: #ff5a4a;
  --m-coral-400: #ff7a6c;
  --m-coral-300: #ffa094;
  --m-coral-tint: rgba(255, 90, 74, 0.10);
  --m-coral-tint-strong: rgba(255, 90, 74, 0.22);

  --m-mint-500:  #5ddba6;
  --m-mint-400:  #7ee5b8;
  --m-mint-300:  #a5edc9;
  --m-mint-tint: rgba(93, 219, 166, 0.12);

  --m-violet-500: #9d8fff;

  --m-board-light: #ede0c0;
  --m-board-dark:  #4a6650;
  --m-board-edge:  #2a3a32;

  --m-font-display: 'Instrument Serif', 'Times New Roman', serif;
  --m-font-body:    'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --m-font-mono:    'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  --m-s-1: 4px; --m-s-2: 8px; --m-s-3: 12px; --m-s-4: 16px;
  --m-s-5: 20px; --m-s-6: 24px; --m-s-7: 32px; --m-s-8: 40px;
  --m-s-9: 56px; --m-s-10: 72px;

  --m-r-1: 6px; --m-r-2: 10px; --m-r-3: 14px; --m-r-4: 20px; --m-r-pill: 999px;

  --m-elev-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 6px 18px -10px rgba(0,0,0,0.6);
  --m-elev-2: 0 1px 0 rgba(255,255,255,0.05) inset, 0 14px 30px -12px rgba(0,0,0,0.7);
  --m-ring-focus: 0 0 0 2px var(--m-ink-900), 0 0 0 4px var(--m-amber-500);

  /* Atmospheric layer tokens — referenced by ::before / ::after so the
     light theme can re-tune them without overriding the whole rule. */
  --m-atmo-grid:     rgba(255, 255, 255, 0.018);
  --m-atmo-radial-1: rgba(74, 102, 80, 0.22);  /* moss highlight, upper-right */
  --m-atmo-radial-2: rgba(0, 0, 0, 0.5);       /* ink shadow, lower-left */
  --m-grain-opacity: 0.035;
  --m-grain-blend:   overlay;

  --m-ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --m-ease-in-out: cubic-bezier(0.65, 0.05, 0.36, 1);
  --m-dur-fast: 140ms; --m-dur-base: 240ms; --m-dur-slow: 420ms;
}

/* ============================================================
   LIGHT THEME — "Studio at Morning"
   ------------------------------------------------------------
   Same design system, daylight version. Overrides the dark
   tokens with warm-cream surface values and walnut text.
   Activated by adding `theme-light` alongside `design-modern`.

   Token names like --m-ink-900 are retained semantically as
   "the page-background variable" rather than "ink"; in light
   mode they resolve to warm cream. Same for --m-bone-50 = the
   "primary-text" var, which resolves to deep walnut in light.
   This minimum-invasive override avoids refactoring ~1500
   lines of CSS rules; semantic naming can be cleaned up later.
   ============================================================ */
body.design-modern.theme-light {
  /* Surfaces (page → card → elevated, lightest first) */
  --m-ink-900: #faf2dc;   /* page bg base */
  --m-ink-850: #faf2dc;   /* page bg */
  --m-ink-800: #fffaee;   /* card bg */
  --m-ink-750: #fff5e0;   /* elevated bg */
  --m-ink-700: #e8dcbf;   /* subtle border (warm tan) */
  --m-ink-600: #d4c69a;   /* strong border */
  --m-ink-500: #c4b58a;   /* divider */

  /* Text (primary → faint) — same role mapping, light-theme values */
  --m-bone-50:  #1f1810;  /* primary (deep walnut) */
  --m-bone-100: #2f2618;
  --m-bone-200: #4a3f2e;
  --m-bone-300: #8a7d5e;  /* tertiary / labels */
  --m-bone-400: #b3a684;  /* disabled */

  /* Accents — retuned. Amber deepens for contrast on cream;
     coral warms to rust so urgency isn't abrasive on bright bg;
     mint deepens to emerald so the green reads against light. */
  --m-amber-500: #c08214;
  --m-amber-400: #d99820;
  --m-amber-300: #f0b340;
  --m-amber-tint: rgba(192, 130, 20, 0.14);

  --m-coral-500: #c8472e;
  --m-coral-400: #d96047;
  --m-coral-300: #e88572;
  --m-coral-tint: rgba(200, 71, 46, 0.10);
  --m-coral-tint-strong: rgba(200, 71, 46, 0.22);

  --m-mint-500: #2f7d4f;
  --m-mint-400: #45a06a;
  --m-mint-300: #76c596;
  --m-mint-tint: rgba(47, 125, 79, 0.12);

  --m-violet-500: #6c5dd3;

  /* Board palette unchanged — ivory + moss work on both themes */

  /* Shadows shift to warm-soft amber tint + inset white highlight */
  --m-elev-1: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 4px 14px -6px rgba(150, 110, 40, 0.18);
  --m-elev-2: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 12px 28px -10px rgba(150, 110, 40, 0.25);

  /* Atmospheric tokens — amber radial replaces moss; warm-ink shadow
     replaces black shadow; grid lines are walnut on cream; paper
     grain uses multiply instead of overlay so it darkens the cream. */
  --m-atmo-grid:     rgba(74, 60, 30, 0.04);
  --m-atmo-radial-1: rgba(240, 179, 64, 0.18);
  --m-atmo-radial-2: rgba(74, 60, 30, 0.08);
  --m-grain-opacity: 0.05;
  --m-grain-blend:   multiply;

  /* Focus ring inner color shifts from ink-900 (was dark) to cream */
  --m-ring-focus: 0 0 0 2px var(--m-ink-900), 0 0 0 4px var(--m-amber-500);
}

/* ----- Modern/Classic toggling ----- */
/* The settings FAB is always visible (in both modes) so the user can find
   the toggle from either side. Everything else is gated. */

/* Hide modern UI when not in modern mode */
body:not(.design-modern) .m-only { display: none !important; }

/* Hide classic UI when in modern mode */
body.design-modern .navbar,
body.design-modern main {
  display: none;
}

body.design-modern {
  font-family: var(--m-font-body);
  background: var(--m-ink-850);
  color: var(--m-bone-50);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--m-dur-base) var(--m-ease-in-out),
              color var(--m-dur-base) var(--m-ease-in-out);
}

/* Atmospheric chess-grid texture + radial lights behind everything.
   Colors come from atmosphere tokens so the light theme can re-tune
   them without redeclaring the whole rule. */
body.design-modern::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--m-atmo-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--m-atmo-grid) 1px, transparent 1px),
    radial-gradient(ellipse 80% 60% at 75% 5%, var(--m-atmo-radial-1), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 95%, var(--m-atmo-radial-2), transparent 65%);
  background-size: 80px 80px, 80px 80px, auto, auto;
}

body.design-modern::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--m-grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.9'/></svg>");
  mix-blend-mode: var(--m-grain-blend);
}

.m-page {
  position: relative; z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--m-s-7) var(--m-s-7) var(--m-s-10);
}

/* ----- Typography ----- */
.m-display, .m-page h1, .m-page h2, .m-page h3 {
  font-family: var(--m-font-display);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.02;
  margin: 0;
}
.m-page h1 { font-size: clamp(40px, 5.4vw, 64px); }
.m-page h2 { font-size: clamp(28px, 3.4vw, 38px); }
.m-page h3 { font-size: 22px; }

.m-label {
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m-bone-300);
  font-weight: 500;
}

.m-mono { font-family: var(--m-font-mono); font-variant-numeric: tabular-nums; }

.m-lead-quote {
  font-family: var(--m-font-display);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--m-bone-50);
}
.m-lead-quote em { font-style: italic; color: var(--m-bone-100); }
.m-lead-quote .struck {
  position: relative;
  font-style: italic;
  color: var(--m-coral-300);
}
.m-lead-quote .struck::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%;
  top: 56%;
  height: 2px;
  background: var(--m-coral-500);
  transform: rotate(-2deg);
  transform-origin: left center;
}

/* ----- Top bar ----- */
.m-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--m-s-4) var(--m-s-5);
  padding-bottom: var(--m-s-5);
  border-bottom: 1px solid var(--m-ink-700);
}

.m-brand {
  display: inline-flex; align-items: center; gap: var(--m-s-3);
  text-decoration: none; color: var(--m-bone-50);
  cursor: pointer;
}
.m-brand-mark {
  width: 30px; height: 30px;
  position: relative;
  background:
    conic-gradient(from 45deg,
      var(--m-amber-500) 0deg 90deg,
      var(--m-ink-800) 90deg 180deg,
      var(--m-amber-500) 180deg 270deg,
      var(--m-ink-800) 270deg 360deg);
  border-radius: var(--m-r-1);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.4),
    0 0 0 1px var(--m-ink-700),
    0 6px 14px -6px rgba(240, 179, 64, 0.35);
}
.m-brand-mark::after {
  content: ""; position: absolute; inset: 30%;
  background: var(--m-bone-50); border-radius: 50%; opacity: 0.85;
}
.m-brand-word {
  font-family: var(--m-font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
}

.m-nav-pills { display: inline-flex; align-items: center; gap: var(--m-s-1); margin-left: var(--m-s-4); }
.m-pill-nav {
  font-family: var(--m-font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--m-bone-300);
  padding: 7px 12px;
  border-radius: var(--m-r-pill);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color var(--m-dur-fast) var(--m-ease-out),
              background var(--m-dur-fast) var(--m-ease-out);
}
.m-pill-nav:hover { color: var(--m-bone-50); background: rgba(255,255,255,0.03); }
.m-pill-nav.active {
  color: var(--m-ink-900);
  background: var(--m-amber-500);
  border-color: var(--m-amber-400);
  box-shadow: 0 0 0 4px var(--m-amber-tint), 0 6px 14px -8px rgba(240, 179, 64, 0.6);
}
.m-pill-nav[disabled],
.m-pill-nav.is-soon {
  cursor: not-allowed;
  opacity: 0.55;
}
.m-pill-nav:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }

.m-streak {
  margin-left: auto;
  display: inline-flex; align-items: stretch; gap: 18px;
  padding: 14px 20px 14px 16px;
  background: linear-gradient(180deg, var(--m-ink-750), var(--m-ink-800));
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-3);
  box-shadow: var(--m-elev-1);
  position: relative;
}
.m-streak::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--m-coral-500), var(--m-amber-500));
  border-radius: var(--m-r-3) 0 0 var(--m-r-3);
}

/* At-risk state — streak is alive (user solved yesterday) but no solve today
   yet. Coral gradient on the side stripe + ticker label so the user notices
   the countdown matters. The pulse is slow so it reads as "urgency", not
   "alarm". */
.m-streak.is-at-risk::before {
  background: linear-gradient(180deg, var(--m-coral-500), var(--m-coral-400));
  animation: m-streak-at-risk-pulse 2.6s var(--m-ease-in-out) infinite;
}
@keyframes m-streak-at-risk-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
.m-streak.is-at-risk .m-streak-end .m-streak-label {
  color: var(--m-coral-400);
}
.m-streak.is-at-risk .m-streak-ticker {
  color: var(--m-coral-300);
}
.m-streak.is-at-risk .m-fire {
  filter: drop-shadow(0 0 8px rgba(255, 90, 74, 0.55));
}
.m-streak .m-fire {
  font-size: 34px;
  line-height: 1;
  align-self: center;
  filter: drop-shadow(0 0 10px rgba(255, 90, 74, 0.45));
  animation: m-fire-flicker 2.4s var(--m-ease-in-out) infinite;
  transform-origin: 50% 60%;
}
@keyframes m-fire-flicker {
  0%, 100% { transform: scale(1)    translateY(0);    filter: drop-shadow(0 0 10px rgba(255, 90, 74, 0.45)); }
  35%      { transform: scale(1.04) translateY(-1px); filter: drop-shadow(0 0 14px rgba(255, 90, 74, 0.55)); }
  70%      { transform: scale(0.98) translateY(0);    filter: drop-shadow(0 0 7px  rgba(255, 90, 74, 0.35)); }
}

.m-streak-meta {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; justify-content: center;
}
.m-streak-row { display: flex; align-items: baseline; gap: var(--m-s-3); }
.m-streak-num {
  font-family: var(--m-font-mono); font-weight: 700; font-size: 40px; line-height: 1;
  color: var(--m-bone-50); letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.m-streak-label {
  font-family: var(--m-font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--m-bone-300);
}
.m-streak-progress {
  position: relative;
  height: 6px; width: 140px;
  background: var(--m-ink-700);
  border-radius: var(--m-r-pill); overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.18);
}
.m-streak-progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--m-amber-500), var(--m-mint-500));
  border-radius: var(--m-r-pill);
  transition: width var(--m-dur-slow) var(--m-ease-out);
  position: relative;
}
/* "Almost there" shimmer — kicks in at ≥80% of daily goal as a reward cue */
.m-streak-progress > i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.35) 50%,
    transparent 100%);
  opacity: 0;
  animation: m-progress-shimmer 2.2s var(--m-ease-out) infinite;
}
.m-streak.almost-there .m-streak-progress > i::after { opacity: 1; }
@keyframes m-progress-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.m-streak-divider {
  width: 1px; align-self: stretch;
  background: var(--m-ink-600);
  opacity: 0.5;
}
.m-streak-end {
  display: flex; flex-direction: column; gap: 4px;
  justify-content: center; min-width: 130px;
}
.m-streak-end .m-streak-label { color: var(--m-amber-400); }
.m-streak-ticker {
  font-family: var(--m-font-mono); font-weight: 600; font-size: 22px;
  line-height: 1.1;
  color: var(--m-bone-50); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

/* Avatar / auth slot */
.m-auth-slot { display: inline-flex; align-items: center; gap: 10px; }
.m-auth-slot img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--m-ink-700); }
.m-auth-slot .m-auth-name { font-size: 13px; color: var(--m-bone-200); }
.m-signin-btn {
  font-family: var(--m-font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--m-ink-750); color: var(--m-bone-100);
  border: 1px solid var(--m-ink-700); border-radius: var(--m-r-pill);
  padding: 8px 14px; cursor: pointer;
}
.m-signin-btn:hover { background: var(--m-ink-700); color: var(--m-bone-50); }

.m-cog {
  width: 34px; height: 34px;
  border: 1px solid var(--m-ink-700);
  background: var(--m-ink-800);
  border-radius: var(--m-r-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--m-bone-200); cursor: pointer;
  transition: background var(--m-dur-fast) var(--m-ease-out), color var(--m-dur-fast) var(--m-ease-out);
}
.m-cog:hover { background: var(--m-ink-750); color: var(--m-bone-50); }
.m-cog:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }

/* ----- Coach hero ----- */
.m-hero {
  position: relative;
  margin-top: var(--m-s-7);
  padding: var(--m-s-7);
  background:
    radial-gradient(ellipse 60% 100% at 0% 50%, var(--m-coral-tint), transparent 60%),
    linear-gradient(180deg, var(--m-ink-800), var(--m-ink-750));
  border: 1px solid var(--m-ink-700);
  border-left: 3px solid var(--m-coral-500);
  border-radius: var(--m-r-3);
  box-shadow: var(--m-elev-2);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--m-s-6);
  overflow: hidden;
}
.m-hero::after {
  content: ""; position: absolute;
  right: -10%; bottom: -40%;
  width: 50%; aspect-ratio: 1/1;
  background: radial-gradient(circle, rgba(74, 102, 80, 0.22), transparent 60%);
  pointer-events: none;
}

.m-coach-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--m-amber-400), var(--m-amber-500) 60%, #b3801f 100%);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow:
    inset 0 -10px 22px -10px rgba(0,0,0,0.45),
    0 0 0 1px var(--m-ink-700),
    0 0 0 8px rgba(240, 179, 64, 0.08);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; position: relative; flex-shrink: 0;
}
.m-coach-avatar::after {
  content: ""; position: absolute; inset: -10px;
  border: 1px solid rgba(240, 179, 64, 0.35);
  border-radius: 50%;
  animation: m-breathe 3.4s var(--m-ease-in-out) infinite;
}
@keyframes m-breathe {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%      { transform: scale(1.08); opacity: 0; }
}

.m-hero-body { min-width: 0; }
.m-hero-cue-row { display: inline-flex; align-items: center; gap: var(--m-s-3); margin-bottom: var(--m-s-4); }
.m-hero-cue { color: var(--m-coral-400); font-weight: 600; }

.m-live-dot {
  display: inline-flex; align-items: center; gap: var(--m-s-2);
  padding: 3px 9px 3px 7px;
  background: var(--m-coral-tint-strong);
  border: 1px solid rgba(255, 90, 74, 0.35);
  border-radius: var(--m-r-pill);
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--m-coral-300);
  text-transform: uppercase;
}
.m-live-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--m-coral-500);
  box-shadow: 0 0 0 0 rgba(255, 90, 74, 0.7);
  animation: m-pulse 1.6s var(--m-ease-out) infinite;
}
@keyframes m-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(255, 90, 74, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 90, 74, 0); }
  100% { box-shadow: 0 0 0 0    rgba(255, 90, 74, 0); }
}

.m-hero-cta-row { margin-top: var(--m-s-6); display: flex; align-items: center; gap: var(--m-s-5); flex-wrap: wrap; }

.m-btn {
  font-family: var(--m-font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  padding: 12px 22px;
  border-radius: var(--m-r-2);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--m-s-2);
  transition: transform var(--m-dur-fast) var(--m-ease-out),
              background var(--m-dur-fast) var(--m-ease-out),
              box-shadow var(--m-dur-fast) var(--m-ease-out);
  white-space: nowrap;
}
.m-btn:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }
.m-btn:active { transform: translateY(1px); }
.m-btn-primary {
  background: var(--m-amber-500);
  color: var(--m-ink-900);
  border-color: var(--m-amber-400);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 10px 28px -12px rgba(240, 179, 64, 0.55);
}
.m-btn-primary:hover {
  background: var(--m-amber-400);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 14px 32px -10px rgba(240, 179, 64, 0.7),
    0 0 0 6px var(--m-amber-tint);
}
.m-btn-ghost { background: transparent; color: var(--m-bone-200); border-color: var(--m-ink-700); }
.m-btn-ghost:hover { background: var(--m-ink-800); color: var(--m-bone-50); }
.m-btn-big { font-size: 17px; padding: 14px 26px; }
.m-cta-aside { color: var(--m-bone-300); font-size: 14px; }

.m-stamp {
  position: absolute;
  top: var(--m-s-5); right: var(--m-s-5);
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--m-coral-400);
  border: 1px solid var(--m-coral-500);
  padding: 5px 9px;
  border-radius: var(--m-r-1);
  background: var(--m-coral-tint);
  transform: rotate(2deg);
  z-index: 2;
}

/* ----- Cards / puzzle row ----- */
.m-puzzle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--m-s-5);
  margin-top: var(--m-s-6);
}
@media (max-width: 880px) { .m-puzzle-row { grid-template-columns: 1fr; } }

.m-card {
  background: var(--m-ink-800);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-3);
  box-shadow: var(--m-elev-1);
  padding: var(--m-s-5);
  position: relative;
}
.m-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--m-s-3); margin-bottom: var(--m-s-4);
}
.m-card-head .m-label { color: var(--m-bone-300); }

.m-opp-line {
  font-family: var(--m-font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--m-bone-100);
}
.m-opp-line .m-opp { color: var(--m-coral-400); }

.m-move-pill {
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--m-r-pill);
  background: var(--m-ink-750);
  border: 1px solid var(--m-ink-700);
  color: var(--m-bone-200);
}

/* Modern chess board */
.m-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  /* Explicit rows so ranks with no pieces don't collapse — auto rows would
     size to content, and an empty rank (common in endgames) has no piece
     glyph to back its min-height. */
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1/1;
  border-radius: var(--m-r-2);
  overflow: hidden;
  border: 1px solid var(--m-board-edge);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 20px 40px -22px rgba(0,0,0,0.7);
  position: relative;
}
.m-sq {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Arial Unicode MS', 'Apple Symbols', 'Segoe UI Symbol', system-ui, sans-serif;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
  user-select: none;
}
.m-sq.light { background: var(--m-board-light); }
.m-sq.dark  { background: var(--m-board-dark); }

.m-sq .m-piece {
  position: relative;
  transition: transform var(--m-dur-fast) var(--m-ease-out), color var(--m-dur-fast) var(--m-ease-out);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
  line-height: 1;
}
/* White pieces: boxwood-ivory fill, NEON ORANGE outline + layered glow */
.m-sq .m-piece.white {
  color: #f5e9c8;
  -webkit-text-stroke: 1px #ff6a00;
  text-stroke: 1px #ff6a00;
  text-shadow:
    0 0 1px #ff6a00,
    0 0 4px rgba(255, 106, 0, 0.75),
    0 0 12px rgba(255, 140, 30, 0.5),
    0 0 22px rgba(255, 165, 60, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.55);
}
/* Black pieces: pure black fill, NEON BLUE outline (thin) */
.m-sq .m-piece.black {
  color: #000000;
  -webkit-text-stroke: 0.8px #00e0ff;
  text-stroke: 0.8px #00e0ff;
  text-shadow:
    0 0 1px #00e0ff,
    0 0 5px rgba(0, 224, 255, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.55);
}
.m-sq.hl-from .m-piece {
  filter: drop-shadow(0 0 8px rgba(255, 90, 74, 0.55)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
  animation: m-piece-attention 2.4s var(--m-ease-in-out) infinite;
}
@keyframes m-piece-attention {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1px); }
}

.m-sq.hl-from::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255, 90, 74, 0.32);
  box-shadow: inset 0 0 0 2px var(--m-coral-500);
  pointer-events: none;
}
.m-sq.hl-target::before {
  content: ""; position: absolute; inset: 22%;
  border-radius: 50%;
  border: 3px solid var(--m-mint-500);
  box-shadow: 0 0 18px 0 rgba(93, 219, 166, 0.45);
  pointer-events: none;
  animation: m-target-pulse 2.2s var(--m-ease-in-out) infinite;
}
@keyframes m-target-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.06); opacity: 0.75; }
}

.m-sq .m-coord {
  position: absolute;
  font-family: var(--m-font-mono);
  font-size: 9px;
  opacity: 0.55;
  pointer-events: none;
}
.m-sq .m-coord.rank { top: 3px; left: 4px; }
.m-sq .m-coord.file { bottom: 2px; right: 4px; }
.m-sq.light .m-coord { color: #6b6450; }
.m-sq.dark  .m-coord { color: #d6ccb0; }

.m-board-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--m-s-3); margin-top: var(--m-s-4);
  font-family: var(--m-font-mono); font-size: 12px; color: var(--m-bone-300);
}
.m-board-foot .m-played {
  text-decoration: line-through;
  text-decoration-color: var(--m-coral-500);
  text-decoration-thickness: 2px;
  color: var(--m-bone-200);
}
.m-board-foot .m-hint { color: var(--m-amber-400); cursor: pointer; }
.m-board-foot .m-hint:hover { color: var(--m-amber-300); }
.m-board-foot .m-hint.is-used {
  color: var(--m-bone-300);
  cursor: default;
  font-style: italic;
}
.m-board-foot .m-hint.is-used:hover { color: var(--m-bone-300); }

/* ----- Choices ----- */
.m-puzzle-info { display: flex; flex-direction: column; gap: var(--m-s-4); }
.m-puzzle-question {
  font-family: var(--m-font-display);
  font-size: clamp(24px, 2.8vw, 30px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--m-bone-50);
}
.m-puzzle-question em { font-style: italic; color: var(--m-bone-100); }

.m-choices { display: flex; flex-direction: column; gap: var(--m-s-2); margin-top: var(--m-s-1); }

.m-choice {
  display: grid;
  grid-template-columns: 32px 78px 1fr;
  align-items: center;
  gap: var(--m-s-3);
  padding: 12px 14px;
  background: var(--m-ink-750);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-2);
  cursor: pointer;
  transition: transform var(--m-dur-fast) var(--m-ease-out),
              background var(--m-dur-fast) var(--m-ease-out),
              border-color var(--m-dur-fast) var(--m-ease-out),
              box-shadow var(--m-dur-fast) var(--m-ease-out);
  text-align: left;
  color: inherit;
  font: inherit;
}
.m-choice:hover {
  transform: translateX(2px);
  background: var(--m-ink-800);
  border-color: var(--m-ink-600);
}
.m-choice:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }
.m-choice-key {
  width: 30px; height: 30px;
  border: 1px solid var(--m-ink-600);
  background: var(--m-ink-800);
  color: var(--m-bone-200);
  border-radius: var(--m-r-1);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--m-font-mono); font-size: 12px; font-weight: 700;
}
.m-choice-move {
  font-family: var(--m-font-mono); font-size: 16px; font-weight: 600;
  color: var(--m-bone-50); letter-spacing: -0.01em;
}
.m-choice-why {
  color: var(--m-bone-300);
  font-size: 14px; line-height: 1.4;
}
.m-choice.selected {
  background: var(--m-ink-800);
  border-color: var(--m-amber-500);
  box-shadow: 0 0 0 4px var(--m-amber-tint);
}
.m-choice.is-correct {
  background: var(--m-mint-tint);
  border-color: var(--m-mint-500);
}
.m-choice.is-correct .m-choice-move { color: var(--m-mint-400); }
.m-choice.is-bad {
  background: var(--m-coral-tint);
  border-color: rgba(255, 90, 74, 0.45);
}
.m-choice.is-bad .m-choice-move { color: var(--m-coral-400); }
.m-choice.shake { animation: m-shake 280ms cubic-bezier(.36,.07,.19,.97); }
.m-choice.is-locked {
  cursor: default;
  transform: none !important;
}
.m-choice.is-locked:hover {
  transform: none;
  background: var(--m-ink-750);
  border-color: var(--m-ink-700);
}
.m-choice.is-locked.is-correct:hover {
  background: var(--m-mint-tint);
  border-color: var(--m-mint-500);
}
.m-choice.is-locked.is-bad:hover {
  background: var(--m-coral-tint);
  border-color: rgba(255, 90, 74, 0.45);
}

.m-coach-line {
  display: flex;
  align-items: flex-start;
  gap: var(--m-s-2);
  margin-top: var(--m-s-2);
  padding: 10px 14px;
  border-radius: var(--m-r-2);
  border: 1px solid var(--m-ink-700);
  background: var(--m-ink-750);
  font-family: var(--m-font-display);
  font-size: 18px;
  font-style: italic;
  line-height: 1.3;
  color: var(--m-bone-100);
  animation: m-revealUp var(--m-dur-base) var(--m-ease-out) both;
}
.m-coach-line .m-coach-line-icon {
  font-style: normal;
  font-family: var(--m-font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.m-coach-line--win {
  border-color: var(--m-mint-500);
  background: var(--m-mint-tint);
  color: var(--m-mint-300);
}
.m-coach-line--win .m-coach-line-icon { color: var(--m-mint-500); }
.m-coach-line--fail {
  border-color: rgba(255, 90, 74, 0.45);
  background: var(--m-coral-tint);
  color: var(--m-coral-300);
}
.m-coach-line--fail .m-coach-line-icon { color: var(--m-coral-500); }

.m-coach-line .m-coach-line-text { flex: 1; min-width: 0; }

/* Next leak CTA — anchors to the right edge of the coach-line, fades in
   slightly after the line itself so the eye lands on the explanation first. */
.m-next-leak {
  flex-shrink: 0;
  margin-left: var(--m-s-3);
  font-family: var(--m-font-body);
  font-weight: 600;
  font-size: 14px;
  font-style: normal;
  letter-spacing: -0.005em;
  padding: 7px 14px;
  border-radius: var(--m-r-pill);
  border: 1px solid var(--m-amber-500);
  background: transparent;
  color: var(--m-amber-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background var(--m-dur-fast) var(--m-ease-out),
              color var(--m-dur-fast) var(--m-ease-out),
              box-shadow var(--m-dur-fast) var(--m-ease-out);
  opacity: 0;
  transform: translateX(6px);
  animation: m-next-leak-in var(--m-dur-base) var(--m-ease-out) 280ms forwards;
}
.m-next-leak:hover {
  background: var(--m-amber-500);
  color: var(--m-ink-900);
  box-shadow: 0 0 0 4px var(--m-amber-tint);
}
.m-next-leak:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }
.m-next-leak .m-next-leak-arrow {
  font-family: var(--m-font-mono);
  font-size: 14px;
  line-height: 1;
  transition: transform var(--m-dur-fast) var(--m-ease-out);
}
.m-next-leak:hover .m-next-leak-arrow { transform: translateX(2px); }
@keyframes m-next-leak-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes m-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.m-choices-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--m-s-3); margin-top: var(--m-s-1);
  font-family: var(--m-font-mono); font-size: 11px;
  color: var(--m-bone-300); letter-spacing: 0.08em;
}
.m-choices-foot kbd {
  font-family: var(--m-font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--m-ink-600);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--m-ink-800);
  color: var(--m-bone-100);
  margin: 0 1px;
}

/* ----- Heatmap ----- */
.m-heat-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--m-s-3);
  margin-top: var(--m-s-9);
  margin-bottom: var(--m-s-4);
}
.m-heat-head .m-label { color: var(--m-bone-300); }
.m-heat-head h3 { color: var(--m-bone-50); font-family: var(--m-font-display); font-size: 26px; }
.m-heat-head h3 em { font-style: italic; color: var(--m-coral-300); }

.m-heat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--m-s-3);
}
@media (max-width: 720px) { .m-heat-row { grid-template-columns: repeat(2, 1fr); } }

.m-heat-card {
  --m-leak: 0.9;
  background: var(--m-ink-800);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-3);
  padding: var(--m-s-4);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--m-dur-fast) var(--m-ease-out),
              border-color var(--m-dur-fast) var(--m-ease-out);
}
.m-heat-card:hover { transform: translateY(-2px); border-color: var(--m-ink-600); }
.m-heat-card::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0; width: 3px;
  background: color-mix(in oklab, var(--m-coral-500) calc(var(--m-leak) * 100%), var(--m-bone-400));
}
.m-heat-card[data-leak="3"] { --m-leak: 1.0; }
.m-heat-card[data-leak="2"] { --m-leak: 0.6; }
.m-heat-card[data-leak="1"] { --m-leak: 0.3; }
.m-heat-card[data-leak="0"] {
  border: 1px dashed var(--m-ink-600);
  background: transparent;
}
.m-heat-card[data-leak="0"]::before { display: none; }

/* Drill mode states on the heatmap row */
.m-heat-card.is-active-drill {
  border-color: var(--m-amber-500);
  box-shadow: 0 0 0 1px var(--m-amber-500), 0 14px 28px -16px var(--m-amber-tint);
  cursor: default;
  /* Critical: pointer-events stop clicks on the active card from
     re-running startDrill and wiping drill.completed back to 0. */
  pointer-events: none;
}
.m-heat-card.is-active-drill:hover { transform: none; }
.m-heat-card.is-drill-locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.m-heat-card.is-drill-locked:hover { transform: none; border-color: var(--m-ink-700); }

.m-heat-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--m-font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m-amber-500);
  background: var(--m-amber-tint);
  border: 1px solid var(--m-amber-500);
  padding: 3px 7px;
  border-radius: var(--m-r-pill);
  font-weight: 600;
}

.m-heat-title {
  font-family: var(--m-font-display);
  font-size: 22px; line-height: 1.1;
  color: var(--m-bone-50);
}
.m-heat-title em { font-style: italic; }
.m-heat-meta {
  font-family: var(--m-font-mono); font-size: 11px;
  color: var(--m-bone-300); letter-spacing: 0.04em;
  margin-top: 6px;
}
.m-heat-cta {
  margin-top: var(--m-s-3); font-size: 13px;
  color: var(--m-bone-100);
  display: inline-flex; align-items: center; gap: 6px;
}
.m-heat-cta strong { color: var(--m-amber-400); font-weight: 600; }
.m-heat-card:hover .m-heat-cta strong { color: var(--m-amber-300); }

.m-heat-bar {
  height: 4px; background: var(--m-ink-700);
  border-radius: var(--m-r-pill);
  margin-top: var(--m-s-4); overflow: hidden;
}
.m-heat-bar > i {
  display: block; height: 100%;
  width: calc(var(--m-leak) * 100%);
  background: linear-gradient(90deg, var(--m-coral-500), var(--m-amber-500));
  border-radius: var(--m-r-pill);
  transition: width var(--m-dur-slow) var(--m-ease-out);
}

/* ----- Empty state — search before any player loaded ----- */
.m-empty {
  margin-top: var(--m-s-9);
  padding: var(--m-s-9) var(--m-s-7);
  background: linear-gradient(180deg, var(--m-ink-800), var(--m-ink-750));
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-4);
  box-shadow: var(--m-elev-2);
  text-align: center;
  max-width: 760px; margin-left: auto; margin-right: auto;
}
.m-empty h2 {
  font-family: var(--m-font-display);
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  margin-bottom: var(--m-s-3);
}
.m-empty h2 em { font-style: italic; color: var(--m-amber-400); }
.m-empty p { color: var(--m-bone-200); font-size: 16px; max-width: 52ch; margin: 0 auto var(--m-s-6); }
.m-empty-search {
  display: flex; gap: var(--m-s-2);
  max-width: 480px;
  margin: 0 auto;
}
.m-input {
  flex: 1; min-width: 0;
  font-family: var(--m-font-body);
  font-size: 15px;
  padding: 13px 16px;
  background: var(--m-ink-900);
  color: var(--m-bone-50);
  border: 1px solid var(--m-ink-600);
  border-radius: var(--m-r-2);
  transition: border-color var(--m-dur-fast) var(--m-ease-out), box-shadow var(--m-dur-fast) var(--m-ease-out);
}
.m-input:focus { outline: none; border-color: var(--m-amber-500); box-shadow: 0 0 0 4px var(--m-amber-tint); }

/* ----- Loading state (when search in flight) ----- */
.m-loading { margin-top: var(--m-s-6); display: inline-flex; align-items: center; gap: var(--m-s-3); color: var(--m-bone-200); font-size: 14px; }
.m-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--m-ink-600);
  border-top-color: var(--m-amber-500);
  border-radius: 50%;
  animation: m-spin 720ms linear infinite;
}
.m-spin-icon {
  display: inline-block;
  animation: m-spin 900ms linear infinite;
  transform-origin: center;
}
@keyframes m-spin { to { transform: rotate(360deg); } }

/* ----- Skeleton/ghost cards (shown while autoQuickScan streams analyses) ----- */
.m-skeleton-status {
  margin-top: var(--m-s-6);
  text-align: center;
}
.m-skeleton-status-line {
  font-family: var(--m-font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.2;
  color: var(--m-bone-100);
  max-width: 56ch;
  margin: 0 auto;
}
.m-skeleton-status-line em { font-style: italic; color: var(--m-amber-400); }

.m-skeleton-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--m-s-5);
  margin-top: var(--m-s-5);
}
@media (max-width: 880px) {
  .m-skeleton-row { grid-template-columns: 1fr; }
}

.m-skeleton-card {
  background: var(--m-ink-800);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-3);
  padding: var(--m-s-5);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--m-s-3);
}

/* Generic ghost block — pulse animation on a subtle bg */
.m-skel {
  background: linear-gradient(90deg,
    var(--m-ink-700) 0%,
    var(--m-ink-600) 50%,
    var(--m-ink-700) 100%);
  background-size: 200% 100%;
  border-radius: var(--m-r-1);
  animation: m-skel-shimmer 1800ms var(--m-ease-in-out) infinite;
}
@keyframes m-skel-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.m-skel-head    { height: 22px; width: 60%; }
.m-skel-board   { aspect-ratio: 1/1; width: 100%; border-radius: var(--m-r-2); }
.m-skel-foot    { height: 14px; width: 80%; }
.m-skel-label   { height: 10px; width: 35%; }
.m-skel-question{ height: 28px; width: 90%; }
.m-skel-choice  { height: 54px; width: 100%; }

/* ----- Error banner ----- */
.m-error {
  margin-top: var(--m-s-4);
  padding: 12px 16px;
  border: 1px solid rgba(255, 90, 74, 0.4);
  background: var(--m-coral-tint);
  color: var(--m-coral-300);
  border-radius: var(--m-r-2);
  font-size: 14px;
}

/* ----- Reveal choreography ----- */
.m-reveal { opacity: 0; transform: translateY(6px); animation: m-revealUp var(--m-dur-slow) var(--m-ease-out) forwards; }
.m-reveal[data-d="0"] { animation-delay: 0ms; }
.m-reveal[data-d="1"] { animation-delay: 80ms; }
.m-reveal[data-d="2"] { animation-delay: 180ms; }
.m-reveal[data-d="3"] { animation-delay: 300ms; }
.m-reveal[data-d="4"] { animation-delay: 420ms; }
@keyframes m-revealUp { to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   Settings drawer & FAB — visible in BOTH design modes so the
   toggle is always reachable. Styling lives here; classic
   style.css remains untouched. Note the high z-index so it
   sits above classic UI.
   ============================================================ */
.cc-settings-fab {
  position: fixed; right: 18px; bottom: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center; gap: 6px;
  padding: 9px 14px 9px 12px;
  background: rgba(26, 35, 38, 0.96);
  color: #ede4cc;
  border: 1px solid #232e31;
  border-radius: 999px;
  font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 30px -12px rgba(0,0,0,0.7);
}
.cc-settings-fab:hover { background: rgba(35, 46, 49, 0.98); color: #f6efde; }

.cc-settings-drawer {
  position: fixed; right: 18px; bottom: 64px;
  z-index: 1000;
  width: 300px;
  max-width: calc(100vw - 36px);
  background: #131a1c;
  border: 1px solid #232e31;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,0.8);
  display: none;
  color: #ede4cc;
  font-family: 'Bricolage Grotesque', -apple-system, system-ui, sans-serif;
}
.cc-settings-drawer.open { display: block; }
.cc-settings-drawer h4 {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 16px;
  color: #f6efde;
  letter-spacing: -0.005em;
}
.cc-set-row {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cc-set-row > .cc-set-label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a39c87;
}
.cc-set-row > .cc-set-help {
  font-size: 12px;
  color: #a39c87;
  line-height: 1.4;
}
.cc-seg {
  display: inline-flex;
  border: 1px solid #2f3c40;
  border-radius: 999px;
  overflow: hidden;
  background: #1a2326;
  width: max-content;
}
.cc-seg button {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: #d4cab1;
  cursor: pointer;
}
.cc-seg button.on {
  background: #f0b340;
  color: #0a0d0e;
  font-weight: 600;
}

.cc-reset-btn {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: 1px solid #ff5a4a;
  background: transparent;
  color: #ff7a6c;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  width: max-content;
  transition: background 140ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cc-reset-btn:hover {
  background: rgba(255, 90, 74, 0.12);
  color: #ff5a4a;
}
.cc-reset-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #131a1c, 0 0 0 4px #ff5a4a;
}

/* ============================================================
   REPORT VIEW
   ============================================================ */

.m-report-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--m-s-4);
  margin-top: var(--m-s-7);
  margin-bottom: var(--m-s-5);
}
.m-report-meta {
  font-family: var(--m-font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--m-bone-300);
}
.m-report-meta em {
  font-style: normal;
  color: var(--m-amber-400);
  font-weight: 600;
}

.m-report-section {
  margin-bottom: var(--m-s-8);
}
.m-report-section-title {
  font-family: var(--m-font-display);
  font-size: 30px;
  font-weight: 400;
  margin: 0;
  color: var(--m-bone-50);
  letter-spacing: -0.005em;
  line-height: 1.05;
}
.m-report-section .m-label {
  display: block;
  margin: var(--m-s-2) 0 var(--m-s-4);
}
.m-report-rows {
  display: flex;
  flex-direction: column;
  gap: var(--m-s-3);
}

.m-report-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--m-s-4);
  padding: var(--m-s-5);
  background: var(--m-ink-800);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-3);
  box-shadow: var(--m-elev-1);
  position: relative;
}
.m-report-row::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--m-bone-400);
  border-radius: var(--m-r-3) 0 0 var(--m-r-3);
}
.m-report-row.m-report-pri-high::before    { background: var(--m-coral-500); }
.m-report-row.m-report-pri-medium::before  { background: var(--m-amber-500); }
.m-report-row.m-report-pri-low::before     { background: var(--m-amber-300); }
.m-report-row.m-report-pri-info::before    { background: var(--m-bone-300); }
.m-report-row.m-report-pri-positive::before{ background: var(--m-mint-500); }

.m-report-row-main { min-width: 0; flex: 1 1 auto; }
.m-report-row-title {
  font-family: var(--m-font-display);
  font-size: 22px;
  line-height: 1.15;
  color: var(--m-bone-50);
}
.m-report-row-detail {
  font-family: var(--m-font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--m-bone-200);
  margin-top: 6px;
}
.m-report-row-advice {
  font-family: var(--m-font-body);
  font-size: 14px;
  color: var(--m-bone-300);
  margin-top: var(--m-s-2);
  line-height: 1.4;
}

.m-report-drill {
  flex-shrink: 0;
  font-family: var(--m-font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--m-r-pill);
  border: 1px solid var(--m-amber-500);
  background: transparent;
  color: var(--m-amber-400);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--m-dur-fast) var(--m-ease-out),
              color var(--m-dur-fast) var(--m-ease-out),
              box-shadow var(--m-dur-fast) var(--m-ease-out);
  align-self: flex-start;
}
.m-report-drill:hover {
  background: var(--m-amber-500);
  color: var(--m-ink-900);
  box-shadow: 0 0 0 4px var(--m-amber-tint);
}
.m-report-drill:focus-visible { outline: none; box-shadow: var(--m-ring-focus); }

.m-report-empty {
  padding: var(--m-s-6);
  background: var(--m-ink-800);
  border: 1px dashed var(--m-ink-600);
  border-radius: var(--m-r-3);
  color: var(--m-bone-300);
  font-style: italic;
  text-align: center;
}

@media (max-width: 720px) {
  .m-report-row { flex-direction: column; }
  .m-report-drill { margin-top: var(--m-s-3); align-self: flex-start; }
  .m-report-section-title { font-size: 24px; }
}

/* Settings cog also overrides modern's m-cog when inside the topbar — already handled */

/* ============================================================
   Mobile/responsive sweep — anything that breaks below ~720px.
   The puzzle-row + heatmap collapses are already in place above.
   This block handles topbar density and page-padding economy.
   ============================================================ */

@media (max-width: 720px) {
  .m-page {
    padding: var(--m-s-5) var(--m-s-4) var(--m-s-9);
  }

  /* Topbar: still flex-row but wraps when items don't fit. The streak strip
     wraps to its own line under brand+pills on narrow widths. */
  .m-topbar { gap: var(--m-s-3) var(--m-s-4); }

  .m-nav-pills { margin-left: 0; }

  /* Streak strip becomes the full row underneath. margin-left:auto from the
     desktop layout still works inside a wrapped row because it just hugs the
     right edge of its own line. The widget stays big — the topbar wraps and
     gives it space rather than shrinking the dopamine number. */
  .m-streak {
    flex: 1 1 auto;
    min-width: 0;
    gap: 14px;
    padding: 12px 16px 12px 14px;
  }
  .m-streak .m-fire { font-size: 28px; }
  .m-streak-num { font-size: 34px; }
  .m-streak-ticker { font-size: 18px; }
  .m-streak-progress { width: 100px; }
  .m-streak-end { min-width: 100px; }

  /* Auth slot can sit alongside the cog without forcing its own row. */
  .m-auth-slot .m-auth-name { display: none; }

  /* Hero: tighter padding so the lead-quote has more room. */
  .m-hero {
    padding: var(--m-s-5) var(--m-s-5);
    gap: var(--m-s-4);
  }
  .m-coach-avatar {
    width: 56px; height: 56px; font-size: 28px;
  }
  .m-stamp { top: var(--m-s-3); right: var(--m-s-3); }

  /* Puzzle card padding tighter. */
  .m-card { padding: var(--m-s-4); }
  .m-choice { padding: 10px 12px; }
  .m-choice-key { width: 26px; height: 26px; font-size: 11px; }
  .m-choice-move { font-size: 15px; }

  /* Coach line + next leak can wrap on narrow */
  .m-coach-line { flex-wrap: wrap; }
  .m-next-leak { margin-left: 0; margin-top: var(--m-s-2); }
}

/* ============================================================
   MODERN REELS — Tournament Hall at Midnight, vertical feed
   ------------------------------------------------------------
   Fullscreen overlay (#m-reels-root, .mr-root) mounted by
   js/modern-reels.js. Stacked .mr-card panels, each 100vh.
   .mr-track translates vertically to navigate between reels.

   Tokens reused from the design system above so the light
   theme block (body.design-modern.theme-light) re-tunes them
   automatically — no separate light-mode reels overrides
   needed in this PR.
   ============================================================ */

body.mr-active #modern-root,
body.mr-active main,
body.mr-active .nav-tabs,
body.mr-active .cc-settings-fab,
body.mr-active .cc-settings-drawer {
  display: none !important;
}

.mr-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--m-ink-900);
  font-family: var(--m-font-body);
  color: var(--m-bone-50);
  overflow: hidden;
  isolation: isolate;
}

.mr-root::before {
  /* Subtle atmospheric grid — same vocabulary as the dashboard */
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--m-atmo-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--m-atmo-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.mr-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ---- Top progress bar ---- */
.mr-progress {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 88px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.mr-dot {
  flex: 1 1 auto;
  height: 3px;
  background: rgba(243, 235, 213, 0.18);
  border-radius: 999px;
  transition: background var(--m-dur-fast) var(--m-ease-out);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.mr-dot-seen   { background: var(--m-bone-300); }
.mr-dot-active { background: rgba(243, 235, 213, 0.20); box-shadow: 0 0 0 1px rgba(255,255,255,0.10); }
/* Progress fill — the active dot's --mr-dot-fill is animated from 0% to
   100% over the auto-advance window by _startProgressTimer. */
.mr-dot-active::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--mr-dot-fill, 0%);
  background: var(--m-bone-50);
  border-radius: 999px;
  transition: width 14s linear;
}

/* ---- Close + counter ---- */
.mr-close {
  position: absolute;
  top: 12px; right: 16px;
  width: 36px; height: 36px;
  border: 1px solid var(--m-ink-600);
  background: rgba(10, 13, 14, 0.65);
  color: var(--m-bone-100);
  font-family: var(--m-font-display);
  font-size: 26px;
  line-height: 1;
  border-radius: var(--m-r-pill);
  cursor: pointer;
  backdrop-filter: blur(8px);
  z-index: 6;
  transition: background var(--m-dur-fast) var(--m-ease-out);
}
.mr-close:hover { background: var(--m-ink-700); }

.mr-counter {
  position: absolute;
  top: 44px; right: 16px;
  font-family: var(--m-font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--m-bone-300);
  z-index: 5;
}
.mr-counter-sep { opacity: 0.5; }

/* ---- Track + cards ---- */
.mr-track-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.mr-track {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  transform: translateY(0);
  transition: transform var(--m-dur-slow) var(--m-ease-in-out);
  will-change: transform;
}

.mr-card {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 64px 24px 80px;
  box-sizing: border-box;
  overflow: hidden;
}

.mr-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.92;
}

/* Category-specific atmosphere */
.mr-cat-hype .mr-card-bg {
  background:
    radial-gradient(60% 50% at 20% 10%, rgba(255, 122, 108, 0.18), transparent 60%),
    radial-gradient(50% 40% at 90% 90%, rgba(240, 179, 64, 0.14), transparent 70%),
    var(--m-ink-850);
}
.mr-cat-insight .mr-card-bg {
  background:
    radial-gradient(60% 50% at 80% 10%, rgba(93, 219, 166, 0.10), transparent 60%),
    radial-gradient(50% 40% at 10% 90%, rgba(157, 143, 255, 0.10), transparent 70%),
    var(--m-ink-850);
}
.mr-cat-interactive .mr-card-bg {
  background:
    radial-gradient(60% 50% at 30% 80%, rgba(157, 143, 255, 0.16), transparent 60%),
    radial-gradient(50% 40% at 80% 20%, rgba(240, 179, 64, 0.12), transparent 70%),
    var(--m-ink-850);
}

.mr-emoji {
  position: absolute;
  top: 8%; left: 50%;
  transform: translateX(-50%);
  font-size: 128px;
  opacity: 0.06;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.mr-card-content {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--m-s-4);
  text-align: center;
}

/* ---- Category pill ---- */
.mr-pill {
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--m-r-pill);
  border: 1px solid var(--m-ink-600);
  background: rgba(10, 13, 14, 0.6);
  color: var(--m-bone-200);
}
.mr-cat-hype        .mr-pill { color: var(--m-coral-300); border-color: var(--m-coral-tint-strong); }
.mr-cat-insight     .mr-pill { color: var(--m-mint-300);  border-color: rgba(93, 219, 166, 0.30); }
.mr-cat-interactive .mr-pill { color: var(--m-amber-300); border-color: rgba(240, 179, 64, 0.30); }

/* ---- Title + subtitle ---- */
.mr-title {
  font-family: var(--m-font-display);
  font-weight: 400;
  font-size: clamp(28px, 5.5vw, 48px);
  line-height: 1.05;
  margin: 0;
  color: var(--m-bone-50);
  letter-spacing: -0.01em;
}
.mr-subtitle {
  font-family: var(--m-font-body);
  font-size: 15px;
  color: var(--m-bone-300);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ---- Body shared widgets ---- */
.mr-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--m-s-5);
  margin-top: var(--m-s-3);
}

.mr-big-num {
  font-family: var(--m-font-display);
  font-size: clamp(72px, 16vw, 140px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--m-bone-50);
  font-feature-settings: 'tnum' 1;
}
.mr-num-coral { color: var(--m-coral-400); }
.mr-num-flame {
  background: linear-gradient(135deg, var(--m-coral-400), var(--m-amber-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mr-big-label {
  font-family: var(--m-font-body);
  font-size: 14px;
  color: var(--m-bone-300);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.mr-subtle {
  font-family: var(--m-font-body);
  font-size: 13px;
  color: var(--m-bone-400);
  letter-spacing: 0.02em;
}

/* ---- Giant-killer vs layout ---- */
.mr-vs {
  display: flex;
  align-items: center;
  gap: var(--m-s-4);
  font-family: var(--m-font-mono);
}
.mr-vs-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--m-s-3) var(--m-s-4);
  background: rgba(10, 13, 14, 0.50);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-2);
  min-width: 140px;
}
.mr-vs-label {
  font-size: 11px;
  color: var(--m-bone-300);
  letter-spacing: 0.08em;
}
.mr-vs-rating {
  font-size: 28px;
  color: var(--m-bone-50);
  font-feature-settings: 'tnum' 1;
}
.mr-vs-vs {
  font-family: var(--m-font-display);
  font-size: 22px;
  color: var(--m-bone-300);
  font-style: italic;
}
.mr-callout {
  display: flex;
  align-items: baseline;
  gap: var(--m-s-3);
  padding: var(--m-s-3) var(--m-s-5);
  border-radius: var(--m-r-2);
  background: var(--m-mint-tint);
  border: 1px solid rgba(93, 219, 166, 0.30);
}
.mr-callout-num {
  font-family: var(--m-font-display);
  font-size: 36px;
  color: var(--m-mint-400);
}
.mr-callout-label {
  font-family: var(--m-font-body);
  font-size: 13px;
  color: var(--m-bone-200);
}

/* ---- Clean-game ring + stat block ---- */
.mr-ring-row {
  display: flex;
  gap: var(--m-s-6);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.mr-ring {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--m-ink-850) 70%, transparent 73%),
              conic-gradient(var(--m-mint-500) 0%, var(--m-mint-500) 78%, var(--m-ink-700) 78%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--m-ink-700);
}
.mr-ring-num {
  font-family: var(--m-font-display);
  font-size: 44px;
  line-height: 1;
  color: var(--m-bone-50);
  font-feature-settings: 'tnum' 1;
}
.mr-ring-pct {
  font-size: 18px;
  color: var(--m-bone-300);
  margin-left: 2px;
}
.mr-ring-label {
  font-size: 10px;
  color: var(--m-bone-300);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-top: 4px;
  text-align: center;
}
.mr-stat-block {
  display: flex;
  flex-direction: column;
  gap: var(--m-s-2);
  font-family: var(--m-font-mono);
  text-align: left;
  min-width: 180px;
}
.mr-stat-row {
  display: flex;
  justify-content: space-between;
  gap: var(--m-s-4);
  padding: 6px 12px;
  border-bottom: 1px dashed var(--m-ink-700);
  font-size: 13px;
  color: var(--m-bone-300);
}
.mr-stat-row b { color: var(--m-bone-50); font-weight: 500; }

/* ---- Stats-wrapped grid ---- */
.mr-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--m-s-3);
  width: 100%;
  max-width: 420px;
}
.mr-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--m-s-4) var(--m-s-3);
  background: rgba(10, 13, 14, 0.55);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-2);
  min-height: 88px;
}
.mr-stat-card-wide { grid-column: span 2; }
.mr-stat-num {
  font-family: var(--m-font-display);
  font-size: 36px;
  line-height: 1;
  color: var(--m-bone-50);
  font-feature-settings: 'tnum' 1;
}
.mr-stat-cap {
  font-family: var(--m-font-body);
  font-size: 11px;
  color: var(--m-bone-300);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.mr-stat-mint  { border-color: rgba(93, 219, 166, 0.30); background: var(--m-mint-tint); }
.mr-stat-mint  .mr-stat-num { color: var(--m-mint-400); }
.mr-stat-coral { border-color: var(--m-coral-tint-strong); background: var(--m-coral-tint); }
.mr-stat-coral .mr-stat-num { color: var(--m-coral-400); }

/* ---- Rating-milestone bar ---- */
.mr-bar {
  width: min(360px, 100%);
  height: 6px;
  background: var(--m-ink-700);
  border-radius: var(--m-r-pill);
  overflow: hidden;
}
.mr-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--m-amber-500), var(--m-mint-400));
  border-radius: var(--m-r-pill);
  transition: width var(--m-dur-slow) var(--m-ease-out);
}

/* ---- Miniboard wrapper + opening-roast move list + puzzle meta ---- */
.mr-board-wrap {
  position: relative;
  padding: var(--m-s-3);
  background: rgba(10, 13, 14, 0.55);
  border: 1px solid var(--m-ink-700);
  border-radius: var(--m-r-2);
}
.mr-board-wrap .reel-board {
  /* MiniBoard ships with its own .reel-board / .reel-sq / .reel-piece
     styling from style.css. We let it render at its native size; the
     wrapper provides the modern surface around it. */
  display: block;
}

.mr-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: center;
  font-family: var(--m-font-mono);
  font-size: 14px;
  color: var(--m-bone-200);
  max-width: 480px;
}
.mr-move {
  padding: 2px 6px;
  border-radius: 4px;
}
.mr-move-blunder {
  background: var(--m-coral-tint-strong);
  color: var(--m-coral-300);
  font-weight: 500;
}

.mr-puzzle-meta {
  display: flex;
  flex-direction: column;
  gap: var(--m-s-2);
  font-family: var(--m-font-mono);
  min-width: 220px;
}
.mr-meta-row {
  display: flex;
  justify-content: space-between;
  gap: var(--m-s-4);
  padding: 6px 12px;
  border-bottom: 1px dashed var(--m-ink-700);
  font-size: 13px;
  color: var(--m-bone-300);
}
.mr-meta-row b { color: var(--m-bone-50); font-weight: 500; }

.mr-cta-line {
  font-family: var(--m-font-body);
  font-size: 13px;
  color: var(--m-bone-300);
  font-style: italic;
  letter-spacing: 0.01em;
  text-align: center;
  max-width: 360px;
}
.mr-mono { font-family: var(--m-font-mono); }
.mr-bad  { color: var(--m-coral-400); }

/* ---- First-reel swipe hint ---- */
.mr-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--m-font-mono);
  font-size: 11px;
  color: var(--m-bone-400);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  animation: mr-pulse 2.4s ease-in-out infinite;
}
@keyframes mr-pulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, 0); }
  50%      { opacity: 0.9; transform: translate(-50%, -4px); }
}

/* ---- Responsive: narrow ---- */
@media (max-width: 520px) {
  .mr-card { padding: 56px 16px 72px; }
  .mr-vs { gap: var(--m-s-3); }
  .mr-vs-side { min-width: 0; padding: var(--m-s-2) var(--m-s-3); }
  .mr-stat-grid { max-width: 100%; }
  .mr-emoji { font-size: 96px; }
  .mr-ring { width: 120px; height: 120px; }
  .mr-ring-num { font-size: 36px; }
}

/* ---- Modern Reels: interactive controls ---- */

.mr-hidden { display: none !important; }

/* Generic action button (puzzle reveal + similar). Modern primary look. */
.mr-action-btn {
  font-family: var(--m-font-mono);
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: var(--m-r-pill);
  border: 1px solid var(--m-amber-500);
  background: var(--m-amber-tint);
  color: var(--m-amber-300);
  cursor: pointer;
  transition: background var(--m-dur-fast) var(--m-ease-out),
              transform var(--m-dur-fast) var(--m-ease-out);
}
.mr-action-btn:hover {
  background: rgba(240, 179, 64, 0.22);
  transform: translateY(-1px);
}
.mr-action-btn:focus-visible {
  outline: none;
  box-shadow: var(--m-ring-focus);
}

/* Puzzle answer reveal */
.mr-puzzle-answer {
  display: flex;
  align-items: center;
  gap: var(--m-s-3);
  padding: var(--m-s-3) var(--m-s-5);
  border-radius: var(--m-r-2);
  background: var(--m-mint-tint);
  border: 1px solid rgba(93, 219, 166, 0.30);
  animation: mr-fade-in var(--m-dur-base) var(--m-ease-out);
}
.mr-answer-label {
  font-family: var(--m-font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--m-bone-300);
}
.mr-answer-san {
  font-family: var(--m-font-mono);
  font-size: 22px;
  color: var(--m-mint-400);
}

/* Best-move arrow overlay drawn by _revealPuzzle */
.mr-arrow-anim {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  animation: mr-arrow-grow var(--m-dur-slow) var(--m-ease-out);
}
.mr-board-wrap { position: relative; }
@keyframes mr-arrow-grow {
  0%   { opacity: 0; transform: scale(0.6); transform-origin: center; }
  100% { opacity: 1; transform: scale(1); }
}

/* Guess-eval buttons */
.mr-guess-buttons {
  display: flex;
  gap: var(--m-s-2);
  flex-wrap: wrap;
  justify-content: center;
}
.mr-guess-btn {
  font-family: var(--m-font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  border-radius: var(--m-r-2);
  border: 1px solid var(--m-ink-600);
  background: rgba(10, 13, 14, 0.65);
  color: var(--m-bone-100);
  cursor: pointer;
  transition: background var(--m-dur-fast) var(--m-ease-out),
              border-color var(--m-dur-fast) var(--m-ease-out);
  min-width: 92px;
}
.mr-guess-btn:hover:not(:disabled) {
  background: var(--m-ink-700);
  border-color: var(--m-bone-400);
}
.mr-guess-btn:focus-visible {
  outline: none;
  box-shadow: var(--m-ring-focus);
}
.mr-guess-btn.mr-guess-correct-btn {
  border-color: var(--m-mint-500);
  background: var(--m-mint-tint);
  color: var(--m-mint-300);
}
.mr-guess-btn.mr-guess-wrong-btn {
  border-color: var(--m-coral-500);
  background: var(--m-coral-tint);
  color: var(--m-coral-300);
}
.mr-guess-btn.mr-guess-disabled {
  cursor: default;
  opacity: 0.78;
}

.mr-guess-result {
  display: flex;
  align-items: baseline;
  gap: var(--m-s-3);
  padding: var(--m-s-3) var(--m-s-5);
  border-radius: var(--m-r-2);
  border: 1px solid var(--m-ink-700);
  background: rgba(10, 13, 14, 0.55);
  animation: mr-fade-in var(--m-dur-base) var(--m-ease-out);
}
.mr-guess-result.mr-guess-correct {
  border-color: rgba(93, 219, 166, 0.40);
  background: var(--m-mint-tint);
}
.mr-guess-result.mr-guess-wrong {
  border-color: var(--m-coral-tint-strong);
  background: var(--m-coral-tint);
}
.mr-result-prefix {
  font-family: var(--m-font-display);
  font-size: 22px;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  font-style: italic;
}
.mr-guess-correct .mr-result-prefix { color: var(--m-mint-400); }
.mr-guess-wrong   .mr-result-prefix { color: var(--m-coral-400); }
.mr-result-eval {
  font-family: var(--m-font-mono);
  font-size: 14px;
  color: var(--m-bone-100);
}

/* Opening-roast board hover hint */
.mr-type-opening-roast #mr-roast-board-0,
.mr-type-opening-roast .mr-board-wrap {
  cursor: pointer;
}

/* Shared fade-in keyframe used by the reveal/answer/result panels */
@keyframes mr-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   .m-board.is-reels — modern board variant for the reels overlay
   ------------------------------------------------------------
   Smaller (220-240px), composed at quieter intensities than the
   dashboard puzzle board. Per the frontend-design consult
   ("Midnight, Composed"):
     - 0.5-0.6px piece strokes; drop the outer glow rings —
       a 1px stroke around a 24px glyph reads as a halo, not an outline
     - flat color square highlights (no pulse/animation); the board
       is re-rendered every 900ms during opening-roast playback and
       animations would strobe
     - no coord labels by default
     - 1px edge + rounded radius + inset highlight; no heavy drop
       shadow (parent .mr-board-wrap already provides card elevation)
   ============================================================ */

.m-board.is-reels {
  /* Inline width/height come from ModernBoard.render's wrapper style.
     CSS grid layout from .m-board still applies (8x8 grid). */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  /* Drop dashboard's 0 20px 40px -22px rgba(0,0,0,0.7) — the reels
     card already has elevation. */
}

/* Smaller piece glyphs that fit 27-30px squares without overflow. */
.m-board.is-reels .m-sq {
  font-size: 22px;
}

/* Toned-down piece outlines — keep the orange/cyan signal, drop the bloom. */
.m-board.is-reels .m-piece.white {
  -webkit-text-stroke: 0.6px #ff6a00;
  text-stroke: 0.6px #ff6a00;
  text-shadow:
    0 0 1px #ff6a00,
    0 1px 2px rgba(0, 0, 0, 0.55);
}
.m-board.is-reels .m-piece.black {
  -webkit-text-stroke: 0.5px #00e0ff;
  text-stroke: 0.5px #00e0ff;
  text-shadow:
    0 0 1px #00e0ff,
    0 1px 2px rgba(0, 0, 0, 0.55);
}

/* No animations during playback — square highlights are static washes
   for normal moves (inline rgba(245, 198, 106, 0.32) amber from JS),
   coral overlay for blunder via the .hl-blunder role class. */
.m-board.is-reels .hl-from .m-piece,
.m-board.is-reels .hl-target,
.m-board.is-reels .hl-from {
  animation: none;
}
.m-board.is-reels .hl-from::after,
.m-board.is-reels .hl-target::before {
  display: none;
}

/* Blunder highlight — flat coral wash on the to/from squares. Both
   light and dark squares share the same overlay color so the verdict
   reads cleanly without per-square tuning. */
.m-board.is-reels .hl-blunder {
  position: relative;
}
.m-board.is-reels .hl-blunder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 90, 74, 0.34);
  box-shadow: inset 0 0 0 1.5px rgba(255, 90, 74, 0.55);
  pointer-events: none;
}

/* Arrow SVG produced by ModernBoard. Same drop-shadow grace from JS. */
.m-board .m-arrow {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}
