:root {
  --bg: #0e1620;
  --panel: #152130;
  --panel-2: #1d2b3d;
  --line: #2d3e53;
  --text: #e2e9f1;
  --muted: #8b9cb1;
  --steel: #9db6d3;
  --accent: #e3a845;
  --win: #5bb06a;
  --loss: #d0563f;
  --blood: #7c2a1e;
  --display: "Big Shoulders Display", Impact, sans-serif;
  --body: "Barlow", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, #23374f 0%, transparent 70%),
    linear-gradient(#0e1620, #101b28 60%, #0b121b);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

/* Skyline along the bottom of every page, as a faint texture. One wide panorama (3.903:1), centred
   and never repeated. It's sized to span the window, so narrow screens crop its sides rather than
   tiling it; on very wide screens it's capped at 45% of the height and its tapered ends sit short of
   the edges instead. */
body::before {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  --sky-h: min(max(min(48vw, 34vh), calc(100vw / 3.9)), 45vh); /* 48vw: phones get a taller, side-cropped slice */
  height: var(--sky-h);
  background: linear-gradient(to top, rgba(157, 182, 211, 0.1), rgba(157, 182, 211, 0.035));
  -webkit-mask: url("skyline-nyc.svg") center bottom / auto 100% no-repeat;
  mask: url("skyline-nyc.svg") center bottom / auto 100% no-repeat;
  pointer-events: none;
  z-index: -1;
}

body > main { flex: 1 0 auto; width: 100%; }

/* Play screens and the home page fit the window exactly: header, main, footer, no page scroll.
   Each page sizes its main element from the height that's left (see #stage in game.css).
   Results screens drop .fit and scroll normally; main only scrolls itself in windows too small to fit. */
body.fit { height: 100vh; height: 100dvh; min-height: 0; }
body.fit > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }

/* hidden tooltips can poke past the screen edge; don't let them add sideways scroll */
html, body { overflow-x: clip; }

a { color: inherit; }

button { font: inherit; color: inherit; }

.masthead {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 22, 32, 0.7);
  backdrop-filter: blur(6px);
}

.masthead .brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}

.masthead .brand span { color: var(--accent); }

.masthead .date { color: var(--muted); font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn.primary:hover { background: #fff; }

@media (max-width: 480px) {
  .masthead { padding: 12px 16px; }
  .masthead .brand { font-size: 19px; }
}

.site-footer {
  flex: none;
  padding: 8px 16px 10px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.site-footer .sep { margin: 0 6px; opacity: 0.6; }
.site-footer a { white-space: nowrap; }

/* Footer on every page: hero heads drift along a band at the bottom of the page, and the footer
   text sits on a rounded tab rising out of it. The tab is a little taller than the icons, so its top
   edge clears them. The strip fades to 50% as it nears the tab and stays at 50% behind it;
   initMarquee() sets --tab-l / --tab-r to the tab's edges. */
.site-footer.tab-footer {
  --band: 64px;
  --icon: 46px;
  --fade: 90px;
  position: relative;
  height: var(--band);
  padding: 0;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
}
.marquee {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  overflow: hidden;
  pointer-events: none;
  --m: linear-gradient(to right,
    #000 0, #000 calc(var(--tab-l, 50%) - var(--fade)),
    rgba(0, 0, 0, 0.5) var(--tab-l, 50%), rgba(0, 0, 0, 0.5) var(--tab-r, 50%),
    #000 calc(var(--tab-r, 50%) + var(--fade)), #000 100%);
  -webkit-mask: var(--m);
  mask: var(--m);
}
.marquee-track { display: flex; align-items: center; gap: 14px; padding-left: 14px; will-change: transform; }
.marquee img { flex: none; display: block; user-select: none; }
.marquee .mq-hero { width: var(--icon); height: var(--icon); border-radius: 50%; background: rgba(29, 43, 61, 0.7); }
.marquee .mq-item { width: calc(var(--icon) * 0.82); height: calc(var(--icon) * 0.82); border-radius: 9px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); }
.footer-tab {
  position: relative; z-index: 1;
  max-width: calc(100% - 24px);
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 7px 14px 8px 22px;
  border-radius: 16px 16px 0 0;
  background: rgba(10, 16, 24, 0.62); /* see-through enough that the heads show behind the text */
  box-shadow: 0 -8px 22px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);
  backdrop-filter: blur(1.5px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  font-size: 14px;
  line-height: 1.45;
}
.ft-lines { display: flex; flex-direction: column; align-items: center; white-space: nowrap; }
.footer-tab .kofi, .footer-tab .kyj { font-weight: 700; }
.footer-tab .kyj { color: var(--text); }
.feedback-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--text);
  font: 600 13px var(--body);
  text-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.feedback-btn:hover { border-color: var(--accent); }
.feedback-btn svg { width: 15px; height: 15px; color: var(--accent); }
@media (max-width: 520px) {
  .site-footer.tab-footer { --fade: 50px; }
  .footer-tab { gap: 12px; padding: 6px 10px 7px 14px; font-size: 13px; line-height: 1.4; }
  .feedback-btn { padding: 6px 10px; font-size: 12px; }
}

/* --- feedback dialog --- */
.fb-dialog {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
.fb-dialog::backdrop { background: rgba(5, 9, 14, 0.7); backdrop-filter: blur(3px); }
.fb-form, .fb-done { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 6px; }
.fb-form[hidden], .fb-done[hidden] { display: none; }
.fb-head { display: flex; align-items: center; justify-content: space-between; }
.fb-head h2 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.fb-close { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px; }
.fb-intro, .fb-note { margin: 0; color: var(--muted); font-size: 14px; }
.fb-note { font-size: 12px; }
.fb-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; }
.fb-field em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; }
.fb-field .fb-count { float: right; }
.fb-field input, .fb-field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: 500 16px var(--body); /* 16px stops iOS zooming in on focus */
}
.fb-field textarea { resize: vertical; min-height: 110px; line-height: 1.4; }
.fb-field input:focus, .fb-field textarea:focus { outline: none; border-color: var(--accent); }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-error { margin: 0; min-height: 1.2em; color: var(--loss); font-size: 13px; font-weight: 600; }
.fb-error:empty { display: none; }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fb-done { align-items: center; text-align: center; padding-top: 28px; padding-bottom: 12px; }
.fb-done p { margin: 0; color: var(--muted); }
.fb-done .fb-done-title { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--text); text-transform: uppercase; }
.fb-credits { margin: 8px 0 0; padding: 10px 20px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.fb-credits a { color: var(--steel); }

.site-footer a { color: var(--steel); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer .kofi { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
