/* =============================================================================
   SPARRING CHESS — DESIGN SYSTEM
   A cohesive design language inspired by the Digital Dojo concept
   ============================================================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Source+Sans+3:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* =============================================================================
   DESIGN TOKENS
   ============================================================================= */
:root {
  /* Primary Colors (from logo) */
  --fighter-red: #C62828;
  --fighter-red-dark: #8E0000;
  --fighter-red-light: #FF5F52;
  --digital-blue: #1565C0;
  --digital-blue-dark: #003C8F;
  --digital-blue-light: #5E92F3;

  /* Neutral Colors */
  --knight-black: #1A1A1A;
  --ring-gray: #546E7A;
  --ring-gray-light: #78909C;
  --steel: #37474F;
  --slate: #263238;

  /* Background Colors */
  --canvas: #FAFAFA;
  --canvas-warm: #FFF8F0;
  --panel: #FFFFFF;
  --panel-elevated: #FFFFFF;
  --surface: #FAFAFA;

  /* Semantic Colors */
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --warning: #F57C00;
  --warning-light: #FFF3E0;
  --error: #D32F2F;
  --error-light: #FFEBEE;
  --info: #1976D2;
  --info-light: #E3F2FD;

  /* Chess Result Colors */
  --win-green: #2E7D32;
  --draw-gray: #78909C;
  --loss-red: #C62828;
  --white-piece: #F5F5F5;
  --black-piece: #424242;

  /* Typography */
  --font-display: 'Bebas Neue', Impact, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;

  /* Font Weights */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-glow-red: 0 0 20px rgba(198, 40, 40, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(21, 101, 192, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-tooltip: 400;

  /* Layout */
  --header-height: 72px;
  --sidebar-width: 320px;
  --max-width: 1600px;
  --max-width-content: 800px;
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: 1.6;
  color: var(--knight-black);
  background: var(--canvas);
  min-height: 100vh;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(135deg, rgba(198, 40, 40, 0.03) 0%, transparent 50%),
    linear-gradient(225deg, rgba(21, 101, 192, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-normal);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--knight-black);
}

h1 { font-size: var(--text-5xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--text-3xl); margin-bottom: var(--space-4); }
h3 { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
h4 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
h5 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
h6 { font-size: var(--text-base); margin-bottom: var(--space-1); }

p {
  margin-bottom: var(--space-4);
  color: var(--ring-gray);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--digital-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--digital-blue-dark);
  text-decoration: underline;
}

strong, b {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

small {
  font-size: var(--text-sm);
  color: var(--ring-gray-light);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* =============================================================================
   LAYOUT
   ============================================================================= */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* =============================================================================
   HEADER
   ============================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--panel);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  height: var(--header-height);
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  text-decoration: none;
  color: inherit;
}

.site-header__brand:hover {
  text-decoration: none;
}

.site-logo {
  width: 84px;
  height: 84 px;
  object-fit: contain;
  transition: transform var(--transition-base);
}

.site-header__brand:hover .site-logo {
  transform: scale(1.05);
}

.site-header__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--knight-black);
  margin: 0;
  text-wrap-mode: nowrap;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ring-gray);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--knight-black);
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.nav-link.active {
  color: var(--fighter-red);
  background: var(--error-light);
}

/* Nav mini dropdown (Config menu) */
.nav-dropdown-wrapper {
  position: relative;
}

.nav-dropdown-trigger {
  gap: var(--space-1);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.nav-dropdown-trigger svg {
  transition: transform var(--transition-fast);
}

.nav-dropdown-wrapper.open .nav-dropdown-trigger svg {
  transform: rotate(180deg);
}

.nav-mini-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
  margin-top: var(--space-1);
}

.nav-dropdown-wrapper.open .nav-mini-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-mini-dropdown__item {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--ring-gray);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-mini-dropdown__item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--knight-black);
}

.nav-mini-dropdown__item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.nav-mini-dropdown__item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.nav-mini-dropdown__divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: var(--space-1) 0;
}

/* User dropdown - hide config items on desktop (shown via nav Config dropdown) */
/*.user-dropdown-wrapper .user-dropdown-config-item {
  display: none;
}*/

/* User dropdown trigger styling */
.user-dropdown-wrapper .nav-dropdown-trigger {
  color: var(--knight-black);
}

.user-dropdown-wrapper .nav-mini-dropdown {
  right: 0;
  left: auto;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: white;
}

.header-settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.header-settings-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.header-settings-btn svg {
  transition: transform var(--transition-fast);
}

.header-settings-btn:hover svg {
  transform: rotate(45deg);
}

.howitworks-short {
  display: none;
}

@media (max-width: 600px) {
  /* Hide the nav Config dropdown on mobile */
  .site-header__nav .nav-dropdown-wrapper {
    display: none;
  }

  /* Show config items in user dropdown on mobile */
  .user-dropdown-wrapper .user-dropdown-config-item {
    display: block;
  }

  .howitworks-full { display: none; }
  .howitworks-short { display: inline; }
}


.user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.main-layout {
  display: grid;
 /* grid-template-columns: 1fr minmax(auto, 350px);*/
  gap: 2rem;
}

.main-layout__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 900px) {
  .main-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* "Unwrap" sidebar so children participate in main-layout's flex */
  .main-layout__sidebar {
    display: contents;
  }

  /* Onboarding moves to top */
  .onboarding-box {
    order: -1;
  }

  /* Study stays in middle (order: 0 by default) */

  /* Ads stay at bottom */
  .ad-space {
    order: 1;
  }
}

/* Config Trigger Button */
/*.config-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ring-gray);
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.config-trigger:hover {
  color: var(--knight-black);
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.2);
}

.config-trigger.active {
  color: var(--fighter-red);
  border-color: var(--fighter-red);
  background: var(--error-light);
}

.config-trigger svg {
  flex-shrink: 0;
}*/

/* Config Dropdown Panel */
.config-dropdown {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  background: var(--panel);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-lg);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

/* The site header stays fixed on top of everything, so a panel at top:0 hid its own title and close button
   behind it, while its height still allowed for the header: a strip of the page showed through underneath. */

.config-dropdown.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.config-dropdown__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-6);
}

.config-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.config-dropdown__header h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.config-dropdown__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Pin button */
.dropdown-pin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.5;
}

.dropdown-pin-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  opacity: 0.8;
}

.dropdown-pin-btn .pin-icon {
  font-size: var(--text-base);
  transition: transform var(--transition-fast);
}

/* Pinned state */
.config-dropdown.pinned .dropdown-pin-btn {
  opacity: 1;
  background: var(--digital-blue);
  color: white;
}

.config-dropdown.pinned .dropdown-pin-btn:hover {
  background: var(--sapphire);
}

.config-dropdown.pinned .dropdown-pin-btn .pin-icon {
  transform: rotate(45deg);
}

/* Pinned indicator border */
.config-dropdown.pinned {
  box-shadow: 0 0 0 2px var(--digital-blue), var(--shadow-lg);
}

.config-dropdown__help {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin: 0 0 var(--space-3) 0;
  line-height: 1.5;
}

/* How it works toggle */
.how-it-works-toggle {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--digital-blue);
  text-decoration: none;
  margin-bottom: var(--space-4);
  cursor: pointer;
}

.how-it-works-toggle::before {
  content: "▶ ";
  font-size: 0.7em;
  transition: transform var(--transition-fast);
  display: inline-block;
}

.how-it-works-toggle.open::before {
  content: "▼ ";
}

.how-it-works-toggle:hover {
  text-decoration: underline;
}

.how-it-works-content {
  background: var(--info-light);
  border-left: 3px solid var(--digital-blue);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--ring-gray);
  border-radius: var(--radius-md);
}

.how-it-works-content p {
  margin: 0 0 var(--space-3);
}

.how-it-works-content p:last-child {
  margin-bottom: 0;
}

.how-it-works-content ul {
  margin: var(--space-3) 0;
  padding-left: var(--space-5);
}

.how-it-works-content li {
  margin: var(--space-2) 0;
}

/* How it works sections (main dropdown) */
.how-it-works-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.how-it-works-section-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
 }

.how-it-works-section {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.how-it-works-section h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-3);
  color: var(--digital-blue);
}

.how-it-works-section p {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin-bottom: var(--space-3);
}

.how-it-works-section ul {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.how-it-works-section li {
  margin: var(--space-2) 0;
}

@media (max-width: 768px) {
  .how-it-works-sections {
    grid-template-columns: 1fr;
  }
}

/* Config Grid Layout */
.config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.config-grid--2col {
  grid-template-columns: repeat(2, 1fr);
}

.config-dropdown__content {
  padding: var(--space-2) 0;
}

/* Import form */
.import-form__simple {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

@media (max-width: 600px) {
  .import-form__simple {
    grid-template-columns: 1fr;
  }
}

.import-form__notice {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  margin: var(--space-2) 0;
  font-style: italic;
}

.import-form__advanced {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

@media (max-width: 600px) {
  .import-form__advanced {
    grid-template-columns: 1fr;
  }
}

.import-form__until-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.import-form__until-row input[type="month"] {
  flex: 1;
}

.import-form__open-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--ring-gray);
  white-space: nowrap;
  cursor: pointer;
}

.import-form__open-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.import-form__advanced-link {
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
  margin-top: var(--space-1);
  display: inline-block;
}

.import-form__advanced-link:hover {
  color: var(--ring-gray);
}

.config-column h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-4);
  color: var(--ring-gray);
}

.config-column .field-group {
  margin-bottom: var(--space-4);
}

.config-column .field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-2);
}

/* Collapsible Config Columns */
.config-column--collapsible .config-column__toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}

.config-column--collapsible .config-column__toggle::before {
  content: "▼";
  font-size: 0.6em;
  transition: transform var(--transition-fast);
}

.config-column--collapsible.collapsed .config-column__toggle::before {
  transform: rotate(-90deg);
}

.config-column--collapsible .config-column__content {
  overflow: hidden;
  transition: max-height var(--transition-base), opacity var(--transition-base);
  max-height: 500px;
  opacity: 1;
}

.config-column--collapsible.collapsed .config-column__content {
  max-height: 0;
  opacity: 0;
}

/* Compact Skill Toggle */
.skill-toggle-compact {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.skill-option-compact {
  flex: 1;
  cursor: pointer;
}

.skill-option-compact input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.skill-option-compact span {
  display: block;
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  background: var(--canvas);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.skill-option-compact:hover span {
  border-color: var(--ring-gray-light);
}

.skill-option-compact input[type="radio"]:checked + span {
  background: var(--error-light);
  border-color: var(--fighter-red);
  color: var(--fighter-red);
}

/* Config Toggles */
.config-toggles {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* Date Inputs Compact */
.date-inputs {
  display: flex;
  gap: var(--space-2);
}

.date-inputs input {
  flex: 1;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

@media (max-width: 768px) {
  .date-inputs {
    flex-direction: column;
  }

  .date-inputs input {
    width: 100%;
  }
}

/* Config Dropdown Footer */
.config-dropdown__footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-5);
  margin-top: var(--space-4);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.config-dropdown__footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* When footer only has one child (like just a close button), push it to the end */
.config-dropdown__footer > .btn:only-child,
.config-dropdown__footer > .dropdown-close-btn:only-child {
  margin-left: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .config-dropdown {
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .config-dropdown__inner {
    padding: var(--space-4);
    max-width: 100%;
    box-sizing: border-box;
  }

  .config-dropdown input,
  .config-dropdown select {
    max-width: 100%;
    box-sizing: border-box;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .config-trigger span {
    display: none;
  }
}

/* =============================================================================
   FOOTER
   ============================================================================= */
.site-footer {
  background: var(--slate);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-10) var(--space-6);
  margin-top: auto;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: white;
  text-decoration: none;
}

.footer-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.footer-logo span {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-tagline {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.5);
  max-width: 280px;
  line-height: 1.6;
}

.footer-section h5 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--space-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links a {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: white;
  text-decoration: none;
}

.footer-bottom {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  margin-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-copyright {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.4);
}

.footer-powered {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.3);
}

.footer-powered a {
  color: rgba(255, 255, 255, 0.5);
}

.footer-version {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.25);
  font-family: var(--font-mono);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary Button (Red) */
.btn-primary {
  background: var(--fighter-red);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--fighter-red-dark);
  box-shadow: var(--shadow-lg), var(--shadow-glow-red);
}

/* Secondary Button (Blue) */
.btn-secondary {
  background: var(--digital-blue);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
  background: var(--digital-blue-dark);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--knight-black);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.25);
}

/* Outline Buttons */
.btn-outline-red {
  background: transparent;
  color: var(--fighter-red);
  border: 2px solid var(--fighter-red);
}

.btn-outline-red:hover {
  background: var(--fighter-red);
  color: white;
}

.btn-outline-blue {
  background: transparent;
  color: var(--digital-blue);
  border: 2px solid var(--digital-blue);
}

.btn-outline-blue:hover {
  background: var(--digital-blue);
  color: white;
}

/* Small Button */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

/* Large Button */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* =============================================================================
   FORMS
   ============================================================================= */
label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--knight-black);
  margin-bottom: var(--space-2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="month"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--knight-black);
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--digital-blue);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

input::placeholder {
  color: var(--ring-gray-light);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23546E7A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  appearance: none;
}

select[multiple] {
  background-image: none;
  padding-right: var(--space-4);
  min-height: 120px;
}

select option {
  padding: var(--space-2);
}

#configDropdown select option {
  padding: 0;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--fighter-red);
}

/* Form Group */
.form-group {
  margin-bottom: var(--space-5);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
  margin-top: var(--space-1);
}

/* Toggle Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
}

.toggle input {
  width: auto;
}

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.card-header h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin-top: var(--space-1);
}

/* =============================================================================
   PANELS (Collapsible Sections)
   ============================================================================= */
.panel {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.panel-header:hover {
  background: rgba(0, 0, 0, 0.02);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.panel-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fighter-red);
  color: white;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

.panel-icon.blue {
  background: var(--digital-blue);
}

.panel-summary {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
}

.panel-toggle {
  color: var(--ring-gray);
  transition: transform var(--transition-fast);
}

details[open] .panel-toggle {
  transform: rotate(180deg);
}

.panel-body {
  padding: var(--space-5);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Config Panel specific */
.config-panel details {
  border: none;
  box-shadow: none;
}

.config-panel details summary {
  list-style: none;
}

.config-panel details summary::-webkit-details-marker {
  display: none;
}

.config-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.config-summary:hover {
  background: rgba(0, 0, 0, 0.02);
}

.config-summary-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.config-summary-text {
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

#configDetails[open] .config-summary-text {
  display: none;
}

/* Quick Options (always visible in config panel) */
.config-quick-options {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--canvas);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* =============================================================================
   WIZARD STEPS
   ============================================================================= */
.wizard-steps {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
}

.wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.wizard-step:hover {
  border-color: var(--ring-gray-light);
  transform: none;
  box-shadow: none;
}

.wizard-step.active {
  background: var(--fighter-red);
  color: white;
  border-color: var(--fighter-red);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.1);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.wizard-step.active .step-number {
  background: rgba(255, 255, 255, 0.25);
}

.step-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.wizard-section {
  display: none;
  padding: var(--space-5);
}

.wizard-section.active {
  display: block;
}

.wizard-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--space-5);
}

.optional-badge {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.06);
  color: var(--ring-gray);
  border-radius: var(--radius-sm);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wizard-prev {
  background: transparent;
  color: var(--knight-black);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.wizard-prev:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
  box-shadow: none;
}

.wizard-next,
.wizard-save {
  background: var(--fighter-red);
  color: white;
}

/* Skill Toggle Cards */
.skill-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.skill-option {
  cursor: pointer;
}

.skill-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--canvas);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--transition-fast);
}

.skill-option:hover .skill-card {
  border-color: var(--ring-gray-light);
}

.skill-option input[type="radio"]:checked + .skill-card {
  background: var(--error-light);
  border-color: var(--fighter-red);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

.skill-card strong {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
}

.skill-card small {
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

/* Field Groups */
.field-group {
  margin-bottom: var(--space-5);
}

.field-label {
  display: flex;
  /*align-items: center;*/
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-2);
}

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  background: rgba(0, 0, 0, 0.08);
  color: var(--ring-gray);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.help-btn:hover {
  background: var(--digital-blue);
  color: white;
  transform: none;
  box-shadow: none;
}

.help-text {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  background: var(--info-light);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  border-left: 3px solid var(--digital-blue);
}

.help-text p { margin-bottom: var(--space-2); }
.help-text p:last-child { margin-bottom: 0; }
.help-text ul { margin: var(--space-2) 0; padding-left: var(--space-5); }
.help-text li { margin: var(--space-1) 0; }

.config-notice {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  padding: var(--space-3) var(--space-4);
  background: var(--canvas);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--digital-blue);
  margin-bottom: var(--space-4);
}

.config-notice a {
  color: var(--digital-blue);
  font-weight: var(--weight-medium);
}

.ratings-section {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.date-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* =============================================================================
   BOARD LAYOUT
   ============================================================================= */
.board-layout {
  display: grid;
  /* Board, the practice itself, and the analysis beside it rather than pushing the board up the page */
  grid-template-columns: auto minmax(340px, 1fr) minmax(280px, 340px);
  gap: var(--space-6);
  align-items: start;
}

.analysis-column {
  min-width: 0;
}

.board-column {
  position: flex;
  /*top: calc(var(--header-height) + var(--space-6));*/

  display: grid;
  gap: 0rem;
}

.board-container {
  position: relative;
  width: 420px;
  min-width: 280px;
  max-width: 600px;
}

.board {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  /*box-shadow: var(--shadow-lg);*/
}

.board .cg-wrap {
  width: 100%;
  height: 100%;
}

/* Chessground places the file letters for a wrapper with room to the right of the board, which lichess's own
   theme gives it: left:24px on a full-width row pushes them past the board and, on a phone, off the screen.
   (The rank numbers are left alone: their top:-20px is what their translateY(39%) is measured against.) */
.cg-wrap coords.files {
  left: 0;
}

.board-resize-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: var(--fighter-red);
  border-radius: var(--radius-sm);
  opacity: 0.7;
  transition: all var(--transition-fast);
  z-index: 10;
}

.board-resize-handle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
}

.board-resize-handle:hover {
  opacity: 1;
  transform: scale(1.1);
}

.board-container.resizing .board-resize-handle {
  opacity: 1;
  transform: scale(1.2);
}

.board-container.resizing {
  user-select: none;
}

/* Board navigation bar */
.board-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0;
}

.board-nav__buttons {
  display: flex;
  gap: 2px;
}

.board-nav__step-buttons {
  display: flex;
  gap: 0;
}

.board-nav__step-buttons button:first-child {
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.board-nav__step-buttons button:last-child {
  border-top-left-radius:0;
  border-bottom-left-radius:0;
}

.board-nav__btn {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--knight-black);
  cursor: pointer;
  line-height: 1;
  transition: background var(--transition-fast);
  min-width: 32px;
  text-align: center;
}

.board-nav__btn:hover {
  background: var(--canvas);
}

.board-nav__btn:active {
  background: rgba(0, 0, 0, 0.06);
}

.board-nav__restart-btn {
  margin-left: auto;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-size: var(--text-xs);
  color: var(--ring-gray);
  cursor: pointer;
  white-space: nowrap;
}

.board-nav__restart-btn:hover {
  background: var(--canvas);
  color: var(--knight-black);
}

.board-nav__restart-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

.board-nav__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--knight-black);
  min-width: 0;
}

.board-nav__side {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--knight-black);
  min-width: 0;
}

.board-nav__move-text {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.board-nav__side {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  font-weight: var(--weight-medium);
}

.board-nav__indicators {
  display: flex;
  align-items: center;
  gap: 3px;
}

.board-nav__indicators .line-score-dot {
  width: 10px;
  height: 10px;
}

.board-nav__indicators .line-score-dot.combined {
  width: 14px;
  height: 14px;
  margin-right: 2px;
}

/* Board Controls Card */
.board-controls-card {
  padding: var(--space-4);
}

.board-controls-card label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin: 0;
}

.board-controls-card select {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

/* Line Selector Row */
.line-selector-row {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.line-selector-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ring-gray);
}

.line-selector-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.line-selector {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  background: white;
  color: var(--knight-black);
  cursor: pointer;
}

.line-selector:disabled {
  background: var(--canvas);
  color: var(--ring-gray-light);
  cursor: not-allowed;
}

.line-selector-cog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--ring-gray);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
}

.line-selector-cog:hover {
  background: var(--canvas);
  color: var(--knight-black);
}

/* Board Controls Row */
.board-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.board-controls-row label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin: 0;
}

.board-controls-row select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.board-controls {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.board-settings {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.board-settings label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.fen-export {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.fen-export span {
  font-size: var(--text-sm);
  color: var(--digital-blue);
  cursor: pointer;
  font-weight: var(--weight-medium);
}

.fen-export input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

/* Side Grid */
.side-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

/* =============================================================================
   MOVE HISTORY
   ============================================================================= */
.history-card {
  display: flex;
  flex-direction: column;
}

.fen-export-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.fen-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.move-history {
  list-style: none;
  margin: 0;
  display: grid;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
}

.move-history li {
  display: grid;
  grid-template-columns: 48px 1fr 1fr;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: -1px;
}

.move-history li:first-child {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.move-history li:last-child {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.move-history li:hover {
  background: rgba(0, 0, 0, 0.04);
}

.history-num {
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.history-move {
  padding: var(--space-2) var(--space-3);
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  text-align: center;
}

.history-move:hover {
  background: var(--info-light);
  border-color: var(--digital-blue);
}

/* =============================================================================
   ENGINE
   ============================================================================= */
.engine-card {
  overflow: hidden;
  min-width: 0;
}

.engine-status {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin: var(--space-3) 0;
}

.engine-score {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
  margin-right: var(--space-2);
}

.engine-depth {
  font-weight: var(--weight-semibold);
  color: var(--ring-gray);
}

.engine-meta {
  font-size: var(--text-sm);
  color: var(--ring-gray-light);
}

.engine-controls {
  margin-top: var(--space-4);
}

.engine-settings {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--canvas);
  border-radius: var(--radius-md);
}

.engine-line {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.engine-line:last-child {
  border-bottom: none;
}

.engine-line-score {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  min-width: 48px;
  flex-shrink: 0;
}

.engine-line-pv {
  color: var(--ring-gray);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Debug Panel */
.debug-toggle {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-top: var(--space-2);
}

.debug-toggle:hover {
  color: var(--knight-black);
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.debug-panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--slate);
  border-radius: var(--radius-md);
  color: white;
}

.debug-input-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.debug-command-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.debug-command-input:focus {
  outline: none;
  border-color: var(--digital-blue-light);
}

.debug-log {
  max-height: 300px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.debug-log-entry { padding: var(--space-1) 0; }
.debug-log-command { color: #FFE082; }
.debug-log-response { color: #81D4FA; }
.debug-log-error { color: #EF9A9A; }

/* =============================================================================
   GLOBAL STATUS CARD
   ============================================================================= */
.global-status-card {
  padding: var(--space-4);
}

.global-status-grid {
  display: grid;
  gap: var(--space-3);
}

.status-section {
  padding: var(--space-3) var(--space-4);
  background: var(--canvas);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.status-section h5 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ring-gray);
  margin-bottom: var(--space-2);
}

.status-content {
  font-size: var(--text-sm);
}

.status-placeholder {
  color: var(--ring-gray-light);
  font-style: italic;
}

.status-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.status-total {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.status-bar {
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
  margin: var(--space-2) 0;
}

.status-bar-white { background: var(--white-piece); border: 1px solid #ccc; border-right: none; }
.status-bar-draw { background: var(--draw-gray); }
.status-bar-black { background: var(--black-piece); }
.status-bar-win { background: var(--win-green); }
.status-bar-loss { background: var(--loss-red); }

.status-percentages {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.status-total {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  margin-top: var(--space-1);
  font-weight: var(--weight-light);
}

.status-pct-draw { color: var(--draw-gray); }
.status-pct-win, .status-pct-white { color: var(--win-green); font-weight: var(--weight-medium); }
.status-pct-loss, .status-pct-black { color: var(--loss-red); font-weight: var(--weight-medium); }

.status-in-repertoire .status-message { color: var(--success); font-weight: var(--weight-semibold); }
.status-out-of-repertoire .status-message { color: var(--error); font-weight: var(--weight-semibold); }

.status-success-count {
  display: inline-block;
  background: var(--success-light);
  color: var(--success);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  margin-top: var(--space-1);
}

.status-moves {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

/* =============================================================================
   QUICK STATUS BAR (Horizontal bar above board)
   ============================================================================= */
.quick-status-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--panel);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: var(--space-3);
  /*grid-column: 1 / -1;*/
}

.quick-status-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--canvas);
  border-radius: var(--radius-sm);
  min-width: 0;
}

 @media (max-width: 600px) {
  .quick-status-item {
    padding: var(--space-1);
  }
  }

.quick-status-content {
  flex: 1;
}

.quick-status-footer {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: var(--space-1);
  min-height: 0;
}

.quick-status-footer:empty {
  display: none;
}

.quick-status-header__side {
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  color: var(--ring-gray);
}

.quick-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.quick-status-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ring-gray);
}

.quick-status-cog {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
  align-self: self-start;
}

.quick-status-cog:hover {
  opacity: 1;
  color: var(--ring-gray);
}

.quick-status-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--knight-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Special styling for engine score */
.quick-status-value.engine-score {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--knight-black);
}


.quick-status-bar-container {
  width: 100%;
}

.quick-status-bar .status-bar.quick-bar {
  height: 8px;
  margin: var(--space-1) 0 0 0;
}

.quick-status-bar-label-detail {
  font-weight: var(--weight-light);
}

/* .engine-eval-toggle inherits layout from .repertoire-hint-btn; keep this class
   only as a hook for future overrides (e.g. colour variants). */

@media (max-width: 600px) {
  .quick-status-bar-label-detail {
    display: block;
  }
}


.quick-status-total {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.quick-status-depth {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.quick-status-placeholder {
  color: var(--ring-gray-light);
  font-style: italic;
  font-size: var(--text-xs);
}

.quick-status-value.status-pct-win { color: var(--win-green); min-width: 2rem; text-align: center;}
.quick-status-value.status-pct-loss { color: var(--loss-red); min-width: 2rem; text-align: center; }
.quick-status-value.status-in-repertoire { color: var(--success); min-width: 2rem; text-align: center; }
.quick-status-value.status-out-of-repertoire { color: var(--error); }
.quick-status-value.status-no-data { color: var(--ring-gray-light); font-style: italic; }

/* Expandable quick status items */
.quick-status-item--expandable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.quick-status-item--expandable:hover {
  background: var(--panel);
}

.quick-status-item--expandable .quick-status-header h4 {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.quick-status-item--expandable .quick-status-header h4::after {
  content: "\25BE"; /* down triangle */
  font-size: 10px;
  color: var(--ring-gray-light);
  transition: transform var(--transition-fast);
  transform: rotate(-90deg);
}

.quick-status-item--expandable.expanded .quick-status-header h4::after {
  transform: rotate(0deg);
}

.quick-status-item--expandable .quick-status-value,
.quick-status-item--expandable .quick-status-total {
  cursor: pointer;
}

.quick-status-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
  margin-top: 2px;
}

/* Detail panel - hidden by default */
.quick-status-detail {
  display: none;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  font-size: var(--text-sm);
}

.quick-status-item--expandable.expanded .quick-status-detail {
  display: block;
}

.detail-empty {
  color: var(--ring-gray-light);
  font-style: italic;
  padding: var(--space-1) 0;
}

.detail-section-title {
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ring-gray);
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
  font-size: 10px;
}

.detail-section-title:first-child {
  margin-top: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-2);
  padding: 3px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  align-items: center;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-move {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
  font-family: var(--font-mono);
}

.detail-wdl {
  display: flex;
  gap: 4px;
  font-family: var(--font-mono);
}

.detail-wdl > span {
  display: inline-block;
  width: 32px;
  text-align: right;
}

.detail-games {
  color: var(--ring-gray-light);
  white-space: nowrap;
  text-align: right;
}

/* Plan rows use 2-column layout */
.detail-row--plan {
  grid-template-columns: 1fr auto;
}

.detail-plan-moves {
  font-family: var(--font-mono);
  color: var(--knight-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-plan-stats {
  color: var(--ring-gray);
  white-space: nowrap;
}

.engine-detail-row {
  grid-template-columns: auto 1fr;
}

.engine-detail-pv {
  font-family: var(--font-mono);
  color: var(--ring-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Repertoire hint buttons (in footer) */
.repertoire-hint-buttons {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
}

.repertoire-hint-btn {
  padding: 1px 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid var(--ring-gray);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--knight-black);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.repertoire-hint-btn:hover {
  background: var(--bg-hover);
}

/*.repertoire-hint-btn.active {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}*/

.engine-lines-btn.active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.repertoire-footer-text {
  vertical-align: middle;
}

.repertoire-footer-text--error {
  color: #dc2626;
  font-weight: var(--weight-semibold);
}

.repertoire-footer-text--warning {
  color: #d97706;
}

.repertoire-footer-text--success {
  color: #16a34a;
}

.repertoire-undo-btn {
  border-color: #dc2626 !important;
  color: #dc2626 !important;
}

.repertoire-undo-btn:hover {
  background: #dc2626 !important;
  color: #fff !important;
}

.repertoire-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.repertoire-footer-comments {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.repertoire-footer-comment {
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  color: var(--ring-gray);
  background: rgba(0, 0, 0, 0.03);
  border-left: 2px solid var(--ring-gray-light);
  border-radius: 2px;
  white-space: pre-wrap;
  word-wrap: break-word;
  align-items: baseline;
}

.repertoire-footer-comment-move {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
  flex-shrink: 0;
}

.repertoire-footer-comment-text {
  flex: 1;
}

.repertoire-footer-comment--empty {
  color: var(--ring-gray-light);
  border-left-color: transparent;
  background: transparent;
  font-style: italic;
}

/* Repertoire detail panel */
.repertoire-detail-row {
  display: block;
}

.repertoire-detail-row .detail-row-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  align-items: center;
}

.detail-continuation {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ring-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repertoire-detail-row .detail-comment {
  margin-top: 4px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  color: var(--ring-gray);
  background: rgba(0, 0, 0, 0.03);
  border-left: 2px solid var(--ring-gray-light);
  border-radius: 2px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Diff badge: comparison vs sparring DB */
.detail-diff {
  display: inline-block;
  margin-left: 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  cursor: help;
}

.detail-diff--positive {
  color: var(--win-green);
}

.detail-diff--negative {
  color: var(--loss-red);
}

.detail-diff--neutral {
  color: var(--ring-gray-light);
}

@media (max-width: 900px) {
  .quick-status-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-status-item {
    flex: none;
  }
  .quick-status-bar-container,
  .quick-status-total {
  }

  /* When expanded on mobile, span full width */
  .quick-status-item--expandable.expanded {
    grid-column: 1 / -1;
  }
}

/* =============================================================================
   CARDS LAYOUT (Move Lists)
   ============================================================================= */
.cards-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-6);
}

.hint-text {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin-bottom: var(--space-4);
}

.move-list {
  list-style: none;
  display: grid;
  gap: var(--space-2);
  max-height: 400px;
  overflow-y: auto;
}

.move-list li {
  padding: var(--space-3) var(--space-4);
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.move-list li:hover {
  border-color: var(--digital-blue);
  background: var(--info-light);
}

.move-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.move-text {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.move-subline {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  margin-top: var(--space-1);
}

.win-stat { color: var(--win-green); font-weight: var(--weight-medium); }
.draw-stat { color: var(--draw-gray); margin-left: var(--space-2); }
.loss-stat { color: var(--loss-red); margin-left: var(--space-2); }

/* User Turn Message */
.user-turn-message {
  padding: var(--space-4);
  background: var(--canvas);
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: var(--space-4);
}

.user-turn-message p {
  margin-bottom: var(--space-3);
  color: var(--ring-gray);
}

/* =============================================================================
   AUTH PAGES
   ============================================================================= */
.auth-container {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.auth-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-6);
  object-fit: contain;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-subtitle {
  text-align: center;
  color: var(--ring-gray);
  margin-bottom: var(--space-6);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
}

.auth-btn.primary {
  background: var(--fighter-red);
  color: white;
}

.auth-btn.primary:hover {
  background: var(--fighter-red-dark);
  transform: translateY(-1px);
}

.auth-btn.google {
  background: white;
  color: var(--knight-black);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.auth-btn.google:hover {
  background: var(--canvas);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}

.auth-divider span {
  color: var(--ring-gray);
  font-size: var(--text-sm);
}

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.auth-links a {
  font-size: var(--text-sm);
}

.auth-message {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.auth-message.success {
  background: var(--success-light);
  color: var(--success);
}

.auth-message.error {
  background: var(--error-light);
  color: var(--error);
}

/* =============================================================================
   STATIC PAGES
   ============================================================================= */
.static-content {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
}

.static-content h1 {
  margin-bottom: var(--space-8);
}

.static-section {
  margin-bottom: var(--space-10);
}

.static-section h2 {
  color: var(--knight-black);
  margin-bottom: var(--space-4);
}

.static-section p {
  line-height: 1.8;
}

/* Thanks Page */
.thanks-intro {
  font-size: var(--text-lg);
  color: var(--ring-gray);
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.thanks-card {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.thanks-card.featured {
  display: flex;
  gap: var(--space-6);
  border-color: var(--fighter-red);
  border-width: 2px;
}

.thanks-icon {
  flex-shrink: 0;
  color: var(--fighter-red);
}

.thanks-content { flex: 1; }

.thanks-card h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.thanks-link a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--fighter-red);
  color: white;
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  margin-top: var(--space-3);
  transition: all var(--transition-fast);
}

.thanks-link a:hover {
  background: var(--fighter-red-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Changelog Page */
.changelog-intro {
  color: var(--ring-gray);
  margin-bottom: var(--space-8);
}

.changelog-entry {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.changelog-entry:last-child {
  border-bottom: none;
}

.changelog-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.changelog-header h2 {
  margin: 0;
}

.changelog-tag {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

.changelog-tag.new {
  background: var(--info-light);
  color: var(--digital-blue);
}

.changelog-tag.launch {
  background: var(--success-light);
  color: var(--success);
}

.changelog-list {
  padding-left: var(--space-5);
}

.changelog-list li {
  margin-bottom: var(--space-2);
  line-height: 1.6;
  color: var(--ring-gray);
}

.changelog-list strong {
  color: var(--knight-black);
}

/* =============================================================================
   PRACTICE PAGE
   ============================================================================= */

.practice-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.practice-page__header h1 {
  margin-bottom: 0;
}

.practice-auth-notice {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--ring-gray);
}

.practice-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--ring-gray);
}

/* Stats grid */
.practice-stats__grid {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.practice-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  min-width: 100px;
  flex: 1;
}

.practice-stat__value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
}

.practice-stat__value--green {
  color: #16a34a;
}

.practice-stat__label {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Week groups */
.practice-week {
  margin-bottom: var(--space-6);
}

.practice-week__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.practice-week__title {
  margin: 0;
  font-size: var(--text-base);
}

.practice-week__summary {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

/* Line groups within a week */
.practice-line-group {
  margin-bottom: var(--space-4);
  margin-left: var(--space-2);
}

.practice-line-group__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--panel);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-1);
  flex-wrap: wrap;
}

.practice-line-group__name {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.practice-line-group__meta {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.practice-line-group__header .practice-rating-bar {
  flex: 1;
  min-width: 60px;
  max-width: 120px;
}

/* Individual session rows */
.practice-line-group__sessions {
  padding-left: var(--space-3);
}

.practice-session-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: var(--text-sm);
}

.practice-session-row:hover {
  background: rgba(0, 0, 0, 0.03);
}

.practice-session-row__time {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  min-width: 130px;
}

.practice-session-row__detail {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  min-width: 40px;
}

.practice-session-row .practice-rating-bar {
  flex: 1;
  max-width: 80px;
}

/* Pagination */
.practice-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.practice-pagination__info {
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

/* Badges */
.practice-badge {
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: var(--weight-semibold);
}

.practice-badge--completed {
  background: #dcfce7;
  color: #16a34a;
}

.practice-badge--deviated {
  background: #fef3c7;
  color: #d97706;
}

.practice-badge--abandoned {
  background: #f3f4f6;
  color: #6b7280;
}

/* Rating bar */
.practice-rating-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: #f3f4f6;
  margin-top: var(--space-1);
}

.practice-rating-bar__green {
  background: #16a34a;
}

.practice-rating-bar__yellow {
  background: #eab308;
}

.practice-rating-bar__red {
  background: #dc2626;
}

/* Detail */
.practice-detail__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
}

.practice-detail__header h2 {
  margin: 0;
}

.practice-detail__meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin-bottom: var(--space-4);
}

/* Move rows */
.practice-detail__moves {
  margin-top: var(--space-4);
}

.practice-move-row {
  display: grid;
  grid-template-columns: 30px 60px 1fr auto auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: var(--text-sm);
}

.practice-move-row--header {
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--ring-gray);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.practice-move-row__num {
  color: var(--ring-gray);
  text-align: right;
}

.practice-move-row__san {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.practice-move-row__dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.practice-move-row__eval {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  min-width: 50px;
  text-align: right;
}

.practice-move-row__rep {
  min-width: 20px;
  text-align: center;
}

.practice-rep-icon--yes {
  color: #16a34a;
}

.practice-rep-icon--no {
  color: #dc2626;
}

/* =============================================================================
   NOTICES & STATUS
   ============================================================================= */
.auth-notice {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.auth-notice p {
  margin: 0;
  font-size: var(--text-sm);
  color: #6D4C00;
}

.auth-notice a {
  color: var(--fighter-red);
  font-weight: var(--weight-semibold);
}

.download-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
}

.download-status p {
  margin: 0;
  font-size: var(--text-sm);
  flex: 1;
}

.status-close-btn {
  background: none;
  border: none;
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
  padding: var(--space-1);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  color: inherit;
}

.status-close-btn:hover {
  opacity: 1;
  transform: none;
  box-shadow: none;
}

.download-status.status-loading {
  background: var(--info-light);
  border: 1px solid var(--digital-blue);
  color: var(--digital-blue-dark);
}

.download-status.status-success {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success);
}

.download-status.status-error {
  background: var(--error-light);
  border: 1px solid var(--error);
  color: var(--error);
}

/* =============================================================================
   IMPORTS & REPERTOIRE LISTS
   ============================================================================= */
.imports-list,
.repertoire-list,
.lines-list {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.imports-list h4,
.repertoire-list h4,
.lines-list h4 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ring-gray);
  margin-bottom: var(--space-3);
}

.imports-list ul,
.repertoire-list ul,
.lines-list ul {
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.import-item,
.repertoire-item,
.line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
}

@media (max-width: 600px) {
  .import-item,
  .repertoire-item,
  .line-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

.import-info,
.repertoire-info,
.line-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.import-header,
.repertoire-header,
.line-header {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--knight-black);
}

.import-details {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-stats {
  font-size: var(--text-xs);
  color: var(--success);
  font-weight: var(--weight-medium);
}

.import-time,
.repertoire-time,
.line-time {
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
  font-style: italic;
}

.import-warning {
  font-size: var(--text-xs);
  color: var(--warning);
  font-weight: var(--weight-medium);
}

.import-status {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
}

.import-status-progress {
  color: var(--info);
  background: rgba(59, 130, 246, 0.1);
}

.import-status-error {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.import-buttons,
.repertoire-buttons,
.line-buttons {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.import-delete-btn,
.repertoire-delete-btn,
.line-delete-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  background: white;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.import-delete-btn:hover,
.repertoire-delete-btn:hover,
.line-delete-btn:hover {
  background: var(--error-light);
  transform: translateY(-1px);
  box-shadow: none;
}

.line-load-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  background: white;
  color: var(--digital-blue);
  border: 1px solid var(--digital-blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.line-load-btn:hover {
  background: var(--info-light);
  transform: translateY(-1px);
  box-shadow: none;
}

.import-refresh-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  background: white;
  color: var(--digital-blue);
  border: 1px solid var(--digital-blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.import-refresh-btn:hover {
  background: var(--info-light);
  transform: translateY(-1px);
  box-shadow: none;
}

.import-active-toggle,
.repertoire-active-toggle input,
.line-active-toggle input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--success);
}

.import-item.import-deleting {
  opacity: 0.4;
  pointer-events: none;
}

.import-item.import-inactive,
.repertoire-item.repertoire-inactive,
.line-item.line-inactive {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.02);
}

.toggle-form-link {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--digital-blue);
  font-weight: var(--weight-medium);
  margin: var(--space-3) 0;
}

/* Line Board (mini board for creating lines) */
.line-board-section {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

@media (max-width: 768px) {
  .line-board-section {
    grid-template-columns: 1fr;
  }
}

.line-board-container {
  min-width: 400px;
  width: 400px;
  height: 400px;
}

@media (max-width: 768px) {
  .line-board-container {
    width: 100%;
    min-width: unset;
    height: auto;
    aspect-ratio: 1;
  }
}

.line-board {
  width: 100%;
  height: 100%;
}

.line-board-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.line-board-history {
  flex: 1;
  min-height: 80px;
  max-height: 120px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.line-move-history {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.line-move-history li {
  display: flex;
  gap: 2px;
}

.line-move-history .move-number {
  color: var(--ring-gray);
}

.line-move-history .move {
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 2px;
}

.line-move-history .move:hover {
  background: rgba(0, 0, 0, 0.08);
}

.line-board-buttons {
  display: flex;
  gap: var(--space-2);
}

.line-fen-moves-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 500px) {
  .line-fen-moves-row {
    grid-template-columns: 1fr;
  }
}

.line-fen-moves-row input[readonly] {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ring-gray);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* =============================================================================
   CONTROLS FORM
   ============================================================================= */
.controls {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.actions-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

/* Icon Button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--ring-gray);
}

.icon-btn:hover {
  background: var(--canvas);
  color: var(--knight-black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* =============================================================================
   UTILITIES
   ============================================================================= */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* Focus Styles for Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--digital-blue);
  outline-offset: 2px;
}

/* Skip to Content Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-5);
  background: var(--fighter-red);
  color: white;
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-3));
  right: var(--space-4);
  z-index: var(--z-tooltip);
  width: min(26rem, calc(100vw - var(--space-4) * 2));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  /* Floating: a notification must never push the board down mid-move */
  pointer-events: none;
}

.toast-container > * {
  pointer-events: auto;
}

.toast-container:empty {
  display: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: toast-slide-down 0.3s ease-out;
}

.toast.toast-hiding {
  animation: toast-slide-up 0.3s ease-in forwards;
}

@keyframes toast-slide-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-slide-up {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.toast-spinner {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 3px solid var(--info-light);
  border-top-color: var(--digital-blue);
  border-radius: 50%;
  animation: toast-spin 0.8s linear infinite;
}

@keyframes toast-spin {
  to {
    transform: rotate(360deg);
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--text-sm);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--knight-black);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  word-wrap: break-word;
}

.toast-close {
  flex-shrink: 0;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ring-gray-light);
  font-size: var(--text-lg);
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--knight-black);
}

/* Toast types */
.toast-loading {
  border-left: 4px solid var(--digital-blue);
  background: linear-gradient(to right, var(--info-light), white);
}

.toast-success {
  border-left: 4px solid var(--success);
  background: linear-gradient(to right, var(--success-light), white);
}

.toast-success .toast-icon {
  background: var(--success);
  color: white;
}

.toast-success .toast-icon::after {
  content: "✓";
  font-weight: bold;
}

.toast-error {
  border-left: 4px solid var(--error);
  background: linear-gradient(to right, var(--error-light), white);
}

.toast-error .toast-icon {
  background: var(--error);
  color: white;
}

.toast-error .toast-icon::after {
  content: "✕";
  font-weight: bold;
}

.toast-info {
  border-left: 4px solid var(--digital-blue);
  background: linear-gradient(to right, var(--info-light), white);
}

.toast-info .toast-icon {
  background: var(--digital-blue);
  color: white;
}

.toast-info .toast-icon::after {
  content: "i";
  font-weight: bold;
  font-style: italic;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 1200px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1240px) {
  .board-layout {
    grid-template-columns: auto 1fr;
  }

  .analysis-column {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  /* Resizing the board takes a drag from a corner: no way to do it by touch, and it overhangs the board */
  .board-resize-handle {
    display: none;
  }

  .board-layout {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .board-column {
    position: static;
  }

  .board-container {
    width: calc(100vw - var(--space-4) * 2);
    max-width: calc(100vw - var(--space-4) * 2);
  }

  .side-grid {
    grid-template-columns: 1fr;
  }

  .cards-layout {
    grid-template-columns: 1fr;
  }

  .global-status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .site-header__inner {
    padding: var(--space-3) var(--space-4);
  }

.site-header__nav {
    display: none;
  }

  .site-header {
    position: relative;
  }

  .site-logo {
    width: 64px;
    height: 64px;
  }

  .site-header__title {
    font-size: var(--text-xl);
  }

  .page-main {
    padding: var(--space-4);
  }

  .skill-toggle {
    grid-template-columns: 1fr;
  }

  .date-range {
    grid-template-columns: 1fr;
  }

  .wizard-steps {
    flex-direction: column;
  }

  .site-footer__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-brand {
    align-items: center;
  }

  .footer-tagline {
    max-width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-3);
  }

  .thanks-card.featured {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }

  .auth-card {
    padding: var(--space-6);
  }

  .card {
    padding: var(--space-4);
  }
}

/* Print Styles */
@media print {
  body::before {
    display: none;
  }

  .site-header,
  .site-footer,
  .skip-link {
    display: none;
  }

  .page-wrapper {
    display: block;
  }

  .page-main,
  .static-content {
    padding: 0;
    max-width: 100%;
  }

  .card,
  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: var(--text-sm);
    color: var(--ring-gray);
  }

  a[href^="#"]::after,
  a[href^="/"]::after {
    content: "";
  }
}

/* =============================================================================
   STUDY LINE CARD
   ============================================================================= */
.study-line-card {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 2px solid var(--digital-blue);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

.study-line-card.collapsed {
  padding: var(--space-2) var(--space-4);
}

@media (max-width: 600px) {
  .study-line-card.collapsed {
    padding: var(--space-2) var(--space-3);
  }
}

.study-line-card__header {
  margin-bottom: var(--space-4);
}

.study-line-card__title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
}

/* Collapsed view */
.study-line-collapsed {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.study-line-card.collapsed .study-line-collapsed {
  display: flex;
}

.study-line-card.collapsed .study-line-form {
  display: none;
}

.study-line-card.collapsed .study-line-card__header {
  display: none;
}

.study-line-collapsed__content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
    flex-grow: 1;
}

.study-line-collapsed__line {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: var(--space-1);
  flex-grow: 1;
}

.study-line-collapsed__line h2{
  margin-bottom: 0;
}

.study-line-collapsed__label {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
}

.study-line-collapsed__value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
  font-family: var(--font-display);
}

.study-line-collapsed__value-detail {
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--ring-gray);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--font-display);
  width:100%;
}

/* Edit dropdown in collapsed study line card */
.edit-dropdown-wrapper {
  position: relative;
}

.edit-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  min-width: 180px;
  overflow: hidden;
}

.edit-dropdown.open {
  display: block;
}

.edit-dropdown__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  font-size: var(--text-sm);
  color: var(--knight-black);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.edit-dropdown__item:hover {
  background: var(--panel);
}

.edit-dropdown__item + .edit-dropdown__item {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.study-line-collapsed__summary {
  display: flex;
  gap: var(--space-2);
}

.study-line-collapsed__chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  background: var(--digital-blue);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius);
}

/* Expanded form */
.study-line-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.study-line-form__field {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.study-line-form__field--line {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .study-line-form__field--line {
    grid-column: span 1;
  }
}

.study-line-form__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--knight-black);
}

.study-line-form__select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  background: white;
  color: var(--knight-black);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.study-line-form__select:hover {
  border-color: var(--digital-blue);
}

.study-line-form__select:focus {
  outline: none;
  border-color: var(--digital-blue);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

.study-line-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.study-line-form__actions-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.study-line-form__actions-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


.study-line-form__actions .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

#addLineBtn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-4);
  color: var(--ring-gray);
}

.empty-state p {
  margin-bottom: var(--space-3);
}

/* =============================================================================
   ONBOARDING BOX
   ============================================================================= */
.onboarding-box {
  background: linear-gradient(135deg, var(--digital-blue) 0%, #1e3a5f 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  color: white;
  box-shadow: var(--shadow-md);
}

.onboarding-box.hidden {
  display: none;
}

.onboarding-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  cursor: pointer;
}

.onboarding-box.collapsed .onboarding-box__header {
  margin-bottom: 0;
}

.onboarding-box__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.onboarding-box__icon {
  font-size: 1.5rem;
}

.onboarding-box__title h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: #e7e6e6;
}

.onboarding-box__collapsed-progress {
  display: none;
  font-size: var(--text-sm);
  opacity: 0.8;
  margin-left: var(--space-2);
}

.onboarding-box.collapsed .onboarding-box__collapsed-progress {
  display: inline;
}

.onboarding-box__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.onboarding-box__chevron {
  transition: transform var(--transition-fast);
  opacity: 0.7;
}

.onboarding-box.collapsed .onboarding-box__chevron {
  transform: rotate(-90deg);
}

.onboarding-box__content {
  transition: all var(--transition-fast);
}

.onboarding-box.collapsed .onboarding-box__content {
  display: none;
}

.onboarding-box__subtitle {
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-sm);
  opacity: 0.9;
  color: white;
}

.onboarding-dismiss-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.onboarding-dismiss-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.onboarding-step:hover:not(.onboarding-step--complete) {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.onboarding-step--complete {
  opacity: 0.7;
  cursor: default;
}

.onboarding-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.onboarding-step--complete .onboarding-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.onboarding-label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.onboarding-arrow {
  font-size: var(--text-lg);
  opacity: 0.5;
}

.onboarding-step:hover:not(.onboarding-step--complete) .onboarding-arrow {
  opacity: 1;
}

.onboarding-box__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.onboarding-progress {
  font-size: var(--text-sm);
  opacity: 0.8;
}

.onboarding-box__footer .btn-ghost {
  color: white;
  opacity: 0.8;
}

.onboarding-box__footer .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

/* Mobile: collapsed by default */
@media (max-width: 600px) {
  .onboarding-box:not(.expanded) {
    padding: var(--space-3);
  }

  .onboarding-box:not(.expanded) .onboarding-box__header {
    margin-bottom: 0;
  }

  .onboarding-box:not(.expanded) .onboarding-box__collapsed-progress {
    display: inline;
  }

  .onboarding-box:not(.expanded) .onboarding-box__chevron {
    transform: rotate(-90deg);
  }

  .onboarding-box:not(.expanded) .onboarding-box__content {
    display: none;
  }
}

/* ==========================================================================
   Support Box
   ========================================================================== */

.support-box {
  background: linear-gradient(135deg, var(--panel) 0%, var(--bg) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
}

.support-box__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.support-box__icon {
  font-size: var(--text-xl);
  color: var(--error);
}

.support-box__header h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin: 0;
}

.support-box__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.support-box__mission {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

.support-box__message {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  line-height: 1.5;
  margin: 0;
}

.support-box__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.support-btn__icon {
  font-size: var(--text-base);
}

/* ==========================================================================
   Ad Space
   ========================================================================== */

.ad-space {
  margin-top: var(--space-4);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ad-space__image {
  width: 100%;
  height: auto;
  display: block;
}

/* Placeholder styling when image doesn't load */
.ad-space__image[src=""],
.ad-space__image:not([src]) {
  min-height: 100px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--panel) 100%);
}

@media (max-width: 600px) {
  .support-box {
    padding: var(--space-4);
  }

  .support-box__actions {
    flex-direction: column;
  }

  .support-box__actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================================================
   LINE SCORE
   ============================================================================= */
.line-score-container {
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.line-score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.line-score-header h4 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--knight-black);
}

.line-score-line-name {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  font-weight: var(--weight-medium);
}

.line-score-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
}

.line-score-buttons {
  display: flex;
  gap: var(--space-2);
}

.line-score-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--ring-gray);
}

.line-score-btn:hover {
  background: var(--canvas);
  color: var(--knight-black);
  border-color: rgba(0, 0, 0, 0.2);
}

.line-score-btn--help {
  color: var(--digital-blue);
  border-color: var(--digital-blue);
}

.line-score-btn--help:hover {
  background: var(--info-light);
  color: var(--digital-blue-dark);
}

.line-score-legend {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.line-score-legend .legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.line-score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.line-score-row {
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.line-score-row:last-child {
  margin-bottom: 0;
}

.line-score-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.line-score-row-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.line-score-move {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
  min-width: 60px;
}

.line-score-indicators {
  display: flex;
  gap: var(--space-2);
  flex: 1;
  justify-content: flex-end;
  margin-right: var(--space-3);
}

.line-score-chevron {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  transition: transform var(--transition-fast);
}

.line-score-row.expanded .line-score-chevron {
  transform: rotate(180deg);
}

/* Details section - hidden by default, slides down */
.line-score-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  background: rgba(0, 0, 0, 0.02);
  border-top: 0 solid rgba(0, 0, 0, 0.06);
}

.line-score-row.expanded .line-score-details {
  max-height: 400px;
  padding: var(--space-3) var(--space-4);
  border-top-width: 1px;
}

.line-score-detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  gap: var(--space-3);
}

.line-score-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ring-gray);
  flex-shrink: 0;
  min-width: 90px;
}

.detail-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--knight-black);
  flex: 1;
  text-align: right;
}

/* Detail state classes */
.detail-good {
  color: var(--success);
}

.detail-warn {
  color: var(--warning);
}

.detail-bad {
  color: var(--error);
}

.detail-text {
  display: inline-block;
}

/* Engine detail styling */
.engine-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.engine-row {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  font-size: var(--text-xs);
}

.engine-row span:first-child {
  color: var(--ring-gray);
}

/* WDL Bar styling */
.wdl-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.wdl-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--ring-gray-light);
}

.wdl-win {
  background: var(--success);
  transition: width 0.3s ease;
}

.wdl-draw {
  background: var(--ring-gray);
  transition: width 0.3s ease;
}

.wdl-loss {
  background: var(--error);
  transition: width 0.3s ease;
}

.wdl-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.wdl-total {
  font-size: var(--text-xs);
  color: var(--ring-gray);
  text-align: right;
}

.line-score-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ring-gray-light);
  transition: background-color var(--transition-fast);
}

/* Combined dot (larger, shown in header) */
.line-score-dot.combined {
  width: 18px;
  height: 18px;
}

/* Rating colors */
.line-score-dot.green {
  background: var(--success);
}

.line-score-dot.yellow {
  background: var(--warning);
}

.line-score-dot.red {
  background: var(--error);
}

.line-score-dot.gray {
  background: var(--ring-gray-light);
  opacity: 0.5;
}

/* Pending/loading state with pulsing animation */
.line-score-dot.pending {
  animation: dot-pulse 1.2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Legend dot styling (no animation) */
.line-score-legend .line-score-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.line-score-legend .text-muted {
  color: var(--ring-gray);
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .line-score-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .line-score-buttons {
    width: 100%;
  }

  .line-score-btn {
    flex: 1;
    text-align: center;
  }

  .line-score-legend {
    width: 100%;
    justify-content: flex-start;
    gap: var(--space-2);
  }

  .line-score-row-header {
    padding: var(--space-2) var(--space-3);
  }

  .line-score-move {
    min-width: 50px;
    font-size: var(--text-sm);
  }

  .line-score-dot {
    width: 12px;
    height: 12px;
  }

  .line-score-dot.combined {
    width: 16px;
    height: 16px;
  }

  .line-score-row.expanded .line-score-details {
    padding: var(--space-2) var(--space-3);
    max-height: 500px;
  }

  .detail-label,
  .detail-value {
    font-size: var(--text-xs);
  }

  .detail-label {
    min-width: 70px;
  }

  .wdl-labels {
    font-size: 10px;
  }
}

/* Lichess auth banner */
.lichess-auth-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff3cd;
  border-bottom: 1px solid #ffc107;
  color: #856404;
  font-size: 14px;
  text-align: center;
}

.lichess-auth-banner a {
  color: #856404;
  font-weight: 600;
  text-decoration: underline;
}

.lichess-auth-banner a:hover {
  color: #533f03;
}

.lichess-auth-banner__close {
  background: none;
  border: none;
  font-size: 18px;
  color: #856404;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.lichess-auth-banner__close:hover {
  color: #533f03;
}

/* =============================================================================
   ADMIN PAGE
   ============================================================================= */

/* .page-wrapper is a flex column: without an explicit width the auto margins shrink the page to its content */
.static-content.admin-page {
  width: 100%;
  max-width: var(--max-width);
}

.admin-page .practice-stat__label {
  text-align: center;
}

.admin-section-title {
  font-size: var(--text-lg);
  color: var(--knight-black);
  margin: var(--space-6) 0 var(--space-3);
}

.admin-section-title__hint {
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--ring-gray);
  margin-left: var(--space-2);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: var(--space-8) 0 var(--space-4);
}

.admin-toolbar__search {
  flex: 1;
  min-width: 220px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  font: inherit;
}

.admin-toolbar__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ring-gray);
  white-space: nowrap;
}

.admin-toolbar__sort select {
  padding: var(--space-2);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--panel);
}

.admin-table-wrapper {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.admin-table th,
.admin-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: top;
}

.admin-table th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--ring-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table th.admin-table__num,
.admin-table td.admin-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-table__row {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.admin-table__row:hover,
.admin-table__row:focus-visible {
  background: var(--info-light);
  outline: none;
}

.admin-table__truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user__name {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.admin-user__email {
  color: var(--ring-gray);
  font-size: var(--text-sm);
}

.admin-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  margin-left: var(--space-1);
}

.admin-badge--ok {
  background: var(--success-light);
  color: var(--success);
}

.admin-badge--warn {
  background: var(--warning-light);
  color: #B45309;
}

.admin-badge--error {
  background: var(--error-light);
  color: var(--error);
}

.admin-badge--muted {
  background: rgba(0, 0, 0, 0.06);
  color: var(--steel);
}

.admin-detail__header {
  margin: var(--space-4) 0 var(--space-6);
}

.admin-detail__header h2 {
  margin-bottom: var(--space-1);
}

.admin-detail__meta {
  font-size: var(--text-sm);
  color: var(--ring-gray);
  margin-top: var(--space-2);
}

.admin-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
}

.admin-steps__item {
  color: var(--ring-gray);
  font-size: var(--text-sm);
}

.admin-steps__item--done {
  color: var(--knight-black);
}

.admin-steps__mark {
  display: inline-block;
  width: 1.2em;
  font-weight: var(--weight-bold);
  color: var(--ring-gray-light);
}

.admin-steps__item--done .admin-steps__mark {
  color: var(--success);
}

.admin-steps__date {
  color: var(--ring-gray);
  margin-left: var(--space-1);
}

.admin-rating {
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-sm);
  padding: 0 4px;
}

.admin-rating--green {
  background: var(--success-light);
  color: var(--success);
}

.admin-rating--yellow {
  background: var(--warning-light);
  color: #B45309;
}

.admin-rating--red {
  background: var(--error-light);
  color: var(--error);
}

.admin-error-text {
  color: var(--error);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
  max-width: 360px;
  word-break: break-word;
}

/* Admin: tabs and filter row */

.admin-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.admin-tabs__tab {
  padding: var(--space-2) var(--space-4);
  color: var(--ring-gray);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.admin-tabs__tab:hover {
  color: var(--knight-black);
}

.admin-tabs__tab--active {
  color: var(--digital-blue);
  border-bottom-color: var(--digital-blue);
}

.admin-filters {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.admin-filters__hint {
  flex-basis: 100%;
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.admin-filters__key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--chart-series-1-soft);
  vertical-align: baseline;
}

/* Admin: charts. Palette validated with the dataviz palette checker against the white panel surface */

.admin-page {
  --chart-surface: var(--panel);
  --chart-series-1: #1565C0;
  --chart-series-1-soft: #9CC2EA;
  --chart-good: #008300;
  --chart-okay: #EDA100;
  --chart-bad: #D03B3B;
  --chart-grid: #ECEFF1;
  --chart-axis: #CFD8DC;
}

.admin-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  transition: opacity var(--transition-base);
}

/* While refetching, hold the previous render instead of flashing a skeleton */
.admin-chart-grid--loading {
  opacity: 0.5;
}

.admin-chart {
  margin: 0;
  background: var(--chart-surface);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}

.admin-chart__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.admin-chart__titles {
  display: flex;
  flex-direction: column;
}

.admin-chart__title {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.admin-chart__subtitle {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.admin-chart__toggle {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  font: inherit;
  font-size: var(--text-xs);
  color: var(--ring-gray);
  cursor: pointer;
}

.admin-chart__toggle:hover,
.admin-chart__toggle[aria-pressed="true"] {
  color: var(--knight-black);
  border-color: rgba(0, 0, 0, 0.3);
}

.admin-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--steel);
}

.admin-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.admin-chart__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.admin-chart__svg {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.admin-chart__svg:focus-visible {
  outline: 2px solid var(--digital-blue-light);
  outline-offset: 2px;
}

.admin-chart__grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.admin-chart__axis {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.admin-chart__tick {
  fill: var(--ring-gray);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.admin-chart__value {
  fill: var(--knight-black);
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

.admin-chart__column {
  transition: opacity var(--transition-fast);
}

.admin-chart__svg:hover .admin-chart__column,
.admin-chart__svg:focus .admin-chart__column {
  opacity: 0.55;
}

.admin-chart__svg .admin-chart__column.admin-chart__column--active {
  opacity: 1;
}

.admin-chart__hit {
  fill: transparent;
}

.admin-chart__empty {
  color: var(--ring-gray);
  font-size: var(--text-sm);
  padding: var(--space-8) 0;
  text-align: center;
  margin: 0;
}

.admin-chart__table {
  border: none;
}

.admin-chart-tooltip {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  background: var(--knight-black);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity var(--transition-fast);
  max-width: 260px;
}

.admin-chart-tooltip--visible {
  opacity: 1;
}

.admin-chart-tooltip__title {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.admin-chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.admin-chart-tooltip__row strong {
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* Tooltip rows key their series with a short stroke, not a box */
.admin-chart-tooltip__key {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

/* Horizontal bars: thin, rounded data-end, square at the baseline, value at the tip */
.admin-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.admin-bars__row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.admin-bars__label {
  color: var(--steel);
}

.admin-bars__track {
  display: block;
  min-width: 0;
  padding-right: 96px;
  border-left: 1px solid var(--chart-axis);
}

.admin-bars__plot {
  display: block;
  position: relative;
  height: 16px;
}

.admin-bars__bar {
  display: block;
  height: 100%;
  background: var(--chart-series-1);
  border-radius: 0 4px 4px 0;
}

.admin-bars__value {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  margin-left: var(--space-2);
  color: var(--ring-gray);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-bars__value strong {
  color: var(--knight-black);
}

/* Version reported by the loaded Stockfish build (from its UCI "id name") */
.engine-version-badge {
  display: block;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
}

.engine-version-badge[data-state="ready"] {
  color: var(--ring-gray);
}

.engine-version-badge[data-state="error"] {
  color: var(--error);
}

/* =============================================================================
   PRACTICE
   The board is the page. Around it: the line being practiced, one verdict at a
   time, and a scoresheet that remembers the practice.
   ============================================================================= */
:root {
  /* One colour per verdict; "best" takes the brand blue so the scale is not only green-to-red */
  --verdict-best: #1565C0;
  --verdict-good: #2E7D32;
  --verdict-inaccuracy: #B7791F;
  --verdict-mistake: #D9620F;
  --verdict-blunder: #C62828;
  --paper: #FFFDF7;
  --paper-rule: rgba(21, 101, 192, 0.14);
}

/* ---- Line header ---- */
.practice-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4) var(--space-8);
  align-items: end;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 3px solid var(--knight-black);
}

.practice-header__name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--knight-black);
}

.practice-header__moves {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--steel);
  margin: var(--space-2) 0 0;
}

.practice-header__idea {
  max-width: 62ch;
  margin: var(--space-2) 0 0;
  font-size: var(--text-lg);
  line-height: 1.4;
  color: var(--slate);
}

.practice-header__side {
  display: grid;
  gap: var(--space-2);
  justify-items: end;
  text-align: right;
}

.practice-header__count {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: 0.03em;
  color: var(--fighter-red);
}

.practice-header__meta {
  margin: 0;
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.practice-header__best {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.practice-header__stars,
.line-picker__stars,
.scoresheet__stars {
  color: #E0A100;
  letter-spacing: 0.08em;
}

.practice-header__actions {
  display: flex;
  gap: var(--space-2);
}

/* Only on an opening's own page (/openings/<slug>), where it links back to the index */
.practice-header__all {
  display: none;
}

body[data-line] .practice-header__all {
  display: inline-flex;
}

/* ---- Board + panel ---- */
.practice-panel {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  align-content: start;
}

@media (min-width: 901px) {
  .board-container {
    width: 520px;
  }

  .practice-panel {
    max-width: 38rem;
  }
}

@media (min-width: 1280px) {
  .board-container {
    width: 580px;
  }
}

.move-badge {
  position: absolute;
  z-index: 5;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  transform: translate(-70%, -30%);
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 2px solid #fff;
  background: var(--badge-color, var(--ring-gray));
  color: #fff;
  font-weight: var(--weight-bold);
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

[data-verdict="best"] { --badge-color: var(--verdict-best); }
[data-verdict="good"] { --badge-color: var(--verdict-good); }
[data-verdict="inaccuracy"] { --badge-color: var(--verdict-inaccuracy); }
[data-verdict="mistake"] { --badge-color: var(--verdict-mistake); }
[data-verdict="blunder"] { --badge-color: var(--verdict-blunder); }

.board-nav__verdict {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  margin-left: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--badge-color, var(--ring-gray));
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-bold);
}

/* ---- Verdict strip: the one loud element on the page ---- */
.move-verdict {
  position: relative;
  padding: var(--space-4) var(--space-5) var(--space-4) calc(var(--space-5) + 6px);
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.move-verdict::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--badge-color, var(--knight-black));
}

.move-verdict[data-verdict="pending"] { --badge-color: var(--ring-gray-light); }
.move-verdict[data-verdict="unavailable"] { --badge-color: var(--ring-gray); }
.move-verdict[data-verdict="finished"] { --badge-color: var(--knight-black); }
.move-verdict[data-verdict="locked"] { --badge-color: var(--fighter-red); }

.move-verdict__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.move-verdict__badge {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--badge-color, var(--knight-black));
}

.move-verdict__move {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--knight-black);
  white-space: nowrap;
}

.move-verdict__insight {
  margin: var(--space-2) 0 0;
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--slate);
  min-height: 1.45em;
}

.move-verdict[data-tone="hook"] .move-verdict__insight {
  color: var(--digital-blue-dark);
}

.move-verdict__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.move-verdict__actions:empty {
  display: none;
}

.move-verdict__link {
  margin-left: auto;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ring-gray);
  text-decoration: underline;
  cursor: pointer;
}

.move-verdict__link:hover {
  color: var(--knight-black);
}

.move-verdict__details {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed rgba(0, 0, 0, 0.15);
  font-size: var(--text-sm);
  color: var(--slate);
}

.move-verdict__detail {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: var(--space-2);
}

.move-verdict__detail-label {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.move-verdict__detail--muted {
  color: var(--ring-gray);
}

@keyframes verdict-stamp {
  0% { transform: scale(1.035); box-shadow: 0 0 0 3px color-mix(in srgb, var(--badge-color, #1A1A1A) 35%, transparent); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

.move-verdict--stamp {
  animation: verdict-stamp 260ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* ---- Scoresheet ---- */
.scoresheet {
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 3px 3px 0 rgba(0, 0, 0, 0.05);
}

.scoresheet__tally {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--knight-black);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.scoresheet__tally-item:empty {
  display: none;
}

.scoresheet__tally-item--combo {
  color: var(--fighter-red);
}

.scoresheet__opening {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--paper-rule);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--steel);
}

.scoresheet__moves {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 264px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.scoresheet__row {
  display: grid;
  grid-template-columns: 3rem 1fr 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--paper-rule);
}

.scoresheet__number {
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  color: var(--ring-gray);
}

.scoresheet__cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-left: 1px solid var(--paper-rule);
  background: none;
  font: inherit;
  color: var(--knight-black);
  text-align: left;
  cursor: pointer;
}

.scoresheet__cell:hover {
  background: rgba(21, 101, 192, 0.06);
}

.scoresheet__cell--empty {
  cursor: default;
}

.scoresheet__cell--rival {
  color: var(--steel);
}

.scoresheet__cell--user {
  font-weight: var(--weight-medium);
}

.scoresheet__glyph {
  min-width: 1.4em;
  font-weight: var(--weight-bold);
  color: var(--badge-color, var(--ring-gray));
}

.scoresheet__share {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--ring-gray-light);
}

.scoresheet__empty {
  padding: var(--space-4);
  font-family: var(--font-body);
  color: var(--ring-gray);
}

/* The finished sheet: the result goes at the bottom, as on paper */
.scoresheet__result {
  padding: var(--space-4);
  border-top: 2px solid var(--knight-black);
  display: grid;
  gap: var(--space-3);
}

.scoresheet__score {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.scoresheet__accuracy {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  line-height: 0.9;
  color: var(--knight-black);
}

.scoresheet__score-side {
  display: grid;
  gap: var(--space-1);
}

.scoresheet__stars {
  font-size: var(--text-2xl);
  line-height: 1;
}

.scoresheet__counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.scoresheet__count {
  color: var(--badge-color);
  font-weight: var(--weight-bold);
}

.scoresheet__xp {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm);
}

.scoresheet__xp li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.18);
}

.scoresheet__xp .scoresheet__xp-total {
  border-bottom: none;
  padding-top: var(--space-1);
  font-weight: var(--weight-bold);
}

.scoresheet__notes {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--slate);
}

.scoresheet__slip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.scoresheet__result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.scoresheet__result-actions .btn-primary {
  flex: 1 1 12rem;
  padding-block: var(--space-4);
  font-size: var(--text-base);
}

@keyframes result-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.scoresheet__result:not(.hidden) {
  animation: result-rise 320ms ease-out;
}

.practice-actions {
  display: flex;
  gap: var(--space-2);
}

/* ---- Analysis: everything the power user had before, one click away ---- */
.analysis-panel {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: var(--space-3);
}

.analysis-panel__summary {
  cursor: pointer;
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
  padding: var(--space-1) 0 var(--space-3);
}

.analysis-panel__hint {
  margin-left: var(--space-2);
  font-weight: var(--weight-normal);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

/* ---- Progress in the header ---- */
.progress-hud {
  --belt-color: #f5f5f5;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-full);
  background: var(--panel);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--knight-black);
  cursor: pointer;
}

.progress-hud:hover {
  border-color: rgba(0, 0, 0, 0.3);
}

.progress-hud__streak {
  font-weight: var(--weight-bold);
  color: var(--ring-gray);
}

.progress-hud__streak[data-active="true"] {
  color: var(--fighter-red);
}

.progress-hud__streak::before {
  content: "\1F525";
  margin-right: 2px;
}

.progress-hud__belt {
  display: grid;
  gap: 3px;
  min-width: 6.5rem;
  text-align: left;
}

.progress-hud__belt-name {
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.progress-hud__bar,
.progress-panel__bar {
  display: block;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.progress-hud__bar-fill,
.progress-panel__bar span {
  display: block;
  height: 100%;
  background: var(--belt-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  border-radius: inherit;
  transition: width var(--transition-slow);
}

.progress-hud__today {
  letter-spacing: 0.15em;
  font-size: 10px;
  color: var(--ring-gray);
}

.progress-hud__today[data-done="true"] {
  color: var(--success);
}

.progress-hud__xp {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--steel);
}

.progress-panel {
  display: grid;
  gap: var(--space-5);
}

.progress-panel__belt-name {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  line-height: 1;
}

.progress-panel__bar {
  height: 10px;
  margin: var(--space-2) 0;
}

.progress-panel__belt-next,
.progress-panel__note {
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.progress-panel__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: var(--space-3);
  margin: 0;
}

.progress-panel__stats div {
  padding: var(--space-3);
  border-left: 3px solid var(--knight-black);
  background: var(--canvas);
}

.progress-panel__stats dt {
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.progress-panel__stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1.1;
}

.progress-panel__heading {
  margin: 0;
}

.progress-panel__lines {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.progress-panel__lines th {
  padding: var(--space-1) var(--space-2);
  border-bottom: 2px solid var(--knight-black);
  text-align: left;
  font-weight: var(--weight-semibold);
}

.progress-panel__lines td {
  padding: var(--space-2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.progress-panel__lines td:not(:first-child),
.progress-panel__lines th:not(:first-child) {
  text-align: right;
  font-family: var(--font-mono);
}

.progress-panel__stars {
  color: #E0A100;
  letter-spacing: 0.08em;
}

.progress-panel__achievements {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-2);
}

.progress-panel__achievements li {
  display: grid;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.progress-panel__achievements li.is-earned {
  border-style: solid;
  border-color: #E0A100;
  background: #FFF8E1;
  color: var(--knight-black);
}

/* ---- Line picker ---- */
.line-picker__columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-6);
}

.line-picker__group h4 {
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 2px solid var(--knight-black);
}

.line-picker__group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--knight-black);
  margin-bottom: var(--space-2);
}

.line-picker__group-header h4 {
  border: none;
  margin: 0;
}

.line-picker__list {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
}

.line-picker__item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 var(--space-3);
  padding: var(--space-2) var(--space-2);
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.line-picker__item:hover {
  background: var(--canvas-warm);
}

.line-picker__name {
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

.line-picker__moves {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

.line-picker__record {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.line-picker__best {
  font-family: var(--font-mono);
  color: var(--knight-black);
}

.line-picker__best[data-score="low"] {
  color: var(--fighter-red);
  font-weight: var(--weight-semibold);
}

.line-picker__note {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.line-picker__best--new {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--ring-gray);
}

/* Suggestions from the user's own games: a row opens into the variations it splits into */
.line-picker__item--tree {
  grid-template-columns: 1fr auto auto;
}

.line-picker__chevron {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  width: 1em;
  text-align: center;
  color: var(--ring-gray);
}

.line-picker__item--tree[aria-expanded="true"] {
  background: var(--canvas-warm);
}

.line-picker__drill {
  padding: var(--space-2) 0 var(--space-3) var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 2px solid var(--canvas-warm);
  margin-left: var(--space-2);
}

.line-picker__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.line-picker__sublist .line-picker__item {
  border-bottom: none;
}

.line-picker__pawn {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.2em;
  margin-right: 0.15em;
}

.line-picker__pawn[data-side="white"] {
  fill: #fff;
  stroke: var(--knight-black);
  stroke-width: 1.6;
}

.line-picker__pawn[data-side="black"] {
  fill: var(--knight-black);
}

.line-picker__rest {
  margin: var(--space-2) 0 0;
  font-style: italic;
}

.line-picker__catalog > summary {
  cursor: pointer;
  padding: var(--space-2) 0;
  font-weight: var(--weight-semibold);
  color: var(--knight-black);
}

#linePickerMoreBtn {
  margin-top: var(--space-2);
}

.line-picker__empty {
  padding: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.line-picker__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.line-picker__option {
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

/* ---- Modal (login wall) ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.62);
}

.modal__box {
  position: relative;
  width: min(30rem, 100%);
  padding: var(--space-8);
  background: var(--panel);
  border-top: 6px solid var(--fighter-red);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  border: none;
  background: none;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--ring-gray);
  cursor: pointer;
}

.modal__lead {
  margin: 0 0 var(--space-1);
  font-weight: var(--weight-semibold);
  color: var(--fighter-red);
}

.modal__title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  line-height: 1;
}

.modal__text {
  margin: 0 0 var(--space-4);
  line-height: 1.5;
  color: var(--slate);
}

.modal__keeps {
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  list-style: none;
  background: var(--canvas-warm);
  border-left: 3px solid #E0A100;
  display: grid;
  gap: var(--space-1);
  font-weight: var(--weight-semibold);
}

.modal__keeps:empty {
  display: none;
}

.modal__actions {
  display: grid;
  gap: var(--space-2);
}

.modal__actions .btn {
  padding-block: var(--space-4);
  font-size: var(--text-base);
}

.modal__foot {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

body.modal-open {
  overflow: hidden;
}

.move-verdict__idea {
  display: none;
  margin: var(--space-2) 0 0;
  line-height: 1.45;
  color: var(--ring-gray);
}

/* ---- Small screens: board first, verdict right under it ---- */
@media (max-width: 900px) {
  .practice-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--space-2);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .practice-header__name {
    font-size: clamp(1.6rem, 7vw, 2.25rem);
  }

  /* The idea moves into the verdict strip so the board is on screen without scrolling */
  .practice-header__idea {
    display: none;
  }

  .move-verdict__idea:not(:empty) {
    display: block;
  }

  .practice-header__side {
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: start;
    text-align: left;
    gap: var(--space-1) var(--space-3);
  }

  .practice-header__meta {
    font-size: var(--text-sm);
  }

  .practice-header__best,
  .practice-header__count {
    grid-column: 1;
  }

  .practice-header__actions {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .board-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .practice-panel {
    width: 100%;
  }

  .progress-hud__xp,
  .progress-hud__today {
    display: none;
  }
}

@media (max-width: 600px) {
  /* The buttons had a column of their own, leaving the line's details a third of the screen to wrap in */
  .practice-header__side {
    grid-template-columns: 1fr;
  }

  .practice-header__actions {
    grid-column: 1;
    grid-row: auto;
    flex-wrap: wrap;
    margin-top: var(--space-1);
  }

  /* A cog is 11px of glyph: it needs a finger-sized box around it to be tappable. Padding only, so the
     box grows inwards: a negative margin to recover the space pushed it out of its own card. */
  .quick-status-cog {
    padding: var(--space-2);
    font-size: var(--text-sm);
    opacity: 0.8;
  }

  .progress-hud {
    gap: var(--space-2);
    padding: 3px var(--space-2);
  }

  .progress-hud__belt {
    min-width: 3.75rem;
  }

  .progress-hud__belt-name {
    font-size: 11px;
  }

  .nav-link--openings {
    display: none;
  }

  /* The logo already carries the name; the header needs the room for progress and login */
  .site-header__title {
    display: none;
  }

  .practice-header__actions .btn {
    padding-inline: var(--space-2);
  }

  .move-verdict__badge {
    font-size: var(--text-2xl);
  }

  .scoresheet__moves {
    max-height: 168px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .move-verdict--stamp,
  .scoresheet__result:not(.hidden) {
    animation: none;
  }
}

/* ---- Openings index ---- */
.openings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--space-4) var(--space-8);
}

.openings-list li {
  padding-top: var(--space-3);
  border-top: 2px solid var(--knight-black);
}

.openings-list a {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--knight-black);
  text-decoration: none;
}

.openings-list a:hover {
  color: var(--fighter-red);
}

.openings-list__moves {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ring-gray);
}

.openings-list p {
  margin: var(--space-1) 0 0;
  line-height: 1.45;
  color: var(--slate);
}

.auth-progress-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--canvas-warm);
  border-left: 3px solid #E0A100;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}
