:root {
  --bg: #17131d;
  --panel: #211b28;
  --panel-2: #292230;
  --line: #49404f;
  --text: #eeeaf0;
  --muted: #8d8493;
  --pink: #f13f91;
  --red: #f02d55;
  --yellow: #f4e72b;
  --cyan: #43d5dc;
  --green: #8be667;
  --orange: #ff8a24;
  --cell: clamp(43px, 5.4vw, 72px);
  --gap: clamp(5px, .7vw, 10px);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 35%, rgba(91, 47, 90, .18), transparent 34%),
    linear-gradient(#1b1720, #151119);
  font-family: "Courier New", Consolas, monospace;
  overflow-x: hidden;
}

body:has(.modal.open) { overflow: hidden; }

button { font: inherit; }

.game-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 24px;
  display: flex;
  flex-direction: column;
}

.brand-row, .help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: #b7abbc;
  letter-spacing: 3px;
  font-size: 13px;
  font-weight: 700;
}

.brand-mark { color: var(--pink); text-shadow: 0 0 12px var(--pink); }

.sound-button {
  width: 36px;
  height: 32px;
  border: 1px solid #514656;
  border-radius: 3px;
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
}

.sound-button:hover { border-color: var(--cyan); box-shadow: 0 0 10px rgba(67,213,220,.2); }
.sound-button.muted { color: var(--muted); }
.game-controls { display: flex; gap: 7px; }
.trophy-button { color: var(--yellow); font-size: 19px; text-shadow: 0 0 9px rgba(244,231,43,.7); }
.trophy-button:hover { border-color: var(--yellow); box-shadow: 0 0 12px rgba(244,231,43,.25); }

.hud {
  position: relative;
  min-height: 84px;
  margin-top: 14px;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: 1fr .8fr 1.35fr .8fr 1fr .7fr;
  gap: 12px;
  align-items: center;
  background: rgba(28, 23, 33, .9);
  border: 3px solid var(--pink);
  border-radius: 12px 3px 12px 3px;
  box-shadow: 0 0 16px rgba(241, 63, 145, .14), inset 0 0 22px rgba(241, 63, 145, .035);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
}

.hud-cell { text-align: center; }
.hud-cell span { display: block; margin-bottom: 3px; color: var(--pink); font-size: 13px; font-weight: 700; letter-spacing: 1px; }
.hud-cell strong { font-size: clamp(18px, 2vw, 28px); line-height: 1; letter-spacing: 1px; text-shadow: 0 0 8px currentColor; }
.hud-cell.cyan span { color: var(--cyan); }
.hud-cell.green span { color: var(--green); }
.hud-cell.time-cell span { color: var(--yellow); }
.time-cell strong { color: var(--yellow); }
.time-cell { position: relative; }
.time-main { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; }
.time-readout { flex: 0 1 auto; min-width: 0; }

.time-track { height: 5px; margin: 8px auto 0; border: 1px solid var(--pink); background: #352331; }
.time-track i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--pink)); transition: width .25s linear; box-shadow: 0 0 8px var(--yellow); }

.lives { display: flex; justify-content: center; gap: 8px; }
.lives[hidden] { display: none; }
.heart { position: relative; width: 22px; height: 20px; color: var(--pink); filter: drop-shadow(0 0 5px var(--pink)); }
.heart::before { content: "♥"; font-size: 24px; line-height: 20px; }
.heart.lost { color: #3c3340; filter: none; }
.player-cell > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.practice-badge { display: block; color: var(--cyan); font-size: 18px !important; text-shadow: 0 0 7px rgba(67,213,220,.45) !important; }
.practice-badge[hidden] { display: none; }

.arena {
  position: relative;
  height: clamp(350px, 47vh, 510px);
  min-height: 350px;
  overflow: hidden;
  isolation: isolate;
}

.stars, .stars::before, .stars::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, var(--pink) 0 1px, transparent 2px),
    radial-gradient(circle, var(--yellow) 0 1px, transparent 2px),
    radial-gradient(circle, #ff4e4e 0 1px, transparent 2px);
  background-size: 187px 173px, 251px 211px, 311px 223px;
  background-position: 30px 20px, 90px 65px, 160px 10px;
  opacity: .65;
  animation: starDrift 16s linear infinite;
}

.stars::before, .stars::after { content: ""; opacity: .45; transform: translateX(100px); }
.stars::after { transform: translateX(-80px) translateY(50px); animation-duration: 23s; }

@keyframes starDrift { to { background-position: 30px 193px, 90px 276px, 160px 233px; } }

.grid {
  position: absolute;
  z-index: -1;
  left: 8%;
  right: 8%;
  bottom: -15px;
  height: 150px;
  opacity: .26;
  background-image:
    linear-gradient(rgba(241,63,145,.7) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241,63,145,.7) 1px, transparent 1px);
  background-size: 55px 27px;
  transform: perspective(220px) rotateX(58deg);
  transform-origin: bottom;
  mask-image: linear-gradient(transparent 8%, black 85%);
}

.status-line {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  color: #716879;
  font-size: 13px;
  letter-spacing: 2px;
  text-align: center;
}

.words-stage {
  position: absolute;
  z-index: 3;
  top: 68px;
  left: 0;
  right: 0;
}

.word-row {
  min-height: calc(var(--cell) + 8px);
  display: flex;
  justify-content: center;
  gap: var(--gap);
}

.word-row.ticker-row {
  position: relative;
  left: 50%;
  width: max-content;
  min-width: 0;
  justify-content: flex-start;
  transition: transform .34s cubic-bezier(.2,.72,.25,1);
}
.ticker-row .letter-tile { width: 42px; height: 54px; flex: 0 0 42px; font-size: 29px; }
.ticker-row .space-tile { width: 24px; flex-basis: 24px; border-color: transparent; background: transparent; box-shadow: none; }
.ticker-row .space-tile::before, .ticker-row .space-tile::after { display: none; }

.preview-word { margin-bottom: clamp(34px, 5vh, 62px); }

.letter-tile {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  color: var(--yellow);
  background: rgba(35, 31, 31, .9);
  font-size: clamp(25px, 3.4vw, 45px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 9px currentColor;
  box-shadow: 0 0 9px rgba(244,231,43,.17), inset 0 0 15px rgba(244,231,43,.05);
  clip-path: polygon(7px 0, calc(100% - 5px) 0, 100% 6px, 100% calc(100% - 8px), calc(100% - 7px) 100%, 5px 100%, 0 calc(100% - 6px), 0 7px);
  transition: color .15s, border-color .15s, opacity .2s, transform .2s;
}

.letter-tile::before, .letter-tile::after {
  content: "";
  position: absolute;
  background: currentColor;
  opacity: .28;
}
.letter-tile::before { width: 12px; height: 2px; top: 7px; right: 5px; }
.letter-tile::after { width: 2px; height: 13px; bottom: 5px; left: 6px; }

.preview-word .letter-tile {
  color: var(--red);
  background: rgba(43, 25, 32, .88);
  transform: scale(.92);
  filter: saturate(.82);
}

.active-word .letter-tile.next {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 0 18px rgba(244,231,43,.47), inset 0 0 14px rgba(244,231,43,.09);
  animation: targetPulse 1s ease-in-out infinite;
}

@keyframes targetPulse { 50% { filter: brightness(1.35); } }

.letter-tile.targeted { color: var(--orange); }
.letter-tile.hit {
  color: #4d4734;
  border-color: #4e4835;
  background: rgba(20, 19, 21, .82);
  text-shadow: none;
  box-shadow: inset 0 0 20px #0b0a0c;
  animation: tileHit .38s ease-out;
}
.letter-tile.hit span { opacity: .12; }

@keyframes tileHit {
  0% { transform: scale(1.12); color: white; filter: brightness(2); }
  35% { transform: rotate(-3deg) scale(.94); }
  100% { transform: scale(1); }
}

.letter-tile.spawn { animation: tileSpawn .42s cubic-bezier(.16,.78,.25,1.28) both; }
@keyframes tileSpawn { from { opacity: 0; transform: translateY(-75px) rotate(10deg) scale(.4); } }

.words-stage.shift .active-word { animation: activeVanish .5s ease-in both; }
.words-stage.shift .preview-word { animation: previewDrop .7s cubic-bezier(.2,.75,.25,1) both; }
@keyframes activeVanish { to { opacity: 0; transform: translateY(55px) scale(.75); filter: blur(5px); } }
@keyframes previewDrop { to { transform: translateY(calc(var(--cell) + clamp(34px, 5vh, 62px))) scale(1.087); filter: hue-rotate(48deg) brightness(1.2); } }

.launcher {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 62px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
}
.launcher-core { position: absolute; inset: 10px; border-radius: 50%; background: #fff9a8; box-shadow: 0 0 10px var(--yellow), 0 0 25px var(--orange); }
.launcher-ring { position: absolute; inset: 2px; border: 2px solid var(--yellow); border-radius: 50%; animation: launcherSpin 3s linear infinite; }
.launcher-ring::before { content: ""; position: absolute; width: 8px; height: 3px; top: -2px; left: 3px; background: var(--orange); box-shadow: 17px 25px 0 var(--pink); }
@keyframes launcherSpin { to { transform: rotate(360deg); } }

.projectile {
  position: absolute;
  z-index: 8;
  width: 15px;
  height: 15px;
  margin: -7px;
  border-radius: 50%;
  background: #fffbd0;
  box-shadow: 0 0 6px #fff, 0 0 14px var(--yellow), 0 0 28px var(--orange);
  pointer-events: none;
}
.projectile::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 7px;
  width: 70px;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--pink), transparent);
  transform: rotate(var(--trail-angle)) translateX(-100%);
  transform-origin: right;
  filter: blur(.2px);
}

.spark { position: absolute; z-index: 9; width: 5px; height: 2px; background: var(--yellow); box-shadow: 0 0 7px currentColor; pointer-events: none; animation: spark .5s ease-out both; }
@keyframes spark { to { opacity: 0; transform: translate(var(--sx), var(--sy)) rotate(170deg); } }

.combo {
  position: absolute;
  z-index: 10;
  left: calc(50% + 38px);
  bottom: 65px;
  min-width: 70px;
  color: var(--orange);
  font-weight: 900;
  text-shadow: 0 0 8px var(--orange);
}
.combo.pop { animation: comboPop .35s ease-out; }
@keyframes comboPop { 50% { transform: scale(1.25) rotate(-3deg); } }

.arena.wrong { animation: wrongShake .25s linear; }
@keyframes wrongShake { 25% { transform: translateX(-6px); filter: saturate(2); } 75% { transform: translateX(6px); } }

.keyboard-wrap { position: relative; z-index: 5; margin-top: -18px; }
.finger-hint { min-height: 22px; margin-bottom: 7px; color: #aaa1ad; font-size: 13px; text-align: center; letter-spacing: 1px; }
.finger-hint strong { color: var(--yellow); }
.blind-mode .finger-hint::before { content: "СЛЕПАЯ ПЕЧАТЬ · "; color: var(--pink); font-weight: 700; }
.keyboard-wrap::after { display: none; }
.blind-mode .finger-hint { visibility: hidden; }
.blind-mode .keyboard { display: none; }
.blind-mode .keyboard-wrap {
  min-height: 74px;
  display: grid;
  place-items: center;
  margin-top: 8px;
  border-top: 1px solid rgba(67,213,220,.14);
  border-bottom: 1px solid rgba(67,213,220,.14);
  background: linear-gradient(90deg, transparent, rgba(67,213,220,.04), transparent);
}
.blind-mode .keyboard-wrap::after {
  content: "СЛЕПАЯ ПЕЧАТЬ  •  СМОТРИТЕ ТОЛЬКО НА СТРОКУ";
  display: block;
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(67,213,220,.45);
}
.keyboard { display: flex; flex-direction: column; gap: 5px; align-items: center; user-select: none; }
.key-row { width: 100%; display: flex; justify-content: center; gap: 5px; }
.key {
  height: clamp(38px, 4.8vw, 54px);
  min-width: clamp(31px, 4.8vw, 54px);
  flex: 0 1 54px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid #4d4551;
  border-radius: 4px;
  color: #9eabb0;
  background: linear-gradient(145deg, #29242d, #211d25);
  font-size: clamp(12px, 1.5vw, 18px);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.2);
  transition: .12s ease;
}
.key.wide { flex-basis: 95px; }
.key.wider { flex-basis: 130px; }
.key.space { flex-basis: 360px; }
.key.target {
  color: var(--yellow);
  border-color: var(--yellow);
  background: #323021;
  box-shadow: 0 0 11px rgba(244,231,43,.25), inset 0 -3px 0 rgba(0,0,0,.25);
  transform: translateY(-2px);
}
.key.pressed { color: white; border-color: var(--cyan); background: #254149; transform: translateY(2px); box-shadow: 0 0 12px rgba(67,213,220,.35); }
.key.bad { color: white; border-color: var(--pink); background: #57233d; animation: keyBad .28s; }
@keyframes keyBad { 50% { transform: translateY(3px); } }

.help-row { margin-top: 14px; color: #9b929f; font-size: 13px; letter-spacing: 1px; }
kbd { padding: 3px 5px; border: 1px solid #514855; border-radius: 3px; color: #a49ba8; background: #252029; font: inherit; }

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(12, 9, 15, .82);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.modal.open { display: grid; opacity: 1; visibility: visible; }
.modal-card {
  width: min(680px, 100%);
  padding: 36px clamp(24px, 5vw, 55px);
  text-align: center;
  background: linear-gradient(155deg, rgba(39,31,45,.98), rgba(24,20,29,.98));
  border: 2px solid var(--pink);
  border-radius: 15px 3px 15px 3px;
  box-shadow: 0 0 40px rgba(241,63,145,.22), inset 0 0 35px rgba(241,63,145,.04);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
}
#startModal .modal-card { width: min(860px, calc(100vw - 24px)); max-width: 100%; padding: 28px 48px; max-height: calc(100vh - 20px); overflow-x: hidden; overflow-y: auto; }
#startModal .modal-icon { font-size: 32px; }
#startModal h1 { margin-bottom: 16px; font-size: clamp(46px, 7vw, 68px); }
.modal-card.compact { width: min(390px, 100%); }
.modal-icon { color: var(--yellow); font-size: 36px; text-shadow: 0 0 12px var(--yellow), 0 0 30px var(--orange); animation: iconPulse 1.2s ease-in-out infinite; }
@keyframes iconPulse { 50% { transform: scale(1.2); } }
.eyebrow { margin: 10px 0; color: var(--cyan); font-size: 13px; font-weight: 700; letter-spacing: 2px; }
.modal h1 { margin: 6px 0 16px; font-size: clamp(42px, 8vw, 72px); line-height: .86; letter-spacing: 4px; text-shadow: 4px 4px 0 #5a1537; }
.modal h1 span { color: var(--pink); }
.modal h2 { margin: 10px 0 28px; font-size: 42px; color: var(--pink); letter-spacing: 4px; text-shadow: 3px 3px 0 #511732; }
.modal-copy { color: #c9c1cc; font-family: Arial, sans-serif; font-size: 18px; line-height: 1.55; }
.access-card { width: min(620px, 100%); }
.access-card h2 { margin-bottom: 18px; color: var(--text); font-size: clamp(24px, 5vw, 40px); line-height: 1.05; }
.access-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.access-actions .primary-button { min-width: 0; margin: 0; }
.auth-button {
  padding: 14px 18px;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  color: var(--cyan);
  background: rgba(67,213,220,.06);
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 0 13px rgba(67,213,220,.12);
}
.auth-button:hover { color: #18131b; background: var(--cyan); }
.auth-card { width: min(440px, 100%); text-align: left; }
.auth-card h2 { margin-bottom: 25px; text-align: center; }
.auth-card .eyebrow, .auth-card .auth-demo, .auth-card .auth-error { text-align: center; }
.auth-label { display: block; margin: 14px 0 7px; color: var(--cyan); font-size: 13px; font-weight: 700; letter-spacing: 1.5px; }
.auth-input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #5a4d5f; border-radius: 4px; outline: none; color: var(--text); background: #1f1a24; font: 700 16px Consolas, monospace; }
.auth-input:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(67,213,220,.22); }
.auth-error { min-height: 20px; margin: 12px 0 0; color: var(--pink); font-family: Arial, sans-serif; font-size: 14px; }
.auth-demo { margin: 4px 0 0; color: #aaa1ad; font-family: Arial, sans-serif; font-size: 14px; }
.auth-demo strong { color: var(--yellow); }
.auth-card .primary-button { display: block; width: 100%; margin-top: 18px; }
.menu-player { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0 6px; padding: 13px 16px; border: 1px solid #4d4251; border-radius: 4px; background: rgba(26,22,31,.72); }
.menu-player span { color: #a79daa; font-size: 13px; letter-spacing: 1.5px; }
.menu-player strong { max-width: 260px; overflow: hidden; color: var(--cyan); font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.menu-player button { padding: 8px 11px; border: 1px solid #504653; border-radius: 3px; color: var(--yellow); background: transparent; font-size: 12px; cursor: pointer; }
.menu-player button:hover { border-color: var(--yellow); }
.primary-button {
  min-width: 230px;
  margin-top: 16px;
  padding: 15px 24px;
  border: 0;
  border-radius: 4px;
  color: #1b131c;
  background: var(--yellow);
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(244,231,43,.3), inset 0 -4px 0 rgba(173,128,14,.35);
  transition: transform .15s, filter .15s;
}
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.12); }
.primary-button:active { transform: translateY(2px); }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.mode-button {
  min-height: 134px;
  padding: 18px 14px;
  border: 1px solid #55495a;
  border-radius: 5px;
  color: #c8becd;
  background: linear-gradient(145deg, #29232e, #211c26);
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.mode-button strong { display: block; margin-bottom: 12px; color: var(--cyan); font-size: 16px; letter-spacing: 1px; }
.mode-button span { display: block; color: #b2a9b6; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.45; }
.mode-button:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 0 15px rgba(67,213,220,.15); }
.mode-button.featured { border-color: var(--yellow); box-shadow: 0 0 14px rgba(244,231,43,.12); }
.mode-button.featured strong { color: var(--yellow); }
.mode-button.selected { border-color: var(--yellow); background: linear-gradient(145deg, #39351f, #29241c); box-shadow: 0 0 16px rgba(244,231,43,.2); transform: translateY(-2px); }
.mode-button.selected strong { color: var(--yellow); }
.profile-panel {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 15px;
  align-items: end;
  margin: 16px 0;
  padding: 11px 12px;
  border: 1px solid #4d4251;
  border-radius: 5px;
  background: rgba(26,22,31,.72);
  text-align: left;
}
.player-name-label { grid-column: 1; color: var(--cyan); font-size: 9px; letter-spacing: 2px; }
.player-name-input {
  grid-column: 1;
  width: 100%;
  height: 35px;
  padding: 0 10px;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  outline: none;
  color: var(--text);
  background: #211c26;
  font: 700 14px Consolas, monospace;
  box-shadow: inset 0 0 10px rgba(67,213,220,.04);
}
.player-name-input:focus { box-shadow: 0 0 10px rgba(67,213,220,.25); }
.profile-stats { grid-column: 2; grid-row: 1 / span 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.profile-stats > div { min-width: 0; text-align: center; }
.profile-stats span { display: block; min-height: 20px; color: #766d7c; font-size: 7px; letter-spacing: .5px; }
.profile-stats strong { color: var(--yellow); font-size: 16px; }
.course-progress { grid-column: 1 / -1; display: grid; grid-template-columns: 150px 1fr; gap: 15px; align-items: center; }
.course-progress span { color: #8f8595; font-size: 9px; }
.course-progress i { display: block; height: 4px; border: 1px solid #514456; background: #29202c; }
.course-progress b { display: block; width: 20%; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); box-shadow: 0 0 7px var(--cyan); transition: width .3s; }
.section-label { margin: 24px 0 10px; color: var(--pink); font-size: 14px; letter-spacing: 2px; }
.exercise-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.exercise-grid button {
  min-height: 46px;
  padding: 11px 7px;
  border: 1px solid #4e4553;
  border-radius: 4px;
  color: #a9a0ad;
  background: #211c26;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
}
.exercise-grid button:hover { color: var(--cyan); border-color: var(--cyan); }
.exercise-grid button.selected { color: #1c171f; border-color: var(--yellow); background: var(--yellow); box-shadow: 0 0 12px rgba(244,231,43,.25); }
.menu-start-button { display: block; min-width: 300px; margin: 22px auto 0; font-size: 17px; }
.secondary-button {
  display: block;
  margin: 12px auto 0;
  padding: 9px 16px;
  border: 1px solid #554a59;
  border-radius: 4px;
  color: #918797;
  background: transparent;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
}
.secondary-button:hover { color: var(--pink); border-color: var(--pink); }
.small-note { margin: 18px 0 0; color: #bdb5c1; font-size: 15px; line-height: 1.4; }
.progress-card { width: min(900px, 100%); max-height: calc(100dvh - 28px); padding: 30px 34px; overflow-x: hidden; overflow-y: auto; text-align: left; }
.progress-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.progress-heading .eyebrow { margin-top: 0; }
.progress-heading h2 { margin: 6px 0 8px; color: var(--pink); font-size: clamp(28px, 5vw, 44px); line-height: 1; }
.progress-player { margin: 0; color: var(--cyan); font-size: 13px; letter-spacing: 1px; }
.progress-close { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid #584b5c; border-radius: 4px; color: var(--text); background: #211b28; font-size: 25px; cursor: pointer; }
.progress-close:hover { color: var(--pink); border-color: var(--pink); }
.progress-filters { display: flex; gap: 8px; margin: 24px 0 14px; }
.progress-filters button { padding: 10px 15px; border: 1px solid #514655; border-radius: 3px; color: #aaa1ad; background: transparent; font-size: 13px; cursor: pointer; }
.progress-filters button.selected { color: #1b161d; border-color: var(--yellow); background: var(--yellow); font-weight: 800; }
.progress-filters.guest button[data-range="today"] { display: none; }
.progress-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.progress-summary > div { min-height: 112px; padding: 17px 14px; border: 1px solid #55495a; border-radius: 5px; background: linear-gradient(145deg, #29232e, #211c26); }
.progress-summary span { display: block; min-height: 34px; color: #b9b0bd; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.25; }
.progress-summary strong { display: inline-block; margin-top: 6px; color: var(--yellow); font-size: 30px; line-height: 1; text-shadow: 0 0 10px rgba(244,231,43,.25); }
.progress-summary small { margin-left: 6px; color: #8d8493; font-family: Arial, sans-serif; font-size: 11px; }
.progress-course { margin-top: 12px; padding: 16px 18px; border: 1px solid #4e4452; border-radius: 5px; background: rgba(26,22,31,.7); }
.progress-course > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.progress-course span { color: var(--cyan); font-size: 12px; letter-spacing: 1px; }
.progress-course strong { color: var(--text); font-size: 15px; }
.progress-course i { display: block; height: 8px; margin-top: 12px; border: 1px solid #514456; background: #29202c; }
.progress-course b { display: block; width: 20%; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); box-shadow: 0 0 8px var(--cyan); transition: width .3s; }
.history-section { margin-top: 22px; }
.history-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.history-title h3 { margin: 0 0 10px; color: var(--pink); font-size: 14px; letter-spacing: 1.5px; }
.history-title span { color: #bdb4c1; font-family: Arial, sans-serif; font-size: 13px; }
.history-list { display: grid; gap: 7px; }
.history-item { display: grid; grid-template-columns: 120px minmax(150px, 1fr) repeat(4, minmax(65px, .55fr)); gap: 8px; align-items: center; padding: 11px 13px; border: 1px solid #443a48; border-radius: 4px; background: #211c26; }
.history-item time { color: #aea5b2; font-family: Arial, sans-serif; font-size: 13px; }
.history-item b { color: var(--cyan); font-size: 13px; }
.history-item span { color: #c0b7c4; font-family: Arial, sans-serif; font-size: 13px; }
.history-item strong { color: var(--yellow); }
.history-empty { padding: 24px; border: 1px dashed #4b414f; color: #978d9c; font-family: Arial, sans-serif; font-size: 14px; text-align: center; }
.result-card { width: min(480px, 100%); }
.result-score span, .result-grid span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.result-score strong { color: var(--yellow); font-size: 44px; text-shadow: 0 0 12px rgba(244,231,43,.4); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 5px; }
.result-grid > div { padding: 12px 5px; border: 1px solid #463c4b; background: #211c26; }
.result-grid strong { display: block; margin-top: 6px; font-size: 21px; }
.new-record { min-height: 18px; color: var(--pink); font-weight: 700; }
.result-mode { margin: -18px 0 15px; color: var(--cyan); font-size: 11px; letter-spacing: 2px; }
.weak-letter { min-height: 18px; margin: 4px 0 0; color: #a89ead; font-size: 11px; }
.eye-card { width: min(560px, 100%); }
.eye-instruction { color: #aaa1af; font-family: Arial, sans-serif; font-size: 14px; }
.eye-track { position: relative; height: 90px; margin: 24px 0 16px; overflow: hidden; border-left: 1px solid #443947; border-right: 1px solid #443947; }
.eye-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, #443947, transparent); }
.eye-track i { position: absolute; top: calc(50% - 8px); left: 12px; width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--yellow), 0 0 24px var(--orange); animation: eyeMove 3.2s ease-in-out infinite alternate; }
@keyframes eyeMove { to { left: calc(100% - 28px); transform: scale(.7); } }
.eye-timer { color: #817787; font-size: 11px; }
.eye-timer strong { color: var(--cyan); }

@media (max-width: 900px) {
  .game-shell { width: calc(100% - 14px); }
  .hud { padding-inline: 10px; grid-template-columns: .9fr .75fr 1.45fr .75fr .9fr .7fr; gap: 5px; }
  .hud-cell span { font-size: 9px; letter-spacing: 0; }
  .hud-cell strong { font-size: clamp(14px, 2.5vw, 20px); }
  .time-main { gap: 3px; }
  #startModal .modal-card { padding-inline: clamp(14px, 4vw, 32px); }
  .keyboard-wrap { overflow: hidden; }
  .keyboard { width: 100%; min-width: 0; }
  .key-row { gap: clamp(2px, .45vw, 4px); }
  .key { min-width: 0; flex: 1 1 0; height: clamp(30px, 5vw, 42px); padding-inline: 2px; font-size: clamp(8px, 1.6vw, 13px); }
  .key.wide { flex: 1.7 1 0; }
  .key.wider { flex: 2.25 1 0; }
  .key.space { flex: 6 1 0; }
}

@media (max-width: 760px) {
  :root { --cell: clamp(38px, 11vw, 58px); --gap: 5px; }
  .game-shell { width: min(100% - 14px, 1180px); padding-top: 8px; }
  .brand-row { justify-content: flex-end; }
  .brand { display: none; }
  .hud { min-height: 72px; margin-top: 0; padding: 10px 8px; grid-template-columns: .9fr .75fr 1.45fr .75fr .9fr .7fr; gap: 3px; border-width: 2px; }
  .hud-cell span { font-size: 8px; letter-spacing: 0; }
  .hud-cell strong { font-size: 15px; }
  .time-track { margin-top: 5px; }
  .arena { height: 370px; }
  .words-stage { top: 78px; }
  .preview-word { margin-bottom: 45px; }
  .letter-tile { font-size: 25px; }
  .keyboard-wrap { margin-top: -25px; overflow: hidden; padding-bottom: 4px; }
  .help-row { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-button { min-height: 96px; }
  .access-actions { grid-template-columns: 1fr; }
  .progress-card { padding: 24px 18px; }
  .progress-summary { grid-template-columns: repeat(2, 1fr); }
  .history-item { grid-template-columns: 95px 1fr repeat(2, minmax(60px, .7fr)); }
  .history-item span:nth-of-type(3), .history-item span:nth-of-type(4) { display: none; }
  .exercise-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-panel { grid-template-columns: 1fr; }
  .player-name-label, .player-name-input, .profile-stats, .course-progress { grid-column: 1; grid-row: auto; }
  .course-progress { grid-template-columns: 1fr; gap: 5px; }
}

@media (max-width: 520px) {
  .modal { padding: 7px; }
  #startModal .modal-card { width: calc(100vw - 14px); max-height: calc(100dvh - 14px); padding: 16px 12px; }
  #startModal h1 { font-size: clamp(34px, 14vw, 50px); }
  .modal-copy { font-size: 15px; }
  .hud { min-height: 116px; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; }
  .hud-cell.player-cell { display: block; }
  .hud-cell span { font-size: 7px; }
  .hud-cell strong { font-size: 13px; letter-spacing: 0; }
  .time-main { display: flex; }
  .time-readout { min-width: 0; }
  .practice-badge { font-size: 13px !important; }
  .arena { height: 330px; min-height: 330px; }
  .words-stage { top: 62px; }
  .key { height: 29px; font-size: 7px; border-radius: 3px; }
  .key-row { gap: 2px; }
  .keyboard { gap: 3px; }
  .profile-stats span { font-size: 6px; }
  .mode-button { padding: 10px; }
  .menu-start-button { min-width: min(260px, 100%); }
  .access-card, .auth-card { padding: 26px 18px; }
  .access-card h2 { font-size: 27px; }
  .menu-player { gap: 7px; padding-inline: 8px; }
  .menu-player span { display: none; }
  .progress-card { width: calc(100vw - 14px); padding: 20px 13px; }
  .progress-heading h2 { font-size: 28px; }
  .progress-player { font-size: 10px; }
  .progress-filters button { flex: 1; padding-inline: 7px; font-size: 9px; }
  .progress-summary { gap: 7px; }
  .progress-summary > div { min-height: 94px; padding: 12px 10px; }
  .progress-summary span { min-height: 27px; font-size: 10px; }
  .progress-summary strong { font-size: 24px; }
  .progress-course > div, .history-title { align-items: flex-start; flex-direction: column; gap: 5px; }
  .history-item { grid-template-columns: 1fr 1fr; gap: 7px; }
  .history-item time, .history-item b { grid-column: auto; }
}

@media (max-height: 760px) and (min-width: 761px) {
  .game-shell { padding-top: 8px; }
  .brand-row { justify-content: flex-end; }
  .brand { display: none; }
  .hud { margin-top: 0; min-height: 70px; padding-top: 9px; padding-bottom: 9px; }
  .arena { height: 360px; }
  .words-stage { top: 55px; }
  .keyboard-wrap { margin-top: -35px; }
  .key { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
