
* {
  box-sizing: border-box;
}

:root {
  --bg: #090d1b;
  --card: #11182b;
  --ink: #f3f5ff;
  --muted: #8994b2;
  --line: #293653;
  --purple: #8b7cff;
  --blue: #388fdf;
  --green: #61e6b0;
  --red: #ff718d;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 5%, #25205a 0%, transparent 35%),
    radial-gradient(ellipse at 90% 75%, #102b50 0%, transparent 35%),
    var(--bg);
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  transition: .3s;
}

.shell {
  max-width: 1120px;
  margin: auto;
  padding: 0 25px;
}

/* HEADER */

header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
}

.brand i {
  font-size: 9px;
  font-style: normal;
  color: #b7adff;
  background: #29234f;
  padding: 5px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b7cff, #4c9cff);
  box-shadow: 0 5px 25px #7565ff55;
  font: 700 21px "Space Mono";
}

button {
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  transition: .2s ease;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

#theme {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 15px;
}

/* SETUP */

.setup {
  max-width: 720px;
  margin: 65px auto;
  text-align: center;
}

.eyebrow {
  color: #a99eff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
}

.setup h1,
.result h1 {
  font-size: clamp(36px, 6vw, 52px);
  letter-spacing: -1.5px;
  margin: 12px 0;
  font-weight: 800;
}

.setup h1 em,
.result h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #9a88ff, #55c4ff);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.setup-card,
.result-card {
  background: linear-gradient(145deg, #171f38, #101729);
  padding: 30px;
  border-radius: 20px;
  border: 1px solid #303c60;
  box-shadow: 0 20px 65px #0005;
  text-align: left;
}

.setup-card h3 {
  font-size: 14px;
  margin: 22px 0 13px;
}

.setup-card h3:first-child {
  margin-top: 0;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option {
  padding: 11px 17px;
  border: 1px solid var(--line);
  background: #0c1428;
  color: #aab4d1;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.option.active {
  background: linear-gradient(135deg, #6556d9, #426fc8);
  color: white;
  border-color: #9487ff;
  box-shadow: 0 5px 20px #7565ff33;
}

.hint {
  color: var(--muted);
  font-size: 11px;
}

#customText {
  width: 100%;
  height: 95px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1428;
  color: var(--ink);
  font: 13px "Outfit";
  outline: none;
}

#customText:focus,
#typing:focus {
  border-color: #8b7cff;
  box-shadow: 0 0 0 3px #8b7cff20;
}

.start-btn {
  width: 100%;
  padding: 16px;
  margin-top: 25px;
  background: linear-gradient(100deg, #765ff0, #388fdf);
  color: white;
  border: 0;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 25px #6556d944;
}

.hidden {
  display: none !important;
}

/* TEST SCREEN */

.test {
  max-width: 850px;
  margin: 55px auto;
}

.test-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 12px;
}

.back-btn,
.secondary-btn {
  padding: 10px 15px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stats div {
  background: linear-gradient(145deg, #18223d, #11192d);
  border: 1px solid #293656;
  border-radius: 14px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stats small,
.result-card small {
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
}

.stats b {
  font: 700 27px "Space Mono";
}

.progress {
  height: 5px;
  background: #26314d;
  border-radius: 10px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8b7cff, #4bbcff);
  transition: width .3s;
}

.passage-heading {
  font-size: 12px;
  margin-top: 30px;
  letter-spacing: 1px;
}

.passage {
  padding: 28px;
  min-height: 150px;
  line-height: 2.1;
  font: 16px/2.1 "Space Mono", monospace;
  background: linear-gradient(145deg, #151e35, #101729);
  border: 1px solid #303c60;
  border-radius: 15px;
  color: #7785a7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.correct {
  color: var(--green);
}

.incorrect {
  color: var(--red);
  background: #4b2036;
  border-radius: 3px;
}

.current {
  border-left: 2px solid #a99eff;
}

#typing {
  width: 100%;
  height: 110px;
  margin-top: 18px;
  padding: 17px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0c1428;
  color: var(--ink);
  font: 14px "Space Mono";
  outline: none;
}

#typing:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.secondary-btn {
  margin-top: 15px;
}

/* RESULT */

.result {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
}

.result-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  text-align: center;
  gap: 25px;
}

.result-card div {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card b {
  font: 700 30px "Space Mono";
  color: #9a8aff;
}

.result .secondary-btn {
  width: 100%;
}

/* LIGHT THEME */

body.light {
  --bg: #f1f3ff;
  --card: #ffffff;
  --ink: #1b2340;
  --muted: #68718b;
  --line: #dce1f1;

  background:
    radial-gradient(ellipse at 15% 5%, #dcd7ff 0%, transparent 35%),
    radial-gradient(ellipse at 90% 75%, #d6edff 0%, transparent 35%),
    var(--bg);
}

body.light .setup-card,
body.light .result-card,
body.light .stats div,
body.light .passage {
  background: #ffffff;
  border-color: #dce1f1;
}

body.light .option,
body.light #customText,
body.light #typing {
  background: #f4f5fc;
  color: #1b2340;
}

body.light .option.active {
  background: linear-gradient(135deg, #6556d9, #426fc8);
  color: white;
}

body.light .passage {
  color: #77819e;
}

body.light .stats b {
  color: #1b2340;
}

/* MOBILE */

@media(max-width: 600px) {
  .shell {
    padding: 0 14px;
  }

  .setup {
    margin: 35px auto;
  }

  .setup-card {
    padding: 18px;
  }

  .option {
    padding: 10px 13px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .passage {
    font-size: 13px;
    padding: 17px;
  }

  .test-top {
    gap: 10px;
  }

  .result-card {
    padding: 18px 10px;
  }

  .result-card b {
    font-size: 22px;
  }

  .brand {
    font-size: 16px;
  }

  #theme {
    padding: 8px 10px;
    font-size: 11px;
  }
}
