/* Screechy Goalie's own look: Comic Neon from Doug's style library (cel-shaded comic book, thick ink outlines,
   halftone, speed lines, neon orange and electric blue at night). Luckiest Guy (Apache 2.0, self-hosted) for the
   loud words, Inter for reading. The stadium and Screechy are painted on the canvas (scene.js) behind every screen.
   Loaded after games.css, which keeps the shared rules. */
@font-face { font-family: 'Luckiest Guy'; src: url(/fonts/luckiest-guy.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/Inter-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --bg: #0b0614; --panel: #140b2ee8; --line: #3b2a8a; --ink: #0b0614;
  --text: #ffffff; --soft: #c9c2f0; --orange: #ff7a1a; --blue: #2f8cff; --cyan: #5ff0ff; --pink: #ff3ea5; --lime: #7dff3a; --gold: #ffd23a;
}
body.sg { font: 400 16px/1.42 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; min-height: 100dvh; }
.sg h1, .sg h2, .sg .big-num b, .sg dd, .sg .hud b { font-family: 'Luckiest Guy', Impact, sans-serif; font-weight: 400; letter-spacing: .02em; }
.sg a { color: var(--gold); }
.sg button { font-family: 'Luckiest Guy', Impact, sans-serif; font-weight: 400; letter-spacing: .04em; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink); }
.sg button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.sg button.go { background: linear-gradient(180deg, #ffb066, var(--orange) 55%, #e2500a); color: #1a0700; font-size: 24px; min-height: 58px; text-shadow: 0 1px 0 #ffd2a8; }
.sg button.quiet { background: #ffffff12; color: var(--text); border: 2px solid var(--line); box-shadow: none; font-family: Inter, sans-serif; font-weight: 700; letter-spacing: 0; }
.sg .muted { color: var(--soft); }

#pitch { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; z-index: 0; touch-action: none; }
main { position: relative; z-index: 2; }
.sg-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 60px; position: relative; z-index: 6; }
.sg-top .grow { flex: 1; min-width: 0; }
.sg .icon { min-width: 44px; min-height: 44px; padding: 0; background: #0b0614cc; border: 2px solid var(--line); box-shadow: none; color: var(--text); font-size: 18px; border-radius: 12px; font-family: system-ui, sans-serif; }
.sg .sg-top .back, .sg .lock-btn, .sg .fs-btn { background: #0b0614e6; color: var(--text); }

/* home: a comic panel over the stadium */
.home { max-width: 540px; margin: 3vh auto 0; padding: 20px 16px; display: grid; gap: 12px; text-align: center; width: calc(100% - 32px);
  background: radial-gradient(circle at 1px 1px, #ffffff14 1px, transparent 1.6px) 0 0 / 9px 9px, linear-gradient(180deg, #140b2ef0, #0b0614e0);
  border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 0 0 3px var(--orange), 0 0 40px #2f8cff66; }
.logo { font-size: clamp(46px, 13vw, 84px); line-height: .9; margin: 0; transform: rotate(-3deg); }
.logo span { display: block; color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 4px 5px 0 var(--ink), 0 0 26px #ff7a1a99; }
.logo em { display: block; font-style: normal; color: var(--cyan); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 4px 5px 0 var(--ink), 0 0 26px #2f8cff; }
.home .tag { margin: 0; color: var(--soft); font-weight: 700; }
.need { margin: 0; font-weight: 700; color: var(--cyan); font-size: 14px; min-height: 1em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sg .chip { min-height: 44px; padding: 6px 18px; font-size: 18px; background: #0008; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.sg .chip[aria-pressed="true"] { background: var(--cyan); color: #00121a; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink), 0 0 16px #5ff0ff88; }
.sg .modes .chip { font-size: 15px; padding: 6px 14px; }
.sg .chip.hot[aria-pressed="true"] { background: var(--orange); color: #1a0700; box-shadow: 0 3px 0 var(--ink), 0 0 16px #ff7a1a99; }
.best { font-family: 'Luckiest Guy', sans-serif; color: var(--gold); margin: 0; font-size: 17px; letter-spacing: .03em; min-height: 1px; white-space: pre-line; }
.links { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; }
.links a, .sg .links button.link { color: var(--gold); background: none; border: 0; box-shadow: none; font: 700 15px Inter, sans-serif; letter-spacing: 0; min-height: 40px; padding: 0 4px; text-decoration: underline; display: inline-flex; align-items: center; }
.panel { background: var(--panel); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--blue); border-radius: 18px; padding: 18px; text-align: left; }
.panel > * + * { margin-top: 12px; }
.panel h2 { font-size: 32px; color: var(--gold); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.panel ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
#how { background: none; border: 0; box-shadow: none; }
#how .go { width: 100%; }

/* play: the canvas is the screen; the HUD floats on top */
body.playing .sg-top { position: fixed; top: 0; left: 0; right: 0; padding: 8px 12px; min-height: 0; pointer-events: none; }
body.playing .sg-top > * { pointer-events: auto; }
#play { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.hud { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: #0b0614ee; border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--orange); border-radius: 14px; white-space: nowrap; }
.hud .score { display: flex; align-items: baseline; gap: 4px; }
.hud .score b { font-size: 28px; line-height: 1; color: var(--gold); }
.hud span { font: 700 11px Inter, sans-serif; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; }
.hud .melt { display: grid; gap: 2px; }
.hud .melt i { display: block; width: clamp(80px, 18vw, 150px); height: 12px; border-radius: 6px; background: #ffffff1a; border: 2px solid var(--ink); overflow: hidden; }
.hud .melt b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--blue)); transition: width .4s ease; }
.hud .melt.full b { background: linear-gradient(90deg, var(--pink), var(--orange)); }
.kicks { display: grid; grid-template-columns: repeat(5, 10px); gap: 3px; }
.kicks i { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
.kicks i.gone { background: #ffffff22; border-color: #ffffff33; }
.hint { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; margin: 0; font: 400 18px 'Luckiest Guy', sans-serif; color: #ffffffd0; letter-spacing: .06em; text-shadow: 0 2px 0 var(--ink); }
.hint.now { color: var(--lime); animation: nag .5s ease-in-out infinite alternate; }
@keyframes nag { to { transform: scale(1.08); } }

/* his speech bubble, placed over his head by game.js */
.bubble { position: fixed; z-index: 4; max-width: min(300px, 46vw); padding: 10px 14px; background: #fff; color: #120a1e; border: 3px solid var(--ink); border-radius: 18px; font: 400 clamp(15px, 2.4vw, 20px)/1.15 'Luckiest Guy', Impact, sans-serif; letter-spacing: .02em; box-shadow: 4px 5px 0 var(--ink); transform: translate(-50%, -100%); pointer-events: none; animation: say .25s cubic-bezier(.2,1.6,.4,1) both; text-align: center; }
.bubble::after { content: ''; position: absolute; left: 22px; bottom: -16px; width: 22px; height: 18px; background: #fff; border: 3px solid var(--ink); border-top: 0; border-left: 0; transform: skewX(30deg); clip-path: polygon(0 0, 100% 0, 0 100%); border-right: 0; border-left: 3px solid var(--ink); }
.bubble.left::after { left: auto; right: 22px; transform: skewX(-30deg); clip-path: polygon(0 0, 100% 0, 100% 100%); border-left: 0; border-right: 3px solid var(--ink); }
.bubble.screech { background: var(--gold); transform: translate(-50%, -100%) rotate(-3deg); }
.bubble.screech::after { background: var(--gold); }
@keyframes say { from { transform: translate(-50%, -100%) scale(.3); opacity: 0; } }

/* end card */
.endc { max-width: 520px; margin: 3vh auto 0; padding: 0 16px 20px; width: 100%; }
.endc .panel { text-align: center; }
.endc h2 { font-size: clamp(28px, 7vw, 42px); }
.big-num { margin: 0; }
.big-num b { font-size: 76px; line-height: 1; color: var(--text); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 0 24px #ff7a1a99; }
.big-num span { display: block; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.new { margin: 0; font: 400 22px 'Luckiest Guy', sans-serif; color: var(--lime); letter-spacing: .05em; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.stats div { background: #0008; border: 2px solid var(--ink); border-radius: 12px; padding: 8px; }
.stats dt { font: 700 11px Inter, sans-serif; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; }
.stats dd { margin: 0; font-size: 24px; color: var(--cyan); }
.endc .go { width: 100%; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
body.ended main { padding-top: 0; }

/* sideways phones: the home card goes wide and short */
@media (orientation: landscape) and (max-height: 500px) {
  .sg-top { min-height: 48px; padding: 4px 12px; }
  .home { margin-top: 0; grid-template-columns: 1fr 1fr; align-items: center; max-width: 820px; column-gap: 18px; row-gap: 8px; padding: 12px 16px; }
  .home > .logo, .home > .tag { grid-column: 1; }
  .home > .chips, .home > .modes, .home > .need, .home > .go, .home > .best, .home > .links { grid-column: 2; }
  .home > .logo { grid-row: 1 / span 3; font-size: 52px; }
  .sg .chip { min-height: 38px; }
  .home > .tag { grid-row: 4 / span 2; }
  .endc { margin-top: 0; max-width: 760px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .big-num b { font-size: 50px; }
  .endc .panel > * + * { margin-top: 8px; }
  .endc .panel { padding: 12px; }
  .hint { font-size: 14px; bottom: 8px; left: 12px; right: auto; max-width: 34vw; text-align: left; }
  .bubble { font-size: 14px; max-width: 34vw; padding: 6px 10px; border-radius: 14px; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .home { margin-top: 8vh; }
}
/* narrow screens: the scoreboard sits under the Back and Lock buttons */
@media (max-width: 760px) {
  .hud { top: calc(max(8px, env(safe-area-inset-top)) + 54px); }
}
@media (max-width: 760px) and (orientation: landscape) and (max-height: 500px) {
  .hud { top: max(6px, env(safe-area-inset-top)); left: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble, .hint.now { animation: none; }
}
