:root {
  color-scheme: dark;
  --background: #10172b;
  --surface: #172037;
  --frame: #090e1b;
  --ink: #fff5d8;
  --muted: #bdc6dc;
  --line: #354360;
  --yolk: #ffce53;
  --aqua: #94e4df;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 1rem/1.64 Inter, system-ui, sans-serif;
}
a { color: var(--aqua); }
a:hover { color: var(--ink); }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 4px; }
.container {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}
.skip-link {
  position: fixed;
  z-index: 3;
  top: .5rem;
  left: .5rem;
  padding: .5rem 1rem;
  background: var(--frame);
  translate: 0 -150%;
}
.skip-link:focus { translate: 0; }

.site-header { background: var(--frame); border-bottom: 1px solid var(--line); }
.site-nav { display: flex; align-items: center; gap: 2rem; min-height: 72px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  text-decoration: none;
  font: 800 1.7rem/1 var(--display);
  white-space: nowrap;
}
.brand img { display: block; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; margin-left: auto; }
.nav-links a, .site-footer nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav-links a:hover, .site-footer nav a:hover { color: var(--ink); text-decoration: underline; }
.button, .button-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 44px;
  padding: .6rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font: 700 .95rem/1.3 Inter, system-ui, sans-serif;
  text-decoration: none;
}
.button { background: var(--yolk); color: #211708; }
.button:hover { background: #ffe299; color: #211708; }
.button-outline { background: var(--frame); border-color: var(--line); color: var(--ink); }
.button-outline:hover { border-color: var(--aqua); }

.intro { padding-block: 2.5rem 1.4rem; }
h1, h2, h3 { font-family: var(--display); line-height: 1; }
h1 { font-size: clamp(3.65rem, 8vw, 7.2rem); letter-spacing: -.022em; margin: 0; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0 0 1rem; }
h3 { font-size: 1.8rem; margin: 0 0 .6rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
.intro p { color: var(--muted); font-size: 1.07rem; max-width: 62ch; margin: .65rem 0 0; }

.player { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 16px 55px #090e1b80; }
.player-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--frame);
}
.player-stage:fullscreen { width: 100%; height: 100%; aspect-ratio: auto; }
.player-stage iframe, .player-loading { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-stage iframe { display: block; border: 0; background: var(--frame); }
.player-loading {
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
  background: var(--frame);
  color: var(--ink);
  text-align: center;
}
.player-spinner {
  width: 2.6rem;
  height: 2.6rem;
  border: 3px solid var(--line);
  border-top-color: var(--yolk);
  border-radius: 50%;
  animation: player-spin .85s linear infinite;
}
@keyframes player-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .player-spinner { animation: none; }
}

.player-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1rem; }
.player-title { font-weight: 700; margin: 0; }
.player-note { color: var(--muted); font-size: .88rem; }
.player-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.player-actions button { white-space: nowrap; }

.guide-section { margin-block: clamp(2.8rem, 6vw, 5.3rem); }
.section-intro, .panel p, .panel li, .faq p, .legal p { color: var(--muted); }
.controls-grid, .lobbies-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.modes-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.gameplay-image { max-width: 720px; margin: 0 auto 1.25rem; }
.gameplay-image img { display: block; width: 100%; height: auto; }
.gameplay-image figcaption { padding: .65rem 1rem; color: var(--muted); font-size: .88rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.controls-panel, .guide-panel, .mode-card { padding: clamp(1rem, 2vw, 1.5rem); }
.guide-panel ol { margin: .75rem 0 1rem; padding-left: 1.4rem; }
.guide-panel li + li { margin-top: .45rem; }
.controls-panel table { border-collapse: collapse; width: 100%; }
.controls-panel caption { text-align: left; font-weight: 700; padding-bottom: .65rem; }
.controls-panel th, .controls-panel td { text-align: left; padding: .36rem .35rem .36rem 0; border-top: 1px solid var(--line); }
.controls-panel tbody th { font-weight: 500; color: var(--muted); }
kbd {
  display: inline-block;
  margin: .15rem .26rem .15rem 0;
  padding: .05rem .43rem;
  border: 1px solid #63769d;
  border-radius: 5px;
  background: var(--frame);
  font: 600 .88rem/1.55 Inter, system-ui, sans-serif;
}
.mode-card .mode-type { color: var(--aqua); font-size: .78rem; font-weight: 700; margin-bottom: .5rem; }
.text-link { display: inline-block; margin-top: 1.25rem; font-weight: 650; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .55rem; }
.faq summary { padding: .75rem 1rem; cursor: pointer; font-weight: 650; }
.faq summary::marker { color: var(--yolk); }
.faq details p { padding: 0 1rem .9rem; max-width: 76ch; }

.legal { max-width: 760px; padding-block: clamp(2rem, 6vw, 4rem); min-height: 58vh; }
.legal h1 { font-size: clamp(2.8rem, 7vw, 4.7rem); margin-bottom: 1rem; }
.legal h2 { font-size: 2rem; margin: 1.6rem 0 .6rem; }
.site-footer { background: var(--frame); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem 1.5rem; padding-block: 1.6rem; }
.site-footer p { color: var(--muted); font-size: .88rem; margin: .5rem 0 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }

@media (max-width: 960px) {
  .modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .container { width: calc(100% - 28px); }
  .site-nav { flex-wrap: wrap; justify-content: space-between; gap: .3rem .65rem; min-height: 0; padding-block: .6rem .35rem; }
  .nav-links { order: 2; width: 100%; gap: 1.1rem; margin: 0; font-size: .91rem; }
  .nav-links a { display: flex; align-items: center; min-height: 44px; }
  .brand { font-size: 1.45rem; }
  .brand img { width: 32px; height: 32px; }
  .intro { padding-block: 1.45rem 1.1rem; }
  .intro p { font-size: 1rem; }
  .player-stage { min-height: 198px; }
  .player-toolbar, .footer-inner { flex-direction: column; align-items: flex-start; }
  .controls-grid, .lobbies-grid, .modes-grid { grid-template-columns: 1fr; }
}
