@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #090a12;
  --panel: rgba(18, 20, 34, 0.82);
  --panel-solid: #121420;
  --panel-light: #181b2a;
  --border: rgba(255, 255, 255, 0.09);
  --muted: #8d91a6;
  --text: #f7f7fb;
  --lime: #c9ff3d;
  --lime-dark: #9dcc22;
  --purple: #9d73ff;
  --pink: #ff5e9e;
  --red: #ff5a68;
  --cyan: #53d9ff;
  --radius: 20px;
  --mono: "DM Mono", Consolas, monospace;
  --sans: "Manrope", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(135, 86, 255, 0.12), transparent 38%),
    linear-gradient(145deg, #0b0c15, #07080e 70%);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.1;
  pointer-events: none;
}

.ambient-one {
  top: 15%;
  left: -270px;
  background: var(--purple);
}

.ambient-two {
  right: -300px;
  bottom: 0;
  background: var(--lime);
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 90px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand strong {
  color: var(--lime);
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: #080a0e;
  background: var(--lime);
  border-radius: 10px 5px 10px 5px;
  box-shadow: 0 0 24px rgba(201, 255, 61, 0.2);
  transform: skew(-5deg);
}

.brand-mark svg {
  width: 22px;
  fill: currentColor;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-button,
.how-button,
.leaderboard-button,
.quit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: 180ms ease;
}

.icon-button:hover,
.how-button:hover,
.leaderboard-button:hover,
.quit-button:hover {
  border-color: rgba(201, 255, 61, 0.42);
  background: rgba(201, 255, 61, 0.07);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.icon-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .sound-off,
.icon-button.muted .sound-on {
  display: none;
}

.icon-button.muted .sound-off {
  display: block;
}

.how-button {
  gap: 9px;
  height: 42px;
  padding: 0 15px;
  color: #c8cad5;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.leaderboard-button {
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  color: #c8cad5;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.leaderboard-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.how-button span {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid #767b91;
  border-radius: 50%;
  font-size: 11px;
}

.screen {
  display: none;
  animation: screenIn 480ms ease both;
}

.screen.active {
  display: block;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.start-screen {
  padding: 74px 0 90px;
}

.hero {
  max-width: 830px;
  margin: 0 auto 54px;
  text-align: center;
}

.eyebrow,
.result-kicker {
  color: var(--lime);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}

.eyebrow span {
  width: 6px;
  height: 6px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--lime);
  animation: blink 1.6s infinite;
}

@keyframes blink {
  50% { opacity: 0.35; }
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.hero h1 em {
  color: transparent;
  background: linear-gradient(90deg, var(--lime), #e3ff8f);
  -webkit-background-clip: text;
  background-clip: text;
  font-style: normal;
}

.typewriter-line {
  display: inline-flex;
  min-height: 1em;
  align-items: center;
  justify-content: center;
}

.typewriter-line i {
  width: 0.075em;
  height: 0.78em;
  margin-left: 0.08em;
  background: var(--lime);
  box-shadow: 0 0 14px rgba(201, 255, 61, 0.5);
  animation: typewriterCursor 800ms steps(1) infinite;
}

@keyframes typewriterCursor {
  50% { opacity: 0; }
}

.hero p {
  max-width: 580px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.setup-card {
  width: min(850px, 100%);
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(24, 26, 42, 0.86), rgba(13, 15, 25, 0.9));
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.group-heading > span {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: var(--lime);
  border: 1px solid rgba(201, 255, 61, 0.24);
  background: rgba(201, 255, 61, 0.06);
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 11px;
}

.group-heading h2 {
  margin: 0 0 3px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.group-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.difficulty-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 18px 14px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 15px;
  cursor: pointer;
  transition: 180ms ease;
}

.difficulty-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.difficulty-card.selected {
  border-color: var(--lime);
  background: rgba(201, 255, 61, 0.055);
  box-shadow: inset 0 0 0 1px rgba(201, 255, 61, 0.08), 0 8px 28px rgba(0, 0, 0, 0.2);
}

.difficulty-icon {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
}

.difficulty-icon svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.easy-icon { color: var(--cyan); background: rgba(83, 217, 255, 0.1); }
.medium-icon { color: var(--lime); background: rgba(201, 255, 61, 0.1); }
.hard-icon { color: var(--pink); background: rgba(255, 94, 158, 0.1); }

.difficulty-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.difficulty-copy strong {
  font-size: 13px;
}

.difficulty-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radio-dot {
  width: 14px;
  height: 14px;
  margin-left: auto;
  border: 1px solid #4c5062;
  border-radius: 50%;
}

.selected .radio-dot {
  border: 4px solid var(--lime);
}

.setup-divider {
  height: 1px;
  margin: 30px 0;
  background: var(--border);
}

.duration-group {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  align-items: center;
  gap: 30px;
}

.duration-group .group-heading {
  margin-bottom: 0;
}

.duration-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 13px;
}

.duration-options button {
  height: 42px;
  color: #8e92a5;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}

.duration-options button.selected {
  color: #10120c;
  background: var(--lime);
  box-shadow: 0 5px 20px rgba(201, 255, 61, 0.16);
}

.duration-options small {
  font-size: 8px;
}

.start-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 58px;
  margin-top: 30px;
  color: #090b05;
  border: 0;
  background: var(--lime);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(201, 255, 61, 0.14);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: 180ms ease;
}

.start-button:hover {
  background: #d8ff73;
  box-shadow: 0 15px 40px rgba(201, 255, 61, 0.23);
  transform: translateY(-2px);
}

.start-button:active {
  transform: translateY(0) scale(0.99);
}

.start-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.keyboard-hint,
.submit-hint {
  margin: 14px 0 0;
  color: #5e6275;
  font-size: 10px;
  text-align: center;
}

.setup-help-row {
  position: relative;
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
}

.setup-help-row .keyboard-hint {
  margin-top: 14px;
}

.tutorial-link-button {
  position: absolute;
  top: 10px;
  right: 0;
  padding: 5px 0;
  color: #74788b;
  border: 0;
  background: transparent;
  font-size: 10px;
  cursor: pointer;
  transition: 160ms ease;
}

.tutorial-link-button:hover {
  color: var(--lime);
}

kbd {
  padding: 3px 6px;
  color: #a4a7b5;
  border: 1px solid #36394a;
  border-bottom-width: 2px;
  background: #181a26;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9px;
}

/* Game */
.game-screen {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 40px 0 70px;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.round-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-dot {
  width: 9px;
  height: 9px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--lime);
  animation: blink 1.2s infinite;
}

.round-info div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.round-info small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.round-info strong {
  font-size: 12px;
}

.quit-button {
  padding: 9px 13px;
  color: #8f93a6;
  border-radius: 9px;
  font-size: 11px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: rgba(19, 21, 34, 0.75);
  border-radius: 14px;
}

.stat-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #a7abbb;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 9px;
}

.stat-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-card div {
  display: flex;
  flex-direction: column;
}

.stat-card small {
  margin-bottom: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.stat-card strong {
  font-size: 23px;
  line-height: 1;
}

.stat-card strong i {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.timer-stat .stat-icon,
.score-stat .stat-icon {
  color: var(--lime);
  background: rgba(201, 255, 61, 0.07);
}

.score-stat strong {
  color: var(--lime);
}

.play-area {
  position: relative;
  display: flex;
  min-height: 420px;
  margin-top: 14px;
  padding: 48px 30px 36px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(157, 115, 255, 0.06), transparent 46%),
    rgba(16, 18, 29, 0.76);
  background-size: 34px 34px, 34px 34px, auto, auto;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.23);
}

.play-area::before,
.play-area::after {
  position: absolute;
  width: 70px;
  height: 70px;
  content: "";
  pointer-events: none;
}

.play-area::before {
  top: 18px;
  left: 18px;
  border-top: 1px solid rgba(201, 255, 61, 0.18);
  border-left: 1px solid rgba(201, 255, 61, 0.18);
  border-radius: 12px 0 0;
}

.play-area::after {
  right: 18px;
  bottom: 18px;
  border-right: 1px solid rgba(201, 255, 61, 0.18);
  border-bottom: 1px solid rgba(201, 255, 61, 0.18);
  border-radius: 0 0 12px;
}

.combo-hud {
  position: absolute;
  top: 22px;
  left: 24px;
  width: 145px;
  padding: 10px 11px 9px;
  color: #8d91a6;
  border: 1px solid var(--border);
  background: rgba(7, 8, 14, 0.55);
  border-radius: 10px;
  font-family: var(--mono);
  opacity: 0.62;
  transition: 220ms ease;
}

.combo-hud.active {
  opacity: 1;
  border-color: rgba(255, 189, 103, 0.28);
  background: rgba(255, 189, 103, 0.055);
}

.combo-hud.tier-2,
.combo-hud.tier-3 {
  border-color: rgba(201, 255, 61, 0.4);
  background: rgba(201, 255, 61, 0.065);
  box-shadow: 0 0 24px rgba(201, 255, 61, 0.08);
}

.combo-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.combo-hud-top > span {
  font-size: 7px;
  letter-spacing: 0.14em;
}

.combo-hud-top strong {
  color: #c6c9d4;
  font-size: 8px;
}

.combo-hud-top b {
  color: #ffbd67;
  font-size: 12px;
}

.tier-2 .combo-hud-top b,
.tier-3 .combo-hud-top b {
  color: var(--lime);
}

.combo-track {
  height: 3px;
  margin: 7px 0 5px;
  overflow: hidden;
  background: #303342;
  border-radius: 4px;
}

.combo-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff9a62, #ffcc65);
  border-radius: inherit;
  box-shadow: 0 0 7px rgba(255, 189, 103, 0.45);
  transition: width 260ms ease;
}

.tier-2 .combo-track i,
.tier-3 .combo-track i {
  background: linear-gradient(90deg, var(--purple), var(--lime));
  box-shadow: 0 0 8px rgba(201, 255, 61, 0.5);
}

.combo-hud small {
  display: block;
  font-size: 7px;
  letter-spacing: 0.08em;
  text-align: right;
}

.combo-multiplier {
  position: absolute;
  top: 22px;
  right: 24px;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #686c7e;
  border: 1px solid var(--border);
  background: rgba(7, 8, 14, 0.55);
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  transition: 220ms ease;
}

.combo-multiplier.active {
  color: #0d1007;
  border-color: var(--lime);
  background: var(--lime);
  box-shadow: 0 0 28px rgba(201, 255, 61, 0.28);
  transform: rotate(3deg) scale(1.06);
}

.combo-multiplier.tier-3 {
  color: white;
  border-color: var(--purple);
  background: linear-gradient(135deg, var(--purple), #c24cff);
  box-shadow: 0 0 34px rgba(157, 115, 255, 0.38);
}

.combo-celebration {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7);
}

.combo-celebration.show {
  animation: comboCelebration 1050ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.combo-celebration small {
  z-index: 2;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-shadow: 0 0 15px rgba(201, 255, 61, 0.7);
}

.combo-celebration strong {
  z-index: 2;
  color: var(--lime);
  font-size: clamp(72px, 13vw, 126px);
  letter-spacing: -0.08em;
  line-height: 0.9;
  text-shadow: 0 0 30px rgba(201, 255, 61, 0.55);
}

.combo-celebration.tier-3 strong,
.combo-celebration.tier-3 small {
  color: #cdafff;
  text-shadow: 0 0 30px rgba(157, 115, 255, 0.7);
}

.combo-celebration p {
  z-index: 2;
  margin: 8px 0 0;
  padding: 5px 10px;
  color: #101309;
  background: var(--lime);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.combo-celebration.tier-3 p {
  color: white;
  background: var(--purple);
}

.combo-ring {
  position: absolute;
  width: 180px;
  height: 180px;
  border: 2px solid var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(201, 255, 61, 0.2), inset 0 0 45px rgba(201, 255, 61, 0.1);
}

.tier-3 .combo-ring {
  border-color: var(--purple);
  box-shadow: 0 0 70px rgba(157, 115, 255, 0.32), inset 0 0 50px rgba(157, 115, 255, 0.16);
}

.combo-particles {
  position: absolute;
  width: 210px;
  height: 210px;
}

.combo-particles i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 22px;
  background: var(--lime);
  border-radius: 4px;
  transform-origin: 2px -82px;
}

.combo-particles i:nth-child(1) { transform: rotate(0deg) translateY(-88px); }
.combo-particles i:nth-child(2) { transform: rotate(45deg) translateY(-88px); }
.combo-particles i:nth-child(3) { transform: rotate(90deg) translateY(-88px); }
.combo-particles i:nth-child(4) { transform: rotate(135deg) translateY(-88px); }
.combo-particles i:nth-child(5) { transform: rotate(180deg) translateY(-88px); }
.combo-particles i:nth-child(6) { transform: rotate(225deg) translateY(-88px); }
.combo-particles i:nth-child(7) { transform: rotate(270deg) translateY(-88px); }
.combo-particles i:nth-child(8) { transform: rotate(315deg) translateY(-88px); }

.tier-3 .combo-particles i {
  background: var(--purple);
}

.play-area.combo-flash {
  animation: comboArenaFlash 800ms ease;
}

.play-area.combo-flash-3 {
  animation: comboArenaFlash3 900ms ease;
}

@keyframes comboCelebration {
  0% { opacity: 0; transform: scale(0.55) rotate(-5deg); }
  18% { opacity: 1; transform: scale(1.08) rotate(1deg); }
  68% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.25); }
}

@keyframes comboArenaFlash {
  25% { border-color: var(--lime); box-shadow: 0 0 65px rgba(201, 255, 61, 0.2), inset 0 0 60px rgba(201, 255, 61, 0.08); }
}

@keyframes comboArenaFlash3 {
  25% { border-color: var(--purple); box-shadow: 0 0 80px rgba(157, 115, 255, 0.3), inset 0 0 70px rgba(157, 115, 255, 0.12); }
}

.type-label {
  margin: 0 0 14px;
  color: #62667a;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.word-wrap {
  position: relative;
}

.word-wrap h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(43px, 7vw, 72px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1.1;
  text-align: center;
  transition: 100ms ease;
}

.word-wrap h2.bump {
  color: var(--lime);
  transform: scale(1.04);
}

.score-pop {
  position: absolute;
  top: -12px;
  right: -60px;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
}

.score-pop.show {
  animation: scorePop 600ms ease both;
}

@keyframes scorePop {
  0% { opacity: 0; transform: translateY(8px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-18px); }
}

.word-timer {
  width: min(280px, 75%);
  height: 3px;
  margin: 22px 0 28px;
  overflow: hidden;
  background: #292c3a;
  border-radius: 5px;
}

.word-timer span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  transform-origin: left;
}

.typing-box {
  position: relative;
  display: block;
  width: min(530px, 100%);
}

.typing-box input {
  width: 100%;
  height: 62px;
  padding: 0 58px 0 22px;
  color: var(--text);
  caret-color: var(--lime);
  outline: 0;
  border: 1px solid #333748;
  background: rgba(8, 9, 16, 0.8);
  border-radius: 13px;
  font-family: var(--mono);
  font-size: 18px;
  text-align: center;
  transition: 160ms ease;
}

.typing-box input::placeholder {
  color: #454958;
}

.typing-box input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 61, 0.06), 0 8px 25px rgba(0, 0, 0, 0.2);
}

.typing-box.wrong input {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 90, 104, 0.07);
  animation: shake 260ms ease;
}

.typing-box.correct input {
  border-color: var(--lime);
}

@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.input-status {
  position: absolute;
  top: 50%;
  right: 20px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  opacity: 0;
  transform: translateY(-50%) scale(0.7);
  transition: 140ms ease;
}

.input-status svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.correct .input-status,
.wrong .input-status {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.correct .input-status {
  color: #0c1004;
  background: var(--lime);
}

.wrong .input-status {
  color: white;
  background: var(--red);
}

.wrong-icon,
.wrong .check-icon {
  display: none;
}

.wrong .wrong-icon {
  display: block;
}

.submit-hint span {
  margin: 0 6px;
  color: #383b48;
}

.progress-row {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  align-items: center;
  gap: 16px;
  margin-top: 17px;
  color: #696d80;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.progress-row > span:last-child {
  text-align: right;
}

.progress-row strong {
  margin-left: 4px;
  color: #b7b9c4;
  font-size: 11px;
}

.round-progress {
  height: 3px;
  overflow: hidden;
  background: #202330;
  border-radius: 5px;
}

.round-progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--lime));
  transform-origin: left;
}

/* Results */
.result-screen {
  padding: 65px 0 90px;
}

.result-card {
  width: min(650px, 100%);
  margin: 0 auto;
  padding: 42px 45px;
  text-align: center;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 0, rgba(201, 255, 61, 0.07), transparent 30%),
    rgba(17, 19, 31, 0.88);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.result-burst {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 13px;
}

.result-icon {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  color: #101407;
  background: var(--lime);
  border-radius: 18px;
  box-shadow: 0 0 38px rgba(201, 255, 61, 0.25);
  transform: rotate(4deg);
}

.result-icon svg {
  width: 34px;
  fill: currentColor;
}

.result-burst > span {
  position: absolute;
  width: 3px;
  height: 10px;
  background: var(--lime);
  border-radius: 3px;
}

.result-burst > span:nth-child(1) { top: 0; left: 40px; }
.result-burst > span:nth-child(2) { top: 16px; right: 2px; transform: rotate(60deg); }
.result-burst > span:nth-child(3) { right: 5px; bottom: 10px; transform: rotate(120deg); }
.result-burst > span:nth-child(4) { bottom: 0; left: 38px; }
.result-burst > span:nth-child(5) { bottom: 12px; left: 4px; transform: rotate(60deg); }
.result-burst > span:nth-child(6) { top: 15px; left: 3px; transform: rotate(120deg); }

.result-card h2,
.how-dialog h2 {
  margin: 8px 0 7px;
  font-size: 36px;
  letter-spacing: -0.05em;
}

.result-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.hero-score {
  position: relative;
  display: flex;
  margin: 30px 0 16px;
  padding: 25px;
  align-items: center;
  flex-direction: column;
  border: 1px solid rgba(201, 255, 61, 0.15);
  background: rgba(201, 255, 61, 0.035);
  border-radius: 16px;
}

.hero-score small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.hero-score strong {
  color: var(--lime);
  font-size: 49px;
  letter-spacing: -0.04em;
}

.hero-score span {
  position: absolute;
  top: 13px;
  right: 13px;
  padding: 5px 7px;
  color: #111408;
  background: var(--lime);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-score span.hidden {
  display: none;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.result-stats div {
  display: flex;
  padding: 17px 8px;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.result-stats div:last-child {
  border-right: 0;
}

.result-stats small {
  margin-bottom: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.result-stats strong {
  font-size: 20px;
}

.best-line {
  margin: 17px 0 0;
  color: #696d7f;
  font-size: 10px;
}

.best-line strong {
  color: #aeb1bd;
}

.save-score-form {
  margin-top: 20px;
  padding: 18px;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(5, 6, 11, 0.3);
  border-radius: 14px;
}

.save-score-heading {
  display: flex;
  margin-bottom: 15px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.save-score-heading > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.save-score-heading > div span,
.save-score-form > label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.save-score-heading > div strong {
  font-size: 13px;
}

.result-mode-badge {
  padding: 6px 8px;
  color: var(--lime);
  border: 1px solid rgba(201, 255, 61, 0.17);
  background: rgba(201, 255, 61, 0.055);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.save-score-form > label {
  display: block;
  margin-bottom: 7px;
}

.save-score-row {
  display: grid;
  grid-template-columns: 1fr 145px;
  gap: 8px;
}

.save-score-row input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  color: var(--text);
  outline: 0;
  border: 1px solid #343849;
  background: #0c0d15;
  border-radius: 10px;
  font-size: 12px;
  transition: 160ms ease;
}

.save-score-row input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 61, 0.06);
}

.save-score-row input.invalid {
  border-color: var(--red);
  animation: shake 260ms ease;
}

.save-score-row button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #0d1007;
  border: 0;
  background: var(--lime);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: 160ms ease;
}

.save-score-row button:hover {
  background: #dcff7c;
}

.save-score-row button:disabled {
  color: #777b8b;
  background: #303343;
  cursor: default;
}

.save-score-row button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.save-score-message {
  min-height: 14px;
  margin: 8px 0 0;
  color: #696d80;
  font-size: 9px;
}

.save-score-message.error {
  color: var(--red);
}

.save-score-message.success {
  color: var(--lime);
}

.result-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 27px;
}

.result-actions .start-button {
  height: 52px;
  margin-top: 0;
}

.secondary-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 13px;
  color: #a5a8b7;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 180ms ease;
}

.secondary-button:hover {
  color: var(--text);
  border-color: #4a4e61;
  background: rgba(255, 255, 255, 0.06);
}

/* Dialog */
.how-dialog {
  width: min(650px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  border: 1px solid #303444;
  background:
    radial-gradient(circle at 80% 0, rgba(157, 115, 255, 0.09), transparent 30%),
    #141621;
  border-radius: 20px;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.65);
  overflow-x: hidden;
}

.how-dialog::backdrop {
  background: rgba(4, 5, 10, 0.78);
  backdrop-filter: blur(7px);
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 15px;
  color: #777b8e;
  border: 0;
  background: transparent;
  font-size: 25px;
  cursor: pointer;
  z-index: 2;
}

.dialog-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--lime);
  background: rgba(201, 255, 61, 0.08);
  border-radius: 13px;
  font-size: 24px;
}

.dialog-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dialog-icon.purple {
  color: var(--purple);
  background: rgba(157, 115, 255, 0.09);
}

.dialog-icon.pink {
  color: var(--pink);
  background: rgba(255, 94, 158, 0.09);
}

.dialog-icon.orange {
  color: #ffbd67;
  background: rgba(255, 189, 103, 0.09);
}

.dialog-icon.success {
  color: #0e1207;
  background: var(--lime);
}

.how-dialog h2 {
  margin: 6px 0 9px;
  font-size: 29px;
}

.tutorial-topbar {
  display: flex;
  margin: 2px 35px 25px 0;
  align-items: center;
  justify-content: space-between;
}

.tutorial-step-label,
.tutorial-navigation > span {
  color: #777b8e;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.tutorial-dots {
  display: flex;
  gap: 6px;
}

.tutorial-dots i {
  width: 18px;
  height: 3px;
  background: #303342;
  border-radius: 5px;
  transition: 180ms ease;
}

.tutorial-dots i.active {
  background: var(--lime);
  box-shadow: 0 0 7px rgba(201, 255, 61, 0.35);
}

.tutorial-slide {
  display: none;
  min-height: 410px;
  animation: tutorialIn 240ms ease both;
}

.tutorial-slide.active {
  display: block;
}

@keyframes tutorialIn {
  from { opacity: 0; transform: translateX(9px); }
  to { opacity: 1; transform: translateX(0); }
}

.tutorial-lead {
  max-width: 530px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.tutorial-flow {
  display: grid;
  grid-template-columns: 1fr 28px 1fr 28px 1fr;
  margin: 25px 0;
  align-items: center;
}

.tutorial-flow div {
  display: flex;
  min-height: 115px;
  padding: 17px 10px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 13px;
  text-align: center;
}

.tutorial-flow div > span {
  display: grid;
  width: 29px;
  height: 29px;
  margin-bottom: 9px;
  place-items: center;
  color: #101309;
  background: var(--lime);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11px;
}

.tutorial-flow div strong {
  font-size: 12px;
}

.tutorial-flow div small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.tutorial-flow > i {
  height: 1px;
  background: linear-gradient(90deg, #343747, var(--lime), #343747);
}

.dialog-tip {
  margin: 0;
  padding: 11px 13px;
  color: var(--muted);
  background: rgba(157, 115, 255, 0.07);
  border-radius: 9px;
  font-size: 10px;
}

.dialog-tip strong {
  color: var(--purple);
}

.tutorial-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tutorial-stat-grid div {
  display: flex;
  min-height: 100px;
  padding: 15px;
  flex-direction: column;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 12px;
}

.tutorial-stat-grid span {
  margin-bottom: 10px;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.tutorial-stat-grid strong {
  font-size: 12px;
}

.tutorial-stat-grid small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.tutorial-practice {
  display: flex;
  padding: 24px;
  align-items: center;
  flex-direction: column;
  border: 1px solid var(--border);
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    rgba(7, 8, 14, 0.45);
  background-size: 24px 24px;
  border-radius: 14px;
}

.practice-header {
  display: flex;
  width: min(330px, 100%);
  align-items: center;
  justify-content: space-between;
}

.practice-label {
  color: #686c80;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.practice-count {
  color: var(--lime);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.practice-progress {
  display: grid;
  width: min(330px, 100%);
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.practice-progress i {
  height: 3px;
  background: #303342;
  border-radius: 4px;
  transition: 180ms ease;
}

.practice-progress i.active {
  background: #72778a;
}

.practice-progress i.complete {
  background: var(--lime);
  box-shadow: 0 0 7px rgba(201, 255, 61, 0.3);
}

.tutorial-practice > strong {
  margin: 14px 0 18px;
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.tutorial-practice > strong.word-complete {
  animation: practiceSuccess 260ms ease both;
}

@keyframes practiceSuccess {
  50% { color: var(--lime); transform: scale(1.08); }
}

.tutorial-practice input {
  width: min(330px, 100%);
  height: 48px;
  padding: 0 16px;
  color: var(--text);
  outline: 0;
  border: 1px solid #3b3f50;
  background: #0b0c13;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 16px;
  text-align: center;
  transition: 160ms ease;
}

.tutorial-practice input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 61, 0.06);
}

.tutorial-practice.wrong input {
  border-color: var(--red);
}

.tutorial-practice.complete {
  border-color: rgba(201, 255, 61, 0.45);
  background-color: rgba(201, 255, 61, 0.025);
}

.tutorial-practice.complete input {
  color: var(--lime);
  border-color: var(--lime);
}

.tutorial-practice p {
  margin: 10px 0 0;
  color: #73778a;
  font-size: 9px;
}

.tutorial-practice.complete p {
  color: var(--lime);
}

.tutorial-levels,
.tutorial-rules {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.tutorial-levels > div,
.tutorial-rules > div {
  display: grid;
  min-height: 58px;
  padding: 11px 14px;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 11px;
}

.tutorial-levels > div {
  grid-template-columns: 20px 80px 1fr;
}

.tutorial-levels strong {
  font-size: 11px;
}

.tutorial-levels small {
  color: var(--muted);
  font-size: 9px;
}

.level-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 9px currentColor;
}

.level-dot.easy { color: var(--cyan); background: var(--cyan); }
.level-dot.medium { color: var(--lime); background: var(--lime); }
.level-dot.hard { color: var(--pink); background: var(--pink); }

.tutorial-rules > div {
  grid-template-columns: 65px 1fr;
  gap: 8px;
}

.tutorial-rules p {
  display: flex;
  margin: 0;
  flex-direction: column;
}

.tutorial-rules strong {
  font-size: 11px;
}

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

.tutorial-rules kbd {
  width: fit-content;
}

.mini-bar {
  width: 46px;
  height: 4px;
  overflow: hidden;
  background: #343747;
  border-radius: 5px;
}

.mini-bar i {
  display: block;
  width: 65%;
  height: 100%;
  background: var(--lime);
}

.mini-accuracy {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #0d1007;
  background: var(--lime);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.tutorial-practice-button {
  width: 100%;
  height: 47px;
  color: #0d1007;
  border: 0;
  background: var(--lime);
  border-radius: 11px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  cursor: pointer;
}

.tutorial-navigation {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  padding-top: 18px;
  align-items: center;
  border-top: 1px solid var(--border);
}

.tutorial-navigation > span {
  text-align: center;
}

.tutorial-back,
.tutorial-next {
  height: 38px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: 160ms ease;
}

.tutorial-back {
  color: #a4a8b8;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.tutorial-back:disabled {
  opacity: 0.35;
  cursor: default;
}

.tutorial-next {
  color: #0e1107;
  border: 0;
  background: var(--lime);
}

.tutorial-next:disabled {
  color: #777b8b;
  background: #2d3040;
  cursor: not-allowed;
}

.tutorial-next:not(:disabled):hover,
.tutorial-practice-button:hover {
  background: #dcff7c;
}

/* Leaderboard */
.leaderboard-screen {
  padding: 60px 0 90px;
}

.leaderboard-heading {
  display: flex;
  margin-bottom: 25px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 25px;
}

.leaderboard-heading h1 {
  margin: 5px 0 4px;
  font-size: clamp(38px, 6vw, 64px);
  letter-spacing: -0.06em;
  line-height: 1;
}

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

.database-status {
  display: inline-flex;
  margin-left: 5px;
  align-items: center;
  gap: 5px;
  color: #ffbd67;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.database-status::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
}

.database-status.connected {
  color: var(--lime);
}

.database-status.local {
  color: #ffbd67;
}

.database-status.error {
  color: var(--red);
}

.leaderboard-heading-actions {
  display: flex;
  gap: 8px;
}

.leaderboard-home-button,
.clear-scores-button {
  height: 42px;
  padding: 0 15px;
}

.clear-scores-button {
  color: #a1a5b5;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 11px;
  font-size: 10px;
  cursor: pointer;
  transition: 160ms ease;
}

.clear-scores-button:hover:not(:disabled) {
  color: var(--red);
  border-color: rgba(255, 90, 104, 0.38);
  background: rgba(255, 90, 104, 0.06);
}

.clear-scores-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.leaderboard-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(18, 20, 34, 0.72);
  border-radius: 14px;
}

.leaderboard-summary div {
  display: flex;
  min-height: 82px;
  padding: 18px 20px;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
}

.leaderboard-summary div:last-child {
  border-right: 0;
}

.leaderboard-summary small {
  margin-bottom: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.leaderboard-summary strong {
  font-size: 24px;
}

.leaderboard-summary div:nth-child(2) strong {
  color: var(--lime);
}

.leaderboard-summary div:nth-child(4) strong {
  color: #ffbd67;
}

.leaderboard-tools {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.leaderboard-filters,
.personal-best-card {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--border);
  background: rgba(18, 20, 34, 0.72);
  border-radius: 14px;
}

.leaderboard-filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.leaderboard-filters label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.leaderboard-filters label > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.leaderboard-filters select {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 12px;
  color: #d3d5df;
  outline: 0;
  border: 1px solid #343849;
  background: #0d0f18;
  border-radius: 9px;
  font-size: 10px;
  cursor: pointer;
}

.leaderboard-filters select:focus {
  border-color: var(--lime);
}

.leaderboard-filters button {
  height: 42px;
  padding: 0 13px;
  color: #9ca0b1;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 9px;
  font-size: 9px;
  cursor: pointer;
}

.leaderboard-filters button:hover {
  color: var(--lime);
  border-color: rgba(201, 255, 61, 0.3);
}

.personal-best-card {
  display: grid;
  grid-template-columns: 43px 1fr auto;
  align-items: center;
  gap: 12px;
}

.personal-best-card.has-score {
  border-color: rgba(201, 255, 61, 0.22);
  background: rgba(201, 255, 61, 0.035);
}

.personal-best-icon {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  color: var(--lime);
  background: rgba(201, 255, 61, 0.08);
  border-radius: 11px;
}

.personal-best-card > div {
  min-width: 0;
}

.personal-best-card small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.personal-best-card strong {
  display: block;
  overflow: hidden;
  margin: 3px 0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personal-best-card p {
  overflow: hidden;
  margin: 0;
  color: #777b8d;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personal-best-card > b {
  color: var(--lime);
  font-size: 24px;
}

.leaderboard-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(16, 18, 29, 0.8);
  border-radius: 18px;
  box-shadow: 0 25px 75px rgba(0, 0, 0, 0.25);
}

.leaderboard-table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  padding: 14px 15px;
  color: #6e7285;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 6, 11, 0.28);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.leaderboard-table td {
  padding: 15px;
  color: #b5b8c6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 11px;
  white-space: nowrap;
}

.leaderboard-table tbody tr {
  transition: 150ms ease;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.leaderboard-table tbody tr.just-saved {
  background: rgba(201, 255, 61, 0.055);
  box-shadow: inset 3px 0 var(--lime);
}

.leaderboard-table tbody tr.latest-score:not(.just-saved) {
  background: rgba(157, 115, 255, 0.045);
  box-shadow: inset 3px 0 var(--purple);
}

.rank-cell {
  min-width: 90px;
  color: #777b8d !important;
  font-family: var(--mono);
}

.rank-medal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rank-medal b {
  font-size: 21px;
  line-height: 1;
}

.rank-medal small {
  color: #a8acbb;
  font-size: 8px;
  white-space: nowrap;
}

.player-cell {
  min-width: 150px;
}

.player-cell strong {
  display: inline-block;
  overflow: hidden;
  max-width: 170px;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
}

.latest-badge {
  display: inline-flex;
  margin-left: 7px;
  padding: 3px 5px;
  vertical-align: 2px;
  color: var(--purple);
  border: 1px solid rgba(157, 115, 255, 0.22);
  background: rgba(157, 115, 255, 0.07);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.08em;
}

.wpm-cell {
  color: var(--lime) !important;
  font-size: 14px !important;
  font-weight: 800;
}

.score-cell {
  color: var(--text) !important;
  font-weight: 700;
}

.streak-cell {
  color: #ffbd67 !important;
  font-weight: 700;
}

.difficulty-badge {
  display: inline-flex;
  padding: 5px 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.difficulty-badge.easy {
  color: var(--cyan);
  background: rgba(83, 217, 255, 0.08);
}

.difficulty-badge.medium {
  color: var(--lime);
  background: rgba(201, 255, 61, 0.08);
}

.difficulty-badge.hard {
  color: var(--pink);
  background: rgba(255, 94, 158, 0.08);
}

.date-cell {
  color: #777b8d !important;
  font-family: var(--mono);
  font-size: 9px !important;
}

.export-score-button {
  height: 30px;
  padding: 0 10px;
  color: var(--lime);
  border: 1px solid rgba(201, 255, 61, 0.2);
  background: rgba(201, 255, 61, 0.055);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
  transition: 150ms ease;
}

.export-score-button:hover {
  color: #0d1007;
  background: var(--lime);
}

.leaderboard-empty {
  display: none;
  min-height: 380px;
  padding: 55px 20px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.leaderboard-empty.visible {
  display: flex;
}

.leaderboard-empty > span {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  color: var(--lime);
  background: rgba(201, 255, 61, 0.07);
  border-radius: 16px;
}

.leaderboard-empty svg {
  width: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaderboard-empty h2 {
  margin: 18px 0 5px;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.leaderboard-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.leaderboard-empty .start-button {
  width: min(260px, 100%);
  height: 48px;
  margin-top: 22px;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 650px);
  }

  .site-header {
    height: 72px;
  }

  .how-button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .leaderboard-button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .leaderboard-button span {
    display: none;
  }

  .tutorial-link-button {
    position: static;
    margin-top: 7px;
  }

  .setup-help-row {
    flex-direction: column;
  }

  .start-screen {
    padding: 55px 0 60px;
  }

  .hero {
    margin-bottom: 35px;
  }

  .setup-card {
    padding: 22px;
  }

  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-copy small {
    white-space: normal;
  }

  .duration-group {
    grid-template-columns: 1fr;
    gap: 17px;
  }

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

  .play-area {
    min-height: 390px;
    padding-inline: 18px;
  }

  .combo-hud {
    top: 16px;
    left: 16px;
  }

  .combo-multiplier {
    top: 16px;
    right: 16px;
  }

  .progress-row {
    grid-template-columns: 78px 1fr 78px;
    gap: 8px;
  }

  .result-card {
    padding: 35px 20px;
  }

  .leaderboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .leaderboard-summary div:nth-child(2),
  .leaderboard-summary div:nth-child(4) {
    border-right: 0;
  }

  .leaderboard-summary div:nth-child(-n + 4) {
    border-bottom: 1px solid var(--border);
  }

  .leaderboard-summary div:last-child {
    grid-column: 1 / -1;
  }

  .leaderboard-tools {
    grid-template-columns: 1fr;
  }

  .leaderboard-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-filters button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 470px) {
  .brand {
    font-size: 14px;
  }

  .hero h1 {
    font-size: 45px;
  }

  .hero p {
    font-size: 13px;
  }

  .setup-card {
    border-radius: 18px;
  }

  .stat-card {
    padding: 13px 12px;
  }

  .stat-icon {
    width: 30px;
    height: 30px;
  }

  .stat-card strong {
    font-size: 19px;
  }

  .word-wrap h2 {
    font-size: 42px;
  }

  .score-pop {
    right: -35px;
  }

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

  .result-stats div:nth-child(2) {
    border-right: 0;
  }

  .result-stats div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .save-score-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .save-score-row {
    grid-template-columns: 1fr;
  }

  .save-score-row button {
    height: 44px;
  }

  .leaderboard-screen {
    padding-top: 40px;
  }

  .leaderboard-heading-actions {
    width: 100%;
  }

  .leaderboard-heading-actions button {
    flex: 1;
  }

  .leaderboard-summary div {
    min-height: 72px;
    padding: 14px;
  }

  .leaderboard-filters {
    grid-template-columns: 1fr;
  }

  .leaderboard-filters button {
    width: 100%;
  }

  .personal-best-card {
    grid-template-columns: 38px 1fr auto;
    padding: 13px;
  }

  .personal-best-icon {
    width: 38px;
    height: 38px;
  }

  .personal-best-card > b {
    font-size: 19px;
  }

  .secondary-button {
    height: 48px;
  }

  .how-dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
    padding: 22px 18px;
  }

  .tutorial-topbar {
    margin-bottom: 19px;
  }

  .tutorial-slide {
    min-height: 430px;
  }

  .tutorial-flow {
    grid-template-columns: 1fr 14px 1fr 14px 1fr;
  }

  .tutorial-flow div {
    min-height: 105px;
    padding-inline: 5px;
  }

  .tutorial-flow div small {
    font-size: 8px;
  }

  .tutorial-stat-grid div {
    min-height: 92px;
    padding: 12px;
  }

  .tutorial-levels > div {
    grid-template-columns: 18px 62px 1fr;
  }

  .tutorial-rules > div {
    grid-template-columns: 53px 1fr;
  }

  .tutorial-navigation {
    grid-template-columns: 75px 1fr 75px;
  }
}

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

  .typewriter-line i {
    display: none;
  }
}
