/* ------------------------------------------------------------------
   SUPER PIXEL WORLD — Shell / CRT Rahmen
   Der gesamte Spiele-Input läuft auf dem Canvas; dieses CSS liefert
   nur Fullscreen-Layout, CRT-Overlay und Touch-Controls.
   ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #05070d; color: #cfe3ff;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  -webkit-user-select: none; user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #101a2c 0%, #05070d 60%, #020306 100%);
}
canvas#game {
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block; background: #0b1020;
  box-shadow: 0 0 0 2px #1d2a44, 0 18px 60px rgba(0,0,0,.75), 0 0 120px rgba(70,120,255,.10);
  border-radius: 2px;
}
.fx { position: absolute; inset: 0; pointer-events: none; }
#scanlines {
  mix-blend-mode: multiply; opacity: .28; transition: opacity .25s;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.55) 0 1px, rgba(0,0,0,0) 1px 3px);
}
#scanlines.off { opacity: 0; }
#vignette {
  background: radial-gradient(110% 82% at 50% 48%, rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 100%);
}

/* --- Chips oben rechts --------------------------------------------- */
#ui { position: absolute; top: 10px; right: 12px; display: flex; gap: 6px; z-index: 20; }
.chip {
  font: 11px/1 inherit; color: #9fc2ff; background: rgba(12,20,36,.8);
  border: 1px solid #26365c; border-radius: 6px;
  padding: 5px 8px; cursor: pointer; letter-spacing: .04em;
}
.chip:hover { background: rgba(30,48,84,.9); color: #eaf3ff; }
.chip.dead { opacity: .45; text-decoration: line-through; }

/* --- Boot-Screen ---------------------------------------------------- */
#boot {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  background: radial-gradient(60% 60% at 50% 45%, #0b1526 0%, #04060c 75%);
  transition: opacity .45s ease, visibility .45s;
}
#boot.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { text-align: center; max-width: min(720px, 92vw); }
.boot-logo {
  font-size: clamp(22px, 5vw, 44px); font-weight: 800; letter-spacing: .16em;
  color: #ffe9a8;
  text-shadow: 0 0 14px rgba(255,190,70,.55), 0 3px 0 #7a4a12, 0 0 1px #fff;
  margin-bottom: 26px;
}
.boot-bar { height: 8px; width: min(420px, 70vw); margin: 0 auto; background: #0d1626;
  border: 1px solid #24365c; border-radius: 99px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 4%; border-radius: 99px;
  background: linear-gradient(90deg, #3ea8ff, #7ef0b0, #ffe066); transition: width .18s; }
.boot-msg { margin-top: 10px; font-size: 11px; letter-spacing: .18em; color: #6f8bbd; min-height: 14px; }
.boot-keys { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  font-size: 11px; color: #89a6d6; }
.boot-keys b { color: #ffe9a8; font-weight: 700; }
.boot-fine { margin-top: 22px; font-size: 10px; color: #4d628c; letter-spacing: .06em; }

/* --- Touch-Steuerung ------------------------------------------------ */
#touch { position: absolute; inset: 0; z-index: 15; display: none; }
#touch.on { display: block; }
#stick { position: absolute; left: 4%; bottom: 6%; width: 30vw; max-width: 210px; height: 30vw; max-height: 210px;
  border: 2px solid rgba(140,180,255,.28); border-radius: 50%; background: rgba(10,18,34,.35); }
#stick i { position: absolute; left: 50%; top: 50%; width: 34%; height: 34%; margin: -17% 0 0 -17%;
  border-radius: 50%; background: rgba(150,195,255,.5); box-shadow: 0 0 18px rgba(90,150,255,.45); }
.tbtn { position: absolute; bottom: 7%; width: 17vw; max-width: 118px; height: 17vw; max-height: 118px;
  border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700;
  color: #dff0ff; background: rgba(24,42,74,.55); border: 2px solid rgba(150,195,255,.32); }
.tbtn[data-btn="A"] { right: 5%; }
.tbtn[data-btn="B"] { right: 25%; bottom: 4%; width: 13vw; max-width: 92px; height: 13vw; max-height: 92px; }
.tbtn.down { background: rgba(70,120,200,.7); }

@media (max-width: 700px) { #ui { top: 6px; right: 6px; } .chip { padding: 4px 6px; } }

/* ---------------- Laufzeitfehler-Panel ------------------------------- */
#crash {
  position: absolute; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(4, 6, 12, .9); backdrop-filter: blur(2px);
}
#crash.hide { display: none; }
.crash-box {
  width: min(620px, 92vw); padding: 18px 20px; text-align: left;
  background: linear-gradient(180deg, #131a2a, #080c15);
  border: 1px solid #3b4f7d; border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}
.crash-head {
  font-size: 13px; font-weight: 800; letter-spacing: .22em; color: #ff9a86;
  margin-bottom: 8px;
}
.crash-msg { font-size: 13px; color: #ffd9cf; line-height: 1.45; word-break: break-word; }
.crash-stack {
  margin: 12px 0 14px; padding: 10px 12px; max-height: 34vh; overflow: auto;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #9fb6d8; background: #05080f; border: 1px solid #223252; border-radius: 6px;
  white-space: pre-wrap;
}
.crash-row { display: flex; gap: 10px; flex-wrap: wrap; }
.crash-fine { margin-top: 10px; font-size: 10px; letter-spacing: .12em; color: #5f76a3; }
button.chip.wide {
  width: auto; padding: 7px 14px; cursor: pointer;
  font: inherit; font-size: 11px; letter-spacing: .14em;
}
