@import url("https://fonts.googleapis.com/css2?family=Yuji+Boku&family=Zen+Old+Mincho:wght@400;700;900&display=swap");

/* Sunset Slice: ink-black silhouettes against a red-gold sun. The canvas is
   the whole page; panels float over it and let swipes through. */
:root {
  --ink: #140a0e;
  --paper: #fff3dc;
  --sun: #ffb347;
  --red: #c8342a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #2a0f1e;
  overscroll-behavior: none;
  touch-action: none;                 /* swipes cut; they never scroll or zoom */
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Zen Old Mincho", Georgia, serif;
  color: var(--paper);
}
#stage { position: fixed; inset: 0; display: block; touch-action: none; cursor: crosshair; }

.nav-back-games {
  position: fixed; top: 12px; left: 12px; z-index: 99999;
  text-decoration: none; font: 700 15px/1 "Zen Old Mincho", Georgia, serif; letter-spacing: 0.04em;
  color: var(--paper); background: rgba(20, 10, 14, 0.78);
  border: 1px solid rgba(255, 190, 120, 0.55); border-radius: 4px; padding: 8px 13px 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* ---- HUD: top centre, clear of the corner buttons ------------------------ */
.hud {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 14px; pointer-events: none;
  text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(20, 10, 14, 0.6);
}
.hud[hidden] { display: none; }
.hud .score { font-weight: 900; font-size: clamp(28px, 5vw, 44px); min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.hud #hud-sub { font-size: clamp(18px, 3vw, 24px); font-weight: 700; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.hud .seals { color: #ff6b5a; letter-spacing: 0.25em; }
.hud .time.low { color: #ffd06a; }
.pause-btn {
  pointer-events: auto; cursor: pointer;
  font: 700 13px/1 system-ui, sans-serif; color: var(--paper);
  background: rgba(20, 10, 14, 0.6); border: 1px solid rgba(255, 190, 120, 0.45); border-radius: 50%;
  width: 34px; height: 34px;
}

/* ---- panels ------------------------------------------------------------------ */
.panel {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  text-align: center; width: min(92vw, 560px);
}
.panel[hidden] { display: none; }
.panel button {
  pointer-events: auto; cursor: pointer; font: inherit; color: var(--paper);
  background: rgba(20, 10, 14, 0.82); border: 1px solid rgba(255, 190, 120, 0.6); border-radius: 4px;
  padding: 10px 20px; font-size: 1.05rem; font-weight: 700; letter-spacing: 0.05em;
  transition: background 0.15s ease, transform 0.1s ease;
}
.panel button:hover, .panel button:focus-visible { background: rgba(120, 30, 30, 0.9); outline: none; }
.panel button:active { transform: translateY(1px); }

/* The menu: title up top, mode buttons low, the canvas targets in between. */
.menu { top: 0; bottom: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; padding: 58px 0 max(3vh, 14px); }
.menu h1 {
  margin: 0; font-family: "Yuji Boku", "Zen Old Mincho", serif; font-weight: 400;
  font-size: clamp(34px, min(10vw, 11vh), 96px); line-height: 1; color: var(--paper); white-space: nowrap;
  text-shadow: 0 3px 0 var(--ink), 0 0 30px rgba(20, 10, 14, 0.55);
}
.menu .tag { margin: 6px 0 0; font-size: clamp(14px, 2.4vw, 18px); font-weight: 700; text-shadow: 0 1px 0 var(--ink), 0 0 10px rgba(20, 10, 14, 0.7); }
.menu .how { margin: auto 0 10px; font-size: 0.9rem; opacity: 0.92; text-shadow: 0 1px 0 var(--ink), 0 0 8px var(--ink); }
.menu .modes { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.menu .modes button { display: flex; flex-direction: column; gap: 3px; width: 170px; padding: 9px 12px; }
.menu .modes small { font-size: 0.72rem; font-weight: 400; opacity: 0.85; letter-spacing: 0; line-height: 1.3; }
.menu .bests { margin: 10px 0 0; font-size: 0.85rem; text-shadow: 0 1px 0 var(--ink), 0 0 8px var(--ink); }

.over, .paused {
  top: 50%; transform: translate(-50%, -50%);
  padding: 22px 24px 20px; background: rgba(20, 10, 14, 0.86);
  border: 1px solid rgba(255, 190, 120, 0.55); border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.over h2, .paused h2 { margin: 0; font-family: "Yuji Boku", "Zen Old Mincho", serif; font-weight: 400; font-size: clamp(30px, 6vw, 46px); }
.over .big { margin: 8px 0 2px; font-size: 1.35rem; font-weight: 900; }
.over .stats, .paused .stats { margin: 4px 0 16px; opacity: 0.85; }
.row { display: flex; gap: 10px; justify-content: center; }

@media (hover: none) { .menu .desk { display: none; } }
/* On narrow screens the corner buttons fill the top bar: drop the HUD below it. */
@media (max-width: 640px) { .hud { top: 58px; } }
.menu .modes b { white-space: nowrap; }
@media (max-width: 560px) {
  .menu .modes button { width: 100%; max-width: 330px; flex-direction: row; align-items: baseline; gap: 10px; text-align: left; }
  .menu .modes { flex-direction: column; align-items: center; gap: 7px; }
}
/* Short screens (a small phone, a phone on its side, a small laptop window):
   the middle stays free for the menu targets, and nothing is left out to
   keep it so. The room to spare is at the top, so the how-to line moves up
   under the tagline (it reads on into the targets it speaks of), and the
   modes keep their descriptions, closed up. */
@media (max-height: 620px) {
  .menu { padding-bottom: 8px; }
  .menu .how { margin: 5px 0 0; font-size: 0.85rem; line-height: 1.3; }
  .menu .modes { margin-top: auto; }
  .menu .modes button { padding-top: 6px; padding-bottom: 6px; }
  .menu .modes small { line-height: 1.25; }
  .menu .bests { margin-top: 6px; font-size: 0.78rem; }
}
/* ...and shorter still, with the width for it (a phone on its side): the three
   modes share one row, as wide as the window lets them, so each description
   takes two lines or three */
@media (max-height: 520px) {
  .menu { padding-top: 48px; padding-bottom: 5px; }
  .menu h1 { font-size: clamp(26px, 9vh, 44px); }
  .menu .tag { margin-top: 3px; font-size: 14px; }
  .menu .how { margin-top: 3px; font-size: 0.8rem; }
  .menu .bests { margin-top: 4px; font-size: 0.74rem; }
}
/* (a small phone held upright: the three stay one under another, closer) */
@media (max-height: 520px) and (max-width: 560px) {
  .menu .modes { gap: 5px; }
  .menu .modes button { padding-top: 4px; padding-bottom: 4px; }
}
@media (max-height: 520px) and (min-width: 561px) {
  .menu { width: min(96vw, 880px); }
  .menu .modes { flex-direction: row; flex-wrap: nowrap; align-items: stretch; gap: 8px; width: 100%; }
  .menu .modes button { flex: 1 1 0; width: auto; min-width: 0; max-width: 290px; gap: 1px; padding: 5px 9px; }
  .menu .modes small { font-size: 0.7rem; }
}
