/* === Токены === */
/* Дизайн-токены — палитра v1 (frontend/src/App.css) */
:root {
  --bg: #1e1e1e;
  --bg-header: #2d2d2d;
  --bg-auth: #0d0f14;
  --bg-card: #252526;
  --accent: #2d6ff2;
  --accent-light: #4d8aff;
  --teal: #4ec9b0;
  --ok: #4caf50;
  --ok-dark: #0e7c30;
  --warn: #e89b00;
  --gold: #ca8a04;
  --err: #c42b1c;
  --text: #d4d4d4;
  --text-light: #c4c8d4;
  --text-muted: #5a5f72;
  --border: #3a3f52;
  --border-dim: #333;
  --mono: 'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === База === */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ui);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--text-light);
}

h1, h2, h3 {
  color: #fff;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}

h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
h3 { font-size: 16px; margin: 16px 0 8px; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

code {
  background-color: var(--bg-header);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--mono);
  color: #ce9178;
}

/* Таблицы — моноширинные, как в v1 leaderboard */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-family: var(--mono);
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-dim);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

tr:hover td {
  background-color: rgba(45, 111, 242, 0.06);
}

/* Live-борд (проектор): крупнее обычной таблицы */
table.live { font-size: 1.4rem; }
table.live td, table.live th { padding: 10px 16px; }

/* Формы */
label {
  display: block;
  margin: 0.8rem 0;
  color: var(--text-light);
  font-size: 14px;
}

input:not([type="hidden"]), textarea {
  display: block;
  width: 100%;
  max-width: 24rem;
  margin-top: 0.25rem;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--mono);
  background-color: var(--bg-auth);
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 111, 242, 0.35);
}

button, .btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
  background-color: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

button:hover, .btn:hover {
  background-color: var(--accent-light);
  color: #fff;
  box-shadow: 0 0 20px rgba(45, 111, 242, 0.2);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Контурная кнопка-ссылка */
.btn-ghost {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
  background-color: transparent;
  color: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.btn-ghost:hover {
  color: #fff;
  border-color: var(--accent-light);
  box-shadow: 0 0 20px rgba(45, 111, 242, 0.15);
}

/* Кнопка, выглядящая как nav-ссылка (logout и пр.) */
button.linklike {
  padding: 0;
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--accent-light);
  letter-spacing: 0.02em;
  box-shadow: none;
}

button.linklike:hover {
  background: none;
  color: var(--text-light);
  box-shadow: none;
  text-decoration: underline;
}

button.linklike.danger {
  color: var(--err);
}

/* Карточка */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

/* === Шапка === (та же навигация, что на лендинге — единый вид всех страниц) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(45, 111, 242, 0.1);
}
/* Логотип и nav-ссылки используют те же классы, что .landing-nav
   (.nav-logo/.nav-logo-icon/.nav-logo-text/.nav-right/.nav-link/.nav-divider). */

/* === Утилиты === */
.ok { color: var(--ok); }
.error { color: var(--err); }
.muted { color: var(--text-muted); }
.inline { display: inline; }

/* === Лендинг (перенос 1-в-1 из v1 frontend/src/App.css) === */
/* Лендинг — полностраничный takeover: своя фиксированная навигация и футер,
   общий site-header скрыт. Класс landing-page висит на <body>. */
.landing-page {
  position: relative;
  min-height: 100vh;
  background: #0d0f14;
  color: #c4c8d4;
  font-family: 'Source Sans 3', sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}
body.landing-page .site-header { display: none; }
body.landing-page main { max-width: none; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* Grid + Scanline */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(45,111,242,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,111,242,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.scanline {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
}

/* Nav */
.landing-nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  padding: 0.75rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(13,15,20,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(45,111,242,0.1);
}
.nav-logo {
  display: flex; align-items: center; gap: 0.75rem; text-decoration: none;
}
.nav-logo-icon {
  width: 32px; height: 32px;
  border: 2px solid #2d6ff2; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; font-weight: 700;
  color: #4d8aff;
}
.nav-logo-text {
  font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 700;
  color: #e8eaf0; letter-spacing: 0.05em;
}
.nav-logo-text span { color: #4d8aff; }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-link {
  color: #5a5f72; text-decoration: none;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  transition: color 0.3s; letter-spacing: 0.02em;
}
.nav-link:hover { color: #c4c8d4; }
.nav-link-active { color: #c4c8d4; }
.nav-divider { width: 1px; height: 16px; background: #3a3f52; }
/* Кнопка-«Выйти» в виде nav-ссылки (в v1 этого не было — у нас лендинг видят и залогиненные) */
.nav-link.linklike { background: none; border: none; padding: 0; cursor: pointer; font-weight: 400; }

/* Hero */
.hero {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6rem 2rem 4rem; text-align: center;
}
.hero-glow {
  position: absolute; width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(45,111,242,0.08) 0%, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%,-50%); pointer-events: none;
}

/* Terminal */
.terminal-hero {
  width: 100%; max-width: 820px;
  animation: fadeInUp 0.8s ease 0.1s both;
}
.landing-page .terminal {
  background: #13161d;
  border: 1px solid #3a3f52;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.terminal-bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.r { background: #e74c3c; }
.terminal-dot.y { background: #f39c12; }
.terminal-dot.g { background: #2ecc71; }
.terminal-title {
  flex: 1; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
  color: #5a5f72; letter-spacing: 0.05em;
}
.terminal-body {
  padding: 1.5rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; line-height: 1.9;
}

/* MOTD */
.motd-box {
  border: 1px solid #3a3f52;
  border-radius: 4px;
  padding: 1.5rem 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
  overflow-x: auto;
  opacity: 0;
  animation: motdReveal 0.6s ease 0.3s both;
}
.motd-ascii {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: pre;
  background: linear-gradient(135deg, #4d8aff, #2d6ff2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  margin: 0 0 1rem 0;
  padding: 0;
  display: inline-block;
  text-align: left;
}
@media (min-width: 640px) { .motd-ascii { font-size: 0.82rem; } }
@media (min-width: 820px) { .motd-ascii { font-size: 0.95rem; } }
.motd-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #8b90a0;
  letter-spacing: 0.03em;
}
.motd-sub .url { color: #4d8aff; }

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

/* Session lines */
.t-line {
  opacity: 0;
  animation: typeIn 0.3s ease forwards;
}
.t-prompt { color: #4d8aff; }
.t-cmd { color: #e8eaf0; }
.t-comment { color: #5a5f72; }
.t-success { color: #2ecc71; }
.t-warn { color: #f39c12; }
.t-flag { color: #a78bfa; }
.t-center { text-align: center; }

/* Slots */
.slots-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem;
  margin: 0.75rem 0;
  opacity: 0;
  animation: typeIn 0.3s ease forwards;
}
.slots-label { color: #5a5f72; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }
.slots-val { color: #e8eaf0; font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 700; line-height: 1; }
.slots-sep { color: #3a3f52; font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 300; }
.slots-max { color: #4d8aff; font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 700; line-height: 1; }
.slots-text { color: #5a5f72; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }

/* Animation delays */
.d1 { animation-delay: 0.9s; }
.d2 { animation-delay: 1.2s; }
.d3 { animation-delay: 1.8s; }
.d4 { animation-delay: 2.2s; }
.d5 { animation-delay: 2.6s; }
.d6 { animation-delay: 3.0s; }

.t-cursor {
  color: #e8eaf0;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes typeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero buttons */
.hero-actions {
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; margin-top: 2rem;
  animation: fadeInUp 0.8s ease 2.5s both;
}
.btn-play {
  padding: 1rem 3rem;
  background: #2d6ff2; color: #fff; border: none; border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 1.05rem; font-weight: 700;
  cursor: pointer; transition: all 0.3s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.6rem; letter-spacing: 0.03em;
}
.btn-play:hover {
  background: #4d8aff;
  box-shadow: 0 0 35px rgba(45,111,242,0.3);
  transform: translateY(-2px);
}
.hero-auth-links { display: flex; gap: 1.5rem; align-items: center; }
.hero-auth-link {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: #5a5f72; text-decoration: none; transition: color 0.3s;
}
.hero-auth-link:hover { color: #c4c8d4; }
.hero-auth-sep { color: #3a3f52; font-size: 0.7rem; }

/* Sections */
.landing-section { position: relative; z-index: 2; padding: 5rem 2rem; }
.landing-section-alt { background: #13161d; }
.landing-section-bordered {
  border-top: 1px solid rgba(45,111,242,0.06);
  border-bottom: 1px solid rgba(45,111,242,0.06);
}
.section-container { max-width: 900px; margin: 0 auto; }
.section-label {
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: #4d8aff; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.section-label::before { content: '//'; color: #3a3f52; }
.section-title {
  font-family: 'JetBrains Mono', monospace; font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700; color: #e8eaf0;
  margin-bottom: 2.5rem; letter-spacing: -0.01em;
}

/* Leaderboard (landing context) */
.landing-section .leaderboard-table { width: 100%; border-collapse: collapse; }
.landing-section .leaderboard-table thead th {
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; font-weight: 500;
  color: #5a5f72; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.landing-section .leaderboard-table tbody tr { transition: background 0.2s; }
.landing-section .leaderboard-table tbody tr:hover { background: rgba(45,111,242,0.04); }
.landing-section .leaderboard-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.9rem;
}
.landing-section .lb-rank { font-family: 'JetBrains Mono', monospace; color: #5a5f72; font-size: 0.85rem; width: 50px; }
.landing-section .lb-player { font-family: 'JetBrains Mono', monospace; color: #e8eaf0; font-weight: 500; }
.landing-section .lb-player-link { color: #e8eaf0; text-decoration: none; }
.landing-section .lb-player-link:hover { color: #4d8aff; }
.landing-section .lb-level { font-family: 'JetBrains Mono', monospace; color: #4d8aff; }
.landing-section .lb-status { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.landing-section .status-progress { color: #f39c12; }
.landing-section .status-complete { color: #2ecc71; }
.landing-section .lb-empty,
.landing-section .landing-loading,
.landing-section .landing-empty {
  text-align: center; padding: 2rem 1rem;
  color: #5a5f72; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem;
}

/* About */
.about-content {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3rem; align-items: start;
}
.about-text p {
  font-size: 1.05rem; color: #8b90a0; line-height: 1.75; margin-bottom: 1.25rem;
}
.about-text strong { color: #e8eaf0; }
.about-highlights { display: flex; flex-direction: column; gap: 1rem; }
.about-highlight-item {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1.25rem; background: #181b24;
  border: 1px solid rgba(255,255,255,0.04); border-radius: 8px;
}
.about-highlight-icon {
  flex-shrink: 0; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; background: rgba(45,111,242,0.07);
  border-radius: 6px; border: 1px solid rgba(45,111,242,0.12);
}
.about-highlight-item h4 {
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 600;
  color: #e8eaf0; margin-bottom: 0.25rem;
}
.about-highlight-item p { font-size: 0.85rem; color: #5a5f72; line-height: 1.5; margin: 0; }

/* Footer */
.landing-footer {
  position: relative; z-index: 2; padding: 2.5rem 2rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.footer-content {
  max-width: 900px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-left {
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: #5a5f72;
}
.footer-left a { color: #4d8aff; text-decoration: none; transition: color 0.3s; }
.footer-left a:hover { color: #c4c8d4; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  color: #5a5f72; text-decoration: none; transition: color 0.3s;
}
.footer-links a:hover { color: #4d8aff; }

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0; transform: translateY(25px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Landing responsive */
@media (max-width: 768px) {
  .landing-nav { padding: 0.75rem 1.25rem; }
  .nav-right .nav-link { display: none; }
  .nav-right .nav-divider { display: none; }
  .hero { padding: 6rem 1.5rem 3rem; }
  .landing-section { padding: 3.5rem 1.5rem; }
  .about-content { grid-template-columns: 1fr; gap: 2rem; }
  .footer-content { flex-direction: column; gap: 1rem; text-align: center; }
  .motd-ascii { font-size: 0.42rem !important; }
}

/* === Auth (перенос 1-в-1 из v1 frontend/src/App.css) === */
/* Полностраничный takeover: общий site-header скрыт, main центрирует карточку. */
body.auth-bg { background: #0d0f14; }
body.auth-bg .site-header { display: none; }
body.auth-bg main {
  max-width: none; margin: 0; padding: 0;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
  background-color: #181b24;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 3px solid #2d6ff2;
}
.auth-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-family: 'JetBrains Mono', monospace;
  color: #e8eaf0;
  text-align: center;
}
.auth-subtitle {
  margin: 0 0 24px;
  color: #5a5f72;
  text-align: center;
  font-size: 14px;
}
.auth-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-family: 'Source Sans 3', sans-serif;
  background-color: #13161d;
  color: #c4c8d4;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s;
}
.auth-input:focus { border-color: #2d6ff2; }
.auth-button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  background-color: #2d6ff2;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
}
.auth-button:hover {
  background-color: #4d8aff;
  box-shadow: 0 0 20px rgba(45,111,242,0.2);
}
.auth-button:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-error {
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #e74c3c;
  background-color: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 4px;
}
.auth-link {
  margin: 16px 0 0;
  font-size: 13px;
  color: #5a5f72;
  text-align: center;
}
.auth-link a { color: #4d8aff; text-decoration: none; transition: color 0.3s; }
.auth-link a:hover { color: #c4c8d4; }

/* === Игра === */
.play-main {
  max-width: none;
  padding: 1rem 1.5rem;
}

.play-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .play-grid { grid-template-columns: 1fr; }
}

.terminal-wrap {
  position: relative;
}

/* Терминал страницы /play (xterm). Скоуп .terminal-wrap обязателен: иначе
   height:70vh протекает на лендинговый .terminal и даёт пустое поле снизу. */
.terminal-wrap .terminal {
  height: 70vh;
  background: #0d1117;
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 6px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(13, 15, 20, .92);
  border-radius: 6px;
}

.overlay[hidden] {
  display: none;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.level-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.dot.current {
  border-color: var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 10px rgba(45, 111, 242, .6);
}

.dot.done {
  background: var(--ok);
  border-color: var(--ok);
  color: #0a0c10;
}

.level-desc h2 {
  font-size: 0.95rem;
}

.hints-card h2 { font-size: 0.95rem; }
.hints-card .hint-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.hints-card .hint-text { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--text-light); white-space: pre-wrap; }
.hints-card .hint-reveal { width: 100%; font-size: 0.8rem; }

/* === Профиль (перенос 1-в-1 из v1 frontend/src/App.css) === */
.profile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.capacity-counter {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 32px;
}
.capacity-number {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.capacity-separator { font-size: 36px; color: #555; margin: 0 2px; }
.capacity-label { font-size: 14px; color: #888; margin-left: 10px; }

.space-cards-title {
  color: #888; font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 4px;
}
.space-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin: 24px auto 0;
}
.space-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  text-align: left;
  transition: border-color 0.3s;
}
.space-card:hover { border-color: rgba(45, 111, 242, 0.2); }
.space-card-info { flex: 1; }
.space-card-name {
  font-size: 1rem; font-weight: 600; color: #e8eaf0;
  margin: 0 0 4px; font-family: 'JetBrains Mono', monospace;
}
.space-card-progress {
  font-size: 0.82rem; color: #5a5f72; font-family: 'JetBrains Mono', monospace;
}
.space-card-status {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; margin-left: 8px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.space-status-active { color: #4caf50; background: rgba(76, 175, 80, 0.15); }
.space-status-completed { color: #4d8aff; background: rgba(45, 111, 242, 0.1); }
.space-status-idle { color: #888; background: rgba(136, 136, 136, 0.1); }
.space-card-actions { display: flex; gap: 8px; align-items: center; }
.space-card-btn {
  padding: 8px 20px; font-size: 0.85rem; font-weight: 600;
  font-family: 'JetBrains Mono', monospace; border: none; border-radius: 4px;
  cursor: pointer; transition: background-color 0.3s; white-space: nowrap;
  text-decoration: none; display: inline-block;
}
.space-card-btn-play { background: #007acc; color: #fff; }
.space-card-btn-play:hover { background: #005fa3; }
.space-card-btn-completed {
  background: rgba(76, 175, 80, 0.15); color: #4caf50; cursor: default;
}
.space-card-btn form { display: inline; }

/* === Лидерборд === */

/* Медальные цвета для мест 1–3. Серебро/бронза — разовые литералы,
   в палитру не выносим (нигде больше не используются). */
.r1, .r2, .r3 { font-weight: 700; }
.r1 { color: var(--gold); }
.r2 { color: #9ca3af; }
.r3 { color: #b45309; }

/* Зал славы — карточка с золотым акцентом */
.fame { border-color: var(--gold); }
.fame h2 { color: var(--gold); }

/* Хиро пространства */
.space-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--accent-light); }
.space-hero p { color: var(--text-light); }

/* Страница лидерборда (перенос 1-в-1 из v1) */
.leaderboard-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}
.leaderboard-content h1 { color: #fff; font-size: 24px; margin: 0 0 24px; }
.leaderboard-content .leaderboard-table { max-width: 560px; width: 100%; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leaderboard-table th {
  text-align: left; color: #888; font-weight: 600; padding: 8px 12px;
  border-bottom: 1px solid #333; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.leaderboard-table td { padding: 10px 12px; border-bottom: 1px solid #2a2a2a; }
.leaderboard-table .lb-rank { color: #666; width: 40px; }
.leaderboard-table .lb-player { color: #d4d4d4; font-family: 'JetBrains Mono', monospace; }
.leaderboard-table .lb-level { color: #007acc; font-family: 'JetBrains Mono', monospace; }
.leaderboard-table .lb-player-link { color: #e8eaf0; text-decoration: none; }
.leaderboard-table .lb-player-link:hover { color: #4d8aff; }
.hall-of-fame-title, .active-players-title {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem;
  font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 24px 0 12px; align-self: flex-start;
}
.hall-of-fame-title { color: #4caf50; }

/* Публичный профиль — stats-cards из v1 (на доступных в v2 данных) */
.stats-page { max-width: 700px; margin: 0 auto; padding: 32px 20px; }
.stats-username {
  color: #fff; text-align: center; margin-bottom: 24px;
  font-family: 'JetBrains Mono', monospace;
}
.stats-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px;
}
.stats-card {
  background: #1a1a2e; border: 1px solid #333; border-radius: 8px;
  padding: 16px 12px; text-align: center;
}
.stats-card-value {
  font-size: 24px; font-weight: 700; color: #4fc3f7; font-family: 'JetBrains Mono', monospace;
}
.stats-card-label { font-size: 12px; color: #888; margin-top: 4px; }
.stats-info { text-align: center; color: #666; font-size: 13px; margin-bottom: 24px; }
.stats-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.stats-table th {
  text-align: left; padding: 10px 12px; border-bottom: 2px solid #333;
  color: #888; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.stats-table td {
  padding: 10px 12px; border-bottom: 1px solid #222; color: #ccc; font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}
@media (max-width: 600px) { .stats-cards { grid-template-columns: repeat(2, 1fr); } }

/* === Live === */
body.live-bg {
  background: #0a0c10; /* проекторный чёрный, не из палитры */
}

body.live-bg .site-header {
  background: rgba(10, 12, 16, 0.9);
}

.live-wrap {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.live-title {
  color: var(--teal);
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin-bottom: 0;
}

.live-subtitle {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  margin-top: 0.25rem;
}

table.live th, table.live td {
  text-align: center;
}

@keyframes flashUp {
  from { background: rgba(76, 175, 80, 0.35); }
  to   { background: transparent; }
}

@keyframes flashDown {
  from { background: rgba(196, 43, 28, 0.35); }
  to   { background: transparent; }
}

@keyframes flashNew {
  from { background: rgba(45, 111, 242, 0.35); }
  to   { background: transparent; }
}

.flash-up   td { animation: flashUp   1.5s ease-out; }
.flash-down td { animation: flashDown 1.5s ease-out; }
.flash-new  td { animation: flashNew  1.5s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .flash-up td, .flash-down td, .flash-new td { animation: none; }
}
