.comic-entry {
  z-index: 2;
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #221e24;
  border-radius: 0;
  padding: 3px 8px;
  background: #fff9e7;
  color: #221e24;
  font-family: "PingFang HK", "Noto Sans CJK TC", system-ui, sans-serif;
  line-height: 1.2;
  touch-action: auto;
}
.comic-entry::placeholder { color: #665a50; opacity: 1; }
.comic-entry:focus { outline: 2px solid #2856c4; outline-offset: 0; }
#comic-code { text-transform: uppercase; }
#comic-code::placeholder { text-transform: none; }

html, body { height: 100%; overscroll-behavior: none; }

/* The ad stays in document flow, in a separate row below the game's viewport. */
body { display: flex; flex-direction: column; }
#game-ad-footer {
  flex: none;
  margin-top: auto;
  box-sizing: border-box;
  width: 100%;
  padding: 0;
  background: #fff9e7;
  border: 0;
  color: #665a50;
  text-align: center;
}
#game-ad-footer[hidden] { display: none !important; }
.game-ad-label {
  margin: 0 0 4px;
  font: 9px/12px system-ui, sans-serif;
  letter-spacing: 0.12em;
}
.big_two_banner { width: 100%; max-width: none; height: 60px; margin: 0; }
body[data-layout="mobile"] .game-ad-label { display: none; }
body[data-layout="mobile"] #game-ad-footer { height: 60px; min-height: 60px; max-height: 60px; }


/* Desktop uses the entire viewport as the arena, with a portrait game in its center. */
#game-surface { z-index: 1; }
/* Decorative bleed outside the fixed-ratio Godot canvas; never receives input. */
body[data-layout="mobile"] #game-surface {
  --comic-base: #ffcf53; --comic-dark: #f5b640; --comic-light: #ffe297;
  background: radial-gradient(circle at var(--paper-dot-center), #211c2b42 var(--paper-dot-core), transparent var(--paper-dot-edge)) var(--paper-dot-offset) / var(--paper-dot-pitch) var(--paper-dot-pitch),
    repeating-conic-gradient(from 270deg at var(--paper-origin), var(--comic-base) 0 5.7296deg, var(--comic-dark) 5.7296deg 10.5997deg, var(--comic-light) 10.5997deg 17.1887deg);
}
body[data-layout="mobile"][data-game-screen="results"] #game-surface {
  --comic-base: #345b8c; --comic-dark: #254a73; --comic-light: #426f9e;
}
body[data-layout="desktop"] #game-surface {
  box-shadow: 0 0 0 2px #0a1c30, 0 0 0 9px #fff5d810, 0 18px 65px #0007;
}
#desktop-arena { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #102741; }
#desktop-arena[hidden], #game-fullscreen[hidden] { display: none !important; }
.arena-rays, .arena-dots, .arena-glow { position: absolute; inset: 0; }
.arena-rays {
  background: repeating-conic-gradient(from 8deg at 50% 46%, #24486a 0deg 12deg, #132f50 12deg 24deg);
  animation: arena-breathe 12s ease-in-out infinite alternate;
}
.arena-dots { background: radial-gradient(circle, #07152590 1px, transparent 1.6px) 0 0 / 7px 7px; opacity: .36; }
.arena-glow { background: radial-gradient(ellipse at 50% 45%, #83c7e415, transparent 70%), linear-gradient(0deg, #071527b0, transparent 65%); }
.arena-card {
  position: absolute; width: clamp(90px, 10vw, 172px); height: clamp(128px, 14vw, 240px);
  color: #87b3cc; background: #f8edce09; border: 3px solid #081c32; border-radius: 9px;
  box-shadow: 8px 9px #081c3245; opacity: .38; transform: rotate(var(--tilt));
  animation: arena-card-drift 13s ease-in-out infinite alternate;
}
.arena-card span { position: absolute; top: 10px; left: 14px; font: 800 clamp(25px, 3vw, 48px)/1 system-ui, sans-serif; }
.arena-card b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 clamp(58px, 7vw, 108px)/1 Georgia, serif; }
.left-top { --tilt: -18deg; left: 7%; top: 13%; }
.right-top { --tilt: 19deg; right: 7%; top: 12%; animation-delay: -4s; }
.left-bottom { --tilt: 14deg; left: 13%; bottom: 8%; animation-delay: -8s; }
.right-bottom { --tilt: -13deg; right: 12%; bottom: 13%; animation-delay: -6s; }
.arena-spark {
  position: absolute; left: var(--x); top: var(--y); width: 6px; height: 9px;
  background: #f6cd60; opacity: .45; animation: arena-spark-drift 17s ease-in-out infinite alternate;
  animation-delay: var(--delay);
}
.arena-spark:nth-of-type(3n) { background: #da7263; width: 5px; height: 5px; }
#game-fullscreen {
  position: fixed; z-index: 3; right: 20px; top: 20px; width: 43px; height: 43px;
  display: grid; place-items: center; padding: 0; cursor: pointer; color: #172d45;
  border: 2px solid #07192c; border-radius: 2px; background: #fff5d8; box-shadow: 4px 4px #07192c;
}
#game-fullscreen:hover { background: #ffcf5c; }
#game-fullscreen:focus-visible { outline: 3px solid #ffcf5c; outline-offset: 5px; }
body[data-layout="desktop"] #game-ad-footer {
  position: fixed; z-index: 4; right: 16px; bottom: 16px; margin: 0;
  width: calc(var(--ad-width) + 4px); padding: 8px 0 4px; border: 2px solid #221e24;
  box-shadow: 5px 5px #07192c; background: #fff9e7;
}
body[data-layout="desktop"] .big_two_banner { max-width: none; margin: 0; }
body[data-page-hidden="true"] #desktop-arena * { animation-play-state: paused; }
@keyframes arena-breathe { from { opacity: .65; } to { opacity: .95; } }
@keyframes arena-card-drift { from { transform: translateY(-13px) rotate(var(--tilt)); } to { transform: translateY(22px) rotate(calc(var(--tilt) + 5deg)); } }
@keyframes arena-spark-drift { from { transform: translate(0, -24px) rotate(0deg); opacity: .2; } to { transform: translate(24px, 28px) rotate(130deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { #desktop-arena * { animation: none !important; } }

#fullscreen-hint { position: fixed; z-index: 3; right: 20px; top: 76px; max-width: 260px; padding: 9px 12px; color: #172d45; background: #fff5d8; border: 2px solid #07192c; font: 13px/1.5 system-ui, sans-serif; box-shadow: 3px 3px #07192c; }
#fullscreen-hint[hidden] { display: none; }

/* Selectable invitation when native sharing/clipboard is unavailable. */
#invite-manual { box-sizing: border-box; position: fixed; z-index: 10; inset: 0; margin: auto; width: min(360px, calc(100% - 32px)); padding: 17px; background: #fff2ce; border: 3px solid #221e24; box-shadow: 5px 5px #221e24; color: #221e24; font-family: system-ui, sans-serif; touch-action: auto; }
#invite-manual::backdrop { background: #221e24b0; }
#invite-manual h2 { margin: 0 0 12px; font-size: 18px; }
#invite-manual input { box-sizing: border-box; width: 100%; padding: 8px; border: 2px solid #221e24; background: #fff9e7; color: #221e24; font-size: 16px; touch-action: auto; user-select: text; }
#invite-manual button { display: block; margin: 15px 0 0 auto; min-width: 70px; min-height: 44px; padding: 5px 12px; font: 700 15px system-ui; background: #bd2829; color: #fff2ce; border: 2px solid #221e24; box-shadow: 3px 3px #221e24; }
