/* Consolidated Unitype CSS */

/* ==== css/themes.css ==== */
/* Every theme only defines colours. Add your own by copying a block. */
:root,
:root[data-theme='void'] {
  --bg: #06070b;
  --bg-2: #0c0e16;
  --text: #e9ecf6;
  --sub: #566079;
  --main: #6ff2d1;
  --main-2: #6aa8ff;
  --error: #ff5c7a;
  --error-2: #b83a52;
  --warn: #ffcc66;
  --glass: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

:root[data-theme='paper'] {
  --bg: #f3f0e8;
  --bg-2: #e9e5da;
  --text: #24252b;
  --sub: #9a9588;
  --main: #3556d8;
  --main-2: #d6407a;
  --error: #d6334d;
  --error-2: #e58a99;
  --warn: #c98a00;
  --glass: rgba(255, 255, 255, 0.55);
  --line: rgba(0, 0, 0, 0.1);
  --shadow: rgba(60, 50, 30, 0.18);
  color-scheme: light;
}

:root[data-theme='aurora'] {
  --bg: #0a0713;
  --bg-2: #130d22;
  --text: #efe9ff;
  --sub: #5f5486;
  --main: #c28bff;
  --main-2: #ff7ac6;
  --error: #ff5c7a;
  --error-2: #b83a52;
  --warn: #ffd27a;
  --glass: rgba(190, 150, 255, 0.05);
  --line: rgba(190, 150, 255, 0.14);
  --shadow: rgba(5, 0, 20, 0.6);
  color-scheme: dark;
}

:root[data-theme='ember'] {
  --bg: #0d0805;
  --bg-2: #170e08;
  --text: #f6e8dc;
  --sub: #6d5645;
  --main: #ff9a4d;
  --main-2: #ffd166;
  --error: #ff4d5e;
  --error-2: #a8333f;
  --warn: #ffd166;
  --glass: rgba(255, 170, 100, 0.045);
  --line: rgba(255, 170, 100, 0.14);
  --shadow: rgba(10, 3, 0, 0.6);
  color-scheme: dark;
}

:root[data-theme='terminal'] {
  --bg: #020503;
  --bg-2: #07100a;
  --text: #c9f7d3;
  --sub: #31543a;
  --main: #3dff7a;
  --main-2: #b6ff3d;
  --error: #ff5252;
  --error-2: #a33030;
  --warn: #ffe14d;
  --glass: rgba(61, 255, 122, 0.04);
  --line: rgba(61, 255, 122, 0.16);
  --shadow: rgba(0, 10, 3, 0.7);
  color-scheme: dark;
}

:root[data-theme='ocean'] {
  --bg: #04101a;
  --bg-2: #081c2c;
  --text: #dff1ff;
  --sub: #3f6a88;
  --main: #4dc3ff;
  --main-2: #5cffd8;
  --error: #ff6b86;
  --error-2: #b04158;
  --warn: #ffd37a;
  --glass: rgba(77, 195, 255, 0.05);
  --line: rgba(77, 195, 255, 0.16);
  --shadow: rgba(0, 8, 16, 0.65);
  color-scheme: dark;
}

:root[data-theme='dusk'] {
  --bg: #16131f;
  --bg-2: #1f1a2c;
  --text: #ebe4f7;
  --sub: #6f6488;
  --main: #f2a6c4;
  --main-2: #9fb4ff;
  --error: #ff6b86;
  --error-2: #b04158;
  --warn: #ffd37a;
  --glass: rgba(242, 166, 196, 0.05);
  --line: rgba(242, 166, 196, 0.14);
  --shadow: rgba(8, 4, 16, 0.55);
  color-scheme: dark;
}

:root[data-theme='mono'] {
  --bg: #0b0b0c;
  --bg-2: #141415;
  --text: #f2f2f2;
  --sub: #5d5d62;
  --main: #ffffff;
  --main-2: #b5b5bd;
  --error: #ff6666;
  --error-2: #a04444;
  --warn: #dddd88;
  --glass: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ==== css/base.css ==== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: color-mix(in srgb, var(--main) 35%, transparent);
}

/* ---------- background layers ---------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, transparent 30%, var(--bg) 100%);
  opacity: 0.85;
}

/* ---------- app shell ---------- */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 26px 0 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  perspective: 300px;
}

.logo .cube {
  width: 22px;
  height: 22px;
  position: relative;
  transform-style: preserve-3d;
  animation: spin 14s linear infinite;
}

.logo .cube i {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--main);
  border-radius: 4px;
  opacity: 0.9;
}

.logo .cube i:nth-child(2) {
  transform: rotateY(60deg);
  border-color: var(--main-2);
}
.logo .cube i:nth-child(3) {
  transform: rotateY(120deg);
}

@keyframes spin {
  from {
    transform: rotateX(-20deg) rotateY(0deg);
  }
  to {
    transform: rotateX(-20deg) rotateY(360deg);
  }
}

.logo b {
  color: var(--main);
  font-weight: 600;
}

.links {
  display: flex;
  gap: 4px;
}

.links a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--sub);
  font-size: 15px;
  transition: color 0.2s, background 0.2s;
}

.links a:hover {
  color: var(--text);
}

.links a.active {
  color: var(--main);
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--line);
}

.spacer {
  flex: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--sub);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  color: var(--main);
  background: var(--glass);
  border-color: var(--line);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  padding: 28px 0 60px;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

footer {
  padding: 20px 0 28px;
  color: var(--sub);
  font-size: 13px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

footer kbd {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  font-family: var(--font-typing);
  font-size: 12px;
}

/* ---------- glass surfaces ---------- */
.glass {
  background: linear-gradient(145deg, var(--glass), transparent 70%), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px -30px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}

[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out, box-shadow 0.25s;
  will-change: transform;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sub);
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
}

/* ---------- buttons / pills ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--glass);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  transition: transform 0.15s, border-color 0.2s, color 0.2s, background 0.2s;
}

.btn:hover {
  border-color: var(--main);
  color: var(--main);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--main);
  border-color: var(--main);
  color: var(--bg);
  font-weight: 600;
}

.btn.primary:hover {
  color: var(--bg);
  filter: brightness(1.1);
}

.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.pill-row {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-wrap: wrap;
}

.pill {
  border: 0;
  background: none;
  color: var(--sub);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.pill:hover {
  color: var(--text);
}

.pill.on {
  color: var(--main);
  background: color-mix(in srgb, var(--main) 12%, transparent);
}

.pill-sep {
  width: 1px;
  background: var(--line);
  margin: 4px 6px;
}

/* ---------- settings drawer ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 40;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  padding: 28px 26px 40px;
  overflow-y: auto;
  z-index: 50;
  transform: translateX(105%) rotateY(-12deg);
  transform-origin: right center;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 22px 0 0 22px;
}

.drawer.open {
  transform: none;
}

.drawer h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.setting {
  margin-top: 22px;
}

.setting > label,
.setting > .label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: 9px;
}

.setting input[type='range'] {
  width: 100%;
  accent-color: var(--main);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.swatch {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px 6px 8px;
  text-align: center;
  font-size: 11px;
  background: var(--sw-bg);
  color: var(--sw-text);
  position: relative;
  transition: transform 0.15s, border-color 0.2s;
}

.swatch::before {
  content: '';
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--sw-main);
  margin: 0 8px 8px;
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch.on {
  border-color: var(--main);
  box-shadow: 0 0 0 1px var(--main);
}

.font-list {
  display: grid;
  gap: 6px;
}

.font-opt {
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: none;
  font-size: 15px;
}

.font-opt.on {
  border-color: var(--main);
  color: var(--main);
}

/* ---------- intro overlay ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  perspective: 700px;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.intro.out {
  opacity: 0;
  visibility: hidden;
}

.intro-word {
  display: flex;
  font-size: clamp(44px, 9vw, 96px);
  font-weight: 600;
  letter-spacing: -0.03em;
  transform-style: preserve-3d;
  animation: intro-tilt 2.4s ease-out both;
}

.intro-word span {
  display: inline-block;
  opacity: 0;
  animation: letter-in 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 70ms + 150ms);
}

.intro-word span:nth-child(n + 4) {
  color: var(--main);
}

.intro-sub {
  position: absolute;
  bottom: 12%;
  color: var(--sub);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  animation: fade 1s 1.1s both;
}

@keyframes letter-in {
  from {
    opacity: 0;
    transform: translateZ(-260px) rotateX(80deg);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes intro-tilt {
  from {
    transform: rotateX(18deg) rotateY(-14deg);
  }
  to {
    transform: rotateX(0) rotateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 0 14px;
  }
  .nav {
    gap: 8px;
    flex-wrap: wrap;
  }
  .theme-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- stats page / generic ---------- */
.stats-page { max-width: 960px; margin: 0 auto; display: grid; gap: 20px; }
.stats-card { padding: 26px 30px; }
.muted { color: var(--sub); }
.history { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th { text-align: left; color: var(--sub); font-weight: 400; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding: 6px 8px; }
.history td { padding: 8px; border-top: 1px solid var(--line); font-family: var(--font-typing); }
.history td.hl { color: var(--main); }

/* ==== css/typing.css ==== */
.typing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding-top: 4vh;
}

.modebar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 16px;
  flex-wrap: wrap;
  justify-content: center;
  transition: opacity 0.4s, transform 0.4s;
}

.pill-row.plain {
  background: none;
  border: 0;
  padding: 0;
}

/* distraction-free while typing */
.typing.running .modebar,
.typing.running .restart-row {
  opacity: 0.12;
  pointer-events: none;
}

.live {
  height: 48px;
  width: 100%;
  max-width: 1000px;
  display: flex;
  align-items: baseline;
  gap: 22px;
  color: var(--sub);
  font-family: var(--font-typing);
  font-size: 18px;
}

.live .big {
  font-size: 38px;
  color: var(--main);
  font-weight: 500;
}

/* ---------- the words ---------- */
.stage-wrap {
  position: relative;
  width: 100%;
  max-width: 1000px;
}

.stage {
  --lh: 1.7em;
  position: relative;
  font-family: var(--font-typing);
  font-size: var(--fs);
  line-height: var(--lh);
  height: calc(var(--lh) * 3);
  overflow: hidden;
  outline: none;
  color: var(--sub);
  user-select: none;
  cursor: text;
  transition: filter 0.3s, opacity 0.3s;
  mask-image: linear-gradient(#000 78%, transparent);
  -webkit-mask-image: linear-gradient(#000 78%, transparent);
}

.words-inner {
  position: relative;
}

.words {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  transition: transform 0.18s ease-out;
}

.word {
  display: inline-flex;
  height: var(--lh);
  margin: 0 0.32em 0 0;
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
}

.word.wrong {
  border-bottom-color: var(--error);
}

.l {
  transition: color 0.08s;
}

.l.ok {
  color: var(--text);
}

.l.bad {
  color: var(--error);
}

.l.extra {
  color: var(--error-2);
}

/* ---------- caret ---------- */
.caret {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  background: var(--main);
  border-radius: 2px;
  pointer-events: none;
  animation: blink 1.1s steps(1) infinite;
  box-shadow: 0 0 12px color-mix(in srgb, var(--main) 55%, transparent);
}

:root[data-smooth='1'] .caret {
  transition: transform 0.1s cubic-bezier(0.3, 0.8, 0.3, 1), margin-top 0.18s ease-out, height 0.15s;
}

.typing.running .caret {
  animation: none;
}

:root[data-caret='block'] .caret {
  background: color-mix(in srgb, var(--main) 70%, transparent);
  border-radius: 3px;
}

:root[data-caret='underline'] .caret {
  background: none;
  border-bottom: 3px solid var(--main);
  border-radius: 0;
  box-shadow: none;
}

:root[data-caret='outline'] .caret {
  background: none;
  border: 2px solid var(--main);
  border-radius: 4px;
  box-shadow: none;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.typing.blurred .stage {
  filter: blur(6px);
  opacity: 0.5;
}

.typing.blurred .caret {
  opacity: 0;
}

.focus-hint {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.typing.blurred .focus-hint {
  display: grid;
}

.restart-row {
  transition: opacity 0.4s;
}

.restart:hover svg {
  transform: rotate(-180deg);
}

.restart svg {
  transition: transform 0.4s;
  width: 24px;
  height: 24px;
}

/* ---------- result ---------- */
.typing.done .stage-wrap,
.typing.done .live,
.typing.done .restart-row {
  display: none;
}

.result {
  width: 100%;
  max-width: 1000px;
}

.result-card {
  padding: 30px 34px 26px;
  animation: pop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: perspective(900px) translateY(24px) rotateX(10deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.result-head {
  display: grid;
  grid-template-columns: 150px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 34px;
  align-items: start;
}

.result-head .stat:nth-child(1) .v {
  font-size: 76px;
  color: var(--main);
}

.result-head .stat:nth-child(2) .v {
  font-size: 44px;
}

.result-chart {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.stat .k {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sub);
}

.stat .v {
  font-family: var(--font-typing);
  font-size: 26px;
  line-height: 1.15;
}

.stat .sub {
  font-size: 12px;
  color: var(--sub);
  margin-top: 2px;
}

.result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 44px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

/* chart (shared with the stats page) */
.chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .axis {
  fill: var(--sub);
  font-size: 11px;
  font-family: var(--font-typing);
}

.chart .line {
  fill: none;
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .line.wpm {
  stroke: var(--main);
}

.chart .line.raw {
  stroke: var(--sub);
  stroke-width: 1.6;
}

.chart .area {
  fill: color-mix(in srgb, var(--main) 9%, transparent);
}

.chart .err {
  fill: var(--error);
  opacity: 0.85;
}

@media (max-width: 760px) {
  .result-head {
    grid-template-columns: 1fr 1fr;
  }
  .result-chart {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .result-head .stat:nth-child(1) .v {
    font-size: 56px;
  }
}

/* ==== css/learn.css ==== */
/* finger colours: soft, theme-friendly hues */
:root {
  --f0: #ff7a90;
  --f1: #ffb36b;
  --f2: #ffe27a;
  --f3: #7dffa8;
  --f4: #6ff2e8;
  --f5: #6aa8ff;
  --f6: #b08aff;
  --f7: #ff8ae0;
  --f8: #8a93ad;
}

.learn {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  gap: 38px;
}

.learn-hero {
  padding: 40px 44px;
}

.learn-hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 10px 0 12px;
}

.learn-hero p {
  max-width: 560px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.progress {
  flex: 1;
  min-width: 120px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.progress > div {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--main), var(--main-2));
  transition: width 0.4s ease;
}

.progress.thin {
  height: 4px;
  flex-basis: 100%;
}

.muted {
  color: var(--sub);
}

.small {
  font-size: 12px;
}

.stage-title {
  margin-bottom: 14px;
}

.stage-title h2 {
  font-size: 22px;
}

.stage-title p {
  margin: 6px 0 0;
  max-width: 640px;
  line-height: 1.55;
  font-size: 14px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.lesson-card {
  display: block;
  padding: 18px 20px;
  position: relative;
}

.lesson-card .num {
  font-family: var(--font-typing);
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 0.1em;
}

.lesson-card .lt {
  font-size: 18px;
  margin: 6px 0 10px;
  font-weight: 500;
}

.lesson-card:not(.locked):hover {
  border-color: var(--main);
}

.lesson-card.done .num {
  color: var(--main);
}

.lesson-card.locked {
  opacity: 0.4;
}

.lock {
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stars {
  display: inline-flex;
  gap: 3px;
}

.stars i {
  font-style: normal;
  color: var(--line);
  font-size: 16px;
}

.stars i.on {
  color: var(--warn);
  text-shadow: 0 0 10px color-mix(in srgb, var(--warn) 60%, transparent);
}

.link-btn {
  background: none;
  border: 0;
  color: var(--sub);
  font-size: 13px;
  justify-self: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--main);
}

/* ---------- lesson player ---------- */
.lesson {
  max-width: 960px;
  margin: 0 auto;
}

.lesson-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.lesson-head h2 {
  font-size: 26px;
}

.intro-card,
.practice {
  padding: 30px 34px;
}

.new-keys {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 14px;
}

.big-key {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  font-family: var(--font-typing);
  font-size: 42px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  transform: perspective(300px) rotateX(14deg);
  box-shadow: 0 14px 24px -10px var(--shadow);
}

.big-key.f0 { color: var(--f0); border-color: var(--f0); }
.big-key.f1 { color: var(--f1); border-color: var(--f1); }
.big-key.f2 { color: var(--f2); border-color: var(--f2); }
.big-key.f3 { color: var(--f3); border-color: var(--f3); }
.big-key.f4 { color: var(--f4); border-color: var(--f4); }
.big-key.f5 { color: var(--f5); border-color: var(--f5); }
.big-key.f6 { color: var(--f6); border-color: var(--f6); }
.big-key.f7 { color: var(--f7); border-color: var(--f7); }
.big-key.f8 { color: var(--f8); border-color: var(--f8); }

.tip {
  text-align: center;
  color: var(--sub);
  max-width: 560px;
  margin: 0 auto 26px;
  line-height: 1.6;
}

.intro-actions {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  align-items: center;
  font-family: var(--font-typing);
  font-size: 15px;
  margin-bottom: 18px;
}

.drill {
  font-family: var(--font-typing);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.8;
  outline: none;
  user-select: none;
  min-height: 3.6em;
  word-break: break-word;
}

.drill .c {
  color: var(--sub);
  position: relative;
}

.drill .c.done {
  color: var(--text);
  opacity: 0.55;
}

.drill .c.cur {
  color: var(--bg);
  background: var(--main);
  border-radius: 4px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--main) 50%, transparent);
}

.drill .c.shake {
  animation: shake 0.25s;
  background: var(--error);
}

@keyframes shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.finger-hint {
  height: 28px;
  margin: 8px 0 14px;
  text-align: center;
  color: var(--main);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ---------- on-screen keyboard ---------- */
.keyboard-wrap {
  display: flex;
  justify-content: center;
  perspective: 900px;
  overflow-x: auto;
  padding: 8px 0;
}

.keyboard {
  font-family: var(--font-typing);
  font-size: clamp(9px, 1.6vw, 15px);
  transform: rotateX(18deg);
  transform-origin: center top;
  display: grid;
  gap: 0.45em;
}

.krow {
  display: flex;
  gap: 0.45em;
}

.key {
  width: 3.1em;
  height: 3.1em;
  display: grid;
  place-items: center;
  border-radius: 0.6em;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--sub);
  text-transform: uppercase;
  position: relative;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.key.wide {
  width: 5.2em;
  font-size: 0.8em;
}

.key.space {
  width: 22em;
}

/* a quiet colour hint on the bottom edge shows which finger owns each key */
.key::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--fc, transparent);
  opacity: 0.55;
}

.key.f0 { --fc: var(--f0); }
.key.f1 { --fc: var(--f1); }
.key.f2 { --fc: var(--f2); }
.key.f3 { --fc: var(--f3); }
.key.f4 { --fc: var(--f4); }
.key.f5 { --fc: var(--f5); }
.key.f6 { --fc: var(--f6); }
.key.f7 { --fc: var(--f7); }
.key.f8 { --fc: var(--f8); }

.key.bump::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--sub);
}

.key.next,
.key.shift-next {
  color: var(--bg);
  background: var(--fc, var(--main));
  border-color: var(--fc, var(--main));
  transform: translateZ(12px) translateY(-2px);
  box-shadow: 0 0 22px color-mix(in srgb, var(--fc, var(--main)) 55%, transparent);
}

.key.next::after,
.key.shift-next::after {
  display: none;
}

.key.err {
  animation: keyerr 0.35s;
}

@keyframes keyerr {
  0%, 60% {
    background: var(--error);
    border-color: var(--error);
    color: var(--bg);
  }
}

.learn-result {
  text-align: center;
  padding: 40px;
}

.learn-result .stars i {
  font-size: 40px;
  margin: 0 4px;
}

.learn-result h2 {
  margin: 14px 0 6px;
  font-size: 30px;
}

@media (max-width: 720px) {
  .learn-hero,
  .intro-card,
  .practice {
    padding: 22px 18px;
  }
  .key.space {
    width: 14em;
  }
}

/* ==== css/games.css ==== */
/* ---------- hub ---------- */
.games-hub {
  max-width: 960px;
  margin: 0 auto;
}

.games-hub h1 {
  font-size: clamp(30px, 4vw, 46px);
  margin: 8px 0 6px;
}

.hub-sub {
  margin: 0 0 30px;
}

.game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.game-card {
  display: block;
  padding: 28px;
  transition: border-color 0.2s;
}

.game-card:hover {
  border-color: var(--main);
}

.game-card h2 {
  font-size: 28px;
  margin: 6px 0 8px;
}

.game-card p {
  line-height: 1.6;
  margin: 0 0 8px;
  font-size: 15px;
}

.art {
  height: 96px;
  margin-bottom: 20px;
  color: var(--sub);
  transform: translateZ(30px);
}

.art svg {
  width: 100%;
  height: 100%;
}

.game-page {
  max-width: 1000px;
  margin: 0 auto;
}

.game-help {
  text-align: center;
  font-size: 13px;
  margin-top: 16px;
}

/* ---------- intercept ---------- */
.game-wrap {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.game-canvas {
  display: block;
  width: 100%;
}

.hud {
  position: absolute;
  top: 14px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: baseline;
  gap: 22px;
  font-family: var(--font-typing);
  color: var(--sub);
  pointer-events: none;
}

.hud .big {
  font-size: 30px;
  color: var(--main);
}

.hud .combo {
  color: var(--warn);
}

.hud .lives {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-self: center;
}

.hud .lives i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--sub);
  opacity: 0.5;
}

.hud .lives i.on {
  background: var(--main);
  border-color: var(--main);
  opacity: 1;
  box-shadow: 0 0 8px var(--main);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(5px);
  text-align: center;
}

.overlay.show {
  display: flex;
  animation: fade 0.35s;
}

.overlay h3 {
  font-size: 34px;
  margin: 0;
}

.overlay .pb {
  color: var(--warn);
  margin: 0;
}

/* ---------- race ---------- */
.race-entry {
  display: grid;
  justify-items: center;
}

.entry-card {
  width: min(720px, 100%);
  padding: 32px 36px;
}

.input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--main);
}

.input.code {
  font-family: var(--font-typing);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  width: 170px;
  margin-top: 0;
  text-align: center;
}

.entry-split {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 30px;
  margin-top: 30px;
}

.entry-split h3 {
  font-size: 20px;
}

.entry-split p {
  font-size: 14px;
  line-height: 1.55;
  margin: 6px 0 16px;
}

.vline {
  background: var(--line);
}

.join-row {
  display: flex;
  gap: 8px;
}

.err-text {
  min-height: 1.4em;
  color: var(--error);
  font-size: 14px;
  margin: 18px 0 0;
}

.lobby,
.results {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 34px 38px;
  text-align: center;
}

.room-code {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 18px;
  perspective: 600px;
}

.room-code span {
  width: 64px;
  height: 84px;
  display: grid;
  place-items: center;
  font-family: var(--font-typing);
  font-size: 46px;
  font-weight: 500;
  color: var(--main);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: 0 16px 28px -14px var(--shadow), 0 0 24px -8px var(--main);
  animation: flip 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) backwards;
}

.room-code span:nth-child(2) { animation-delay: 0.06s; }
.room-code span:nth-child(3) { animation-delay: 0.12s; }
.room-code span:nth-child(4) { animation-delay: 0.18s; }
.room-code span:nth-child(5) { animation-delay: 0.24s; }

@keyframes flip {
  from {
    opacity: 0;
    transform: rotateX(-90deg) translateY(-20px);
  }
}

.lobby-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.notice {
  font-size: 13px;
  color: var(--warn);
  max-width: 460px;
  margin: 16px auto 0;
  line-height: 1.5;
}

.lobby-settings {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 22px 0;
  flex-wrap: wrap;
}

.pill[disabled] {
  pointer-events: none;
  opacity: 0.7;
}

.btn.big {
  padding: 14px 34px;
  font-size: 16px;
  margin-bottom: 8px;
}

/* lanes */
.lanes {
  display: grid;
  gap: 10px;
  text-align: left;
  margin-top: 10px;
}

.race-lanes {
  padding: 18px 22px;
  max-width: 1000px;
  margin: 0 auto 26px;
}

.lane {
  display: grid;
  grid-template-columns: 170px 1fr 70px;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.lane.me .lane-name {
  color: var(--main);
}

.lane.gone {
  opacity: 0.35;
}

.lane-name {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lane-name i,
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  margin-right: 6px;
}

.lane-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}

.lane-fill {
  height: 100%;
  border-radius: 3px;
  opacity: 0.55;
  transition: width 0.2s linear;
}

.lane-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px currentColor;
  transition: left 0.2s linear;
}

.lane-stat {
  font-family: var(--font-typing);
  text-align: right;
  color: var(--sub);
}

.lobby-players .lane-track {
  display: none;
}

.lobby-players .lane {
  grid-template-columns: 1fr auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.lobby-players .lane-stat {
  display: none;
}

.race-stage {
  max-width: 1000px;
  margin: 0 auto;
}

.race-stage.finished .stage {
  opacity: 0.4;
}

.finish-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--main);
  font-size: 18px;
}

.countdown {
  min-height: 50vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
}

.cd-num {
  font-family: var(--font-typing);
  font-size: 160px;
  color: var(--main);
  line-height: 1;
  text-shadow: 0 0 40px color-mix(in srgb, var(--main) 50%, transparent);
  animation: tick 0.9s ease-out;
}

.cd-num.tick {
  animation: tick 0.9s ease-out;
}

@keyframes tick {
  from {
    opacity: 0;
    transform: perspective(500px) translateZ(-200px) scale(1.4);
  }
  30% {
    opacity: 1;
  }
}

.results h2 {
  font-size: 30px;
  margin: 8px 0 20px;
}

.results .history {
  text-align: left;
}

.me-row td {
  color: var(--main);
}

.results .result-actions {
  justify-content: center;
  margin-top: 26px;
}

@media (max-width: 720px) {
  .entry-split {
    grid-template-columns: 1fr;
  }
  .vline {
    height: 1px;
  }
  .lane {
    grid-template-columns: 110px 1fr 56px;
  }
  .room-code span {
    width: 48px;
    height: 66px;
    font-size: 34px;
  }
}
