/* ═══════════════════════════════════════
   THE FORGE — styles.css
   v0.1 — All CSS: themes, layout, components
   ═══════════════════════════════════════ */

/* ─── §1 — CSS Reset & Base ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── §2 — Theme: Minimal Dark (default) ─── */
:root {
  --bg: #000000;
  --sidebar: #111111;
  --surface: #0a0a0a;
  --surface-hover: #111111;
  --input-bg: #080808;
  --border: #1c1c1c;
  --border-focus: #333333;
  --text: #f0f0f0;
  --text-dim: #4e4e4e;
  --text-mid: #888888;
  --accent: #e8ff47;
  --accent-dim: rgba(232,255,71,0.08);
  --accent-text: #000000;
  --danger: #ff4444;
  --danger-dim: rgba(255,68,68,0.1);
  --success: #22c55e;
  --success-dim: rgba(34,197,94,0.1);
  --warning: #f59e0b;
  --warning-dim: rgba(245,158,11,0.1);
  --info: #3b82f6;
  --info-dim: rgba(59,130,246,0.1);
  --font-display: 'DM Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --text-shadow: none;
  --text-transform: none;
  --header-h: 52px;
  --tab-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ─── §3 — Theme: Terminal ─── */
[data-theme="terminal"] {
  --bg: #020a02;
  --sidebar: #010701;
  --surface: #050f05;
  --surface-hover: #081408;
  --input-bg: #020602;
  --border: #0d240d;
  --border-focus: #1a3a1a;
  --text: #00ff41;
  --text-dim: #094010;
  --text-mid: #0a6a1a;
  --accent: #00ff41;
  --accent-dim: rgba(0,255,65,0.08);
  --accent-text: #020a02;
  --danger: #ff2020;
  --success: #00ff41;
  --warning: #ffaa00;
  --info: #00aaff;
  --font-display: 'Courier New', monospace;
  --font-body: 'Courier New', monospace;
  --font-mono: 'Courier New', monospace;
  --radius: 2px;
  --radius-sm: 1px;
  --radius-lg: 3px;
  --shadow: 0 0 12px rgba(0,255,65,0.1);
  --text-shadow: 0 0 8px rgba(0,255,65,0.45);
  --text-transform: uppercase;
}

[data-theme="terminal"] * {
  text-shadow: var(--text-shadow);
  text-transform: var(--text-transform);
}

[data-theme="terminal"] input,
[data-theme="terminal"] textarea,
[data-theme="terminal"] code,
[data-theme="terminal"] pre,
[data-theme="terminal"] .code-block {
  text-transform: none;
}

[data-theme="terminal"] .header-logo {
  text-shadow: 0 0 12px rgba(0,255,65,0.8);
}

/* ─── §4 — Matrix Rain Canvas ─── */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

[data-theme="terminal"] #matrix-canvas {
  opacity: 1;
}

/* ─── §5 — Layout ─── */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  font-size: 20px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

#app-content {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-bottom));
  overflow: hidden;
  z-index: 1;
}

.tab-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

.tab-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  -webkit-overflow-scrolling: touch;
}

/* ─── §6 — Tab Bar ─── */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s ease;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn svg {
  flex-shrink: 0;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn:not(.active):hover {
  color: var(--text-mid);
}

/* ─── §7 — Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--text-dim);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  transform: scale(0.99);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.card-body {
  font-size: 14px;
  color: var(--text-mid);
}

.card-row {
  display: flex;
  gap: 12px;
}

.card-row > * {
  flex: 1;
}

/* ─── §8 — Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

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

.btn-primary:active {
  filter: brightness(0.95);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-dim);
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(255,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(255,68,68,0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 36px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
  min-height: 52px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── §9 — Form Fields ─── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 6px;
  margin-top: 16px;
}

.field-label:first-child {
  margin-top: 0;
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 44px;
}

.field-input:focus {
  border-color: var(--accent);
}

.field-input-sm {
  width: 80px;
}

.field-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s ease;
}

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

.field-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.field-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ─── §10 — Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-lg {
  max-width: 640px;
}

.modal-sm {
  max-width: 360px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── §11 — Settings Modal ─── */
.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  gap: 12px;
}

.settings-field {
  flex: 1;
}

.theme-picker {
  display: flex;
  gap: 12px;
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
}

.theme-btn:hover {
  border-color: var(--text-dim);
}

.theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.theme-preview {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}

.theme-preview-dark {
  background: #000000;
  border-color: #e8ff47;
}

.theme-preview-terminal {
  background: #020a02;
  border-color: #00ff41;
}

/* ─── §12 — Toast Notifications ─── */
#toast-container {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  border: 1px solid;
  animation: toast-in 0.25s ease forwards;
  pointer-events: auto;
}

.toast-success {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(34,197,94,0.2);
}

.toast-error {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(255,68,68,0.2);
}

.toast-info {
  background: var(--info-dim);
  color: var(--info);
  border-color: rgba(59,130,246,0.2);
}

.toast-exit {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-12px); }
}

/* ─── §13 — Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-unclassified { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
.badge-weak { background: var(--danger-dim); color: var(--danger); }
.badge-developing { background: var(--warning-dim); color: var(--warning); }
.badge-competent { background: var(--info-dim); color: var(--info); }
.badge-solid { background: var(--success-dim); color: var(--success); }
.badge-mastered { background: rgba(168,85,247,0.1); color: #a855f7; }
.badge-distinction { background: rgba(236,72,153,0.1); color: #ec4899; }
.badge-honours { background: var(--accent-dim); color: var(--accent); }

/* ─── §14 — Subject Pills ─── */
.pill-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}

.pill.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.pill:not(.active):hover {
  border-color: var(--text-dim);
  color: var(--text-mid);
}

/* ─── §15 — Countdown Cards (Dashboard) ─── */
.countdown-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.countdown-card {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
}

.countdown-card:active {
  transform: scale(0.98);
}

.countdown-green { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.05); }
.countdown-amber { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.countdown-red { border-color: rgba(255,68,68,0.3); background: rgba(255,68,68,0.05); }

.countdown-subject {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.countdown-days {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.1;
  margin: 4px 0;
}

.countdown-green .countdown-days { color: var(--success); }
.countdown-amber .countdown-days { color: var(--warning); }
.countdown-red .countdown-days { color: var(--danger); }

.countdown-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── §16 — Dashboard Sections ─── */
.dash-section {
  margin-bottom: 24px;
}

.dash-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.dash-alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 8px;
}

.dash-alert-warning {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.2);
}

.dash-alert-info {
  background: var(--info-dim);
  color: var(--info);
  border: 1px solid rgba(59,130,246,0.2);
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.session-item:last-child {
  border-bottom: none;
}

.session-method {
  color: var(--text-mid);
  font-size: 12px;
}

.session-time {
  color: var(--text-dim);
  font-size: 12px;
}

.quick-start-row {
  display: flex;
  gap: 12px;
}

.quick-start-row .btn {
  flex: 1;
}

/* ─── §17 — Notes Tab ─── */
.topic-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 56px;
}

.topic-list-item:hover {
  border-color: var(--text-dim);
}

.topic-list-item:active {
  transform: scale(0.99);
}

.topic-info {
  flex: 1;
  min-width: 0;
}

.topic-name {
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.topic-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Note detail */
.note-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.note-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.note-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.write-preview-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 36px;
}

.toggle-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.notepad {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
}

.notepad:focus {
  border-color: var(--accent);
}

.note-preview {
  padding: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 300px;
  overflow-y: auto;
}

/* Markdown rendered content */
.note-preview h1 { font-size: 22px; font-weight: 700; color: var(--text); margin: 20px 0 10px; font-family: var(--font-display); }
.note-preview h2 { font-size: 18px; font-weight: 600; color: var(--text); margin: 18px 0 8px; font-family: var(--font-display); }
.note-preview h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 14px 0 6px; font-family: var(--font-display); }
.note-preview p { margin: 8px 0; color: var(--text); font-size: 14px; line-height: 1.6; }
.note-preview ul, .note-preview ol { margin: 8px 0; padding-left: 24px; }
.note-preview li { margin: 4px 0; color: var(--text); font-size: 14px; }
.note-preview strong { font-weight: 600; color: var(--accent); }
.note-preview em { font-style: italic; }
.note-preview hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.note-preview a { color: var(--accent); text-decoration: underline; }

.note-preview pre {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  margin: 12px 0;
}

.note-preview code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

.note-preview pre code {
  color: #e0e0e0;
  background: none;
  padding: 0;
}

.note-preview :not(pre) > code {
  background: rgba(232,255,71,0.08);
  padding: 2px 6px;
  border-radius: 3px;
}

[data-theme="terminal"] .note-preview pre {
  background: #010701;
  border-color: #0d240d;
}

[data-theme="terminal"] .note-preview pre code {
  color: #00ff41;
}

/* ─── §18 — Flashcards ─── */
.deck-group {
  margin-bottom: 16px;
}

.deck-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 52px;
}

.deck-group-header:hover {
  border-color: var(--text-dim);
}

.deck-group-name {
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}

.deck-group-count {
  font-size: 13px;
  color: var(--text-dim);
}

.deck-group-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.deck-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.deck-action-btn:hover {
  color: var(--text);
  border-color: var(--border);
}

/* Study session */
.study-session {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
}

.study-progress {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.study-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.study-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.study-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
}

.study-card-text {
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  max-width: 100%;
  word-wrap: break-word;
}

.study-card-text pre {
  text-align: left;
  background: #111111;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

[data-theme="terminal"] .study-card-text pre {
  background: #010701;
}

.study-card-divider {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.study-card-back {
  color: var(--text-mid);
  font-size: 16px;
}

.study-reveal-btn {
  margin-top: 24px;
}

.study-rating-row {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  flex-shrink: 0;
}

.rate-btn {
  flex: 1;
  padding: 12px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
  text-align: center;
}

.rate-wrong {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(255,68,68,0.2);
}

.rate-hard {
  background: var(--warning-dim);
  color: var(--warning);
  border-color: rgba(245,158,11,0.2);
}

.rate-good {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(34,197,94,0.2);
}

.rate-easy {
  background: var(--info-dim);
  color: var(--info);
  border-color: rgba(59,130,246,0.2);
}

.rate-btn:active {
  transform: scale(0.96);
}

/* Session summary */
.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.summary-stat:last-child {
  border-bottom: none;
}

.summary-stat-label {
  color: var(--text-mid);
}

.summary-stat-value {
  font-weight: 600;
  color: var(--text);
}

/* ─── §19 — Pomodoro ─── */
.pomo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  height: 100%;
}

.pomo-subject-select {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.pomo-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

.pomo-time {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
}

.pomo-time.is-break {
  color: var(--success);
}

.pomo-label {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pomo-count {
  font-size: 24px;
  margin-bottom: 32px;
}

.pomo-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.pomo-topic-display {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ─── §20 — Mini Timer (Pomodoro) ─── */
.mini-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}

.mini-timer:hover {
  filter: brightness(1.2);
}

.mini-timer.hidden {
  display: none;
}

.mini-timer-icon {
  font-size: 14px;
}

/* ─── §21 — Paste Modal ─── */
.paste-area {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
}

.paste-area:focus {
  border-color: var(--accent);
}

/* ─── §22 — Utility Classes ─── */
.hidden { display: none !important; }
.text-dim { color: var(--text-dim); }
.text-mid { color: var(--text-mid); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }

.placeholder-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 20px;
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.placeholder-screen h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--text-dim);
  font-size: 14px;
}

.dashboard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-dim);
  font-size: 14px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  font-size: 14px;
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

/* ─── §23 — Responsive ─── */
@media (min-width: 640px) {
  .tab-scroll {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px;
  }

  .pomo-time {
    font-size: 96px;
  }

  .countdown-days {
    font-size: 48px;
  }

  .modal {
    max-height: 80vh;
  }

  .study-card-text {
    font-size: 22px;
  }
}

/* ─── §24 — Scrollbar ─── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}
