/* Shared chrome for every game on this site: page frame, header bar, HUD,
   canvas stage, the non-blocking result strip and the title overlay.
   One owning source — a game's own stylesheet carries only what is specific
   to that game. Colour tokens come from /site.css. */

/* Blade Flip — page chrome. The play area itself is canvas-drawn. */

.game-body { overflow: hidden; }

.frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  max-width: 1280px;
  margin: 0 auto;
}

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(12px, 3vw, 24px);
  font-size: 14px;
}

.bar .back { color: var(--fg-dim); text-decoration: none; font-weight: 600; white-space: nowrap; }

.bar .back:hover { color: var(--fg); }

.hud {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-inline: auto;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

.hud b { color: var(--fg); font-weight: 700; }

.hud .sep { width: 1px; height: 16px; background: var(--line); }

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ghost:hover { color: var(--fg); border-color: var(--fg-dim); }

.stage-wrap { position: relative; min-height: 0; }

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  background: #12173a;
}

/* End-of-run strip. It sits over the sky so the plank that was missed and
   the blade that missed it both stay visible, and it never covers the
   canvas for input — only its own buttons take clicks. */

.result {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 7px 8px 7px 8px;
  background: rgba(13, 16, 44, .9);
  border: 1px solid var(--line);
  border-left: 3px solid var(--fg-dim);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  font-size: 13px;
  white-space: nowrap;
  animation: drop .22s ease-out;
}

.result[hidden] { display: none; }

.result.win { border-left-color: var(--accent); }

.result.loss { border-left-color: #e6584f; }

@keyframes drop {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.result .tag {
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.result.win .tag { color: var(--accent); }

.result.loss .tag { color: #ff8d85; }

.result .msg { color: var(--fg); }

.result .msg b { color: #ffd45e; }

.result .nums { display: flex; gap: 10px; color: var(--fg-dim); font-variant-numeric: tabular-nums; }

.result .nums i { font-style: normal; }

.result .acts { display: flex; gap: 6px; margin-left: 2px; }

.result .acts button {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.result .acts .go { background: var(--accent); color: #0a1f18; }

.result .acts .go:hover { background: #a3ffd8; }

.result .acts .alt { background: transparent; border-color: var(--line); color: var(--fg-dim); }

.result .acts .alt:hover { color: var(--fg); border-color: var(--fg-dim); }

@media (max-width: 700px) {
  .result {
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
    text-align: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 12px;
  }
  .result .nums { order: 3; width: 100%; justify-content: center; font-size: 11px; }
  .result .acts { order: 4; }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 10, 26, .72);
  backdrop-filter: blur(6px);
}

.overlay[hidden] { display: none; }

.panel {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  text-align: center;
  background: #171b3e;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 4vw, 30px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.panel h1 { margin: 0 0 8px; font-size: clamp(26px, 5vw, 38px); letter-spacing: -.02em; }

.panel .lead { margin: 0 0 16px; color: var(--fg-dim); line-height: 1.5; }

.panel .lead b { color: #ffd45e; }

.stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stats span {
  background: #0f1230;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--fg-dim);
}

.stats b { display: block; color: var(--fg); font-size: 18px; font-variant-numeric: tabular-nums; }

.panel button.go, .panel button.alt {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 13px 18px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}

.panel button.go { background: #7dffc4; color: #0a1f18; font-size: 17px; }

.panel button.go:hover { background: #a3ffd8; }

.panel button.alt { background: transparent; border-color: var(--line); color: var(--fg-dim); }

.panel button.alt:hover { color: var(--fg); border-color: var(--fg-dim); }

.panel .hint { margin: 12px 0 0; font-size: 12px; color: var(--fg-dim); opacity: .8; }

.foot { flex-direction: column; align-items: flex-start; gap: 2px; }

.foot p { margin: 0; font-size: 12px; color: var(--fg-dim); }

.foot .muted { opacity: .7; }

kbd {
  background: #0f1230; border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; font-size: 11px;
}

@media (max-width: 620px) {
  /* everything on one line: the header used to wrap and push the sound
     toggle off the right edge on a phone */
  .bar { gap: 8px; padding: 8px 10px; }
  .hud { gap: 9px; font-size: 11px; margin-inline: 0 auto; }
  .hud .sep { display: none; }
  .hud span, .ghost, .bar .back { white-space: nowrap; }
  .bar .back { font-size: 12px; }
  .bar .back span { display: none; }
  .ghost { padding: 5px 10px; font-size: 12px; flex: none; }
  .foot .muted { display: none; }
  /* A fourth control (Rail Dash added a look switch) does not fit on one line
     on a phone. Wrapping is what the 2026-08 rule was avoiding, but what it
     was really avoiding was the sound toggle going off the RIGHT EDGE - an
     overflow, not a second row. Let the bar wrap and keep both rows on screen. */
  .bar { flex-wrap: wrap; row-gap: 6px; }
  .gmenu > summary { padding: 5px 10px; font-size: 12px; }
  .gmenu-list { min-width: 160px; }
}

@media (max-width: 420px) {
  .hud { font-size: 10px; gap: 7px; }
  .result { top: 8px; padding: 8px 10px; }
  .result .acts button { padding: 6px 11px; font-size: 12px; }
}

/* Games menu — reachable from inside every game, no script required to open */
.gmenu { position: relative; flex: none; }
.gmenu > summary {
  list-style: none;
  cursor: pointer;
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
}
.gmenu > summary::-webkit-details-marker { display: none; }
.gmenu > summary:hover, .gmenu[open] > summary { color: var(--fg); border-color: var(--fg-dim); }
.gmenu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 6;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: #171b3e;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.gmenu-list a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.gmenu-list a:hover { background: #0f1230; color: var(--fg); }
.gmenu-list a.all { color: var(--accent); font-weight: 700; }
.gmenu-list a[aria-current="page"] { color: var(--fg); background: #0f1230; }
.gmenu-list hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
