/* Kernel Quest — bright, corny festival landing */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --corn: #FFD23F;
  --corn-deep: #E8A800;
  --husk: #3E8E41;
  --husk-deep: #2E7D32;
  --sky: #7EC8E3;
  --carnival-red: #E2543E;
  --ink: #2B2720;
  --paper: #FFFDF6;
  --cream: #FFF6DC;
}

html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  overflow-x: hidden;
}

/* ---- bunting flags ---- */
.bunting {
  height: 26px;
  background:
    linear-gradient(135deg, transparent 50%, var(--paper) 50%) 0 12px / 28px 14px repeat-x,
    linear-gradient(225deg, transparent 50%, var(--paper) 50%) 14px 12px / 28px 14px repeat-x,
    repeating-linear-gradient(90deg,
      var(--carnival-red) 0 28px, var(--corn) 28px 56px,
      var(--husk) 56px 84px, var(--sky) 84px 112px);
}

/* ---- hero ---- */
.hero { text-align: center; padding: 44px 16px 28px; }
.eyebrow {
  font-family: 'Courier New', monospace; font-weight: bold;
  font-size: clamp(10px, 2.4vw, 13px); letter-spacing: .12em; color: var(--husk-deep);
}
.logo {
  font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
  font-size: clamp(44px, 11vw, 104px);
  line-height: .95; margin: 14px 0 10px; letter-spacing: -0.02em;
  color: var(--corn);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 5px 6px 0 var(--husk), 9px 11px 0 rgba(43,39,32,.15);
  transform: rotate(-1.5deg);
}
.logo span { display: inline-block; }
.tag {
  font-size: clamp(18px, 3.4vw, 26px); font-style: italic; font-weight: bold;
  color: var(--carnival-red); margin-bottom: 12px;
}
.sub { font-size: clamp(14px, 2.4vw, 17px); line-height: 1.6; color: #5A5142; }
.cta {
  display: inline-block; margin-top: 22px;
  font-family: 'Courier New', monospace; font-weight: bold; font-size: 17px;
  background: var(--corn); color: var(--ink); text-decoration: none;
  border: 3px solid var(--ink); border-radius: 999px;
  padding: 13px 30px;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.cta:hover { transform: translateY(2px); box-shadow: 0 3px 0 var(--ink); }
.cta:active { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }

/* ---- arcade cabinet ---- */
.cabinet-wrap { display: flex; justify-content: center; padding: 26px 10px 10px; }
.cabinet {
  background: var(--husk-deep);
  border: 4px solid var(--ink); border-radius: 18px 18px 10px 10px;
  padding: 0 14px 12px; max-width: 96vw;
  box-shadow: 0 14px 34px rgba(43,39,32,.25), inset 0 2px 0 rgba(255,255,255,.18);
}
.marquee {
  font-family: 'Arial Black', sans-serif; text-align: center;
  font-size: clamp(15px, 3vw, 22px); letter-spacing: .2em;
  color: var(--corn); background: var(--ink);
  border: 3px solid var(--ink); border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 10px 18px; margin: 0 6px 14px;
  text-shadow: 0 0 12px rgba(255,210,63,.8);
}
#fswrap { position: relative; }
#stage { line-height: 0; display: flex; justify-content: center; }
#game {
  image-rendering: crisp-edges;  /* fallback for browsers without `pixelated` */
  image-rendering: pixelated;    /* must come LAST — last valid wins */
  background: #000;
  border: 4px solid var(--ink); border-radius: 6px;
  max-width: 100%;
}
.cab-base {
  font-family: 'Courier New', monospace; font-size: 11px; font-weight: bold;
  text-align: center; color: var(--cream); letter-spacing: .14em;
  padding-top: 10px;
}

/* ---- touch controls (inside cabinet, under screen) ---- */
#touch {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 8px 4px; gap: 12px;
}
.t-left, .t-right { display: flex; gap: 14px; }
.t-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--cream); color: var(--ink);
  font-size: 24px; font-weight: bold; font-family: 'Courier New', monospace;
  box-shadow: 0 4px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.t-btn:active { box-shadow: 0 1px 0 var(--ink); transform: translateY(3px); background: var(--corn); }
.t-act { background: var(--corn); }

/* ---- fullscreen toggle + mode ---- */
#fs-btn {
  position: absolute; top: 8px; right: 8px; z-index: 10;
  width: 38px; height: 38px; border-radius: 8px;
  border: 2px solid var(--ink);
  background: rgba(255,248,231,.85); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
}
#fs-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }

#rotate-hint { display: none; }

/* .fs is set by JS for BOTH native fullscreen and the iOS fixed-overlay fallback */
#fswrap.fs {
  position: fixed; inset: 0; z-index: 999;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
body.fs-on { overflow: hidden; }
#fswrap.fs #stage { width: 100%; height: 100%; align-items: center; }
#fswrap.fs #game { border: none; border-radius: 0; }
#fswrap.fs #fs-btn { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
#fswrap.fs #touch {
  position: absolute; left: 0; right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  padding: 0 max(20px, env(safe-area-inset-left));
  pointer-events: none;
}
#fswrap.fs .t-btn { pointer-events: auto; opacity: .6; }
#fswrap.fs .t-btn:active { opacity: 1; }
/* desktop fullscreen: keyboard is the controller, hide the thumb pads */
@media (hover: hover) and (pointer: fine) {
  #fswrap.fs #touch { display: none; }
}
/* phone held upright in fullscreen: nudge toward landscape */
@media (orientation: portrait) and (pointer: coarse) {
  #fswrap.fs #rotate-hint {
    display: block; position: absolute;
    top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
    font-family: 'Courier New', monospace; font-weight: bold; font-size: 12px;
    letter-spacing: .12em; color: var(--corn);
    background: rgba(43,39,32,.75); border-radius: 999px;
    padding: 6px 14px; pointer-events: none;
    animation: hintpulse 2.2s ease-in-out infinite;
  }
}
@keyframes hintpulse { 0%, 100% { opacity: .9; } 50% { opacity: .45; } }

/* ---- info cards ---- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  max-width: 1060px; margin: 34px auto; padding: 0 18px;
}
.card {
  background: var(--cream);
  border: 3px solid var(--ink); border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 6px 6px 0 rgba(43,39,32,.12);
}
.card h2 {
  font-family: 'Arial Black', sans-serif; font-size: 19px;
  margin-bottom: 12px; transform: rotate(-.6deg);
}
.card ul, .card ol { padding-left: 20px; line-height: 1.85; font-size: 15px; }
.card a { color: var(--husk-deep); font-weight: bold; }
.muted { color: #8A7E68; }
.small { font-size: 12px; margin-top: 10px; }

.board-card { background: #FFF; }

/* ---- QR card ---- */
.qr-card { text-align: center; }
.qr-img {
  display: block; margin: 4px auto 10px;
  width: 220px; height: 220px; max-width: 100%;
  border: 3px solid var(--ink); border-radius: 10px;
  background: #FFF; padding: 8px;
  image-rendering: pixelated;
}
.qr-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.qr-dl {
  display: inline-block;
  font-family: 'Arial Black', sans-serif; font-size: 13px;
  color: var(--ink) !important; background: var(--corn);
  border: 3px solid var(--ink); border-radius: 999px;
  padding: 8px 18px; text-decoration: none;
  box-shadow: 0 3px 0 var(--ink);
}
.qr-dl:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.qr-dl-alt { background: var(--cream); }
#page-board { font-family: 'Courier New', monospace; font-weight: bold; list-style: none; padding: 0; }
#page-board li {
  display: flex; justify-content: space-between;
  border-bottom: 2px dashed #E8DEC4; padding: 5px 2px; font-size: 15px;
}
#page-board li:first-child:not(.muted) { color: var(--carnival-red); font-size: 17px; }
#page-board .day { color: var(--husk-deep); font-size: 12px; }

/* ---- pun ticker ---- */
.ticker-wrap {
  overflow: hidden; border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  background: var(--corn); margin-top: 14px;
}
.ticker {
  white-space: nowrap; display: inline-block;
  font-family: 'Arial Black', sans-serif; font-size: 15px; letter-spacing: .08em;
  padding: 9px 0; animation: tick 28s linear infinite;
}
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- footer ---- */
.footer {
  text-align: center; padding: 30px 20px 40px;
  font-size: 13.5px; line-height: 1.8; color: #6B6049;
  max-width: 720px; margin: 0 auto;
}
.footer a { color: var(--husk-deep); font-weight: bold; }

@media (max-width: 560px) {
  .cabinet { padding: 0 8px 10px; }
  .t-btn { width: 56px; height: 56px; }
}
