/* Стиль «Грибного прыжка»: ночное небо + пиксельные рамки; палитра персонажей — ретро-платформеры. */
:root {
  --night: #10142a;
  --night2: #1b2250;
  --paper: #fff3d6;
  --ink: #2b1b17;
  --red: #e0392d;
  --gold: #ffd23f;
  --sky: #6ba5ff;
  --grass: #7cc043;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(#6ba5ff 0, #6ba5ff 55%, var(--night2) 100%);
  color: var(--paper);
  font: 16px/1.45 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
}
[hidden] { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: auto; }
.screen.play { padding: 0; background: #000; display: block; }

.panel {
  width: min(560px, 100%);
  background: var(--night);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--paper), 8px 8px 0 4px rgba(0,0,0,.35);
  padding: 20px 22px;
  text-align: center;
}
h1 { margin: 4px 0 10px; font-size: 26px; letter-spacing: 1px; color: var(--gold); text-shadow: 3px 3px 0 var(--ink); }
.lead { margin: 0 0 12px; color: #d6dcff; }
.hint { margin-top: 12px; font-size: 12px; color: #8f9ad8; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

.btn {
  font: inherit; font-weight: 700; color: var(--ink); background: var(--grass);
  border: 3px solid var(--ink); border-bottom-width: 6px; padding: 9px 18px; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { border-bottom-width: 3px; transform: translateY(3px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: var(--paper); }

/* правила */
.rules-step { font-size: 12px; color: #8f9ad8; letter-spacing: 2px; }
#rulesArt { width: 100%; max-width: 480px; aspect-ratio: 320 / 150; image-rendering: pixelated; border: 3px solid var(--ink); background: var(--sky); display: block; margin: 0 auto; }
.rules-body { text-align: left; margin: 14px 0 6px; min-height: 120px; }
.rules-body p { margin: 6px 0; }
.rules-body .tag { display: inline-block; background: var(--night2); border: 2px solid #3a4590; padding: 0 6px; margin-right: 4px; font-weight: 700; color: var(--gold); }
.rules-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rules-body td { border-bottom: 1px solid #2c3470; padding: 5px 4px; vertical-align: top; }
.rules-body td:first-child { color: var(--gold); white-space: nowrap; padding-right: 10px; }
.dots { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.dots i { width: 10px; height: 10px; background: #3a4590; border: 2px solid var(--ink); }
.dots i.on { background: var(--gold); }

/* присоединение */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.slot { border: 3px dashed #3a4590; padding: 12px 6px; min-height: 88px; color: #8f9ad8; font-size: 13px; }
.slot.taken { border-style: solid; border-color: var(--ink); background: var(--night2); color: var(--paper); }
.slot b { display: block; font-size: 15px; margin-bottom: 4px; }
.slot .x { margin-top: 6px; background: none; border: 0; color: #ff9f93; cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }
.devices { font-size: 12px; color: #aab3ee; text-align: left; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.devices b { color: var(--gold); }

/* игра */
.arena { display: flex; width: 100%; height: 100%; }
.pane { position: relative; flex: 1 1 0; min-width: 0; background: #0a0d1c; border-right: 3px solid #000; }
.pane:last-child { border-right: 0; }
.pane canvas { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.countdown { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: min(28vw, 220px); font-weight: 900; color: var(--gold); text-shadow: 8px 8px 0 var(--ink); pointer-events: none; }
.pause-note { position: fixed; left: 0; right: 0; bottom: 12px; text-align: center; font-weight: 700; color: #fff; text-shadow: 2px 2px 0 #000; pointer-events: none; }
.fire { position: fixed; right: 16px; bottom: 16px; width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--ink); background: var(--red); color: #fff; font: 800 15px ui-monospace, monospace; opacity: .85; touch-action: none; }

/* результаты */
.results { margin: 8px 0; }
.results .line { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 3px solid var(--ink); background: var(--night2); margin-bottom: 8px; text-align: left; }
.results .line.win { background: #4a3d0a; border-color: var(--gold); }
.results .place { font-size: 22px; font-weight: 900; color: var(--gold); }
.results .who { font-weight: 800; }
.results .meta { font-size: 12px; color: #aab3ee; }
.results .score { font-size: 20px; font-weight: 900; }
.swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 2px solid var(--ink); vertical-align: -1px; }

@media (max-width: 600px) {
  .panel { padding: 14px 12px; }
  h1 { font-size: 22px; }
  .devices { grid-template-columns: 1fr; }
}
