:root {
  color-scheme: dark;
  --bg: #090d18;
  --surface: rgba(18, 24, 42, 0.88);
  --surface-2: #161d31;
  --surface-3: #1c2540;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f6f7ff;
  --muted: #9ca6be;
  --purple: #8a6cff;
  --purple-2: #b392ff;
  --mint: #3ee7bd;
  --orange: #ffac66;
  --blue: #59bbff;
  --red: #ff647c;
  --gold: #f6c85f;
  --gold-2: #ffe6a0;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mode-console { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.mode-tabs { display: grid; flex: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px; border: 1px solid var(--border); border-radius: 18px; background: rgba(14, 19, 34, .88); }
.code-mode .target-text, .code-mode #typingInput { font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.8; text-align: left; }
.code-mode #typingInput { min-height: 180px; }
.mode-tab { display: grid; gap: 3px; padding: 11px 16px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.mode-tab span { font-size: .68rem; font-weight: 900; letter-spacing: .13em; }
.mode-tab strong { color: var(--text); font-size: .94rem; }
.mode-tab small { font-size: .72rem; }
.mode-tab.active { border-color: rgba(138,108,255,.38); background: rgba(138,108,255,.15); }
.mode-tab.pro span { color: var(--gold); }
.mode-tab.pro.active { border-color: rgba(246,200,95,.5); background: linear-gradient(135deg, rgba(246,200,95,.2), rgba(35,27,12,.5)); }
.sound-console { display: flex; gap: 8px; }
.sound-button { min-width: 82px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 800; }
.sound-button span { display: block; margin-bottom: 2px; color: var(--gold); font-size: 1.15rem; }
.sound-button[aria-pressed="true"] { border-color: rgba(246,200,95,.55); background: rgba(246,200,95,.12); color: var(--gold-2); }
body.pro-mode { --purple: #e2ac3f; --purple-2: #ffe19a; background: radial-gradient(circle at 18% -10%, rgba(216,158,44,.2), transparent 34rem), radial-gradient(circle at 92% 10%, rgba(48,166,151,.11), transparent 30rem), #070c13; }
body.pro-mode .training-card, body.pro-mode .keyboard-card { border-color: rgba(246,200,95,.3); }
body.pro-mode .card-label, body.pro-mode .eyebrow { color: var(--gold); }
.warmup-card { margin: 14px 0; padding: 12px 16px; border: 1px dashed rgba(246,200,95,.36); border-radius: 13px; background: rgba(246,200,95,.07); }
.warmup-card span { display: block; margin-bottom: 7px; color: var(--gold); font-size: .67rem; font-weight: 900; letter-spacing: .13em; }
.warmup-card strong { color: var(--gold-2); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .96rem; letter-spacing: .08em; }
.illustration-scene.has-atlas { min-height: 170px; padding: 0; background-image: url("assets/pro-scenes.png"); background-size: 400% 300%; background-repeat: no-repeat; filter: none; }
.pro-offer-card { display: grid; gap: 8px; width: 100%; padding: 20px; border: 1px solid rgba(246,200,95,.36); border-radius: 20px; background: radial-gradient(circle at 100% 0, rgba(246,200,95,.2), transparent 10rem), linear-gradient(145deg,#17150f,#0d1420); box-shadow: 0 18px 45px rgba(0,0,0,.25); text-align: left; cursor: pointer; }
.pro-kicker { color: var(--gold); font-size: .7rem; font-weight: 900; letter-spacing: .15em; }
.pro-offer-card strong { font-size: 1.05rem; line-height: 1.35; }
.pro-offer-card small { color: #aeb6c7; line-height: 1.45; }
.pro-offer-card b { margin-top: 4px; color: var(--gold-2); font-size: .83rem; }
.pro-modal::backdrop { background: rgba(2,5,10,.84); backdrop-filter: blur(10px); }
.pro-modal-card { width: min(720px, calc(100vw - 28px)); border-color: rgba(246,200,95,.4); background: radial-gradient(circle at 100% 0, rgba(246,200,95,.16), transparent 19rem), #0d1420; }
.pro-modal-card h2 { max-width: 600px; margin-bottom: 12px; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; }
.pro-lead { max-width: 630px; color: #b5bdcc; line-height: 1.65; }
.pro-benefits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0; }
.pro-benefits article { display: grid; grid-template-columns: 34px 1fr; gap: 4px 10px; padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.035); }
.pro-benefits article > span { grid-row: span 2; color: var(--gold); font-size: .72rem; font-weight: 900; }
.pro-benefits strong { font-size: .9rem; }
.pro-benefits small { color: #969fb1; font-size: .76rem; line-height: 1.4; }
.pro-checkout { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; border: 1px solid rgba(246,200,95,.34); border-radius: 17px; background: rgba(246,200,95,.08); }
.pro-checkout > div { display: grid; gap: 3px; }
.pro-checkout span { color: var(--gold); font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.pro-checkout strong { font-size: 1.6rem; }
.pro-checkout small { color: #aab3c3; }
.pro-buy-button { border: 0; background: linear-gradient(135deg,#ffe39a,#d69c2f); color: #191204; }
.pro-buy-button:disabled { cursor: not-allowed; opacity: .72; }
.pro-preview-button { width: 100%; margin-top: 10px; padding: 13px; border: 1px solid rgba(246,200,95,.4); border-radius: 12px; background: transparent; color: var(--gold-2); cursor: pointer; font-weight: 850; }
.volume-row { display: grid; gap: 8px; margin: 16px 0; color: var(--text); font-size: .8rem; font-weight: 750; }
.volume-row input { width: 100%; accent-color: var(--gold); }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% -10%, rgba(109, 83, 255, 0.22), transparent 34rem),
    radial-gradient(circle at 92% 10%, rgba(31, 210, 184, 0.12), transparent 30rem),
    var(--bg);
  color: var(--text);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(138, 108, 255, 0.72);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one {
  top: 20%;
  left: -17rem;
  background: var(--purple);
}

.ambient-two {
  right: -17rem;
  bottom: 4%;
  background: var(--mint);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.78);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.18em;
}

.brand strong {
  font-weight: 850;
}

.brand em {
  margin-top: 4px;
  color: var(--purple-2);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.45em;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(179, 146, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(138, 108, 255, 0.25), rgba(62, 231, 189, 0.08));
  box-shadow: 0 8px 24px rgba(99, 73, 220, 0.25);
}

.brand-mark span {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--purple-2);
}

.brand-mark span:nth-child(5),
.brand-mark span:nth-child(6) {
  background: var(--mint);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-button {
  min-height: 38px;
  padding: 8px 14px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  border: 1px solid rgba(62, 231, 189, 0.25);
  border-radius: 13px;
  background: rgba(62, 231, 189, 0.08);
  text-align: left;
}

.account-chip > span:last-child,
.account-chip strong,
.account-chip small {
  display: block;
}

.account-chip strong { font-size: 0.78rem; }
.account-chip small { margin-top: 2px; color: var(--mint); font-size: 0.68rem; }

.account-avatar,
.account-big-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--purple), #6549d9);
  color: #fff;
  font-weight: 850;
}

.account-avatar { width: 30px; height: 30px; font-size: 0.75rem; }
.account-big-avatar { width: 68px; height: 68px; margin: 0 auto 16px; font-size: 1.6rem; }

.auth-card > p:not(.eyebrow, .microcopy),
.account-card > p:not(.eyebrow, .microcopy) {
  margin-bottom: 20px;
}

.auth-logo {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid rgba(138, 108, 255, 0.38);
  border-radius: 17px;
  background: rgba(138, 108, 255, 0.15);
  font-size: 1.8rem;
}

.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: #202124;
  font-weight: 750;
}

.google-g {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #4285f4;
  font-size: 1.12rem;
  font-weight: 900;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  content: "";
  background: var(--border);
}

.auth-field {
  display: block;
  margin-bottom: 12px;
  text-align: left;
}

.auth-field span {
  display: block;
  margin: 0 0 6px 2px;
  color: #cdd3e5;
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #0b1020;
  color: var(--text);
  outline: none;
}

.auth-field input:focus { border-color: var(--purple); }

.auth-error {
  min-height: 20px;
  margin: 2px 0 8px !important;
  color: #ff91a2 !important;
  font-size: 0.76rem !important;
  text-align: left;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.account-summary div {
  padding: 13px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
}

.account-summary span,
.account-summary strong { display: block; }
.account-summary span { color: var(--muted); font-size: 0.68rem; }
.account-summary strong { margin-top: 5px; font-size: 1rem; }

.safe-chip,
.layout-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(62, 231, 189, 0.22);
  border-radius: 999px;
  background: rgba(62, 231, 189, 0.08);
  color: #a6f8df;
  font-size: 12px;
  font-weight: 750;
}

.safe-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(62, 231, 189, 0.12);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 9px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.icon-button svg,
.button svg,
.privacy-panel svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.game-column,
.side-column {
  min-width: 0;
}

.mission-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--purple-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.mission-heading h1,
.modal h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 40px);
  letter-spacing: -0.04em;
}

.mission-heading p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.layout-badge {
  border-color: rgba(138, 108, 255, 0.28);
  background: rgba(138, 108, 255, 0.09);
  color: #cfc2ff;
  letter-spacing: 0.08em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card,
.training-card,
.keyboard-card,
.panel,
.profile-card,
.privacy-panel {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(24, 31, 53, 0.92), rgba(14, 19, 34, 0.92));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: var(--radius-md);
}

.stat-card::before {
  position: absolute;
  top: 0;
  left: 14px;
  width: 36px;
  height: 2px;
  content: "";
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.accent-purple { --accent: var(--purple); }
.accent-mint { --accent: var(--mint); }
.accent-orange { --accent: var(--orange); }
.accent-blue { --accent: var(--blue); }

.stat-card > span,
.stat-card > small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0 3px;
}

.stat-card b {
  font-size: 27px;
  line-height: 1;
}

.stat-card strong small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.training-card,
.keyboard-card {
  padding: clamp(18px, 2.6vw, 28px);
  border-radius: var(--radius-lg);
}

.card-label-row,
.keyboard-head,
.goal-row,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-label {
  color: #c7cce0;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.focus-note {
  color: var(--muted);
  font-size: 11px;
}

.focus-note.active {
  color: var(--mint);
}

.illustration-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr;
  align-items: center;
  gap: 22px;
  min-height: 150px;
  margin: 18px 0;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(138, 108, 255, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(62, 231, 189, 0.18), transparent 11rem),
    linear-gradient(135deg, rgba(138, 108, 255, 0.17), rgba(9, 14, 28, 0.82));
}

.illustration-scene {
  display: grid;
  min-height: 108px;
  place-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.035));
  font-size: clamp(4rem, 8vw, 6.4rem);
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.28));
}

.illustration-scene.scene-wide {
  letter-spacing: 0.08em;
  font-size: clamp(2.8rem, 6vw, 5rem);
}

.illustration-copy span,
.illustration-copy strong {
  display: block;
}

.illustration-copy span {
  margin-bottom: 8px;
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.illustration-copy strong {
  max-width: 320px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.35;
}

.illustration-sparkles {
  position: absolute;
  top: 12px;
  right: 16px;
  color: var(--orange);
  font-size: 1.25rem;
}

.target-text {
  min-height: 104px;
  margin: 18px 0;
  padding: 18px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 11, 22, 0.6);
  color: #737d95;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(20px, 2.5vw, 29px);
  font-weight: 650;
  line-height: 1.65;
  letter-spacing: 0.025em;
}

.target-text span {
  position: relative;
  border-radius: 3px;
}

.target-text .char-correct {
  color: var(--mint);
}

.target-text .char-wrong {
  color: #fff;
  background: rgba(255, 100, 124, 0.65);
}

.target-text .char-current {
  color: var(--text);
  background: rgba(138, 108, 255, 0.25);
  box-shadow: inset 0 -2px var(--purple-2);
}

.target-text .char-space.char-current::after,
.target-text .char-space.char-wrong::after {
  position: absolute;
  bottom: 0;
  left: 18%;
  width: 64%;
  height: 2px;
  content: "";
  border-radius: 10px;
  background: currentColor;
}

#typingInput {
  width: 100%;
  min-height: 78px;
  resize: none;
  padding: 15px 17px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  outline: none;
  background: #0a0f1e;
  color: var(--text);
  caret-color: var(--purple-2);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 17px;
  line-height: 1.45;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

#typingInput:focus {
  border-color: rgba(138, 108, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(138, 108, 255, 0.11);
}

#typingInput.input-error {
  border-color: rgba(255, 100, 124, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 100, 124, 0.09);
}

#typingInput:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.typing-help {
  margin: 8px 2px 18px;
  color: var(--muted);
  font-size: 11px;
}

.goal-row > div:first-child {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.goal-row strong {
  color: var(--text);
}

.progress-track,
.xp-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.goal-row .progress-track {
  max-width: 72%;
}

.progress-track span,
.xp-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--mint));
  box-shadow: 0 0 14px rgba(138, 108, 255, 0.38);
  transition: width 160ms ease;
}

.keyboard-card {
  margin-top: 14px;
}

.keyboard-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

#nextKeyLabel {
  display: grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(138, 108, 255, 0.35);
  border-radius: 8px;
  background: rgba(138, 108, 255, 0.13);
  color: #d8d0ff;
}

.finger-hint {
  color: var(--muted);
  font-size: 11px;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 18px;
  user-select: none;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.key {
  display: grid;
  flex: 1;
  min-width: 0;
  max-width: 62px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom-color: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #252e49, #1a2238);
  color: #c6cbda;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 3px 0 #0b0f1c;
  transition: transform 100ms ease, background 100ms ease, color 100ms ease;
}

.key.next-key {
  transform: translateY(2px);
  border-color: rgba(138, 108, 255, 0.85);
  background: linear-gradient(180deg, #9b83ff, #7153e8);
  color: #fff;
  box-shadow: 0 0 22px rgba(138, 108, 255, 0.55);
}

.key.space-key {
  flex: 4;
  max-width: 310px;
}

.control-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 760;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button svg {
  width: 17px;
}

.button-primary {
  border-color: rgba(180, 159, 255, 0.35);
  background: linear-gradient(135deg, #8d71ff, #6f52e1);
  color: #fff;
  box-shadow: 0 10px 24px rgba(101, 70, 222, 0.26);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface-2);
}

.button-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.button-danger {
  width: 100%;
  border-color: rgba(255, 100, 124, 0.25);
  background: rgba(255, 100, 124, 0.09);
  color: #ff9aaa;
}

.wide {
  width: 100%;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 82px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.level-ring {
  display: grid;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--purple) 0deg, var(--purple) 0deg, rgba(255,255,255,.07) 0deg);
  transition: background 200ms ease;
}

.level-ring > div {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #11182a;
}

.level-ring span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.level-ring strong {
  font-size: 27px;
  line-height: 1;
}

.profile-copy {
  min-width: 0;
  flex: 1;
}

.profile-copy p,
.profile-copy strong,
.profile-copy small {
  display: block;
}

.profile-copy p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.profile-copy strong {
  margin-bottom: 10px;
}

.profile-copy small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.panel {
  padding: 19px;
  border-radius: var(--radius-lg);
}

.panel h2 {
  margin: 0;
  font-size: 15px;
}

.panel-head > span {
  color: var(--muted);
  font-size: 10px;
}

.roadmap {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.roadmap li {
  position: relative;
  display: grid;
  grid-template-columns: 31px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 51px;
}

.roadmap li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 36px;
  left: 15px;
  width: 1px;
  height: 30px;
  content: "";
  background: var(--border-strong);
}

.roadmap-index {
  position: relative;
  z-index: 1;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #171e32;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.roadmap li.done .roadmap-index {
  border-color: rgba(62, 231, 189, 0.35);
  background: rgba(62, 231, 189, 0.12);
  color: var(--mint);
}

.roadmap li.current .roadmap-index {
  border-color: rgba(138, 108, 255, 0.6);
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(138, 108, 255, 0.1);
}

.roadmap-copy strong,
.roadmap-copy span {
  display: block;
}

.roadmap-copy strong {
  font-size: 11px;
}

.roadmap-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.roadmap-state {
  color: var(--muted);
  font-size: 9px;
}

.roadmap li.current .roadmap-state {
  color: var(--purple-2);
}

.daily-panel p {
  margin: 12px 0;
  color: var(--muted);
  font-size: 11px;
}

.daily-circles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.daily-circles span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: #596178;
  font-size: 12px;
}

.daily-circles span.done {
  border-color: rgba(62, 231, 189, 0.3);
  background: rgba(62, 231, 189, 0.1);
  color: var(--mint);
}

.privacy-panel {
  display: flex;
  gap: 12px;
  padding: 15px;
  border-color: rgba(62, 231, 189, 0.14);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(62, 231, 189, 0.075), rgba(14, 19, 34, 0.9));
}

.privacy-panel svg {
  flex: 0 0 auto;
  width: 22px;
  color: var(--mint);
}

.privacy-panel strong,
.privacy-panel span {
  display: block;
}

.privacy-panel strong {
  font-size: 11px;
}

.privacy-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.modal {
  width: min(540px, calc(100% - 28px));
  padding: 0;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 0;
  border-radius: 25px;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(3, 5, 12, 0.8);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  padding: clamp(26px, 5vw, 42px);
  border: 1px solid var(--border-strong);
  border-radius: 25px;
  background:
    radial-gradient(circle at 50% 0, rgba(138, 108, 255, 0.21), transparent 16rem),
    #12182a;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal.pro-modal { width: min(900px, calc(100vw - 28px)); }
.pro-modal .pro-modal-card { width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
  .modal { max-height: calc(100dvh - 16px); width: calc(100vw - 16px); }
  .modal.pro-modal { width: calc(100vw - 16px); }
  .pro-modal .modal-card { padding: 52px 18px 24px; }
  .pro-modal .pro-buy-button { min-height: 48px; white-space: normal; width: 100%; }
}

.modal-card > p:not(.eyebrow, .microcopy) {
  max-width: 430px;
  margin: 10px auto 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.modal-icon,
.result-badge {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid rgba(138, 108, 255, 0.4);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(138, 108, 255, 0.27), rgba(62, 231, 189, 0.12));
  color: #d9d0ff;
  font-size: 28px;
  box-shadow: 0 14px 30px rgba(86, 57, 203, 0.27);
}

.layout-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.layout-option {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}

.layout-option:hover,
.layout-option.selected {
  border-color: rgba(138, 108, 255, 0.58);
  background: rgba(138, 108, 255, 0.11);
}

.layout-option span,
.layout-option small {
  color: var(--muted);
  font-size: 10px;
}

.layout-option small {
  margin-top: 6px;
  color: var(--purple-2);
  font-family: "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.13em;
}

.microcopy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 21px 0;
}

.result-stats div {
  padding: 13px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.result-stats span,
.result-stats strong {
  display: block;
}

.result-stats span {
  color: var(--muted);
  font-size: 9px;
}

.result-stats strong {
  margin-top: 5px;
  font-size: 15px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 9px;
}

.result-card.failed .result-badge {
  border-color: rgba(255, 172, 102, 0.4);
  background: rgba(255, 172, 102, 0.1);
  color: var(--orange);
}

.settings-card {
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 22px;
}

.settings-card fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0;
  padding: 0;
  border: 0;
}

.settings-card legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
}

.settings-card fieldset label {
  padding: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
}

.settings-card input {
  accent-color: var(--purple);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 22px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.toggle-row span,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100% - 44px));
  padding: 12px 16px;
  transform: translateY(25px);
  pointer-events: none;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #1b2339;
  box-shadow: var(--shadow);
  opacity: 0;
  font-size: 12px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.paused .target-text,
.paused #typingInput,
.paused .keyboard {
  filter: blur(5px);
  user-select: none;
}

.high-contrast {
  --muted: #c5cad7;
  --border: rgba(255, 255, 255, 0.2);
  --border-strong: rgba(255, 255, 255, 0.34);
  --purple: #9e86ff;
  --mint: #65f6cf;
}

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

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-column {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding-top: 0;
  }

  .profile-card,
  .privacy-panel {
    grid-column: span 1;
  }
}

@media (max-width: 700px) {
  .topbar {
    min-height: 66px;
    padding: 11px 14px;
  }

  .safe-chip {
    padding: 7px 9px;
    font-size: 0;
  }

  .safe-chip .safe-dot {
    margin: 0;
  }

  .auth-button { padding-inline: 10px; font-size: 0.75rem; }
  .account-chip > span:last-child { display: none; }
  .account-chip { padding-right: 6px; }

  .app-shell {
    width: min(100% - 24px, 700px);
    padding-top: 22px;
  }

  .mode-console { flex-direction: column; }
  .sound-console { justify-content: stretch; }
  .sound-button { flex: 1; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .key {
    height: 34px;
    font-size: 9px;
  }

  .keyboard-card {
    padding-inline: 10px;
  }

  .finger-hint {
    display: none;
  }

  .goal-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .goal-row .progress-track {
    max-width: none;
  }
}

@media (max-width: 460px) {
  .mission-heading {
    flex-direction: column;
  }

  .layout-options,
  .result-actions,
  .result-stats {
    grid-template-columns: 1fr;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button {
    padding-inline: 10px;
  }

  .illustration-card {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }

  .illustration-copy strong {
    margin-inline: auto;
  }

  .auth-actions,
  .account-summary {
    grid-template-columns: 1fr;
  }

  .mode-tabs,
  .pro-benefits { grid-template-columns: 1fr; }

  .pro-checkout { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
