  html { scroll-behavior: smooth; }
  body { font-family: 'Inter', sans-serif; }
  h1,h2,h3,h4,.font-display { font-family: 'Poppins', sans-serif; }
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: rgba(79,70,229,0.25); border-radius: 8px; }
  .dark ::-webkit-scrollbar-thumb { background: rgba(124,122,240,0.3); }

  .glass {
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(15,23,42,0.06);
  }
  .dark .glass {
    background: rgba(30,41,59,0.55);
    border: 1px solid rgba(255,255,255,0.06);
  }
  .card {
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -10px rgba(15,23,42,0.12);
  }
  .dark .card { box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 8px 24px -10px rgba(0,0,0,0.5); }

  .skel {
    background: linear-gradient(90deg, rgba(148,163,184,0.15) 25%, rgba(148,163,184,0.3) 37%, rgba(148,163,184,0.15) 63%);
    background-size: 400px 100%;
    animation: shimmer 1.6s linear infinite;
  }

  .nav-item { transition: all .18s ease; }
  .nav-item:hover { background: rgba(79,70,229,0.07); }
  .dark .nav-item:hover { background: rgba(124,122,240,0.1); }
  .nav-item.active { background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(124,58,237,0.10)); color: #4F46E5; }
  .dark .nav-item.active { color: #A5A2FF; }
  .nav-item.active .nav-ico { color: #4F46E5; }
  .dark .nav-item.active .nav-ico { color: #A5A2FF; }

  .toggle { width: 42px; height: 24px; border-radius: 999px; background: #E2E8F0; position: relative; transition: background .2s ease; cursor: pointer; flex-shrink:0; }
  .dark .toggle { background: #334155; }
  .toggle.on { background: #4F46E5; }
  .toggle .dot { position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:999px; background:white; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
  .toggle.on .dot { transform: translateX(18px); }

  .seg-btn { transition: all .15s ease; }
  .seg-btn.active { background: white; color:#4F46E5; box-shadow: 0 1px 3px rgba(15,23,42,0.12); }
  .dark .seg-btn.active { background:#1E293B; color:#A5A2FF; }

  .view { display: none; }
  .view.active { display: block; animation: fadein .45s ease both; }

  .type-editor { caret-color: #4F46E5; line-height: 1.9; }
  .type-editor:focus { outline: none; }

  /* ---- Focus Mode (Practice + Exam): in-website, distraction-free typing layout ----
     Applied by adding body.focus-mode and .focus-ws to the EXISTING workspace element —
     nothing is cloned or moved, so timer / typed text / cursor / audio state are untouched. */
  .focus-bar { display: none; }
  body.focus-mode { overflow: hidden; }
  body.focus-mode #app-sidebar,
  body.focus-mode #app > .flex-1 > header { display: none !important; }
  /* .view's fade-in leaves a transform behind; a transformed ancestor would trap
     position:fixed inside <main> (that was why the old full screen looked broken) */
  body.focus-mode .view.active { animation: none !important; transform: none !important; }

  .focus-ws {
    position: fixed !important; inset: 0; z-index: 40;
    max-width: none !important; margin: 0 !important;
    padding: 12px 16px; box-sizing: border-box;
    overflow-x: hidden; overflow-y: auto;
    background: #F8FAFC;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px; row-gap: 10px;
  }
  .dark .focus-ws { background: #0F172A; }
  .focus-ws > * { margin: 0 !important; min-width: 0; }
  .focus-ws > .focus-bar { display: flex; align-items: center; grid-column: 1; grid-row: 1; }
  .focus-ws > .focus-top { grid-column: 2; grid-row: 1; }
  .focus-ws > .focus-progress { grid-column: 1 / -1; grid-row: 2; }
  .focus-ws .focus-hide { display: none !important; }

  #practice-workspace.focus-ws { grid-template-rows: auto auto auto minmax(96px, 1fr) auto; }
  #practice-workspace.focus-ws > #practice-audio-bar { grid-column: 1 / -1; grid-row: 3; }
  #practice-workspace.focus-ws > #practice-editor { grid-column: 1 / -1; grid-row: 4; height: 100%; min-height: 0 !important; resize: none; }
  #practice-workspace.focus-ws > .focus-bottom { grid-column: 1 / -1; grid-row: 5; justify-content: center; }
  #practice-workspace.focus-ws #practice-fullscreen-btn { display: none; }

  #exam-workspace.focus-ws { grid-template-rows: auto auto minmax(0, 1fr); }
  #exam-workspace.focus-ws > #exam-stage-writing { grid-column: 1 / -1; grid-row: 3; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  #exam-workspace.focus-ws #exam-editor { flex: 1 1 0; min-height: 96px !important; resize: none; }
  #exam-workspace.focus-ws #exam-stage-writing > .focus-bottom { flex: 0 0 auto; width: 100%; max-width: 420px; margin: 0 auto !important; }

  .progress-track { background: #E2E8F0; border-radius: 999px; overflow: hidden; }
  .dark .progress-track { background: #334155; }
  .progress-fill { height: 100%; border-radius: 999px; transition: width .5s ease; background: linear-gradient(90deg,#4F46E5,#7C3AED); }

  .glow-btn { background: linear-gradient(135deg,#4F46E5,#7C3AED); box-shadow: 0 8px 24px -6px rgba(79,70,229,0.5); transition: transform .15s ease, box-shadow .15s ease; }
  .glow-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -6px rgba(79,70,229,0.6); }
  .glow-btn:active { transform: translateY(0px) scale(0.98); }

  .float-card { animation: floaty 5s ease-in-out infinite; }

  mark.wrong { background: rgba(239,68,68,0.16); color:#B91C1C; border-radius:4px; padding:0 2px; text-decoration: line-through; text-decoration-color: rgba(185,28,28,0.5); }
  .dark mark.wrong { color:#FCA5A5; }
  mark.missing { background: rgba(6,182,212,0.14); color:#0E7490; border-radius:4px; padding:0 2px; }
  .dark mark.missing { color:#67E8F9; }
  mark.extra { background: rgba(249,115,22,0.16); color:#C2410C; border-radius:4px; padding:0 2px; }
  .dark mark.extra { color:#FDBA74; }

  .kbd { font-family: ui-monospace, monospace; }

  #app { transition: background .3s ease, color .3s ease; }

  .ring-num { font-variant-numeric: tabular-nums; }