/* ===========================================================
   Loksewa Prep - iOS HIG Design System
   Native Apple iOS 17/18 visual language, SF Pro typography,
   frosted glass vibrancy, touch physics, and grouped insets.
   =========================================================== */

/* ---------- Theme: iOS System Light (Default) ---------- */
:root,
[data-theme="paper"] {
  /* iOS System Backgrounds */
  --bg: #F2F2F7;                   /* iOS System Grouped Background */
  --surface: #FFFFFF;              /* Secondary Grouped Background (Cards) */
  --surface-2: #E5E5EA;            /* Tertiary Grouped Background / Inset Track */
  --surface-hover: #EBEBF0;
  
  /* iOS Typography Colors */
  --text: #000000;                 /* iOS System Label */
  --text-soft: #3C3C43;            /* iOS Secondary Label */
  --text-muted: #8E8E93;           /* iOS Tertiary Label */
  
  /* iOS Separators & Hairlines */
  --border: rgba(60, 60, 67, 0.15); /* iOS System Separator (0.5px hairline) */
  --border-strong: rgba(60, 60, 67, 0.29);
  
  /* iOS System Accents */
  --primary: #007AFF;              /* iOS System Blue */
  --primary-strong: #0062CC;
  --primary-soft: rgba(0, 122, 255, 0.12);
  --on-primary: #FFFFFF;
  
  --green: #34C759;                /* iOS System Green */
  --green-soft: rgba(52, 199, 89, 0.14);
  --red: #FF3B30;                  /* iOS System Red */
  --red-soft: rgba(255, 59, 48, 0.14);
  --amber: #FF9500;                /* iOS System Orange */
  --amber-soft: rgba(255, 149, 0, 0.14);
  --gold: #FFCC00;                 /* iOS System Yellow */
  --brand: #007AFF;
  
  /* iOS Materials & Vibrancy */
  --track: rgba(120, 120, 128, 0.16);
  --ring: #007AFF;
  --scrim: rgba(0, 0, 0, 0.35);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.14);
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(60, 60, 67, 0.15);

  --sw-paper: #F2F2F7;
  --sw-sepia: #E8DCC4;
  --sw-slate: #1C1C1E;
  --sw-midnight: #000000;
}

/* ---------- Theme: iOS System Dark / Slate (OLED Pitch Black) ---------- */
[data-theme="slate"] {
  --bg: #000000;                   /* iOS Dark System Background */
  --surface: #1C1C1E;              /* iOS Dark Secondary Grouped */
  --surface-2: #2C2C2E;            /* iOS Dark Tertiary Grouped */
  --surface-hover: #3A3A3C;
  
  --text: #FFFFFF;                 /* iOS Dark Label */
  --text-soft: #EBEBF5;            /* iOS Dark Secondary Label */
  --text-muted: #8E8E93;           /* iOS Dark Tertiary Label */
  
  --border: rgba(84, 84, 88, 0.36); /* iOS Dark Separator (0.5px hairline) */
  --border-strong: rgba(84, 84, 88, 0.6);
  
  --primary: #0A84FF;              /* iOS Dark System Blue */
  --primary-strong: #409CFF;
  --primary-soft: rgba(10, 132, 255, 0.18);
  --on-primary: #FFFFFF;
  
  --green: #30D158;                /* iOS Dark System Green */
  --green-soft: rgba(48, 209, 88, 0.18);
  --red: #FF453A;                  /* iOS Dark System Red */
  --red-soft: rgba(255, 69, 58, 0.2);
  --amber: #FF9F0A;                /* iOS Dark System Orange */
  --amber-soft: rgba(255, 159, 10, 0.2);
  --gold: #FFD60A;                 /* iOS Dark System Yellow */
  --brand: #0A84FF;
  
  --track: rgba(120, 120, 128, 0.28);
  --ring: #0A84FF;
  --scrim: rgba(0, 0, 0, 0.65);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(28, 28, 30, 0.82);
  --glass-border: rgba(84, 84, 88, 0.36);
}

/* ---------- Theme: Midnight (Deep OLED Black) ---------- */
[data-theme="midnight"] {
  --bg: #000000;
  --surface: #141416;
  --surface-2: #222226;
  --surface-hover: #2E2E34;
  --text: #FFFFFF;
  --text-soft: #D1D1D6;
  --text-muted: #8E8E93;
  --border: rgba(84, 84, 88, 0.32);
  --border-strong: rgba(84, 84, 88, 0.55);
  --primary: #5E5CE6;              /* iOS System Indigo */
  --primary-strong: #7D7AFF;
  --primary-soft: rgba(94, 92, 230, 0.2);
  --on-primary: #FFFFFF;
  --green: #30D158;
  --green-soft: rgba(48, 209, 88, 0.18);
  --red: #FF453A;
  --red-soft: rgba(255, 69, 58, 0.2);
  --amber: #FF9F0A;
  --amber-soft: rgba(255, 159, 10, 0.2);
  --gold: #FFD60A;
  --brand: #5E5CE6;
  --track: rgba(120, 120, 128, 0.28);
  --ring: #5E5CE6;
  --scrim: rgba(0, 0, 0, 0.75);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.75);
  --glass-bg: rgba(20, 20, 22, 0.84);
  --glass-border: rgba(84, 84, 88, 0.32);
}

/* ---------- Theme: Sepia (Warm Eye Comfort) ---------- */
[data-theme="sepia"] {
  --bg: #EAE0CE;
  --surface: #F5ECD9;
  --surface-2: #E0D3BE;
  --surface-hover: #EBE0CB;
  --text: #2C220E;
  --text-soft: #5C4B27;
  --text-muted: #87744D;
  --border: rgba(92, 75, 39, 0.16);
  --border-strong: rgba(92, 75, 39, 0.3);
  --primary: #B25E00;
  --primary-strong: #8F4B00;
  --primary-soft: rgba(178, 94, 0, 0.12);
  --on-primary: #FFFFFF;
  --green: #2E7D32;
  --green-soft: rgba(46, 125, 50, 0.14);
  --red: #C62828;
  --red-soft: rgba(198, 40, 40, 0.14);
  --amber: #D86900;
  --amber-soft: rgba(216, 105, 0, 0.14);
  --gold: #B27B00;
  --brand: #B25E00;
  --track: rgba(92, 75, 39, 0.16);
  --ring: #B25E00;
  --scrim: rgba(44, 34, 14, 0.42);
  --shadow: 0 2px 12px rgba(44, 34, 14, 0.05);
  --shadow-lg: 0 16px 40px rgba(44, 34, 14, 0.16);
  --glass-bg: rgba(245, 236, 217, 0.82);
  --glass-border: rgba(92, 75, 39, 0.16);
}

/* ---------- Theme: Mist (Cool Light) ---------- */
[data-theme="mist"] {
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #DFE5ED;
  --surface-hover: #F2F5F8;
  --text: #111827;
  --text-soft: #4B5563;
  --text-muted: #9CA3AF;
  --border: rgba(156, 163, 175, 0.22);
  --border-strong: rgba(156, 163, 175, 0.4);
  --primary: #0284C7;              /* iOS Light Teal / Sky */
  --primary-strong: #0369A1;
  --primary-soft: rgba(2, 132, 199, 0.12);
  --on-primary: #FFFFFF;
  --green: #16A34A;
  --green-soft: rgba(22, 163, 74, 0.14);
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, 0.14);
  --amber: #D97706;
  --amber-soft: rgba(217, 119, 6, 0.14);
  --gold: #CA8A04;
  --brand: #0284C7;
  --track: rgba(156, 163, 175, 0.2);
  --ring: #0284C7;
  --scrim: rgba(17, 24, 39, 0.38);
  --shadow: 0 2px 12px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, 0.14);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(156, 163, 175, 0.22);
}

/* ---------- Theme: Contrast (High Accessibility) ---------- */
[data-theme="contrast"] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #EEEEEE;
  --surface-hover: #E5E5E5;
  --text: #000000;
  --text-soft: #1C1C1E;
  --text-muted: #48484A;
  --border: #8E8E93;
  --border-strong: #000000;
  --primary: #0040DD;
  --primary-strong: #002BB0;
  --primary-soft: rgba(0, 64, 221, 0.15);
  --on-primary: #FFFFFF;
  --green: #007D2C;
  --green-soft: rgba(0, 125, 44, 0.15);
  --red: #D70015;
  --red-soft: rgba(215, 0, 21, 0.15);
  --amber: #9E4D00;
  --amber-soft: rgba(158, 77, 0, 0.15);
  --gold: #8E6500;
  --brand: #0040DD;
  --track: #C7C7CC;
  --ring: #0040DD;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.94);
  --glass-border: #8E8E93;
}

/* ---------- Theme: Ocean (Deep Blue Dark) ---------- */
[data-theme="ocean"] {
  --bg: #070D18;
  --surface: #0E182A;
  --surface-2: #182844;
  --surface-hover: #1F3356;
  --text: #F0F6FC;
  --text-soft: #B5C6DD;
  --text-muted: #7E93AE;
  --border: rgba(126, 147, 174, 0.25);
  --border-strong: rgba(126, 147, 174, 0.45);
  --primary: #38BDF8;
  --primary-strong: #7DD3FC;
  --primary-soft: rgba(56, 189, 248, 0.18);
  --on-primary: #051322;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.18);
  --red: #FB7185;
  --red-soft: rgba(251, 113, 133, 0.2);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.2);
  --gold: #FDE047;
  --brand: #38BDF8;
  --track: rgba(126, 147, 174, 0.24);
  --ring: #38BDF8;
  --scrim: rgba(0, 0, 0, 0.65);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(14, 24, 42, 0.82);
  --glass-border: rgba(126, 147, 174, 0.25);
}

/* ---------- Theme: Grape (Deep Purple Dark) ---------- */
[data-theme="grape"] {
  --bg: #0B0814;
  --surface: #151024;
  --surface-2: #221B38;
  --surface-hover: #2D244A;
  --text: #F5F3FF;
  --text-soft: #C4B5FD;
  --text-muted: #8B7BB5;
  --border: rgba(139, 123, 181, 0.25);
  --border-strong: rgba(139, 123, 181, 0.45);
  --primary: #A78BFA;
  --primary-strong: #C4B5FD;
  --primary-soft: rgba(167, 139, 250, 0.18);
  --on-primary: #120B24;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.18);
  --red: #F87171;
  --red-soft: rgba(248, 113, 113, 0.2);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.2);
  --gold: #FDE047;
  --brand: #A78BFA;
  --track: rgba(139, 123, 181, 0.24);
  --ring: #A78BFA;
  --scrim: rgba(0, 0, 0, 0.65);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(21, 16, 36, 0.82);
  --glass-border: rgba(139, 123, 181, 0.25);
}

/* ---------- Base & iOS Typography Hierarchy ---------- */
:root {
  /* Apple Native Font Stack (SF Pro + Devanagari) */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", "Public Sans", "Noto Sans Devanagari", sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", "Helvetica Neue", "Public Sans", "Noto Sans Devanagari", sans-serif;
  --deva: "Noto Sans Devanagari", -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  
  /* iOS Inset Rounded Radii */
  --radius: 22px;        /* Standard Grouped Inset Card */
  --radius-lg: 28px;     /* Bottom Sheet Modals */
  --radius-md: 16px;     /* Sub-cards & Option Buttons */
  --radius-sm: 12px;     /* Pills & Segmented Indicators */
  --radius-xs: 8px;      /* Badges & Tags */
  
  /* Motion & Spring Physics */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);       /* iOS Native Sheet/View Spring */
  --ease-touch: cubic-bezier(0.4, 0, 0.2, 1);   /* Fast Tactile Response */
  --dur: 0.2s;
  --dur-spring: 0.36s;
  --wrap: 820px;
  --nav-clear: 96px;

  /* Safe Area Inset Variables (Notches, Dynamic Island, Android System Bars) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

/* Apple iOS Sleek Capsule Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.28);
  border-radius: 9999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 128, 0.48);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 128, 0.28) transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  font-size: 17px; /* iOS Body Base Size */
  letter-spacing: -0.005em;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* iOS Typography Scale */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text);
}

h1 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity var(--dur) ease;
}

a:active {
  opacity: 0.7;
}

code {
  font-family: -apple-system-monospaced, "SF Mono", Menlo, Monaco, monospace;
  background: var(--surface-2);
  padding: 0.15em 0.45em;
  border-radius: 6px;
  font-size: 0.88em;
}

.tnum,
.bar-counter,
.snap-stat-num,
.snap-streak-num,
.ring-score,
.ring-label,
#timerDisplay,
.breakdown-val,
.cat-bar-pct,
.best-badge,
.mastery-pct,
.submit-stat-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.minus {
  font-variant-numeric: normal;
}

/* Icon system */
[hidden] {
  display: none !important;
}
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
}
[data-icon][hidden] {
  display: none;
}
[data-icon] svg {
  width: 1em;
  height: 1em;
  display: block;
}
[data-icon] svg [fill="none"] {
  fill: none;
}

/* App Main Container with Notch / Safe Area Inset Support */
#app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 max(var(--sar), 18px) max(var(--sab), 64px) max(var(--sal), 18px);
}
#view-results {
  max-width: 720px;
  margin: 0 auto;
}
.study-col {
  max-width: 820px;
  margin: 0 auto;
}
.view[hidden] {
  display: none !important;
}

/* ---------- iOS Active Touch Target Physics ---------- */
.ios-touch-target,
.btn,
.icon-btn,
.set-row,
.tool-card,
.option-btn,
.review-tab,
.seg,
.chip,
.ios-back-btn {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ios-touch-target:active,
.btn:active,
.tool-card:active,
.set-row:active {
  transform: scale(0.975);
  opacity: 0.84;
  transition: transform 0.12s var(--ease-touch), opacity 0.12s ease;
}

/* ---------- Top Navigation Bar (Frosted Glass Vibrancy) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(var(--sat), 12px) 0 12px;
  margin-bottom: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid transparent;
  transition: border-color var(--dur) ease, background var(--dur) ease;
}
.topbar.scrolled {
  border-bottom-color: var(--border);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.wordmark-mark {
  font-size: 24px;
  color: var(--brand);
}
.wordmark-mark svg {
  fill: currentColor;
  stroke: none;
}
.wordmark-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.015em;
}
.wordmark-dim {
  color: var(--text-muted);
  font-weight: 500;
}
.topbar-utils {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* iOS Standard Navigation Back Button Pattern */
.ios-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--primary);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease, transform 0.12s var(--ease-touch);
}
.ios-back-btn:active {
  opacity: 0.55;
  transform: scale(0.97);
}
.ios-back-btn [data-icon] {
  font-size: 20px;
}
.ios-back-label {
  letter-spacing: -0.005em;
}

/* Circular iOS Utility Buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  min-width: 38px;
  border-radius: 50%;
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 0.12s var(--ease-touch), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn [data-icon] {
  font-size: 18px;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.icon-btn:active {
  transform: scale(0.93);
  opacity: 0.8;
}
.icon-btn.on {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Theme menu */
.theme-wrap {
  position: relative;
}
.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 60;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  animation: sheetIn 0.25s var(--ease);
}
.theme-menu[hidden] {
  display: none;
}
.theme-menu-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}
.theme-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-height: 44px;
  transition: background var(--dur) ease, transform 0.1s ease;
}
.theme-opt:hover {
  background: var(--surface-hover);
}
.theme-opt:active {
  transform: scale(0.98);
}
.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.sw-paper {
  background: linear-gradient(135deg, #F2F2F7 55%, #007AFF 55%);
}
.sw-sepia {
  background: linear-gradient(135deg, #EAE0CE 55%, #B25E00 55%);
}
.sw-slate {
  background: linear-gradient(135deg, #1C1C1E 55%, #0A84FF 55%);
}
.sw-midnight {
  background: linear-gradient(135deg, #000000 55%, #5E5CE6 55%);
}
.sw-mist {
  background: linear-gradient(135deg, #EEF2F6 55%, #0284C7 55%);
}
.sw-contrast {
  background: linear-gradient(135deg, #FFFFFF 55%, #0040DD 55%);
}
.sw-ocean {
  background: linear-gradient(135deg, #070D18 55%, #38BDF8 55%);
}
.sw-grape {
  background: linear-gradient(135deg, #0B0814 55%, #A78BFA 55%);
}
.sw-custom {
  background: conic-gradient(from 210deg, #FF3B30, #FF9500, #34C759, #007AFF, #AF52DE, #FF3B30);
}
.theme-opt-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.theme-opt-name {
  font-weight: 600;
  font-size: 15px;
}
.theme-opt-note {
  font-size: 12px;
  color: var(--text-muted);
}
.theme-check {
  font-size: 18px;
  color: var(--primary);
  opacity: 0;
}
.theme-opt.active .theme-check {
  opacity: 1;
}
.theme-opt.active {
  background: var(--primary-soft);
}
.theme-menu-sep {
  height: 0.5px;
  background: var(--border);
  margin: 6px 4px;
}
/* iOS 18 Tinted Accent Selector */
.theme-accent-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 10px 8px;
}
.accent-dot {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 9999px;
  background: var(--ac);
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 2px 8px -1px color-mix(in srgb, var(--ac) 45%, transparent);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.accent-dot:hover {
  transform: scale(1.12);
}
.accent-dot:active {
  transform: scale(0.92);
}
.accent-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--ac), 0 4px 12px color-mix(in srgb, var(--ac) 60%, transparent);
  transform: scale(1.08);
}
.accent-dot.active::after {
  content: "";
  position: absolute;
  inset: 5px;
  background: #ffffff;
  border-radius: 9999px;
  opacity: 0.9;
}
.theme-opt-edit {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  opacity: 0;
}
.theme-opt:hover .theme-opt-edit {
  opacity: 1;
}

/* ---------- Theme Editor ---------- */
.editor-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.editor-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.swatch-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s var(--ease-touch), border-color var(--dur) var(--ease);
}
.swatch-btn:hover {
  transform: scale(1.08);
}
.swatch-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}
.color-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
  align-self: flex-start;
}
.color-pick input[type="color"] {
  width: 44px;
  height: 32px;
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  padding: 2px;
}
.editor-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: var(--surface-2);
}
.editor-preview .pv-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.editor-preview .pv-text {
  font-size: 15px;
  color: var(--text);
  flex: 1;
}
.editor-preview .pv-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--green-soft);
  color: var(--green);
}

/* ---------- Hero & Grouped Snapshot ---------- */
.hero {
  padding: 16px 0 24px;
}
.hero-greeting {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.hero-title {
  font-size: clamp(30px, 5.2vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 10px;
}
.hero-accent {
  color: var(--brand);
}
.hero-sub {
  color: var(--text-soft);
  font-size: 16px;
  max-width: 62ch;
  line-height: 1.5;
  margin-bottom: 22px;
}

/* Grouped Inset Snapshot Card */
.snapshot {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 32px);
  padding: 18px 22px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.snap-streak {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.snap-streak-flame {
  font-size: 26px;
  color: var(--amber);
  align-self: center;
}
.snap-streak.cold .snap-streak-flame {
  color: var(--text-muted);
}
.snap-streak-num {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}
.snap-streak-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.snap-divider {
  width: 0.5px;
  align-self: stretch;
  background: var(--border);
  min-height: 36px;
}
.snap-stats {
  display: flex;
  gap: clamp(16px, 4vw, 32px);
  flex-wrap: wrap;
}
.snap-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.snap-stat-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.snap-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Daily goal ring */
.snap-daily {
  display: flex;
  align-items: center;
  gap: 12px;
}
.daily-ring {
  position: relative;
  width: 52px;
  height: 52px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.daily-ring #dailyArc {
  transition: stroke-dashoffset 0.7s var(--ease), stroke 0.3s var(--ease);
}
.daily-ring.done #dailyArc {
  stroke: var(--green);
}
.daily-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.daily-ring.done .daily-center {
  color: var(--green);
}
.daily-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.daily-today {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}
.daily-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Start Row & Launch Card ---------- */
.start-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 34px;
}

.exam-launch-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.exam-launch-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.exam-badge {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.exam-launch-copy h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 3px;
}
.exam-launch-copy p {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.45;
}

.resume-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  font-family: inherit;
  transition: transform 0.12s var(--ease-touch), background var(--dur) ease;
}
.resume-card[hidden] {
  display: none;
}
.resume-card:active {
  transform: scale(0.975);
  background: var(--surface-hover);
}
.resume-icon {
  font-size: 24px;
  color: var(--primary);
  flex-shrink: 0;
}
.resume-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.resume-kicker {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.resume-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.resume-go {
  font-size: 20px;
  color: var(--text-muted);
}

/* ---------- Block Headers ---------- */
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.block-head[hidden] {
  display: none;
}
.block-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.block-title [data-icon] {
  font-size: 19px;
  color: var(--text-soft);
}
.block-hint {
  font-size: 13px;
  color: var(--text-muted);
}
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 6px;
  border-radius: 6px;
  transition: opacity 0.15s ease;
}
.link-btn:active {
  opacity: 0.6;
}

/* ---------- Segmented Practice Category Switcher ---------- */
.sets-segmented-wrap {
  margin: 10px 0 16px;
  display: flex;
}
.sets-segmented {
  display: flex;
  width: 100%;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  border: 0.5px solid var(--border);
}
.sets-segmented .seg-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 38px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
}
.sets-segmented .seg-btn:hover {
  color: var(--text);
}
.sets-segmented .seg-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 0.5px 1px rgba(0, 0, 0, 0.08);
}
.sets-segmented .seg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.sets-segmented .seg-btn.active .seg-badge {
  background: var(--primary-soft);
  color: var(--primary);
}
.set-row-subjective .set-num {
  background: rgba(88, 86, 214, 0.14);
  color: #5856D6;
}
[data-theme="midnight"] .set-row-subjective .set-num,
[data-theme="slate"] .set-row-subjective .set-num {
  background: rgba(94, 92, 230, 0.2);
  color: #5E5CE6;
}

/* ---------- Grouped Inset Practice Sets ---------- */
.sets-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 34px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.set-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--border);
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: background 0.12s ease;
  min-height: 60px;
}
.set-row:last-child {
  border-bottom: none;
}
.set-row:hover {
  background: var(--surface-hover);
}
.set-row:active {
  background: var(--surface-2);
}
.set-row.errored {
  opacity: 0.5;
  cursor: not-allowed;
}
.set-num {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  background: var(--primary-soft);
  color: var(--primary);
}
.set-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.set-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}
.set-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.set-mastery {
  flex: 1;
  max-width: 200px;
}
.set-count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.set-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.set-cta-text {
  font-size: 14px;
  font-weight: 500;
}
.set-cta [data-icon] {
  font-size: 18px;
}
.set-row:hover .set-cta {
  color: var(--primary);
}
.best-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border: 0.5px solid color-mix(in srgb, var(--gold) 34%, transparent);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.best-badge [data-icon] {
  font-size: 13px;
}

/* ---------- Grouped Inset Exam History ---------- */
.history-wrap {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 36px;
  -webkit-overflow-scrolling: touch;
}
.history-wrap[hidden] {
  display: none;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14.5px;
  font-family: var(--font);
}
.history-table thead {
  background: var(--surface-2);
  border-bottom: 0.5px solid var(--border);
}
.history-table th {
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-table td {
  padding: 13px 16px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  vertical-align: middle;
}
.history-table tbody tr:last-child td {
  border-bottom: none;
}
.history-row {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s var(--ease-touch);
  user-select: none;
  -webkit-user-select: none;
}
.history-row:hover td {
  background: var(--surface-hover);
}
.history-row:active {
  transform: scale(0.995);
  opacity: 0.92;
}
.history-row:focus-visible td {
  background: var(--surface-hover);
}
.hist-cell-action {
  width: 28px;
  padding-left: 0 !important;
  padding-right: 14px !important;
  text-align: right;
}
.hist-chevron {
  color: var(--text-muted);
  font-size: 15px;
  transition: transform 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  opacity: 0.55;
  display: inline-flex;
}
.history-row:hover .hist-chevron {
  color: var(--primary);
  opacity: 1;
  transform: translateX(2px);
}
.hist-mode-title {
  font-weight: 600;
  color: var(--text);
}
.pill-pass {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green);
}
.pill-fail {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--red-soft);
  color: var(--red);
}

/* Mastery Track */
.mastery-track {
  height: 6px;
  background: var(--track);
  border-radius: 9999px;
  overflow: hidden;
}
.mastery-fill {
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  transform-origin: left;
  transition: transform 0.7s var(--ease);
}

/* Weak Areas Grid */
.weak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 34px;
}
.weak-grid[hidden] {
  display: none;
}
.weak-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease-touch), background var(--dur) ease;
}
.weak-card:hover {
  background: var(--surface-hover);
}
.weak-card:active {
  transform: scale(0.975);
}
.weak-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.weak-card-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
}
.weak-card-pct {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--amber);
}
.weak-card-foot {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Study Tools Row ---------- */
.tools-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 34px;
}
.tools-row:empty {
  display: none;
}
.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease-touch), background var(--dur) ease;
  min-height: 64px;
}
.tool-card[hidden] {
  display: none;
}
.tool-card:hover {
  background: var(--surface-hover);
}
.tool-card:active {
  transform: scale(0.975);
}
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.tool-mistakes .tool-icon,
.tool-saved .tool-icon {
  background: var(--amber-soft);
  color: var(--amber);
}
.tool-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.tool-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.tool-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
}
.tool-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.tool-go {
  font-size: 20px;
  color: var(--text-muted);
}
.tool-card:hover .tool-go {
  color: var(--primary);
}

/* ---------- Buttons (iOS HIG Physicality) ---------- */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 17px;
  padding: 12px 20px;
  min-height: 48px;
  min-width: 44px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s var(--ease-touch), opacity 0.12s ease, background var(--dur) ease;
  white-space: nowrap;
}
.btn [data-icon] {
  font-size: 19px;
}
.btn:active {
  transform: scale(0.975);
  opacity: 0.84;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.22);
}
.btn-primary:hover {
  background: var(--primary-strong);
}
.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  border: 0.5px solid rgba(0, 122, 255, 0.25);
}
.btn-secondary:hover {
  background: var(--surface-hover);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 500;
}
.btn-ghost:hover {
  background: var(--surface-hover);
}
.btn-nav {
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 18px;
}
.btn-nav:hover {
  background: var(--surface-hover);
}
.btn-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-next {
  background: var(--primary);
  color: #ffffff;
  padding: 12px 22px;
}
.btn-next:hover {
  background: var(--primary-strong);
}
.btn-next:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}
.btn-mark {
  background: var(--surface-2);
  color: var(--text-soft);
  padding: 12px 16px;
}
.btn-mark:hover {
  color: var(--amber);
}
.btn-mark.marked {
  background: var(--amber-soft);
  color: var(--amber);
}
.btn-skip {
  background: var(--surface-2);
  color: var(--text-soft);
  padding: 12px 16px;
}
.btn-danger {
  background: var(--red);
  color: #ffffff;
}
.btn-submit {
  width: 100%;
  background: var(--green);
  color: #ffffff;
  margin-top: auto;
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.25);
}
.btn-submit:hover {
  filter: brightness(1.05);
}
.btn-submit[hidden] {
  display: none;
}
.btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* ---------- iOS Segmented Controls ---------- */
.study-modeswitch,
.review-tabs,
.chip-row,
.builder-type,
.seg-group,
#importTypeSwitch {
  background: rgba(118, 118, 128, 0.12);
  padding: 3px;
  border-radius: 14px;
  display: inline-flex;
  gap: 2px;
  border: none;
}
.study-modeswitch .seg,
.seg-group .seg,
.review-tab,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  min-height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.study-modeswitch .seg:hover,
.seg-group .seg:hover,
.review-tab:hover,
.chip:hover {
  color: var(--text);
}
.study-modeswitch .seg.active,
.seg-group .seg.active,
.review-tab.active,
.chip.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}
.review-tab span {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Quiz Bar & Navigation ---------- */
.quiz-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 10px 0 18px;
  box-shadow: var(--shadow);
}
.bar-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.results-bar .bar-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.bar-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  padding: 5px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--border);
}
.bar-timer[hidden] {
  display: none;
}
.bar-timer [data-icon] {
  font-size: 16px;
  color: var(--text-soft);
}
.bar-timer.warn {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-soft);
}
.bar-timer.warn [data-icon] {
  color: var(--amber);
}
.bar-timer.danger {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
  animation: pulse 1s ease-in-out infinite;
}
.bar-timer.danger [data-icon] {
  color: var(--red);
}

.bar-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--amber);
  padding: 4px 10px;
  background: var(--amber-soft);
  border-radius: var(--radius-xs);
  border: 0.5px solid color-mix(in srgb, var(--amber) 34%, transparent);
  white-space: nowrap;
  animation: streakPop 0.3s var(--ease);
}
.bar-streak[hidden] {
  display: none;
}
.bar-streak [data-icon] {
  font-size: 15px;
}

.bar-progress-wrap {
  flex: 1;
  min-width: 44px;
  height: 6px;
  background: var(--track);
  border-radius: 9999px;
  overflow: hidden;
}
.bar-progress {
  height: 100%;
  width: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.35s var(--ease);
}
.bar-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

/* ---------- Palette Drawer (iOS Bottom Sheet / Slide-Over) ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 70;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade 0.2s ease;
}
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade 0.2s ease;
}
.drawer-overlay[hidden] {
  display: none !important;
}
.palette-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 88vw;
  height: 100dvh;
  background: var(--surface);
  border-left: 0.5px solid var(--border);
  z-index: 91;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.28s var(--ease);
  overflow: hidden;
}
.palette-drawer[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .palette-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 80dvh;
    height: auto;
    border-top: 0.5px solid var(--border);
    border-left: none;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: max(var(--sab), 16px);
  }
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--border);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  background: var(--surface);
  flex-shrink: 0;
}

.palette-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  padding: 10px 18px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 0.5px solid var(--border-strong);
  flex-shrink: 0;
}

.dot-default {
  background: var(--surface);
}

.dot-answered {
  background: var(--primary);
  border-color: var(--primary);
}

.dot-review {
  background: var(--amber);
  border-color: var(--amber);
}

.dot-current {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  max-height: 360px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

@media (max-width: 680px) {
  .palette-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
    padding: 14px 18px;
    max-height: 44dvh;
  }
}

.palette-btn {
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s var(--ease-touch), border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}

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

.palette-btn:active {
  transform: scale(0.92);
}

.palette-btn.p-current {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.palette-btn.p-answered {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.25);
}

.palette-btn.p-correct {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(48, 209, 88, 0.25);
}

.palette-btn.p-wrong {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(255, 69, 58, 0.25);
}

.palette-btn.p-marked::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 1.5px var(--surface);
}

.palette-summary {
  padding: 10px 16px;
  border-top: 0.5px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  text-align: center;
  font-weight: 500;
  flex-shrink: 0;
}

.palette-drawer .btn-submit,
.quiz-side .btn-submit {
  margin: 10px 16px 14px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  background: var(--green);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: transform 0.12s var(--ease-touch), background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.palette-drawer .btn-submit:hover,
.quiz-side .btn-submit:hover {
  background: var(--green-strong);
}

.palette-drawer .btn-submit:active,
.quiz-side .btn-submit:active {
  transform: scale(0.97);
}

/* ---------- Quiz & Study Layout (Split Screen on Desktop) ---------- */
.quiz-main {
  width: 100%;
  max-width: 1060px;
  margin: 16px auto 100px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.question-area {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

@media (min-width: 920px) {
  .quiz-main {
    grid-template-columns: 1fr 310px;
  }
  #btnTogglePalette {
    display: none !important;
  }
}

@media (max-width: 680px) {
  .question-area {
    padding: 18px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
  }
}

/* Docked Sidebar on Desktop */
.quiz-side,
.study-side {
  position: sticky;
  top: 74px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100dvh - 100px);
}

@media (max-width: 919px) {
  .quiz-side,
  .study-side {
    display: none !important;
  }
}

.quiz-side-head {
  padding: 14px 18px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Study Main & Col */
.study-main {
  width: 100%;
  max-width: 760px;
  margin: 16px auto 100px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.study-col {
  min-width: 0;
}

@media (min-width: 920px) {
  .study-main.has-side {
    max-width: 1060px;
    grid-template-columns: 1fr 310px;
  }
}

/* ---------- Question Area & Options ---------- */
.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.q-topic {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 20px;
}
.q-type {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.q-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
  color: var(--text);
}
.q-text:lang(ne) {
  font-family: var(--deva);
  line-height: 1.55;
}

.options-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  min-height: 54px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.4;
  box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease-touch), background var(--dur) ease, border-color var(--dur) ease;
}
.option-btn:hover {
  background: var(--surface-hover);
}
.option-btn:active {
  transform: scale(0.98);
  opacity: 0.85;
}
.opt-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-soft);
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.opt-mark {
  position: absolute;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s var(--ease);
}
.opt-text {
  flex: 1;
}
:lang(ne) .opt-text {
  font-family: var(--deva);
}
.opt-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.opt-tag [data-icon] {
  font-size: 13px;
}

/* Option States */
.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.option-btn.selected .opt-bubble {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.option-btn.correct {
  border-color: var(--green);
  background: var(--green-soft);
}
.option-btn.correct .opt-bubble {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}
.option-btn.correct .opt-letter {
  opacity: 0;
}
.option-btn.correct .opt-mark {
  opacity: 1;
  transform: scale(1);
}
.option-btn.correct .opt-tag {
  color: var(--green);
  background: var(--green-soft);
}

.option-btn.wrong {
  border-color: var(--red);
  background: var(--red-soft);
}
.option-btn.wrong .opt-bubble {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}
.option-btn.wrong .opt-letter {
  opacity: 0;
}
.option-btn.wrong .opt-mark {
  opacity: 1;
  transform: scale(1);
}
.option-btn.wrong .opt-tag {
  color: var(--red);
  background: var(--red-soft);
}
.option-btn.locked {
  cursor: default;
}
.option-btn.dimmed {
  opacity: 0.5;
}
.option-btn.correct-anim .opt-bubble {
  animation: bubblePop 0.38s var(--ease);
}
.option-btn.wrong-anim {
  animation: shake 0.38s ease;
}

/* Explanation */
.explanation-box {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--amber-soft);
  border: 0.5px solid color-mix(in srgb, var(--amber) 26%, transparent);
  border-radius: var(--radius-md);
  animation: qEnter 0.3s var(--ease);
}
.explanation-box[hidden] {
  display: none;
}
.explanation-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
}
.explanation-box p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
}
.explanation-box p:lang(ne) {
  font-family: var(--deva);
}

/* ---------- Fixed Bottom Navigation Bar (Frosted Glass Vibrancy) ---------- */
.quiz-bottom-nav,
.study-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px max(var(--sab), 16px);
  background: var(--glass-bg);
  border-top: 0.5px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.quiz-bottom-nav .btn-next {
  min-width: 140px;
}
.study-nav[hidden] {
  display: none;
}
.study-nav .btn,
.study-nav .btn-next {
  min-width: 120px;
}

/* ---------- Results View ---------- */
.results-card {
  text-align: center;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.result-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.result-badge.pass {
  background: var(--green-soft);
  color: var(--green);
}
.result-badge.fail {
  background: var(--red-soft);
  color: var(--red);
}
.score-ring-wrap {
  width: 150px;
  margin: 0 auto 18px;
}
.ring-score {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  fill: var(--text);
}
.ring-label {
  font-size: 12px;
  fill: var(--text-muted);
}
#scoreRing {
  transition: stroke-dashoffset 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.results-card h2 {
  font-size: 24px;
  margin-bottom: 5px;
}
.result-sub {
  color: var(--text-soft);
  font-size: 15px;
  margin-bottom: 22px;
}

.session-summary {
  max-width: 440px;
  margin: 0 auto 24px;
  padding: 16px 18px;
  text-align: left;
  background: var(--primary-soft);
  border: 0.5px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.session-summary[hidden] {
  display: none;
}
.session-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.session-line [data-icon] {
  font-size: 18px;
  color: var(--primary);
  margin-top: 2px;
  flex-shrink: 0;
}
.session-line strong {
  font-weight: 700;
}
.btn-review-missed {
  align-self: flex-start;
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.15s ease;
}
.btn-review-missed:active {
  opacity: 0.75;
}
.btn-review-missed [data-icon] {
  font-size: 16px;
}

.score-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto 24px;
  text-align: left;
}
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
  background: var(--surface-2);
}
.breakdown-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-soft);
}
.breakdown-label [data-icon] {
  font-size: 16px;
}
.breakdown-val {
  font-weight: 700;
  font-size: 15px;
}
.correct-item .breakdown-label [data-icon] {
  color: var(--green);
}
.wrong-item .breakdown-label [data-icon] {
  color: var(--red);
}
.skip-item .breakdown-label [data-icon] {
  color: var(--text-muted);
}
.time-item .breakdown-label [data-icon] {
  color: var(--primary);
}
.correct-item .breakdown-val {
  color: var(--green);
}
.wrong-item .breakdown-val {
  color: var(--red);
}
.time-item .breakdown-val {
  color: var(--primary);
}

.category-accuracy {
  max-width: 440px;
  margin: 0 auto 20px;
}
.category-accuracy[hidden] {
  display: none;
}
.cat-head {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-align: left;
  margin-bottom: 12px;
  color: var(--text-soft);
}
.cat-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cat-bar-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  width: 128px;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-bar-track {
  flex: 1;
  height: 8px;
  background: var(--track);
  border-radius: 9999px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  transform-origin: left;
  transition: transform 0.8s var(--ease);
}
.cat-bar-pct {
  font-weight: 700;
  font-size: 13px;
  width: 42px;
  text-align: right;
  flex-shrink: 0;
}
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Review List */
.review-list {
  padding-bottom: 40px;
}
.review-item {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.review-item[hidden] {
  display: none;
}
.review-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.review-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  color: #ffffff;
}
.review-status.st-correct {
  background: var(--green);
}
.review-status.st-wrong {
  background: var(--red);
}
.review-status.st-skipped {
  background: var(--text-muted);
}
.review-item .q-index {
  display: inline;
}
.review-mark-flag {
  color: var(--amber);
  font-size: 15px;
  margin-left: auto;
}
.q-text-review {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.45;
}
.q-text-review:lang(ne) {
  font-family: var(--deva);
}
.review-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  padding: 8px 0;
  border-top: 0.5px solid var(--border);
  color: var(--text-soft);
}
.review-row:first-of-type {
  border-top: none;
}
.review-row strong {
  font-weight: 600;
  text-align: right;
}
.review-row.wrong-row strong {
  color: var(--red);
}
.review-row.right-row strong {
  color: var(--green);
}
.review-row.skip-row strong {
  color: var(--text-muted);
}
.review-explain {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--amber-soft);
  border-radius: var(--radius-xs);
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}
.review-explain:lang(ne) {
  font-family: var(--deva);
}
.review-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.review-time [data-icon] {
  font-size: 14px;
}

/* ---------- Study View & Flashcards Carousel ---------- */
.study-topics {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 4px 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 4px 2px 8px;
  cursor: grab;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 128, 0.25) transparent;
}
.study-topics.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}
.study-topics::-webkit-scrollbar {
  height: 4px;
}
.study-topics::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.25);
  border-radius: 9999px;
}
.study-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  scroll-snap-align: start;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border: 0.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.study-topic-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.study-topic-chip:active {
  transform: scale(0.96);
}
.study-topic-chip .chip-name {
  display: inline-block;
}
.study-topic-chip .chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text-muted) 16%, transparent);
  color: var(--text-soft);
}
.study-topic-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px -3px color-mix(in srgb, var(--primary) 40%, transparent);
}
.study-topic-chip.active .chip-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
.study-topic-chip.topic-review {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 40%, transparent);
}
.study-topic-chip.topic-review .chip-badge {
  background: color-mix(in srgb, var(--amber) 20%, transparent);
  color: var(--amber);
}
.study-topic-chip.topic-review.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #ffffff;
  box-shadow: 0 4px 14px -3px color-mix(in srgb, var(--amber) 40%, transparent);
}
.study-topic-chip.topic-review.active .chip-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}
.study-card {
  position: relative;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px clamp(18px, 4vw, 34px);
  box-shadow: var(--shadow);
  margin-bottom: var(--nav-clear);
  animation: qEnter 0.35s var(--ease);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  will-change: transform;
}
.study-card.is-swiping {
  cursor: grabbing;
  transition: none !important;
}
.swipe-stamp {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 10;
  border: 2.5px solid currentColor;
}
.swipe-stamp.stamp-right {
  right: 24px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border-color: var(--green);
  transform: rotate(12deg) scale(0.9);
}
.swipe-stamp.stamp-left {
  left: 24px;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-color: var(--amber);
  transform: rotate(-12deg) scale(0.9);
}
.swipe-stamp.stamp-up {
  top: 18px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-color: var(--primary);
}
.card-swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
}
.card-swipe-hint .hint-arrow {
  opacity: 0.6;
}
.study-card[hidden] {
  display: none;
}
.study-save {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur) ease, background var(--dur) ease;
}
.study-save:hover {
  color: var(--amber);
}
.study-save.saved {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}
.study-card .option-btn {
  cursor: default;
}
#studyRevealBtn {
  margin-top: 20px;
}
#studyRevealBtn[hidden] {
  display: none;
}
.study-empty[hidden] {
  display: none;
}

/* ---------- Notes View (Long Answers) ---------- */
.note-answer-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 18px 0 8px;
}
.note-answer {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}
.note-answer:lang(ne) {
  font-family: var(--deva);
}
.note-answer p {
  margin: 0 0 12px;
}
.note-answer p:last-child {
  margin-bottom: 0;
}
.note-answer .note-pre {
  white-space: pre-wrap;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}
.note-answer ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.note-answer li {
  margin-bottom: 6px;
}
.note-rate {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
}
.note-rate-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.note-rate-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rate-btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) ease, color var(--dur) ease, transform 0.1s ease;
}
.rate-btn:active {
  transform: scale(0.97);
}
.rate-review:hover {
  border-color: var(--red);
  color: var(--red);
}
.rate-partly:hover {
  border-color: var(--amber);
  color: var(--amber);
}
.rate-got {
  margin-left: auto;
}
.rate-got:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

/* Read Aloud Button */
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 17px;
  flex-shrink: 0;
  transition: color var(--dur) ease, background var(--dur) ease;
}
.speak-btn:hover {
  color: var(--primary);
}
.speak-btn.speaking {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  animation: speakPulse 1.1s ease-in-out infinite;
}
.speak-btn[hidden] {
  display: none;
}
.study-speak {
  margin-left: 6px;
}

/* ---------- Settings View (Grouped Inset Style) ---------- */
.settings-body {
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 4px;
}
.settings-note {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.55;
  padding: 12px 16px;
  background: var(--primary-soft);
  border: 0.5px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: var(--radius-md);
}
.settings-group {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.settings-group-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 0.5px solid var(--border);
}
.settings-field-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.seg-group-full {
  display: flex;
  width: 100%;
}
.seg-group-full .seg {
  flex: 1 1 0;
}

.settings-group .settings-field:first-of-type {
  border-top: none;
}
.settings-label {
  font-size: 15px;
  color: var(--text);
}
.text-input.num {
  width: 92px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.settings-avail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}
#btnResetSettings {
  align-self: flex-start;
}

/* ---------- Authentic iOS Toggle Switch ---------- */
.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--track);
  border-radius: 9999px;
  transition: background 0.25s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.25s var(--ease);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
}
.switch input:checked + .switch-track {
  background: var(--green);
}
.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Manage Question Sets ---------- */
.manage-intro {
  margin: 4px 0 24px;
}
.manage-intro p {
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 60ch;
}
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.manage-list:empty {
  display: none;
}
.manage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.manage-row.off {
  opacity: 0.6;
}
.manage-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.manage-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.set-type-tag {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  border: 0.5px solid color-mix(in srgb, var(--primary) 26%, transparent);
  padding: 1px 8px;
  border-radius: 20px;
  vertical-align: middle;
}
.manage-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.manage-row-btns {
  display: flex;
  gap: 6px;
}
.manage-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: color var(--dur) ease, background var(--dur) ease;
}
.manage-icon-btn:hover {
  color: var(--text);
}
.manage-icon-btn.danger:hover {
  color: var(--red);
}

/* ---------- iOS Bottom Sheet Modals & Centered Alerts ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 90;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade 0.2s ease;
}
.modal-overlay[hidden] {
  display: none;
}

/* iOS Bottom Sheet Handle Indicator */
.ios-sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 9999px;
  background: rgba(142, 142, 147, 0.4);
  margin: 6px auto 14px;
}

.modal-card {
  background: var(--surface);
  border-top: 0.5px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  padding-bottom: 0;
  animation: sheetSlideUp 0.32s var(--ease);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.modal-card.modal-lg {
  max-width: 760px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px max(var(--sab), 16px);
  justify-content: flex-end;
  border-top: 0.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.shortcuts-grid {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-soft);
  padding: 6px 0;
}
.shortcut-row span:last-child {
  margin-left: auto;
}
kbd {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--text);
  min-width: 24px;
  text-align: center;
  display: inline-block;
}
.submit-summary {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}
.submit-stat {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
  background: var(--surface-2);
}
.submit-stat-num {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.submit-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ss-answered .submit-stat-num {
  color: var(--green);
}
.ss-unanswered .submit-stat-num {
  color: var(--red);
}
.ss-marked .submit-stat-num {
  color: var(--amber);
}

/* Centered iOS Alert Dialog */
.modal-card.modal-alert,
.ios-alert-card {
  margin: auto;
  max-width: 290px;
  border-radius: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 0.5px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  text-align: center;
  overflow: hidden;
  padding: 20px 0 0;
  animation: alertPop 0.25s var(--ease);
}
.modal-card.modal-alert .ios-sheet-handle {
  display: none;
}
.modal-card.modal-alert .modal-header {
  border-bottom: none;
  justify-content: center;
  padding: 0 16px 8px;
}
.modal-card.modal-alert .modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}
.modal-card.modal-alert .modal-header .icon-btn {
  display: none;
}
.modal-card.modal-alert .confirm-body,
.modal-card.modal-alert .submit-summary {
  padding: 0 16px 16px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.4;
}
.modal-card.modal-alert .modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  border-top: 0.5px solid var(--border);
  margin-top: 14px;
  gap: 0;
}
.modal-card.modal-alert .modal-actions .btn {
  border-radius: 0;
  min-height: 44px;
  font-size: 17px;
  font-weight: 400;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--primary);
}
.modal-card.modal-alert .modal-actions .btn:first-child {
  border-right: 0.5px solid var(--border);
  font-weight: 400;
}
.modal-card.modal-alert .modal-actions .btn:last-child {
  font-weight: 600;
}
.modal-card.modal-alert .modal-actions .btn-danger {
  color: var(--red);
}

/* Custom practice & Builder fields */
.custom-body,
.builder-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.custom-field,
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.custom-label,
.field-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}
.custom-topics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.custom-topics-stat {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-feature-settings: "tnum";
}
.custom-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.custom-search-wrap .search-lead-icon {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}
.custom-search-wrap .search-lead-icon svg {
  width: 16px;
  height: 16px;
}
.custom-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: all var(--dur) var(--ease);
}
.custom-search-input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.custom-topics-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -2px;
}
.custom-topics-bar .mini-btn {
  font-size: 12px;
  padding: 4px 10px;
}
.custom-topics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px 1px;
}
.custom-topic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13.5px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  user-select: none;
}
.custom-topic:hover {
  background: var(--surface-hover);
}
.custom-topic.all {
  background: var(--surface);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}
.custom-topic[hidden] {
  display: none !important;
}
.custom-topic-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.custom-topic-left input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.custom-topic-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-topic-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 15%, transparent);
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
}
.custom-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.custom-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.custom-toggle-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.custom-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.custom-avail {
  font-size: 13px;
  color: var(--text-muted);
}

.text-input,
.text-area {
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  width: 100%;
  transition: border-color var(--dur) ease;
}
.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--primary);
}
.text-area {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}
.q-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.q-card-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}
.opt-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-lead {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}
.import-block {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.import-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 0.5px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}
.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: color var(--dur) ease;
}
.mini-btn:hover {
  color: var(--primary);
}
.code-block {
  margin: 0;
  padding: 12px 14px;
  font-family: -apple-system-monospaced, "SF Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}
.import-status {
  font-size: 13px;
  min-height: 18px;
}
.import-status.ok {
  color: var(--green);
}
.import-status.err {
  color: var(--red);
}

/* ---------- Search View ---------- */
.search-overlay {
  align-items: flex-start;
  padding-top: max(var(--sat), 40px);
}
.search-card {
  max-width: 640px;
  border-radius: var(--radius-lg);
}
.search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--border);
}
.search-lead-icon {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 17px;
  color: var(--text);
  padding: 6px 0;
}
.search-input:focus {
  outline: none;
}
.search-results {
  overflow-y: auto;
  max-height: 64vh;
  padding: 8px 12px;
}
.search-hint {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.search-result {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
}
.search-result + .search-result {
  border-top: 0.5px solid var(--border);
}
.search-result-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.search-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.search-badge.quiz {
  color: var(--primary);
  background: var(--primary-soft);
}
.search-badge.notes {
  color: var(--amber);
  background: var(--amber-soft);
}
.search-topic {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-q {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.search-a {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-a strong {
  color: var(--green);
  font-weight: 600;
}
mark {
  background: color-mix(in srgb, var(--amber) 34%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------- Insights Dashboard ---------- */
.insights-body {
  max-width: 620px;
  margin: 0 auto;
}
.insights-top {
  justify-content: space-around;
  margin: 4px 0 26px;
}
.insights-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}
.insight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.insight-rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  width: 18px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.insight-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.insight-q {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.insight-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.insight-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.insight-val.miss {
  color: var(--red);
}
.insight-val.slow {
  color: var(--amber);
}

/* ---------- Progress Trends ---------- */
.trends-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 34px;
  box-shadow: var(--shadow);
}
.trends-card[hidden] {
  display: none;
}
.trends-stats {
  display: flex;
  gap: 28px;
  margin-bottom: 14px;
}
.trend-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trend-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.trend-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.trend-svg {
  width: 100%;
  height: auto;
  display: block;
}
.trend-axis {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: var(--font);
}

/* ---------- Onboarding Welcome ---------- */
.onboard-body {
  padding: 18px 20px;
}
.onboard-lead {
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 16px;
}
.onboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
}
.onboard-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.onboard-ic {
  font-size: 18px;
  color: var(--primary);
  margin-top: 1px;
  flex-shrink: 0;
}
.onboard-foot {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Notices / Foot ---------- */
.notice {
  border: 0.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-soft);
  margin-bottom: 24px;
}
.notice[hidden] {
  display: none;
}
.notice-error {
  border-style: solid;
  border-color: var(--red);
  background: var(--red-soft);
}
.notice-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}
.notice-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.home-foot {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding-top: 12px;
}

/* ---------- Spring & Physics Animations ---------- */
@keyframes sheetSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes alertPop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bubblePop {
  0% {
    transform: scale(0.6);
  }
  55% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1.04);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-5px);
  }
  44% {
    transform: translateX(5px);
  }
  66% {
    transform: translateX(-3px);
  }
  88% {
    transform: translateX(3px);
  }
}
@keyframes streakPop {
  0% {
    transform: scale(0.8);
  }
  55% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-soft); }
  50% { box-shadow: 0 0 0 5px transparent; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes optIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

#view-home.anim > *:not(.topbar) { animation: riseIn 0.45s var(--ease) both; }
#view-home.anim > *:not(.topbar):nth-child(3) { animation-delay: 0.04s; }
#view-home.anim > *:not(.topbar):nth-child(4) { animation-delay: 0.08s; }
#view-home.anim > *:not(.topbar):nth-child(5) { animation-delay: 0.12s; }
#view-home.anim > *:not(.topbar):nth-child(6) { animation-delay: 0.16s; }
#view-home.anim > *:not(.topbar):nth-child(n + 7) { animation-delay: 0.2s; }
.option-btn.opt-in { animation: optIn 0.3s var(--ease) both; }

/* ---------- Responsive Layouts & Safe Area Inset Rules ---------- */
@media (min-width: 680px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
  .modal-card {
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--border);
    margin: auto;
    max-height: min(85dvh, 640px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }
  .modal-card.modal-lg {
    max-height: min(90dvh, 780px);
  }
  .modal-card .ios-sheet-handle {
    display: none;
  }
}
@media (min-width: 900px) {
  .tools-row { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}

@media (max-width: 680px) {
  #app {
    padding: 0 max(var(--sar), 14px) max(var(--sab), 64px) max(var(--sal), 14px);
  }
  .start-row {
    grid-template-columns: 1fr;
  }
  .tools-row {
    grid-template-columns: 1fr;
  }
  .weak-grid {
    grid-template-columns: 1fr;
  }
  .snapshot {
    gap: 14px 20px;
    padding: 16px 18px;
  }
  .snap-divider {
    display: none;
  }
  .set-row {
    grid-template-columns: auto 1fr;
  }
  .set-cta-text {
    display: none;
  }
  .set-cta {
    grid-column: 2;
    justify-self: end;
    margin-top: -26px;
  }
  .score-breakdown {
    grid-template-columns: 1fr;
  }
  .submit-summary {
    grid-template-columns: 1fr;
  }
  .bar-title {
    display: none;
  }
  .hide-sm {
    display: none;
  }
  .cat-bar-label {
    width: 92px;
    font-size: 12px;
  }
  .quiz-bottom-nav .btn-next {
    min-width: 0;
    flex: 1;
  }
  .btn-nav {
    padding: 12px 14px;
  }
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2.5px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible,
.icon-btn:focus-visible,
.option-btn:focus-visible,
.set-row:focus-visible,
.weak-card:focus-visible,
.resume-card:focus-visible,
.palette-btn:focus-visible {
  outline-offset: 3px;
}

/* ---------- Scrollbar ---------- */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---------- Share Scorecard Modal & Preview ---------- */
.share-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin: 0 20px 16px;
  overflow: hidden;
}

.scorecard-canvas {
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 1000 / 600;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: block;
}

.share-actions-group {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-primary-btn {
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.share-grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-grid-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s var(--ease-touch), background 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  text-align: left;
}

.share-grid-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.share-grid-btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.share-grid-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.share-grid-txt {
  flex: 1;
  line-height: 1.2;
}

.share-social-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.share-social-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.share-social-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 9999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s var(--ease-touch), background 0.15s ease;
  min-height: 32px;
}

.share-social-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

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

/* ---------- iOS Toast Notification ---------- */
.ios-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(28, 28, 30, 0.92);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(255, 255, 255, 0.15);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  animation: toastPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: calc(100vw - 32px);
  text-align: center;
}

.ios-toast[hidden] {
  display: none !important;
}

[data-theme="paper"] .ios-toast,
[data-theme="mist"] .ios-toast {
  background: rgba(30, 30, 32, 0.92);
  color: #ffffff;
}

@keyframes toastPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* ---------- Screen-reader only ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Print (Results & Review) ---------- */
@media print {
  .topbar,
  .quiz-bar,
  .quiz-bottom-nav,
  .study-nav,
  .fixed-utils,
  .review-tabs,
  .result-actions,
  .quiz-side,
  .study-side,
  #btnTogglePalette,
  .drawer-overlay,
  .palette-drawer,
  .modal-overlay,
  .ios-toast {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  #app {
    max-width: none;
  }
  .results-card,
  .review-item {
    box-shadow: none;
    border: 1px solid #999;
    break-inside: avoid;
  }
  .review-item[hidden] {
    display: block !important;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
  #scoreRing {
    transition: none !important;
  }
}

/* ==================== SYLLABUS & PLAYBOOK MODALS ==================== */
.modal-header-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.syllabus-tabs-wrap,
.tips-tabs-wrap {
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: center;
}

.syllabus-tabs,
.tips-tabs {
  display: flex;
  background: var(--track);
  padding: 4px;
  border-radius: 9999px;
  border: 0.5px solid var(--border);
  gap: 3px;
  width: 100%;
  max-width: 540px;
  overflow-x: auto;
  scrollbar-width: none;
}

.syllabus-tabs::-webkit-scrollbar,
.tips-tabs::-webkit-scrollbar {
  display: none;
}

.syllabus-tabs .seg-btn,
.tips-tabs .seg-btn {
  flex: 1;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.syllabus-tabs .seg-btn.active,
.tips-tabs .seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  font-weight: 700;
}

.syllabus-panes-container,
.tips-panes-container {
  padding: 18px 20px 24px;
  overflow-y: auto;
  max-height: calc(85dvh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.syllabus-pane,
.tips-pane,
.simulator-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.15s var(--ease);
}

.syllabus-pane[hidden],
.tips-pane[hidden],
.simulator-pane[hidden] {
  display: none !important;
}

.syllabus-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.s-stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}

.s-stat-num {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.s-stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.syllabus-unit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.syllabus-unit-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: all 0.18s var(--ease);
}

.syllabus-unit-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.unit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.unit-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.unit-title-wrap {
  flex: 1;
  min-width: 0;
}

.unit-title-wrap h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.unit-weightage {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.unit-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
  margin: 0;
}

.btn-practice-unit {
  border-radius: 9999px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 14px !important;
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border: 0.5px solid var(--primary-soft) !important;
  transition: all 0.15s ease !important;
}

.btn-practice-unit:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

.paper2-structure-callout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.p2-part {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}

.p2-part-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(94, 92, 230, 0.14);
  color: #5E5CE6;
  flex-shrink: 0;
}

.p2-part-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.p2-part-info strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.p2-part-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.practical-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practical-item {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}

.practical-item.interview-highlight {
  border-color: rgba(0, 122, 255, 0.4);
  background: var(--primary-soft);
}

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

.p-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--track);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.p-item-left strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.p-item-left span {
  font-size: 12px;
  color: var(--text-muted);
}

.p-item-marks {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* Tips & Playbook Styles */
.tip-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.tip-card.tip-featured {
  border-color: rgba(0, 122, 255, 0.35);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.08);
}

.tip-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tip-card-head h4 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.tip-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tip-pill.math-pill {
  background: var(--green-soft);
  color: var(--green);
}

.tip-pill.danger-pill {
  background: var(--red-soft);
  color: var(--red);
}

.three-pass-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.pass-step {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pass-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pass-time {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.pass-step p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-soft);
  margin: 0;
}

.math-proof-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.math-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  gap: 8px;
}

.math-cond {
  font-weight: 600;
  color: var(--text);
}

.math-val.positive {
  color: var(--green);
  font-weight: 700;
}

.math-val.neutral {
  color: var(--text-muted);
  font-weight: 600;
}

.math-action {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border);
}

.tip-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}

.time-budget-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0;
}

.tb-card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tb-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tb-time {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.tb-length {
  font-size: 12px;
  color: var(--text-muted);
}

.tb-warning {
  font-size: 12.5px;
  color: var(--amber);
  margin: 0;
  line-height: 1.45;
}

.structure-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.s-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.s-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.s-step strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.s-step p {
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Calculator Styles */
.calc-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.calc-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calc-input-row input {
  width: 90px;
  padding: 9px 12px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  border-radius: 12px;
  border: 0.5px solid var(--border);
  background: var(--track);
  color: var(--text);
  outline: none;
}

.calc-preset-btns {
  display: flex;
  gap: 6px;
}

.calc-preset {
  border-radius: 9999px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
}

.calc-results-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-top: 10px;
}

.calc-result-stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cr-val {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.cr-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calc-plan-box {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 10px;
}

.calc-plan-box h5 {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.calc-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-tl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.tl-time {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  min-width: 60px;
  font-variant-numeric: tabular-nums;
}

.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text);
}

.check-ico {
  color: var(--green);
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .three-pass-grid,
  .paper2-structure-callout,
  .time-budget-cards,
  .checklist-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== EXAM SIMULATOR, OMR & PROCTOR CLOCK ==================== */
.simulator-tabs-wrap {
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: center;
}

.simulator-tabs {
  display: flex;
  background: var(--track);
  padding: 4px;
  border-radius: 9999px;
  border: 0.5px solid var(--border);
  gap: 3px;
  width: 100%;
  max-width: 540px;
  overflow-x: auto;
  scrollbar-width: none;
}

.simulator-tabs::-webkit-scrollbar {
  display: none;
}

.simulator-tabs .seg-btn {
  flex: 1;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.simulator-tabs .seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
  font-weight: 700;
}

.simulator-panes-container {
  padding: 18px 20px 24px;
  overflow-y: auto;
  max-height: calc(85dvh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.sim-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}

.sim-card h4 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sim-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
  margin: 0;
}

.sim-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.sim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sim-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.sim-select {
  padding: 11px 16px;
  font-size: 13.5px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: var(--track);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  transition: all 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.sim-select:focus {
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.sim-options-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.sim-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.sim-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 5px;
}

.sim-paper-preview-box {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.sim-preview-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: var(--primary-soft);
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 9999px;
}

.sim-mock-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

.sim-mock-header strong {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 700;
}

.sim-mock-header span {
  font-size: 12.5px;
  color: var(--text-soft);
}

.sim-mock-meta {
  display: flex;
  justify-content: space-around;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 6px;
}

/* OMR Mini Preview */
.omr-preview-sheet {
  background: #ffffff;
  color: #111111;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.omr-preview-head {
  text-align: center;
  border-bottom: 1.5px solid #222;
  padding-bottom: 6px;
}

.omr-h-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.omr-h-sub {
  font-size: 11px;
  color: #555;
}

.omr-meta-strip {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid #ccc;
}

.omr-sample-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
}

.omr-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.omr-qnum {
  width: 22px;
  font-weight: 700;
  text-align: right;
}

.omr-box-wrap {
  display: flex;
  gap: 4px;
}

.omr-box-opt {
  width: 20px;
  height: 20px;
  border: 1.5px solid #222;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10.5px;
}

.omr-bubble-opt {
  width: 18px;
  height: 18px;
  border: 1.5px solid #222;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9.5px;
}

/* ==================== iOS HIG PROCTOR CLOCK & DYNAMIC ISLAND ==================== */
.ios-proctor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 4px 0 16px;
}

/* iOS Segmented Preset Control */
.ios-clock-presets-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.ios-clock-presets {
  display: flex;
  background: var(--track);
  padding: 4px;
  border-radius: 9999px;
  border: 0.5px solid var(--border);
  width: 100%;
  max-width: 500px;
  gap: 4px;
}

.ios-seg-btn {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.ios-seg-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1.2;
}

.ios-seg-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.ios-seg-btn.active {
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ios-seg-btn.active .ios-seg-title {
  color: var(--primary);
  font-weight: 700;
}

.ios-seg-btn.active .ios-seg-badge {
  color: var(--primary);
  opacity: 0.85;
}

/* iOS Custom Time Input Row */
.ios-custom-row {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  animation: fade 0.2s ease;
}

.ios-custom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ios-custom-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.ios-custom-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--track);
  padding: 4px 12px;
  border-radius: 10px;
  border: 0.5px solid var(--border);
}

.ios-custom-input {
  width: 52px;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.ios-custom-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Apple Watch / iOS Timer Circular Ring */
.ios-clock-dial-stage {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ios-dial-ring-box {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ios-dial-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 4px 16px rgba(0, 122, 255, 0.16));
}

.ios-dial-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 9px;
}

.ios-dial-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 9px;
  stroke-linecap: round;
  stroke-dasharray: 640.88;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.9, 0.3, 1), stroke 0.3s ease;
}

.ios-dial-progress.warning {
  stroke: var(--amber);
  filter: drop-shadow(0 4px 16px rgba(255, 149, 0, 0.28));
}

.ios-dial-progress.danger {
  stroke: var(--red);
  filter: drop-shadow(0 4px 16px rgba(255, 59, 48, 0.35));
}

.ios-dial-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  gap: 3px;
}

.ios-dial-pill {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 12px;
  border-radius: 9999px;
  background: var(--surface);
  color: var(--primary);
  border: 0.5px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.25s ease;
}

.ios-dial-digits {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Segoe UI", Roboto, sans-serif;
  font-size: 50px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 4px 0 2px;
}

.ios-dial-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

/* iOS Live Activity / Lock Screen Pace Widget */
.ios-pace-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease);
}

.ios-pace-squircle {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #FF9500 0%, #FF5E3A 100%);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.ios-pace-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.ios-pace-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ios-pace-header-row strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.ios-pace-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 9999px;
}

.ios-pace-content p {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-soft);
  margin: 0;
}

/* iOS Inset List Section & Switch Cell */
.ios-inset-section {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ios-switch-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}

.ios-cell-leading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ios-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #FFF;
  flex-shrink: 0;
}

.ios-icon-yellow {
  background: linear-gradient(135deg, #FFCC00 0%, #FF9500 100%);
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.25);
}

.ios-cell-labels {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ios-cell-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.ios-cell-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Authentic Apple iOS Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
  cursor: pointer;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ios-slider {
  position: absolute;
  inset: 0;
  background-color: var(--track);
  border-radius: 31px;
  transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-switch input:checked + .ios-slider {
  background-color: var(--green);
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(20px);
}

/* Apple iOS Tactile Action Buttons */
.ios-clock-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  margin-top: 4px;
}

.ios-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

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

.ios-action-reset {
  padding: 12px 20px;
  background: var(--track);
  color: var(--text);
  border: 0.5px solid var(--border);
}

.ios-action-reset:hover {
  background: var(--surface-hover);
}

.ios-action-primary {
  flex: 1;
  max-width: 220px;
  padding: 14px 24px;
  background: var(--green);
  color: #FFF;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.35);
}

.ios-action-primary:hover {
  filter: brightness(1.05);
}

.ios-action-primary.is-running {
  background: var(--amber);
  box-shadow: 0 4px 16px rgba(255, 149, 0, 0.35);
}

.ios-action-dock {
  padding: 12px 18px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 0.5px solid var(--primary-soft);
}

.ios-action-dock:hover {
  background: rgba(0, 122, 255, 0.2);
}

/* Floating Mini Proctor Clock Widget (iOS Dynamic Island Style) */
.ios-island-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: rgba(18, 18, 22, 0.9);
  color: #FFF;
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 9999px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: islandPop 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes islandPop {
  0% { transform: scale(0.85) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.island-drag-area {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.island-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #30D158;
  box-shadow: 0 0 10px #30D158;
  animation: pulseDot 1.4s infinite;
}

.island-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
}

.island-time {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #FFF;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.island-pace-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(10, 132, 255, 0.28);
  color: #409CFF;
  border: 0.5px solid rgba(10, 132, 255, 0.45);
}

.island-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 0.5px solid rgba(255, 255, 255, 0.15);
  padding-left: 8px;
}

.island-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
}

.island-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.island-btn:active {
  transform: scale(0.9);
}

.island-btn-close:hover {
  background: rgba(255, 59, 48, 0.35);
  color: #FF453A;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ==================== PRINT MEDIA STYLES ==================== */
.print-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden !important;
  }
  .print-container,
  .print-container * {
    visibility: visible !important;
  }
  .print-container {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 10mm 15mm;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: "Segoe UI", Arial, sans-serif !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }

  .print-header {
    text-align: center;
    border-bottom: 2pt solid #000;
    padding-bottom: 8pt;
    margin-bottom: 12pt;
  }

  .print-header h1 {
    font-size: 15pt;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
  }

  .print-header h2 {
    font-size: 12pt;
    font-weight: 700;
    margin: 3pt 0 0;
  }

  .print-meta-table {
    width: 100%;
    margin-top: 6pt;
    font-size: 10pt;
    font-weight: 600;
  }

  .print-instructions {
    background: #f8f8f8;
    border: 1pt solid #ccc;
    padding: 6pt 10pt;
    font-size: 9pt;
    margin-bottom: 14pt;
    line-height: 1.35;
  }

  .print-questions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12pt 18pt;
  }

  .print-questions-grid.single-col {
    grid-template-columns: 1fr;
  }

  .print-q-item {
    break-inside: avoid;
    margin-bottom: 10pt;
  }

  .print-q-text {
    font-weight: 700;
    font-size: 10pt;
    margin-bottom: 4pt;
  }

  .print-options {
    display: flex;
    flex-direction: column;
    gap: 2pt;
    font-size: 9.5pt;
    padding-left: 6pt;
  }

  .print-opt-item {
    display: flex;
    gap: 6pt;
  }

  /* Printable OMR Sheet Full Page */
  .print-omr-page {
    width: 100%;
    page-break-after: always;
  }

  .print-omr-header {
    text-align: center;
    border-bottom: 2pt solid #000;
    padding-bottom: 6pt;
    margin-bottom: 10pt;
  }

  .print-omr-header h2 {
    margin: 0;
    font-size: 14pt;
    font-weight: 800;
    letter-spacing: 0.05em;
  }

  .print-omr-info-table {
    width: 100%;
    border: 1.5pt solid #000;
    border-collapse: collapse;
    margin-bottom: 12pt;
    font-size: 9.5pt;
  }

  .print-omr-info-table td {
    border: 1pt solid #000;
    padding: 4pt 8pt;
  }

  .print-omr-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0 14pt;
    border-top: 1pt solid #000;
    padding-top: 8pt;
  }

  .print-omr-col {
    display: flex;
    flex-direction: column;
    gap: 4pt;
  }

  .print-omr-row {
    display: flex;
    align-items: center;
    gap: 4pt;
    font-size: 8.5pt;
    height: 18pt;
  }

  .print-omr-num {
    width: 18pt;
    font-weight: 700;
    text-align: right;
  }

  .print-omr-boxes {
    display: flex;
    gap: 3pt;
  }

  .print-box-cell {
    width: 15pt;
    height: 15pt;
    border: 1.5pt solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 8.5pt;
  }

  .print-bubble-cell {
    width: 13pt;
    height: 13pt;
    border: 1.5pt solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 7pt;
  }

  .print-brand-tag {
    margin-top: 14pt;
    text-align: center;
    font-size: 8.5pt;
    color: #666;
    border-top: 1pt solid #ddd;
    padding-top: 6pt;
  }
}


