/* =====================================================================
   Nenoman — fixed "neon hero" theme.
   Same page frame as Neon Dash / Flappy Bird / Timberman (full-height app
   shell, frosted top bar, chunky arcade buttons, hard-shadow stage, card
   overlays, colored rules modal) but with this game's own palette: electric
   midnight, hero-cyan armor glow, magenta danger, lime energy, amber trim.
   Deliberately ignores the center's light/dark mode; no glass.css loaded.
   The board is 16:9 landscape (a side-scroller needs horizontal reach).
   ===================================================================== */
:root {
  --nm-night:  #06081e;   /* page gradient top */
  --nm-violet: #1b1350;   /* page gradient bottom / stage glow */
  --nm-cyan:   #39ffd6;   /* hero armor + keylines */
  --nm-blue:   #3d6bff;   /* grid + secondary neon */
  --nm-pink:   #ff2f8e;   /* danger / primary action */
  --nm-lime:   #b6ff3f;   /* energy + pickups */
  --nm-gold:   #ffd23f;   /* trim + highlights */
  --nm-ink:    #eaf1ff;   /* main text on dark */
  --nm-dim:    rgba(200, 214, 255, .66);
  --nm-line:   rgba(57, 255, 214, .55);
}

html, body { height: 100%; }
body.nm-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% -10%, #291e73 0%, var(--nm-violet) 42%, var(--nm-night) 100%);
  color: var(--nm-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.nm-page *,
body.nm-page *::before,
body.nm-page *::after { box-sizing: border-box; }

/* ---------- App frame ---------- */
.c-app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.c-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 28px);
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(14, 12, 40, .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--nm-line);
  z-index: 20;
}
.c-bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-bar__brand svg { filter: drop-shadow(0 0 6px rgba(57, 255, 214, .55)); }
.c-bar__title {
  margin: 0;
  font-size: clamp(19px, 3.4vw, 26px);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--nm-ink);
  text-shadow: 0 0 12px rgba(61, 107, 255, .7), 0 0 26px rgba(57, 255, 214, .4);
}
.c-bar__stats { display: flex; align-items: center; gap: 8px 18px; margin-left: auto; }
.c-bar__controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat { font-size: 14px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; color: var(--nm-dim); }
.stat b { color: var(--nm-cyan); font-size: 16px; text-shadow: 0 0 8px rgba(57, 255, 214, .5); }

/* ---------- Buttons (chunky neon arcade style) ---------- */
.c-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  padding: 9px 16px;
  border-radius: 12px;
  border: 2px solid var(--nm-line);
  background: rgba(22, 20, 56, .8);
  color: var(--nm-ink);
  box-shadow: 0 3px 0 rgba(4, 4, 18, .7);
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.c-btn:hover { background: rgba(36, 32, 84, .95); border-color: var(--nm-cyan); }
.c-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(4, 4, 18, .7); }
.c-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(57, 255, 214, .5); }
/* .c-btn sets display:inline-block, which would beat the UA's [hidden] rule — restore it. */
.c-btn[hidden] { display: none; }
/* Primary = magenta danger, this game's boss-fight accent. */
.c-btn--primary {
  background: linear-gradient(140deg, #ff5ca8, var(--nm-pink));
  border-color: rgba(255, 210, 63, .65);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .28);
}
.c-btn--primary:hover { background: linear-gradient(140deg, #ff6fb2, var(--nm-pink)); }

/* ---------- Table / stage column ---------- */
.c-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.4vh, 22px);
}
.nm-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 16:9 landscape; capped by viewport height minus chrome (bar + caption). */
  width: min(96vw, calc((100vh - 178px) * 1.7778), 1120px);
  width: min(96vw, calc((100dvh - 178px) * 1.7778), 1120px);
}
.nm-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: var(--nm-night);
  border: 3px solid var(--nm-line);
  box-shadow: 0 10px 0 rgba(4, 4, 18, .55), 0 22px 48px rgba(4, 4, 18, .6), 0 0 40px rgba(61, 107, 255, .35);
  touch-action: manipulation;
  cursor: pointer;
}
#board {
  display: block;
  width: 100%; height: 100%;
  touch-action: none;                  /* capture taps without page scroll */
  -webkit-user-select: none; user-select: none;
}

/* ---------- Caption under the stage ---------- */
.nm-caption {
  flex: none;
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.9;
  color: var(--nm-dim);
}
.nm-card kbd, .c-modal kbd, .nm-caption kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin: 0 1px;
  font: 700 12px/1.5 ui-monospace, "Segoe UI", monospace;
  text-align: center;
  color: var(--nm-ink);
  background: rgba(28, 26, 64, .9);
  border: 1px solid var(--nm-line);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(4, 4, 18, .6);
}

/* ---------- Ready / game-over overlays ---------- */
.nm-overlay {
  touch-action: manipulation;
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(5, 5, 20, .58);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.nm-overlay[hidden] { display: none; }
.nm-card {
  touch-action: manipulation;
  max-width: 380px;
  text-align: center;
  padding: 22px 26px 20px;
  border-radius: 16px;
  background: linear-gradient(160deg, #1e1850, #100d2c);
  border: 2px solid var(--nm-line);
  box-shadow: 0 8px 0 rgba(4, 4, 18, .5), 0 22px 50px rgba(4, 4, 18, .6), 0 0 30px rgba(61, 107, 255, .3);
  color: var(--nm-ink);
  animation: nmPop .3s ease;
}
@keyframes nmPop { from { transform: scale(.88); opacity: 0; } }
.nm-card__big { font-size: 40px; line-height: 1.1; color: var(--nm-cyan); text-shadow: 0 0 16px rgba(57, 255, 214, .7); }
.nm-card h2 {
  margin: 6px 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--nm-ink);
  text-shadow: 0 0 12px rgba(61, 107, 255, .6);
}
/* Overlay card buttons: full-width stacked blocks, always the same length. */
.nm-card .c-btn { font-size: 14px; display: block; width: 100%; margin-top: 8px; }
.nm-card .c-btn[hidden] + .c-btn, .nm-card .c-btn:first-of-type { margin-top: 0; }
/* Keyboard menu highlight (driven by JS, not DOM focus). */
.nm-card .c-btn--sel {
  border-color: var(--nm-cyan);
  box-shadow: 0 0 0 3px rgba(57, 255, 214, .45), 0 3px 0 rgba(4, 4, 18, .7);
}
.nm-card p { margin: 0 0 16px; color: var(--nm-dim); font-size: 13.5px; line-height: 1.55; }
.nm-card p b { color: var(--nm-gold); }
/* Continue / quick-start: the game's mint accent, between cyan keylines and magenta primary. */
.c-btn--quick {
  background: linear-gradient(140deg, #2fe8c0, #12b389);
  border-color: rgba(57, 255, 214, .7);
  color: #04241c;
}
.c-btn--quick:hover { background: linear-gradient(140deg, #45ffd6, #17c99a); }

/* ---------- Rules modal ---------- */
/* The overlay (.c-modal) owns the scrolling, so the scrollbar sits on the dim
   layer, never inside the panel; margin:auto centers while still scrollable. */
.c-modal { position: fixed; inset: 0; z-index: 50; display: flex; overflow: auto; padding: 14px; }
.c-modal[hidden] { display: none; }
.c-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 4, 18, .62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
/* Panel is "inside the grid": deep indigo with cyan keyline and neon text. */
.c-modal__panel {
  position: relative;
  margin: auto;                              /* flex-center that survives overlay scrolling */
  width: min(92vw, 480px);
  background: linear-gradient(160deg, #1e1e5c, #0d0e2c);
  color: #e6ecff;
  border-radius: 16px;
  border: 2px solid var(--nm-line);
  box-shadow: 0 8px 0 rgba(4, 4, 18, .5), 0 24px 60px rgba(4, 4, 18, .7), 0 0 34px rgba(61, 107, 255, .35);
}
.c-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(57, 255, 214, .28);
}
.c-modal__head h2 {
  margin: 0; font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: #fff; text-shadow: 0 0 10px rgba(57, 255, 214, .6);
}
.c-modal__x {
  appearance: none; border: 0; background: none;
  color: #e6ecff; font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.c-modal__x:hover { color: var(--nm-cyan); }
.c-modal__body { padding: 6px 20px 2px; font-size: 13.5px; line-height: 1.5; }
.c-modal__body h3 {
  margin: 12px 0 5px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--nm-cyan);
}
.c-modal__body ul { margin: 0; padding-left: 20px; }
.c-modal__body li { margin: 2.5px 0; }
.c-modal__body b { color: var(--nm-gold); }
.c-modal__lead { margin: 10px 0; }
.c-modal__note {
  margin: 12px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(57, 255, 214, .08);
  border: 1px solid rgba(57, 255, 214, .28);
  font-size: 13px;
  color: #cfe6ff;
}
.c-modal__foot { display: flex; justify-content: flex-end; padding: 12px 20px 16px; }
.c-modal .c-btn { border-color: var(--nm-line); box-shadow: 0 3px 0 rgba(4, 4, 18, .6); }

/* ---------- Responsive (same breakpoints as Neon Dash's frame) ---------- */
@media (max-width: 700px), (max-height: 560px) {
  .c-bar { gap: 5px 12px; padding: 7px clamp(10px, 3vw, 18px); padding-top: max(7px, env(safe-area-inset-top)); }
  .c-bar__brand { gap: 8px; }
  .c-bar__title { font-size: 16px; }
  .c-bar__stats { gap: 4px 12px; margin-left: auto; }
  .stat { font-size: 12px; }
  .stat b { font-size: 13px; }
  .c-btn { padding: 8px 10px; font-size: 12px; }
  .c-bar__controls { gap: 6px; }
  .c-bar__controls .c-btn { padding: 9px 10px; white-space: nowrap; }
  .nm-board { width: min(96vw, calc((100vh - 156px) * 1.7778), 1120px); width: min(96vw, calc((100dvh - 156px) * 1.7778), 1120px); }
}
/* Narrow screens only: the buttons drop to a row of their own and split it
   evenly into full-width thumb targets. */
@media (max-width: 700px) {
  .c-bar__controls { flex: 1 1 100%; flex-wrap: nowrap; }
  .c-bar__controls .c-btn { flex: 1 1 auto; min-width: 0; padding: 9px 6px; overflow: hidden; text-overflow: ellipsis; }
}
/* Smallest phones: labels scale down with the viewport instead of stacking. */
@media (max-width: 380px) {
  .c-bar { gap: 5px 8px; }
  .c-bar__title { font-size: 15px; }
  .stat { font-size: 11px; }
  .stat b { font-size: 12px; }
  .c-bar__controls { gap: 4px; }
  .c-bar__controls .c-btn { font-size: clamp(10px, 3.2vw, 12px); padding: 9px 4px; letter-spacing: .01em; }
}

@media (prefers-reduced-motion: reduce) {
  .c-btn, .nm-card { transition: none; animation: none; }
}
