:root {
  --bg-main: #0b0f17;
  --bg-sidebar: #0f1520;
  --bg-card: #141c2b;
  --bg-card-inner: #182234;
  --bg-input: #0d131d;
  --border-color: #223047;
  --border-glow: rgba(99, 102, 241, 0.35);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

.svg-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.svg-icon-lg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Sidebar */
.sidebar {
  width: 268px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
  color: #f8fafc;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* User Profile Card in Sidebar */
.sidebar-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  margin-bottom: 14px;
  text-align: center;
}

.user-avatar-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 1px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  color: #cbd5e1;
}

.user-display-name {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 4px;
}

.user-role-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-bottom: 10px;
}

.user-role-pill.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.sidebar-auth-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
}

.student-profile-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 14px;
}

.student-profile-box label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.student-profile-box select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.student-profile-box select:focus {
  border-color: var(--accent-blue);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 10px 5px;
}

.nav-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-btn.active {
  background: rgba(56, 189, 248, 0.11);
  border-color: rgba(56, 189, 248, 0.28);
  color: var(--accent-blue);
}

/* Main Content */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  min-height: 60px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 21, 32, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.topbar-stats strong {
  color: var(--text-primary);
}

.content-container {
  padding: 24px 28px 60px;
  max-width: 1340px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Section Headers */
.section-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.section-banner h1 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.section-banner p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Toolbar Controls */
.controls-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  align-items: end;
}

@media (max-width: 1024px) {
  .controls-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.control-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.control-select, .control-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.control-select:focus, .control-input:focus {
  border-color: var(--accent-blue);
}

.btn {
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-card-inner);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-amber {
  background: #f59e0b;
  color: #090d14;
  font-weight: 700;
}

.btn-whatsapp {
  background: #16a34a;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: #15803d;
}

/* Live Stats Bar During Typing */
.live-hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.hud-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.hud-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.hud-value.timer {
  color: var(--accent-amber);
}

.hud-value.good {
  color: var(--accent-green);
}

.hud-value.bad {
  color: var(--accent-red);
}

/* Typing Arena */
.typing-arena {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
}

.target-text-display {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  font-size: 19.5px;
  line-height: 1.85;
  height: 195px;
  overflow-y: auto;
  user-select: none;
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  scroll-behavior: smooth;
}

.word-span {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 2px;
  border-radius: 5px;
  transition: background 0.1s;
}

.word-span.active {
  background: rgba(56, 189, 248, 0.18);
  border-bottom: 2px solid var(--accent-blue);
  color: #fff;
}

.word-span.correct {
  color: #4ade80;
}

.word-span.wrong {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  text-decoration: underline wavy rgba(239, 68, 68, 0.7);
}

.word-span.exam-plain.correct,
.word-span.exam-plain.wrong {
  color: var(--text-secondary);
  background: transparent;
  text-decoration: none;
}

.typing-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.typing-input {
  flex: 1;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  color: #fff;
  font-size: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.typing-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.typing-input.input-error {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.06);
}

/* VIP Result Screen */
.vip-showcase-container {
  background: #121924;
  border: 1px solid #26354d;
  border-radius: 18px;
  padding: 26px;
  margin-top: 10px;
}

.vip-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #223046;
}

.vip-header-bar h2 {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.vip-header-bar p {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 3px;
}

.exam-verdict-banner {
  border-radius: var(--radius-md);
  padding: 15px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.exam-verdict-banner.pass {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.exam-verdict-banner.fail {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.vip-top-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 980px) {
  .vip-top-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.vip-metric-card {
  background: #17202e;
  border: 1px solid #28374e;
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.vip-metric-card::after {
  content: "";
  position: absolute;
  top: -28px;
  right: -28px;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 70%);
  pointer-events: none;
}

.vip-metric-icon {
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vip-metric-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
}

.vip-metric-value {
  font-size: 28px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.15;
}

.vip-metric-sub {
  font-size: 12px;
  color: #64748b;
}

.vip-analysis-zone {
  background: #161f2d;
  border: 1px solid #28374e;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.vip-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.chart-wrapper {
  background: #121a26;
  border: 1px solid #223045;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.chart-canvas {
  width: 100%;
  height: 175px;
  display: block;
}

.deep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 980px) {
  .deep-grid {
    grid-template-columns: 1fr;
  }
}

.deep-card {
  background: #161f2d;
  border: 1px solid #28374e;
  border-radius: 14px;
  padding: 20px;
}

.deep-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deep-card p.desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* Keyboard Visual Heatmap */
.keyboard-heatmap-box {
  background: #121925;
  border: 1px solid #233248;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  margin-bottom: 14px;
  overflow-x: auto;
}

.kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.kb-key {
  width: 45px;
  height: 45px;
  background: #1c2738;
  border: 1px solid #2e405c;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.kb-key.home-key::before {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 12px;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 2px;
}

.kb-key-label {
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
}

.kb-key-ms {
  font-size: 9px;
  color: #94a3b8;
  margin-top: 2px;
}

.kb-key.fast {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.55);
}

.kb-key.medium {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.55);
}

.kb-key.slow {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.7);
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #121a26;
  border: 1px solid #223045;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
}

.stat-row-badge {
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-blue {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.hand-balance-bar {
  height: 26px;
  background: #121a26;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  margin: 10px 0;
  border: 1px solid #28374e;
}

.hand-left {
  background: linear-gradient(90deg, #0284c7, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
}

.hand-right {
  background: linear-gradient(90deg, #7c3aed, #db2777);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
}

.coach-box {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(124, 58, 237, 0.12));
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.coach-text h4 {
  font-size: 14.5px;
  font-weight: 800;
  color: #c4b5fd;
  margin-bottom: 5px;
}

.coach-text p {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.55;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.text-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.text-card h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.text-card-cat {
  font-size: 10.5px;
  color: var(--accent-blue);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.text-card p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

textarea.custom-textarea {
  width: 100%;
  min-height: 130px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px;
  font-size: 13.5px;
  resize: vertical;
  margin-bottom: 12px;
  outline: none;
}

textarea.custom-textarea:focus {
  border-color: var(--accent-blue);
}

/* Flashcards */
.flashcard-stage {
  background: linear-gradient(145deg, #151f30, #111826);
  border: 1px solid #283a56;
  border-radius: 16px;
  padding: 28px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 20px;
}

.flashcard-answer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #334868;
  color: #4ade80;
  font-size: 15px;
  line-height: 1.6;
  display: none;
}

.flashcard-answer.visible {
  display: block;
}

/* Auth Modal (Giriş Yap / Kayıt Ol) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 17, 0.78);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.auth-modal {
  background: #131b29;
  border: 1px solid #283954;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.auth-modal-header h3 {
  font-size: 17px;
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #0d131d;
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.auth-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

.auth-tab-btn.active {
  background: #1e293b;
  color: #fff;
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 12px;
  display: none;
}
