/* ============================================================
   Blackjack Academy — Design System CSS
   Deep Deck theme: minimalist-technic, dark, professional
   ============================================================ */

/* === DESIGN TOKENS === */
:root {
  --surface-dim: #111317;
  --surface: #111317;
  --surface-card: #181C22;
  --surface-container: #1e2023;
  --surface-container-low: #1a1c1f;
  --surface-container-high: #282a2d;
  --surface-container-highest: #333538;
  --surface-bright: #37393d;
  --surface-variant: #333538;

  --on-surface: #e2e2e6;
  --on-surface-variant: #c2c6d6;
  --on-background: #e2e2e6;

  --primary: #adc6ff;
  --primary-container: #4d8eff;
  --on-primary: #002e6a;
  --on-primary-container: #00285d;
  --on-primary-fixed: #001a42;
  --inverse-primary: #005ac2;

  --secondary: #c4c6cd;
  --secondary-container: #44474d;
  --on-secondary: #2e3036;

  --tertiary: #ffb786;
  --tertiary-container: #df7412;
  --on-tertiary: #502400;

  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --error: #ffb4ab;

  --outline: #8c909f;
  --outline-variant: #424754;
  --border-subtle: rgba(255,255,255,0.06);

  --text-primary: #F9FAFB;
  --text-secondary: #9CA3AF;

  --sidebar-width: 280px;

  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 400ms ease;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--surface-dim);
  color: var(--on-surface);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
select, input { font-family: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* === TYPOGRAPHY === */
.text-headline-xl { font-size: 48px; font-weight: 700; line-height: 56px; letter-spacing: -0.02em; }
.text-headline-lg { font-size: 32px; font-weight: 600; line-height: 40px; letter-spacing: -0.02em; }
.text-headline-md { font-size: 20px; font-weight: 600; line-height: 28px; }
.text-body-lg     { font-size: 18px; font-weight: 400; line-height: 28px; }
.text-body-md     { font-size: 16px; font-weight: 400; line-height: 24px; }
.text-label-md    { font-size: 14px; font-weight: 500; line-height: 20px; letter-spacing: 0.01em; }
.text-label-sm    { font-size: 12px; font-weight: 600; line-height: 16px; }

.text-primary-color  { color: var(--primary); }
.text-secondary-color { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--on-surface-variant); }
.text-white   { color: var(--text-primary); }

/* === LAYOUT === */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface-dim);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) 0;
  z-index: 50;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-lg);
}
.sidebar-logo-img {
  width: 160px;
  height: auto;
  display: block;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.3;
}

.sidebar-logo p {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
  opacity: 0.7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-sm);
}

.nav-section-label {
  padding: var(--space-lg) var(--space-md) var(--space-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--outline);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  border-radius: var(--radius);
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  position: relative;
  border-left: 2px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.nav-item.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: transparent;
  font-weight: 600;
  padding-left: calc(var(--space-md) + 2px);
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.topbar-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--on-surface);
  flex: 1;
  margin: 0 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.level-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.icon-btn:hover { color: var(--primary); background: var(--surface-container); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--secondary-container);
  border: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

/* === PAGE CONTAINER === */
.page-content {
  flex: 1;
  padding: var(--space-lg);
  overflow-y: auto;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-content.no-padding { padding: 0; }

/* === VIEWS === */
.view { display: none; }
.view.active { display: flex; flex-direction: column; flex: 1; }

/* === CARDS === */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: 0 0 20px rgba(173,198,255,0.08);
  transform: translateY(-1px);
}

.card-hover-glow:hover {
  box-shadow: 0 0 20px rgba(173,198,255,0.12);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary-fixed);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-container);
  color: var(--on-surface);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover { background: var(--surface-container-high); }

.btn-ghost {
  background: transparent;
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
}
.btn-ghost:hover { background: var(--surface-container); color: var(--on-surface); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-xl); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius); }
.btn-icon { padding: 10px; border-radius: var(--radius-full); }
.btn-full { width: 100%; }

/* === PROGRESS BARS === */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-container);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.8s ease;
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

/* === STAT CARDS === */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: rgba(173,198,255,0.2);
  box-shadow: 0 0 20px rgba(173,198,255,0.06);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-primary { background: rgba(173,198,255,0.15); color: var(--primary); }

/* === DIVIDER === */
.divider { height: 1px; background: var(--border-subtle); }
.divider-v { width: 1px; background: var(--outline-variant); align-self: stretch; }

/* === FORMS === */
.form-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.form-label { font-size: 12px; font-weight: 600; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.05em; }

.form-select, .form-input {
  background: var(--surface-dim);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(173,198,255,0.1);
}

.form-select option { background: var(--surface-container); color: var(--on-surface); }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle-wrap:hover { background: var(--surface-container-high); }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--outline-variant);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-slider { background: var(--primary-container); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* === TABLES === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--outline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  background: rgba(30,32,35,0.5);
}

.data-table tbody td {
  padding: 14px var(--space-lg);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface-dim); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* === PLAY HUD — big score display === */
.play-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 16px 0;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px;
  gap: 4px;
}
.hud-streak-stat {
  flex-direction: row !important;
  gap: 6px;
  align-items: center;
}
.hud-divider {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
  flex-shrink: 0;
}
.hud-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--on-surface);
  transition: color var(--transition-fast);
  letter-spacing: -0.02em;
}
.hud-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.hud-fire {
  font-size: 22px !important;
  color: #F59E0B !important;
  line-height: 1;
}

/* === HAND VALUE BADGE === */
.hand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  padding: 6px 22px;
  border-radius: var(--radius-full);
  margin-top: 12px;
  border: 2px solid transparent;
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
}
.hand-badge:empty { display: none; }
.badge-stand {
  color: #22C55E;
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.1);
}
.badge-danger {
  color: #F59E0B;
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.1);
}
.badge-low {
  color: var(--primary);
  border-color: rgba(173,198,255,0.35);
  background: rgba(173,198,255,0.08);
}

/* === FEEDBACK — redesigned === */
.feedback-result {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.feedback-big-icon {
  font-size: 44px !important;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.feedback-result-correct .feedback-big-icon { color: #22C55E; }
.feedback-result-wrong .feedback-big-icon { color: #EF4444; }
.feedback-result-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.feedback-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.action-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  border: 2px solid transparent;
}
.wrong-chip {
  color: #EF4444;
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  text-decoration: line-through;
}
.correct-chip {
  color: #22C55E;
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
}

/* === PLAYING CARDS — xCards PNG images === */
.playing-card {
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.4);
  flex-shrink: 0;
  user-select: none;
  transition: transform var(--transition), box-shadow var(--transition);
  line-height: 0;
}

.playing-card.card-sm  { height: 76px;  width: auto; }
.playing-card.card-md  { height: 108px; width: auto; }
.playing-card.card-lg  { height: 145px; width: auto; }
.playing-card.card-xl  { height: 185px; width: auto; }

.card-img {
  display: block;
  height: 100%;
  width: auto;
  border-radius: 8px;
}

.playing-card:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0,0,0,0.65);
}

/* Lang switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  transition: background var(--transition-fast);
  opacity: 0.55;
}
.lang-btn.active { background: var(--surface-container-high); opacity: 1; }

/* Card dealing animation */
@keyframes dealCard {
  from {
    transform: translate(-60px, -40px) rotate(-5deg) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
}

.card-deal {
  animation: dealCard 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* === FEEDBACK PANEL === */
.feedback-panel {
  padding: var(--space-md);
  border-radius: var(--radius-xl);
  border: 1px solid;
  transition: all var(--transition);
}

.feedback-panel.correct {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
  box-shadow: 0 0 20px rgba(34,197,94,0.1);
}

.feedback-panel.incorrect {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.25);
  box-shadow: 0 0 20px rgba(239,68,68,0.1);
}

.feedback-panel.neutral {
  background: var(--surface-container);
  border-color: var(--border-subtle);
}

/* === ACTION BUTTONS (Play Mode) === */
.action-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  cursor: pointer;
  font-family: var(--font-body);
}

.action-btn:hover {
  background: var(--surface-container);
  border-color: var(--outline);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(173,198,255,0.08);
}

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

.action-btn.hit:hover     { border-color: var(--success); color: var(--success); }
.action-btn.stand:hover   { border-color: var(--danger); color: var(--danger); }
.action-btn.double:hover  { border-color: var(--primary); color: var(--primary); }
.action-btn.split:hover   { border-color: var(--tertiary); color: var(--tertiary); }
.action-btn.surrender:hover { border-color: var(--warning); color: var(--warning); }

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

.action-btn .action-key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--outline);
  text-transform: uppercase;
}

/* === BLACKJACK TABLE === */
.bj-table {
  flex: 1;
  background: radial-gradient(circle at center, #1e2023 0%, #111317 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
}

.bj-table::before {
  content: "Blackjack Pays 3 to 2";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  opacity: 0.12;
  pointer-events: none;
  white-space: nowrap;
}

.bj-table::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 350px;
  border: 2px solid var(--outline-variant);
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

/* Card sets */
.card-set {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}

/* Table areas */
.dealer-area, .player-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.area-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  opacity: 0.7;
}

.hand-desc {
  color: var(--on-surface-variant);
  font-size: 13px;
  margin-top: 4px;
}

.dealer-zone, .player-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.zone-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  opacity: 0.6;
}

.hand-display {
  display: flex;
  gap: -12px;
  position: relative;
}

.hand-display .playing-card {
  margin-left: -18px;
}

.hand-display .playing-card:first-child { margin-left: 0; }

.hand-value-badge {
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(77,142,255,0.15);
  border: 1px solid var(--primary-container);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* === TABLE GLOW FX === */
.glow-primary { box-shadow: 0 0 30px rgba(173,198,255,0.12); }
.glow-success { box-shadow: 0 0 30px rgba(34,197,94,0.15); }
.glow-danger  { box-shadow: 0 0 30px rgba(239,68,68,0.15); }

/* Atmospheric blur */
.atmo-glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
}

/* === STRATEGY CHART GRID === */
.strategy-grid {
  display: grid;
  grid-template-columns: 72px repeat(10, 1fr);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.strategy-cell {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 0.5px solid rgba(17,19,23,0.4);
  cursor: help;
  transition: filter var(--transition-fast), transform var(--transition-fast);
  position: relative;
  z-index: 1;
}

.strategy-cell:hover {
  filter: brightness(1.3);
  z-index: 10;
  transform: scale(1.08);
}

.strategy-cell.row-label {
  background: rgba(30,32,35,0.8);
  color: var(--on-surface);
  font-weight: 700;
  cursor: default;
  transform: none;
  filter: none;
  border-right: 1px solid var(--border-subtle);
  font-size: 13px;
}

.strategy-cell.col-header {
  background: var(--surface-dim);
  color: var(--on-surface);
  cursor: default;
  transform: none;
  filter: none;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Tooltip */
.strategy-tooltip {
  position: fixed;
  background: var(--surface-card);
  border: 1px solid var(--primary-container);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  font-size: 13px;
  max-width: 260px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}

.strategy-tooltip.visible { display: block; }

/* === TIMER RING === */
.timer-ring-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.timer-ring-track { stroke: var(--surface-container-high); }
.timer-ring-progress {
  stroke: var(--primary);
  transition: stroke-dashoffset 0.1s linear, stroke var(--transition-fast);
}
.timer-ring-progress.urgent { stroke: var(--danger); }

.timer-value {
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(173,198,255,0.4);
  transition: color var(--transition-fast);
}

.timer-value.urgent { color: var(--danger); text-shadow: 0 0 20px rgba(239,68,68,0.4); }

/* === FLASHCARD === */
.flashcard {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

@keyframes flashcardIn {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.flashcard-animate { animation: flashcardIn 0.3s cubic-bezier(0.16,1,0.3,1) both; }

/* === CHALLENGE CARD === */
.challenge-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  transition: box-shadow var(--transition), transform var(--transition);
}

.challenge-card:hover {
  box-shadow: 0 0 20px rgba(173,198,255,0.08);
  transform: translateY(-2px);
}

/* === HEATMAP === */
.heatmap-cell {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  transition: transform var(--transition-fast);
  cursor: default;
}

.heatmap-cell:hover { transform: scale(1.08); z-index: 5; }

/* === LIVE CHART (SVG line) === */
.chart-container {
  position: relative;
  overflow: hidden;
}

.chart-grid-lines {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0.12;
}

.chart-grid-line { border-top: 1px solid var(--outline); }

/* === MINI BAR CHART === */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}

.mini-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: var(--surface-container);
  min-height: 4px;
  transition: height var(--transition);
}

.mini-bar.active { background: var(--primary); }

/* === CARD COUNTING SESSION === */
.count-display {
  background: var(--surface-card);
  border: 1px solid rgba(173,198,255,0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-xl);
  text-align: center;
}

.count-number {
  font-size: 48px;
  font-weight: 900;
  color: var(--on-surface);
  line-height: 1;
  transition: color var(--transition-fast), transform 0.15s;
}

.count-number.positive { color: var(--success); }
.count-number.negative { color: var(--danger); }

@keyframes countBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.count-bump { animation: countBump 0.2s ease; }

/* Large card for counting trainer */
.count-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-md);
  width: 200px;
  height: 280px;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes countCardDeal {
  from { transform: translate(-100px,-80px) rotate(-8deg) scale(0.7); opacity: 0; }
  to   { transform: translate(0,0) rotate(0) scale(1); opacity: 1; }
}

.count-card-deal { animation: countCardDeal 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }

.count-card .card-rank-big { font-size: 36px; font-weight: 900; font-family: Georgia, serif; line-height: 1; }
.count-card .card-suit-big { font-size: 28px; line-height: 1; }
.count-card .card-center   { font-size: 72px; text-align: center; line-height: 1; }

/* === KEYBOARD SHORTCUTS === */
.kbd {
  display: inline-block;
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  color: var(--on-surface-variant);
}

/* === NOTIFICATIONS / TOASTS === */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: auto;
  font-size: 14px;
  font-weight: 500;
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}
.toast { animation: toastIn 0.3s ease forwards; }
.toast.out { animation: toastOut 0.3s ease forwards; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: scale(0.96);
  transition: transform var(--transition);
}

.modal-overlay.active .modal { transform: scale(1); }

/* === PROFILE RING === */
.profile-ring {
  position: relative;
  display: inline-block;
}

.profile-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary-container);
  pointer-events: none;
}

.profile-avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-container), var(--secondary-container));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
}

/* === ACHIEVEMENT BADGE === */
.achievement-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-container-high);
  border: 2px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.achievement-badge.earned {
  border-color: var(--primary-container);
  box-shadow: 0 0 16px rgba(77,142,255,0.25);
}

.achievement-badge.locked { filter: grayscale(1); opacity: 0.4; }

/* === MINI CHART BARS === */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.chart-bar {
  flex: 1;
  background: rgba(173,198,255,0.15);
  border-radius: 3px 3px 0 0;
  transition: height var(--transition), background var(--transition-fast);
  min-height: 4px;
  cursor: pointer;
}

.chart-bar:hover { background: var(--primary); }
.chart-bar.current { background: var(--primary); }

/* === MOBILE (bottom nav) === */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--surface-card);
  border-top: 1px solid var(--border-subtle);
  z-index: 60;
  padding: var(--space-sm) 0;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm);
  color: var(--on-surface-variant);
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: color var(--transition-fast);
  cursor: pointer;
  min-width: 60px;
}

.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--primary); }

/* Menu hamburger for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
}

/* ── Dashboard grids ─────────────────────────────────────── */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dash-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.mode-card-icon {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 8px;
}
.mode-card-desc {
  color: var(--on-surface-variant);
  margin-top: 4px;
}

/* ── Page containers ─────────────────────────────────────── */
.dashboard-container,
.play-container, .speed-container, .focus-container,
.flashcard-container, .counting-container, .analyzer-container,
.charts-container, .stats-container, .challenges-container,
.profile-container, .settings-container, .learn-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-lg);
}

/* === RESPONSIVE === */

/* ── Tablet / no-sidebar (≤1024px) ──────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    display: none;
    flex-direction: column;
  }
  .sidebar.sidebar-open {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100%;
    z-index: 999;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }

  .main-content { margin-left: 0; }
  .mobile-nav   { display: flex; }
  .page-content { padding-bottom: 80px; }

  /* 2-col grids on tablet */
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-mode-grid  { grid-template-columns: repeat(2, 1fr); }

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

  /* Strategy table smaller font */
  .strat-th, .strat-td { padding: 5px 6px; font-size: 11px; min-width: 28px; }
}

/* ── Mobile (≤640px) ─────────────────────────────────────── */
@media (max-width: 640px) {
  .text-headline-xl { font-size: 28px; line-height: 36px; }
  .text-headline-lg { font-size: 20px; line-height: 28px; }
  .text-headline-md { font-size: 17px; }

  .topbar { padding: 0 12px; height: 56px; }
  .topbar-title { font-size: 16px; }

  .dashboard-container,
  .play-container, .speed-container, .focus-container,
  .flashcard-container, .counting-container, .analyzer-container,
  .charts-container, .stats-container, .challenges-container,
  .profile-container, .settings-container, .learn-container {
    padding: 12px;
  }

  /* Stats always 2-col on mobile */
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-mode-grid  { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* BJ table */
  .bj-table { padding: 16px 10px; gap: 16px; }
  .playing-card.card-lg { height: 100px; }
  .playing-card.card-xl { height: 120px; }
  .playing-card.card-md { height: 80px; }

  /* Action buttons — wrap into 3+2 on small screens */
  .action-buttons { gap: 6px; }
  .action-btn {
    padding: 9px 6px;
    font-size: 12px;
    min-width: 56px;
    flex: 1;
  }
  .action-btn .material-symbols-outlined { font-size: 18px; }

  /* Speed mode */
  .speed-hud { gap: 16px; }
  .speed-timer-wrap { width: 64px; height: 64px; }
  .timer-ring { width: 64px; height: 64px; }
  .timer-value { font-size: 16px; }
  .speed-stat span { font-size: 20px; }

  /* Cards in analyzer */
  .analyzer-layout { grid-template-columns: 1fr; }

  /* Strategy table */
  .strat-th, .strat-td { padding: 4px 5px; font-size: 10px; min-width: 24px; }

  /* Flashcard */
  .flashcard { padding: 20px 14px; min-height: 200px; }
  .fc-rate-actions { flex-direction: column; }
  .fc-rate-actions .btn { width: 100%; }

  /* Settings */
  .settings-item { flex-wrap: wrap; gap: 8px; }

  /* Learn */
  .learn-section-header { padding: 14px 16px; }

  /* Challenges */
  .challenge-card { padding: 14px; }

  /* Focus mode grid */
  .focus-mode-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .focus-mode-card { padding: 14px 10px; }

  /* Counting */
  .count-input-area .count-input-row { gap: 6px; }
  .count-guess-btn { min-width: 40px; padding: 6px 4px; font-size: 12px; }

  /* Session bar */
  .play-session-bar { gap: 12px; padding: 8px 12px; }
  .session-stat { font-size: 13px; }

  /* Mobile nav labels */
  .mobile-nav-btn span:last-child { font-size: 10px; }
}

/* ── Very small screens (≤390px) ────────────────────────── */
@media (max-width: 390px) {
  .dash-mode-grid { grid-template-columns: 1fr 1fr; }
  .action-btn { font-size: 11px; min-width: 48px; padding: 8px 4px; }
  .playing-card.card-lg { height: 84px; }
}

/* ── Desktop enhancements (>1024px) ─────────────────────── */
@media (min-width: 1025px) {
  .mobile-nav { display: none; }
  .mobile-menu-btn { display: none; }

  /* Play/focus — bj-table bigger on desktop */
  .bj-table { gap: 32px; padding: 32px; }

  /* Wider sidebar active border */
  .nav-item.active { border-left-width: 3px; }

  /* Speed mode timer bigger */
  .speed-timer-wrap { width: 100px; height: 100px; }
  .timer-ring { width: 100px; height: 100px; }
  .timer-value { font-size: 24px; }
  .speed-stat span { font-size: 28px; }
}

/* === UTILITY CLASSES === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.opacity-60 { opacity: 0.6; }
.opacity-40 { opacity: 0.4; }
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.border-bottom { border-bottom: 1px solid var(--border-subtle); }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }
.hidden { display: none !important; }
.visible { visibility: visible; }
.bg-surface { background: var(--surface); }
.bg-surface-card { background: var(--surface-card); }
.bg-surface-container { background: var(--surface-container); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* === HAND ANALYZER SPECIFIC === */
.card-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

.card-pick-btn {
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  color: var(--on-surface);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.card-pick-btn:hover {
  background: var(--surface-container-high);
  border-color: var(--primary);
  color: var(--primary);
}

.card-pick-btn.selected {
  background: rgba(173,198,255,0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.card-pick-btn .suit-sym { font-size: 14px; }

/* === PAGE-SPECIFIC LAYOUTS === */

/* Play Mode — full height split */
.play-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - 64px);
}

.play-panel-right {
  width: 360px;
  flex-shrink: 0;
  background: var(--surface-container-low);
  border-left: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-lg);
  gap: var(--space-lg);
}

/* Speed Mode — centered layout */
.speed-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  position: relative;
}

/* Card counting layout */
.counting-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-xl);
}

/* Learning center */
.learning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* Pairs display in hand picker */
.suit-btn-row {
  display: flex;
  gap: var(--space-sm);
}

.suit-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: var(--surface-container);
  border: 1px solid var(--border-subtle);
  color: var(--on-surface-variant);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  text-align: center;
}

.suit-btn:hover { background: var(--surface-container-high); }
.suit-btn.red { color: #dc2626; }
.suit-btn.black { color: var(--on-surface); }
.suit-btn.selected { border-color: var(--primary); background: rgba(173,198,255,0.1); }

/* XP Bar animation */
@keyframes xpFill {
  from { width: 0%; }
}
.xp-bar-animate { animation: xpFill 1s ease 0.3s both; }

/* Pulse animations */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
.animate-pulse { animation: pulse 2s infinite; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* Correct/incorrect flash on game area */
@keyframes flashCorrect {
  0%   { background: rgba(34,197,94,0); }
  30%  { background: rgba(34,197,94,0.08); }
  100% { background: rgba(34,197,94,0); }
}
@keyframes flashIncorrect {
  0%   { background: rgba(239,68,68,0); }
  30%  { background: rgba(239,68,68,0.08); }
  100% { background: rgba(239,68,68,0); }
}
.flash-correct   { animation: flashCorrect 0.4s ease; }
.flash-incorrect { animation: flashIncorrect 0.4s ease; }

/* ── Page containers ─────────────────────────────────────── */
/* containers — sizing handled by the responsive section above */

/* ── Play / Focus session bar ────────────────────────────── */
.play-session-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  background: var(--surface-2, var(--surface-container-low));
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.session-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
}
.session-stat .material-symbols-outlined { font-size: 18px; }
.session-stat.streak { color: #F59E0B; }

/* ── Feedback area ───────────────────────────────────────── */
.feedback-area {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin: 16px 0;
  border-left: 4px solid transparent;
}
.feedback-correct {
  background: rgba(34,197,94,0.08);
  border-left-color: #22C55E;
}
.feedback-wrong {
  background: rgba(239,68,68,0.08);
  border-left-color: #EF4444;
}
.feedback-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.feedback-icon { font-size: 20px; }
.feedback-correct .feedback-icon { color: #22C55E; }
.feedback-wrong  .feedback-icon { color: #EF4444; }
.feedback-title { font-size: 16px; font-weight: 600; }
.feedback-ev {
  margin-left: auto;
  font-size: 13px;
  color: #EF4444;
  font-weight: 600;
}
.feedback-action {
  font-size: 14px;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
}
.feedback-explanation {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.6;
}

/* ── Next hand wrap ──────────────────────────────────────── */
.next-wrap {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* ── Action buttons ──────────────────────────────────────── */
.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-2, var(--surface-container));
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  min-width: 80px;
}
.action-btn .material-symbols-outlined { font-size: 22px; }
.action-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.action-btn.hit:hover:not(:disabled)       { border-color: #22C55E; color: #22C55E; background: rgba(34,197,94,0.08); }
.action-btn.stand:hover:not(:disabled)     { border-color: #EF4444; color: #EF4444; background: rgba(239,68,68,0.08); }
.action-btn.double:hover:not(:disabled)    { border-color: #4d8eff; color: #4d8eff; background: rgba(77,142,255,0.08); }
.action-btn.split:hover:not(:disabled)     { border-color: #ffb786; color: #ffb786; background: rgba(255,183,134,0.08); }
.action-btn.surrender:hover:not(:disabled) { border-color: #F59E0B; color: #F59E0B; background: rgba(245,158,11,0.08); }

/* ── Speed Mode ──────────────────────────────────────────── */
.speed-hud {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.speed-timer-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.timer-ring { transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--outline-variant); stroke-width: 5; }
.timer-ring-progress { fill: none; stroke: #4d8eff; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.timer-value {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 700;
  color: var(--on-surface);
  pointer-events: none;
}
.speed-stats { display: flex; gap: 20px; }
.speed-stat { display: flex; flex-direction: column; align-items: center; }
.speed-stat span { font-size: 24px; font-weight: 700; color: var(--primary); }
.speed-stat small { font-size: 11px; color: var(--on-surface-variant); text-transform: uppercase; }
.speed-table { flex: none; }
.speed-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  pointer-events: none;
  animation: flashBig 0.55s ease forwards;
  z-index: 100;
}
.speed-flash.flash-correct { color: #22C55E; }
.speed-flash.flash-wrong   { color: #EF4444; }
@keyframes flashBig {
  0%   { opacity: 1; transform: translate(-50%,-50%) scale(0.8); }
  40%  { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.3); }
}
.speed-setup { max-width: 440px; margin: 0 auto; padding: 32px 24px; }

/* ── Focus Mode ──────────────────────────────────────────── */
.focus-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.focus-mode-card {
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.focus-mode-card:hover { border-color: var(--primary); transform: translateY(-2px); }

/* ── Flashcards ──────────────────────────────────────────── */
.flashcard {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  text-align: center;
}
.fc-scenario .card-set { justify-content: center; }
.fc-scenario > div { margin-bottom: 16px; }
.fc-note {
  display: inline-block;
  background: rgba(239,68,68,0.1);
  color: #EF4444;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  margin-top: 12px;
}
.flashcard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.flashcard-answer { padding-top: 16px; border-top: 1px solid var(--outline-variant); width: 100%; }
.fc-actions, .fc-rate-actions { display: flex; gap: 12px; justify-content: center; }
.fc-cards { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }

/* ── Card Counting ───────────────────────────────────────── */
.count-card-display { margin: 0 auto; }
.count-values-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.count-val-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.val-pos  { background: rgba(34,197,94,0.15);  color: #22C55E; }
.val-neg  { background: rgba(239,68,68,0.15);  color: #EF4444; }
.val-zero { background: var(--surface-container); color: var(--on-surface-variant); }
.count-val-flash {
  font-size: 32px;
  font-weight: 700;
  min-height: 44px;
  margin-top: 12px;
  text-align: center;
}
.flash-pos  { color: #22C55E; }
.flash-neg  { color: #EF4444; }
.flash-zero { color: var(--on-surface-variant); }
.count-guess-btn {
  min-width: 48px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 700;
}
.btn-success-ghost { background: rgba(34,197,94,0.08);  color: #22C55E; border-color: rgba(34,197,94,0.3); }
.btn-danger-ghost  { background: rgba(239,68,68,0.08);  color: #EF4444; border-color: rgba(239,68,68,0.3); }
.btn-success-ghost:hover { background: rgba(34,197,94,0.18); }
.btn-danger-ghost:hover  { background: rgba(239,68,68,0.18); }
.count-input-area { padding: 20px; background: var(--surface-2, var(--surface-container)); border-radius: var(--radius-lg); }
.count-hud { display: flex; justify-content: space-between; align-items: center; }
.count-stats { display: flex; gap: 16px; }
.count-system-info { border-radius: var(--radius-lg); }

/* ── Hand Analyzer ───────────────────────────────────────── */
.analyzer-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.analyzer-input { padding: 24px; }
.analyzer-section + .analyzer-section { margin-top: 24px; }
.picker-group { margin-top: 8px; }
.picker-ranks, .picker-suits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.picker-rank-btn, .picker-suit-btn {
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}
.picker-rank-btn:hover, .picker-suit-btn:hover { border-color: var(--primary); color: var(--primary); }
.picker-rank-btn.active, .picker-suit-btn.active { background: rgba(77,142,255,0.15); border-color: var(--primary); color: var(--primary); }
.analyzer-result { padding: 24px; }
@media (max-width: 680px) {
  .analyzer-layout { grid-template-columns: 1fr; }
}

/* ── Strategy Charts ─────────────────────────────────────── */
.charts-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}
.tab-btn.active {
  background: rgba(77,142,255,0.15);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.charts-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--on-surface-variant); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.charts-table-wrap { overflow-x: auto; }
.strategy-table { border-collapse: collapse; min-width: 520px; }
.strat-th, .strat-td {
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--outline-variant);
  min-width: 34px;
}
.strat-header { background: var(--surface-container); color: var(--on-surface-variant); }
.strat-row-label { background: var(--surface-container) !important; color: var(--on-surface) !important; font-weight: 700; white-space: nowrap; }

/* ── Settings ────────────────────────────────────────────── */
.settings-section + .settings-section { margin-top: 8px; }
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--outline-variant);
  gap: 16px;
}
.settings-item:last-child { border-bottom: none; }
.shortcuts-grid kbd {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: monospace;
}

/* ── Challenges ──────────────────────────────────────────── */
.challenge-card { padding: 20px; transition: border-color var(--transition-fast); }
.challenge-done { border-color: rgba(34,197,94,0.4) !important; }
.challenge-icon { flex-shrink: 0; }
.xp-chip {
  background: rgba(77,142,255,0.12);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-weight: 600;
}

/* ── Learning Center ─────────────────────────────────────── */
.learn-section { padding: 0; overflow: hidden; }
.learn-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  width: 100%;
  background: none;
  border: none;
  color: var(--on-surface);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
}
.learn-section-header:hover { background: var(--surface-container-high); }
.learn-chevron { margin-left: auto; color: var(--on-surface-variant); transition: transform var(--transition-fast); }
.learn-section-body h4 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; color: var(--on-surface); }
.learn-section-body p { font-size: 14px; color: var(--on-surface-variant); line-height: 1.7; margin-bottom: 10px; }
.learn-section-body ul, .learn-section-body ol { padding-left: 20px; color: var(--on-surface-variant); font-size: 14px; line-height: 1.8; }
.learn-section-body li { margin-bottom: 4px; }
.glossary-list, .faq-list { display: flex; flex-direction: column; gap: 12px; }
.glossary-list dt, .faq-list dt { font-size: 14px; font-weight: 600; color: var(--on-surface); margin-bottom: 2px; }
.glossary-list dd, .faq-list dd { font-size: 14px; color: var(--on-surface-variant); line-height: 1.6; margin-left: 16px; }
.tips-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tips-list li { font-size: 14px; color: var(--on-surface-variant); line-height: 1.6; padding-left: 20px; position: relative; }
.tips-list li::before { content: "→"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.training-path { padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.training-path li { padding-left: 40px; position: relative; counter-increment: step; }
.training-path li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; background: rgba(77,142,255,0.15); border: 1px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--primary); }
.training-path li strong { display: block; font-size: 15px; color: var(--on-surface); margin-bottom: 4px; }
.training-path li p { font-size: 13px; color: var(--on-surface-variant); line-height: 1.6; margin: 0; }

/* ── Mode cards (dashboard) ──────────────────────────────── */
.mode-card {
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}
.mode-card:hover { border-color: var(--primary); transform: translateY(-2px); background: rgba(77,142,255,0.05); }

/* ── Dashboard ───────────────────────────────────────────── */
.xp-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(77,142,255,0.1);
  border: 1px solid rgba(77,142,255,0.2);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
}
.mistake-item { flex-wrap: wrap; }
.mistake-item .card-set { gap: 4px; }

/* ── Toasts ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-container-highest);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  pointer-events: auto;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-color: rgba(34,197,94,0.4);  color: #22C55E; }
.toast-error   { border-color: rgba(239,68,68,0.4);  color: #EF4444; }
.toast-info    { border-color: rgba(77,142,255,0.4);  color: var(--primary); }

@media (max-width: 1024px) {
  .toast-container { bottom: 90px; }
}

/* ── surface-2 fallback ──────────────────────────────────── */
.card { background: var(--surface-card, var(--surface-container)); }
