/* TLCC Cosmic Shooter: arcade cabinet + game overlay.
   Self-contained (scoped to .tlc-arcade) so any page can host the game. */

@font-face {  /* Press Start 2P, SIL OFL 1.1, see /assets/fonts/PressStart2P-OFL.txt */
  font-family: 'Press Start 2P';
  src: url('/assets/fonts/press-start-2p-latin-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

.tlc-arcade {
  --cs-cyan: #22E6FF;
  --cs-cyan-soft: rgba(34, 230, 255, 0.35);
  --cs-magenta: #FF3EA5;
  --cs-magenta-soft: rgba(255, 62, 165, 0.35);
  --cs-violet: #8B5CFF;
  --cs-amber: #F08A3C;
  --cs-white: #F6F8FC;
  --cs-muted: #A6B0C2;
  --cs-pixel: 'Press Start 2P', 'IBM Plex Mono', monospace;
  --cs-mono: 'IBM Plex Mono', monospace;
}

/* ---------- cabinet ---------- */
.tlc-arcade.gm-cabinet {
  position: relative; max-width: 980px; margin: 0 auto; padding: 3px; border-radius: 16px;
  background: linear-gradient(135deg, var(--cs-cyan), var(--cs-violet) 45%, var(--cs-magenta));
  box-shadow: 0 0 30px rgba(34, 230, 255, 0.25), 0 0 60px rgba(255, 62, 165, 0.18);
}
.tlc-arcade .gm-cabinet-inner { background: #06040F; border-radius: 13px; padding: clamp(12px, 2vw, 18px); }
.tlc-arcade .gm-cabinet-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-family: var(--cs-pixel); font-size: clamp(0.5rem, 1.4vw, 0.6rem); letter-spacing: 0.06em; color: var(--cs-cyan);
  padding: 4px 4px 12px; white-space: nowrap;
}
.tlc-arcade .gm-cabinet-bar .gm-hi { color: var(--cs-amber); }
.tlc-arcade .gm-cabinet-bar .gm-lives { display: inline-flex; gap: 5px; align-items: center; min-height: 12px; }
.tlc-arcade .cs-life {  /* pixel ship = one life */
  display: inline-block; width: 12px; height: 12px; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 9' shape-rendering='crispEdges'%3E%3Cpath fill='%2322E6FF' d='M5 0h1v2H5z'/%3E%3Cpath fill='%23F6F8FC' d='M4 2h3v3H4zM2 5h7v1H2zM1 6h9v1H1z'/%3E%3Cpath fill='%23FF3EA5' d='M1 7h2v2H1zM8 7h2v2H8z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.tlc-arcade .gm-screen {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #16103A 0%, #07051A 60%, #030208 100%);
  border: 1px solid rgba(34, 230, 255, 0.25);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.tlc-arcade .gm-screen::after { /* CRT vignette + scanlines, above the canvas, below the overlay */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.75);
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 3px);
}
.tlc-arcade .gm-screen::before { /* TLCC logo watermark: every game, behind the overlay, never blocks input */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: url("/assets/images/logo-full.png") no-repeat center / min(62%, 520px) auto;
  opacity: 0.12; mix-blend-mode: screen;
}
.tlc-arcade .gm-cabinet-controls {
  display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  font-family: var(--cs-mono); font-size: 0.74rem; color: var(--cs-muted); padding: 12px 4px 2px;
}
.tlc-arcade .gm-cabinet-controls kbd {
  font-family: var(--cs-mono); font-size: 0.7rem; color: var(--cs-cyan);
  border: 1px solid var(--cs-cyan-soft); border-radius: 3px; padding: 1px 6px; margin-right: 4px;
}

/* no-JS fallback attract screen (removed by the game on load) */
.tlc-arcade .gm-attract { position: relative; z-index: 1; padding: 24px; }
.tlc-arcade .gm-attract-title, .tlc-arcade .cs-title {
  font-family: var(--cs-pixel); font-weight: 400; font-size: clamp(0.95rem, 3.6vw, 1.9rem); line-height: 1.55; margin: 0 0 16px;
  color: var(--cs-white); text-shadow: 0 0 10px var(--cs-magenta), 2px 0 0 var(--cs-cyan);
}
.tlc-arcade .gm-attract-start { font-family: var(--cs-pixel); font-size: clamp(0.62rem, 1.8vw, 0.8rem); color: var(--cs-amber); margin: 0 0 14px; }
.tlc-arcade .gm-attract-note { font-family: var(--cs-mono); font-size: 0.8rem; color: var(--cs-muted); margin: 0; }
.tlc-arcade .gm-attract-ship { display: block; width: 44px; height: 44px; margin: 0 auto 20px; image-rendering: pixelated; }
.tlc-arcade .gm-blink { animation: cs-blink 1.1s steps(1) infinite; }
@keyframes cs-blink { 50% { opacity: 0; } }

/* ---------- game canvas + overlay ---------- */
.tlc-arcade .cs-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
  image-rendering: pixelated; image-rendering: crisp-edges;
  touch-action: none; cursor: crosshair; outline: none;
}
.tlc-arcade .cs-overlay {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(4, 3, 14, 0.62);
}
.tlc-arcade .cs-overlay[hidden] { display: none; }
.tlc-arcade .cs-panel { max-width: 460px; }
.tlc-arcade .cs-sub { font-family: var(--cs-mono); font-size: clamp(0.78rem, 1.8vw, 0.9rem); color: var(--cs-muted); margin: 0 0 18px; }
.tlc-arcade .cs-score-line { font-family: var(--cs-pixel); font-size: clamp(0.62rem, 1.8vw, 0.8rem); color: var(--cs-white); margin: 0 0 10px; line-height: 1.8; }
.tlc-arcade .cs-new-best { color: var(--cs-amber); animation: cs-blink 0.8s steps(1) infinite; }
.tlc-arcade .cs-best { font-family: var(--cs-pixel); font-size: 0.56rem; color: var(--cs-amber); margin: 14px 0 0; }
.tlc-arcade .cs-help { font-family: var(--cs-mono); font-size: 0.72rem; color: var(--cs-muted); margin: 14px 0 0; line-height: 1.6; }
.tlc-arcade .cs-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tlc-arcade .cs-btn {
  font-family: var(--cs-pixel); font-size: clamp(0.62rem, 1.8vw, 0.74rem); letter-spacing: 0.08em;
  padding: 15px 22px; border-radius: 4px; cursor: pointer; border: 2px solid var(--cs-magenta);
  color: #14030C; background: var(--cs-magenta);
  box-shadow: 0 0 18px var(--cs-magenta-soft), 0 0 42px rgba(255, 62, 165, 0.25);
}
.tlc-arcade .cs-btn:hover { background: #FF62B7; }
.tlc-arcade .cs-btn:focus-visible, .tlc-arcade .cs-icon:focus-visible { outline: 2px solid var(--cs-white); outline-offset: 3px; }
.tlc-arcade .cs-link { font-family: var(--cs-mono); font-size: 0.78rem; color: var(--cs-cyan); text-decoration: none; }
.tlc-arcade .cs-link:hover { text-decoration: underline; }

/* in-play corner buttons: pause + full screen */
.tlc-arcade .cs-icons { position: absolute; top: 8px; right: 8px; z-index: 4; display: flex; gap: 8px; }
.tlc-arcade .cs-icons[hidden] { display: none; }
.tlc-arcade .cs-icon svg { width: 16px; height: 16px; display: block; }
.tlc-arcade .cs-icon {
  width: 38px; height: 38px; border-radius: 4px; cursor: pointer;
  font-family: var(--cs-pixel); font-size: 0.62rem; color: var(--cs-cyan);
  background: rgba(6, 4, 15, 0.7); border: 1px solid var(--cs-cyan-soft);
  display: flex; align-items: center; justify-content: center;
}
.tlc-arcade .cs-toast {
  position: absolute; left: 0; right: 0; top: 38%; z-index: 3; pointer-events: none;
  font-family: var(--cs-pixel); font-size: clamp(0.8rem, 3vw, 1.3rem); color: var(--cs-cyan);
  text-shadow: 0 0 12px var(--cs-cyan-soft); opacity: 0; transition: opacity 0.25s;
}
.tlc-arcade .cs-toast.show { opacity: 1; }

/* full screen (real Fullscreen API where available, CSS fallback for iPhone) */
.tlc-arcade.cs-full {
  position: fixed; inset: 0; z-index: 100; max-width: none; margin: 0; border-radius: 0; padding: 0;
  display: flex; background: #06040F;
}
.tlc-arcade.cs-full .gm-cabinet-inner { flex: 1; display: flex; flex-direction: column; border-radius: 0; padding: 10px; }
.tlc-arcade.cs-full .gm-screen { flex: 1; aspect-ratio: auto; }
.tlc-arcade.cs-full .gm-cabinet-controls { display: none; }
body.cs-lock { overflow: hidden; }

/* hide the site's floating sound bar + stars tally while a game is in play */
body.cs-playing .sound-console-wrap.global,
body.cs-playing .star-counter { opacity: 0 !important; pointer-events: none !important; transition: opacity 0.3s; }

@media (max-width: 640px) {
  .tlc-arcade .gm-screen { aspect-ratio: 4 / 5; }
  .tlc-arcade .gm-cabinet-controls .gm-desk { display: none; }
}
@media (min-width: 641px) { .tlc-arcade .gm-cabinet-controls .gm-touch { display: none; } }
@media (prefers-reduced-motion: reduce) { .tlc-arcade .gm-blink, .tlc-arcade .cs-new-best { animation: none; } }
