/*
 * kanonenspiel.css – Vollbild-Oberfläche des Kanonenspiels (zapy.ch/fun/kanonenspiel).
 * Die Spielwelt zeichnet three.js in #stage, alles andere sind HTML-Ebenen darüber.
 */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0221; color: var(--white); }
body { font-family: var(--pixel); user-select: none; -webkit-user-select: none; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Text mit dunklem Rand, gut lesbar auf dem Himmel */
#hud, #msg, #foot { text-shadow: -3px 0 #0d0221, 3px 0 #0d0221, 0 -3px #0d0221, 0 3px #0d0221,
  -2px -2px #0d0221, 2px 2px #0d0221, -2px 2px #0d0221, 2px -2px #0d0221; }

/* ------------------------------------------------------------ HUD oben */
#hud { position: fixed; top: clamp(12px, 2.4vh, 28px); left: 50%; transform: translateX(-50%);
  text-align: center; pointer-events: none; white-space: nowrap; }
#score { font-size: clamp(18px, 2.4vw, 34px); display: flex; gap: .5em; justify-content: center; align-items: baseline; }
#score .p1 { color: #ff2e97; }
#score .p2 { color: #19c8ff; }
#score b { font-weight: normal; color: inherit; }
#score .bump { display: inline-block; animation: bump .6s ease-out; }
@keyframes bump { 0% { transform: scale(2); } 100% { transform: scale(1); } }
#wind { margin-top: .9em; font-size: clamp(10px, 1.05vw, 16px); }
#turn { margin-top: 1.1em; font-size: clamp(14px, 1.7vw, 26px); min-height: 1.2em; }
#turn.blink { animation: turnBlink .8s steps(1) infinite; }
@keyframes turnBlink { 50% { color: #fff; } }

/* ------------------------------------------------------------ Meldungen */
#msg { position: fixed; left: 50%; top: clamp(120px, 17vh, 200px); transform: translateX(-50%) scale(.9);
  max-width: min(84vw, 1100px); padding: .9em 1.6em; text-align: center; pointer-events: none;
  background: rgba(13, 2, 33, .86); border: 4px solid #fff; border-radius: 14px;
  box-shadow: 0 0 0 3px #0d0221, 0 8px 30px rgba(0, 0, 0, .35);
  opacity: 0; transition: opacity .25s, transform .25s; text-shadow: none; }
#msg.on { opacity: 1; transform: translateX(-50%) scale(1); }
#msg .t { font-size: clamp(13px, 1.5vw, 24px); line-height: 1.5; }
#msg .s { font-size: clamp(9px, .95vw, 14px); color: #ffe600; margin-top: .8em; }
#msg .s:empty { display: none; }
#msg.win .s { animation: turnBlink 1s steps(1) infinite; }

/* ------------------------------------------------------------ Zielanzeige (Sprechblase) */
#aim { --pc: #ff2e97; position: fixed; left: 0; top: 0; display: flex; gap: 18px; align-items: stretch; padding: 14px 18px 16px;
  background: #fff; color: #0d0221; border: 4px solid #0d0221; border-radius: 24px;
  box-shadow: 0 6px 0 rgba(13, 2, 33, .25); pointer-events: none; opacity: 0; transition: opacity .2s;
  font-size: 8px; will-change: transform; }
#aim.on { opacity: 1; }
#aim::after { content: ""; position: absolute; bottom: -22px; left: 34px; width: 26px; height: 26px; background: #fff;
  border-right: 4px solid #0d0221; border-bottom: 4px solid #0d0221; transform: skewX(25deg) rotate(45deg); border-radius: 0 0 6px 0; }
#aim.left::after { left: auto; right: 34px; transform: skewX(-25deg) rotate(45deg); }
#aim .badge { position: absolute; top: -18px; right: -18px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--pc); border: 3px solid #0d0221; color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; }
#aim.left .badge { right: auto; left: -18px; }
/* wie auf dem Handy: links der Winkelmesser, rechts der senkrechte Pulverbalken */
#aim .col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#aim .gauge { width: 66px; height: 66px; flex: none; }
#aim .needle { stroke: var(--pc); }
#aim .lbl { color: #7a6a9a; }
#aim .val { font-size: 16px; }
#aim .bar { position: relative; width: 26px; height: 66px; border: 3px solid #0d0221; border-radius: 10px; background: #eee6ff; overflow: hidden; }
#aim .bar i { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: var(--pc);
  box-shadow: inset 4px 0 0 rgba(255, 255, 255, .45); }

/* ------------------------------------------------------------ QR-Kacheln an den Rändern */
.tile { --pc: #ff2e97; position: fixed; top: 50%; left: clamp(8px, 1.2vw, 22px); transform: translateY(-50%);
  width: clamp(132px, 12vw, 220px); padding: 12px 12px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #0d0221; border: 4px solid var(--pc); border-radius: 6px;
  box-shadow: 0 0 0 3px #000, 0 0 24px var(--pc); text-align: center;
  transition: width .35s, padding .35s, background .08s; }
#tile2 { --pc: #19c8ff; left: auto; right: clamp(8px, 1.2vw, 22px); }
.tile .pl { color: var(--pc); font-size: clamp(14px, 1.4vw, 22px); text-shadow: 0 0 10px var(--pc); }
.tile .qr { width: 100%; aspect-ratio: 1; background: #fff; padding: 8px; }
.tile .qr svg { width: 100%; height: 100%; display: block; }
.tile .cap { font-size: clamp(7px, .62vw, 10px); line-height: 1.7; color: #ffe600; animation: turnBlink 1.2s steps(1) infinite; }
.tile .ready { display: none; font-size: clamp(9px, .8vw, 12px); color: var(--pc); text-shadow: 0 0 10px var(--pc); }
.tile.off .qr { opacity: .15; }
.tile.ready { width: clamp(76px, 6.2vw, 110px); padding: 10px 6px; }
.tile.ready .qr, .tile.ready .cap { display: none; }
.tile.ready .ready { display: block; }
.tile.hot { background: var(--pc); }
.tile.hot .pl, .tile.hot .ready { color: #0d0221; text-shadow: none; }
.tile.turn { animation: tilePulse 1s ease-in-out infinite; }
@keyframes tilePulse { 50% { box-shadow: 0 0 0 3px #000, 0 0 48px var(--pc), 0 0 90px var(--pc); } }

/* ------------------------------------------------------------ Fusszeile */
#foot { position: fixed; left: 50%; bottom: clamp(8px, 1.6vh, 18px); transform: translateX(-50%);
  display: flex; gap: 28px; align-items: center; white-space: nowrap; font-size: 9px; color: #fff;
  opacity: .55; transition: opacity .3s; }
#foot:hover { opacity: 1; }
#foot a { color: #19f6ff; text-decoration: none; }
#foot button { font: inherit; color: #ffe600; background: none; border: 2px solid #ffe600; border-radius: 4px; padding: 6px 10px; cursor: pointer;
  text-shadow: inherit; }
body.idle #foot { opacity: 0; }
body.idle { cursor: none; }

@media (max-width: 800px) { #foot .keys { display: none; } }
@media (prefers-reduced-motion: reduce) { .tile .cap, #turn.blink, .tile.turn { animation: none; } }

/* Compi spielt diesen Platz: QR bleibt sichtbar, damit jemand übernehmen kann */
.tile.cpu .pl::after { content: " · PC"; }
.tile.cpu .cap { color: #fff; animation: none; }

/* ?cover: nur die Spielwelt (Titelbild der Spielhalle) */
body.cover .tile, body.cover #foot, body.cover #msg, body.cover #hud, body.cover #aim { display: none !important; }
