/* Chrome shared by every game page */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: #0e1020; color: #f4f1ff;
  font-family: ui-rounded, 'Trebuchet MS', 'Segoe UI', sans-serif;
}
/* The game fills exactly one screen; the how-to-play guide sits below it. */
.screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.bar {
  flex: none; height: 52px; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: #171a33; border-bottom: 1px solid #2a2e55;
}
.bar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar a, .bar button {
  font: inherit; font-size: 14px; font-weight: 700; color: #f4f1ff; text-decoration: none;
  background: #262a52; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.bar a:hover, .bar button:hover { background: #343a72; }
.bar a:focus-visible, .bar button:focus-visible { outline: 2px solid #ffd24a; outline-offset: 2px; }
main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; }
canvas {
  width: min(100%, calc((100vh - 76px) * 4 / 3)); height: auto; aspect-ratio: 4 / 3;
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.5); touch-action: none; display: block;
}

/* Ad banner under the game. Hidden until an ad unit is configured in assets/config.js.
   It sits in its own labelled strip, away from the play area, so it is never clicked by accident. */
.ad { flex: none; text-align: center; padding: 6px 12px 10px; }
.ad::before {
  content: 'Advertisement'; display: block; margin-bottom: 4px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #77759a;
}
.ad-game ins { display: inline-block; width: 320px; height: 100px; }
@media (min-width: 800px) { .ad-game ins { width: 728px; height: 90px; } }
@media (min-height: 521px) { body.has-ad canvas { width: min(100%, calc((100vh - 76px - 136px) * 4 / 3)); } }
@media (max-height: 520px) { .ad-game { display: none; } }

/* ---------- how-to-play guide under the game ---------- */
@media (max-width: 560px) { .bar .how { display: none; } }
.guide { max-width: 72ch; margin: 0 auto; padding: 36px 20px 56px; line-height: 1.6; color: #dcd9f2; }
.guide h2 { margin: 0 0 10px; font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -.02em; color: #f4f1ff; }
.guide h3 { margin: 26px 0 6px; font-size: 18px; color: #ffd24a; }
.guide p { margin: 0 0 10px; }
.guide ul { margin: 0; padding-left: 22px; }
.guide li { margin-bottom: 6px; }
.guide .links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 32px; padding-top: 18px; border-top: 1px solid #2a2e55; font-size: 14px; }
.guide .links a { color: #aeabd0; }
.guide .links a:hover { color: #f4f1ff; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- custom cursor: a chunky yellow arrow, pink with a spark over anything clickable ---------- */
html { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M4 3v22l6-5.5 4.5 9.5 4.5-2-4.2-9H23z' transform='translate(1.5 2)' fill='%23171a33' opacity='.35'/%3E%3Cpath d='M4 3v22l6-5.5 4.5 9.5 4.5-2-4.2-9H23z' fill='%23ffd24a' stroke='%23171a33' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M7 9v9' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' opacity='.8'/%3E%3C/svg%3E") 4 3, auto; }
a, button, .card, summary, label { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cg transform='translate(4 4)'%3E%3Cpath d='M4 3v22l6-5.5 4.5 9.5 4.5-2-4.2-9H23z' transform='translate(1.5 2)' fill='%23171a33' opacity='.35'/%3E%3Cpath d='M4 3v22l6-5.5 4.5 9.5 4.5-2-4.2-9H23z' fill='%23ff5a7a' stroke='%23171a33' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M7 9v9' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' opacity='.8'/%3E%3C/g%3E%3Cpath d='M5 1.5v4M1.5 5h4M2.6 2.6l2 2' stroke='%23ffd24a' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M14 2.5l-1.2 2.8M2.5 14l2.8-1.2' stroke='%23ffd24a' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") 8 7, pointer; }
input[type="search"], input[type="text"], textarea { cursor: text; }

/* ---------- phones ---------- */
[hidden] { display: none !important; }
.rotate-tip { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(14,16,32,.95); text-align: center; }
.rotate-tip div { display: grid; gap: 10px; justify-items: center; max-width: 30ch; }
.rotate-tip strong { font-size: 24px; font-weight: 900; }
.rotate-tip span { color: #aeabd0; font-size: 16px; }
.rotate-tip button { margin-top: 14px; font: inherit; font-size: 15px; font-weight: 700; color: #f4f1ff; background: #262a52; border: 0; border-radius: 999px; padding: 12px 20px; }
/* sideways on a phone: slim the top bar and give every spare pixel to the game */
@media (max-height: 500px) and (orientation: landscape) {
  .bar { height: 36px; gap: 8px; padding: 0 8px; }
  .bar h1 { font-size: 14px; }
  .bar a, .bar button { font-size: 12px; padding: 5px 10px; }
  .bar .how { display: none; }
  main { padding: 3px; }
  canvas { width: min(100%, calc((100dvh - 42px) * 4 / 3)); border-radius: 8px; }
}
