* {
  box-sizing: border-box;
}

:root {
  --bg-1: #0f172a;
  --bg-2: #111827;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --accent-2: #6366f1;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.18), transparent 35%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
}

h1 {
  margin: 0 0 8px;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.profile-card,
.control-card,
.panel,
.badges-section,
.typing-panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.profile-card {
  min-width: 240px;
  padding: 14px;
}

.profile-card label,
.control-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}

#playerName,
#input {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  outline: none;
  transition: 0.2s ease;
}

#playerName:focus,
#input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.top-controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.control-card {
  padding: 16px;
}

.difficulty-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-btn {
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.2s ease;
}

.difficulty-btn:hover,
.difficulty-btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.difficulty-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.quote-info-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.race-track {
  margin-bottom: 18px;
}

.track-line {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(to right, #1e293b, #334155);
  border: 1px solid var(--border);
}

#playerIcon {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(0, -50%);
  font-size: 30px;
  transition: transform 0.1s linear;
  z-index: 10;
  pointer-events: none;
}

.finish-flag {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
}

.track-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.typing-panel {
  padding: 18px;
  margin-bottom: 20px;
}

#quote {
  font-size: 22px;
  line-height: 1.9;
  min-height: 120px;
  padding: 18px;
  background: rgba(248, 250, 252, 0.95);
  color: #1e293b;
  border-radius: 16px;
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
  margin-bottom: 14px;
}

.word {
  display: inline;
  font-weight: 600;
  transition: color 0.2s ease, background 0.2s ease;
}

.completed-word {
  color: #94a3b8;
}

.current-word {
  background: rgba(56, 189, 248, 0.22);
  border-radius: 4px;
  padding: 2px 4px;
}

.typing-correct {
  color: var(--success);
}

.typing-wrong {
  color: var(--danger);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

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

#stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 14px;
  text-align: center;
}

.stat-label {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

#resultMessage {
  min-height: 34px;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
}

.win {
  color: var(--success);
}

.lose {
  color: #fca5a5;
}

.badges-section {
  padding: 18px;
  margin-bottom: 20px;
}

.badges-section h2,
.panel h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.badge-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.badge-card.unlocked {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
}

.badge-name {
  font-weight: 800;
  display: block;
  margin-bottom: 6px;
}

.badge-desc {
  color: var(--muted);
  font-size: 13px;
}

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.panel {
  padding: 18px;
}

.list-panel {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.list-item strong {
  display: inline-block;
  margin-right: 8px;
}

.list-meta {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0 30px; 
}

button {
  padding: 13px 24px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(56, 189, 248, 0.2);
}

#restartBtn {
  background: linear-gradient(135deg, #64748b, #475569);
}

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

@media (max-width: 920px) {
  .hero,
  .top-controls,
  .panels-grid,
  #stats {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero {
    align-items: stretch;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }

  .container {
    padding: 18px;
  }

  h1 {
    font-size: 32px;
  }

  #quote {
    font-size: 18px;
  }

  .difficulty-buttons {
    flex-direction: column;
  }

  .buttons {
    flex-direction: column;
  }
} 
.account-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.account-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);

  display: flex;              
  align-items: center;
  justify-content: center;

  font-size: 26px;            
  line-height: 1;            
  cursor: pointer;
  transition: 0.2s ease;
}

.account-btn:hover,
.account-btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.player-status {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.auth-container {
  max-width: 1100px;
}

.auth-hero {
  align-items: center;
}

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

.auth-panel {
  padding: 20px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 8px;
}

.auth-input {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  outline: none;
  transition: 0.2s ease;
  margin-bottom: 14px;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.auth-panel button,
.buttons button {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  transition: 0.2s ease;
}

.auth-panel button:hover,
.auth-panel button:focus-visible,
.buttons button:hover,
.buttons button:focus-visible {
  transform: translateY(-1px);
}

.guest-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-message {
  margin-top: 18px;
  min-height: 24px;
  font-weight: 700;
}

.error-text {
  color: #fca5a5;
}

.success-text {
  color: #86efac;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  font-weight: 700;
  transition: 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.list-panel {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.history-row {
  grid-template-columns: 1fr auto auto;
}

.list-rank,
.list-meta {
  color: var(--muted);
  font-size: 13px;
}

.list-name {
  font-weight: 700;
}

.list-score {
  font-weight: 800;
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

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

.buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

@media (max-width: 900px) {
  .auth-grid,
  .panels-grid,
  .top-controls {
    grid-template-columns: 1fr;
  }

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

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

  .account-area {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }

  .container {
    padding: 18px;
  }

  h1 {
    font-size: 32px;
  }

  #quote {
    font-size: 18px;
    line-height: 1.7;
  }

  #stats {
    grid-template-columns: 1fr;
  }

  .list-row,
  .history-row {
    grid-template-columns: 1fr;
  }
}
.chart-container {
  margin: 20px 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  height: 320px;
}