@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap");
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap");

:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --ink: #231f20;
  --muted: #6f6a64;
  --brand: #f26a4b;
  --brand-dark: #c65037;
  --accent: #3f88c5;
  --panel: rgba(255, 255, 255, 0.85);
  --shadow: 0 24px 60px rgba(35, 31, 32, 0.12);
  --panel-strong: #fffdf8;
  --border-soft: rgba(35, 31, 32, 0.08);
  --keyboard-bg: #dddddd;
  --key-bg: #eeeeee;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14131a;
  --ink: #f0ece7;
  --muted: #a59f98;
  --brand: #ff7a59;
  --brand-dark: #ff5c3a;
  --accent: #5aa6e8;
  --panel: rgba(28, 27, 34, 0.9);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --panel-strong: #1e1c24;
  --border-soft: rgba(240, 236, 231, 0.12);
  --keyboard-bg: #2a2733;
  --key-bg: #3a3642;
}

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

body {
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 20% 10%, #fff7ea, #f7f3ea 40%, #efe5d7 100%);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

body[data-theme="dark"] {
  background: radial-gradient(circle at 20% 10%, #24212c, #14131a 45%, #0f0e12 100%);
}

.page {
  position: relative;
  z-index: 1;
  padding: 48px clamp(20px, 4vw, 64px) 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.4;
  mix-blend-mode: multiply;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 380px;
  height: 380px;
  background: #f9d7c5;
  top: -120px;
  left: -80px;
}

.orb-2 {
  width: 320px;
  height: 320px;
  background: #d6e7f2;
  bottom: -120px;
  right: -40px;
  animation-delay: 2s;
}

.orb-3 {
  width: 220px;
  height: 220px;
  background: #fdeaa8;
  top: 40%;
  left: 55%;
  animation-delay: 4s;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}

.hero.hidden,
.panel.hidden {
  display: none;
}

.hero h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 4vw, 4.2rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.subtitle {
  max-width: 560px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-card {
  background: var(--panel);
  border-radius: 24px;
  padding: 20px 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  min-width: 240px;
}

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

.metric .label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
}

.metric .value {
  font-size: 1.6rem;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  padding: 28px clamp(20px, 3vw, 40px);
  box-shadow: var(--shadow);
}

.intro {
  display: grid;
  place-items: center;
  min-height: 60vh;
  text-align: center;
}

.intro-content {
  max-width: 560px;
  display: grid;
  gap: 18px;
}

.intro-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.page.hidden {
  display: none;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

.align-right {
  justify-self: end;
  text-align: right;
}

.duration-highlight {
  margin-top: 8px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(242, 106, 75, 0.18);
  color: var(--brand);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body[data-theme="dark"] .duration-highlight {
  background: rgba(90, 166, 232, 0.22);
  color: #a9d4ff;
  border: 1px solid rgba(90, 166, 232, 0.35);
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-size: 0.85rem;
  color: var(--muted);
}

select,
input {
  font-family: "Space Grotesk", sans-serif;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(35, 31, 32, 0.15);
  background: #fffefc;
  font-size: 0.95rem;
}

.buttons {
  flex-direction: row;
  gap: 12px;
}

button {
  font-family: "Space Grotesk", sans-serif;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 14px 30px rgba(242, 106, 75, 0.35);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(35, 31, 32, 0.2);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(35, 31, 32, 0.15);
}

.practice {
  margin-top: 24px;
  display: grid;
  gap: 18px;
  position: relative;
}

.word-stream {
  background: var(--panel-strong);
  border-radius: 18px;
  padding: 20px;
  min-height: 120px;
  font-size: 1.15rem;
  line-height: 1.6;
  border: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
  min-height: 160px;
}

.paragraph-result {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 19, 26, 0.6);
  backdrop-filter: blur(6px);
  border-radius: 18px;
}

.paragraph-result.hidden {
  display: none;
}

.result-card {
  background: var(--panel);
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.result-card h3 {
  margin-bottom: 8px;
}

.word-stream .word {
  padding: 2px 6px;
  border-radius: 8px;
  margin-right: 0;
  display: inline-block;
}

.word-stream .space-gap {
  display: inline-block;
  min-width: 6px;
  padding: 0 2px;
  margin-right: 0;
  border-radius: 999px;
  color: rgba(35, 31, 32, 0.35);
  text-align: center;
  font-size: 0.9rem;
}

.word-stream .space-gap.active {
  background: rgba(46, 204, 113, 0.18);
  color: #2ecc71;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.word-stream .space-gap::before {
  content: "•";
}

.word-stream .word.active {
  background: transparent;
  border: none;
}

.word-stream .word.correct {
  color: #1f6f3a;
}

.word-stream .word.incorrect {
  color: #b73c2d;
  text-decoration: underline;
}

.word-stream .char {
  padding: 2px 1px;
  border-radius: 6px;
}

.word-stream .char.correct {
  color: #1f6f3a;
  background: rgba(31, 111, 58, 0.12);
}

.word-stream .char.incorrect {
  color: #b73c2d;
  background: rgba(183, 60, 45, 0.12);
}

.word-stream .char.cursor {
  border-bottom: 2px solid #2ecc71;
}

.word-stream .char.extra {
  color: #b73c2d;
  text-decoration: underline;
}

.hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 1px;
  width: 1px;
}

.keyboard {
  margin-top: 6px;
}

.main-container {
  max-width: 1022px;
  padding: 10px;
  box-sizing: border-box;
  font-size: 15px;
  margin: 12px auto 0;
  background-color: var(--keyboard-bg);
  border-radius: 20px;
  box-shadow: 2px 3px 20px rgba(0, 0, 0, 0.2);
  font-family: "Open Sans", sans-serif;
  color: var(--ink);
}

.main-container .row {
  margin: 4px 0;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
}

.main-container .col {
  padding: 6px;
  background-color: var(--key-bg);
  font-size: 13px;
  text-align: center;
  border-radius: 6px;
  margin: 2px;
  cursor: pointer;
  width: 48px;
  min-height: 36px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  text-transform: capitalize;
  font-weight: 600;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.main-container .col span {
  display: block;
  line-height: 1.1;
}

.main-container .col.backspace {
  width: 114px;
  text-align: left;
}

.col.capsloack {
  width: 114px;
  text-align: left;
}

.main-container .col.tab,
.main-container .col.slace {
  width: 84px;
  text-align: left;
}

.col.shift,
.col.enter {
  width: 120px;
  text-align: left;
}

.col.space {
  width: 520px;
}

.col.ctrl {
  width: 70px;
}

.rightclickopt {
  width: 14px;
  height: 18px;
  border: 2px solid #000000;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.main-container .col .rightclickopt span {
  width: 100%;
  height: 1px;
  background-color: #000000;
  margin: 2px 0;
}

.main-container .col.pressed {
  background: rgba(63, 136, 197, 0.25);
  border-color: rgba(63, 136, 197, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(63, 136, 197, 0.2);
}

.main-container .col.expected {
  background: rgba(242, 106, 75, 0.28);
  border-color: rgba(242, 106, 75, 0.7);
  box-shadow: 0 8px 18px rgba(242, 106, 75, 0.25);
  animation: pulse 1.2s ease-in-out infinite;
}

.main-container .col.expected::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 10px;
  border: 2px solid rgba(242, 106, 75, 0.45);
  opacity: 0.6;
  animation: ring 1.2s ease-in-out infinite;
}

.main-container .col:hover {
  transform: translateY(-2px);
}

.main-container .col:active {
  transform: translateY(0);
}

.chart-wrap {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

canvas {
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  background: #fff7ea;
  border: 1px solid rgba(35, 31, 32, 0.08);
}

.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.chart-legend .dot.wpm {
  background: var(--brand);
}

.chart-legend .dot.accuracy {
  background: var(--accent);
}

.dashboard h2 {
  font-family: "Fraunces", serif;
  font-size: 2rem;
  margin-bottom: 6px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.dash-card {
  background: #fffdf8;
  border-radius: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(35, 31, 32, 0.08);
}

.session-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.session-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f1e6;
  font-size: 0.9rem;
}

.word-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.pill-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pill-list li {
  padding: 6px 10px;
  background: #f2eee7;
  border-radius: 999px;
  font-size: 0.8rem;
}

.totals {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.totals .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.totals .value {
  font-size: 1.4rem;
  font-weight: 600;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding-bottom: 24px;
}

@keyframes drift {
  from {
    transform: translateY(0) translateX(0) scale(1);
  }
  to {
    transform: translateY(-20px) translateX(16px) scale(1.05);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes ring {
  0% {
    transform: scale(0.92);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.05);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .hero-card {
    width: 100%;
  }

  .word-stats {
    grid-template-columns: 1fr;
  }

  .buttons {
    flex-direction: column;
  }
}
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 64px) 0;
}

.nav .brand {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav .links {
  display: flex;
  gap: 14px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav a.active {
  border-color: rgba(242, 106, 75, 0.6);
  background: rgba(242, 106, 75, 0.15);
}

.nav a:hover {
  border-color: rgba(63, 136, 197, 0.5);
}
.nav-toggle {
  margin-left: 12px;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.horizontal-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}

.horizontal-metrics .metric {
  min-width: 120px;
}
