:root { --bg:#141414; --panel:#1c1c1c; --line:#2c2c2c; --text:#e8e8e8; --muted:#9a9a9a; --orange:#F7931A; --red:#c81e1e; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1040px; margin: 0 auto; padding: 18px 16px 40px; }
h2 { font-size: 20px; margin: 0 0 6px; }
p { margin: 0 0 10px; } .sub { color: var(--muted); font-size: 14.5px; } .sub.small { font-size: 13.5px; } code { background: #000; padding: 1px 6px; border-radius: 5px; color: var(--orange); }
.warnband { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 18px; background: var(--red); color: #fff; font-size: 17px; text-align: center; border-top: 4px solid #ff6b6b; border-bottom: 4px solid #7a0000; animation: bandpulse 1.8s ease-in-out infinite; }
.warnband span { font-size: 24px; } .warnband.bottom { position: sticky; bottom: 0; z-index: 5; }
@keyframes bandpulse { 0%,100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); } 50% { box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); } }
/* Gerät */
.device-wrap { margin: 10px 0 26px; }
.device { position: relative; width: 100%; max-width: 1000px; margin: 0 auto; aspect-ratio: 1000/520; user-select: none; -webkit-user-select: none; }
.device svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.device canvas { position: absolute; left: 34%; top: 25%; width: 32%; height: 46.154%; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; border-radius: 4px; }
.device .overlay { position: absolute; left: 34%; top: 25%; width: 32%; height: 46.154%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(0,0,0,.82); color: #ccc; font-size: clamp(11px, 1.4vw, 15px); text-align: center; padding: 10px; border-radius: 4px; }
.device .overlay.hidden { display: none; }
.spinner { width: 28px; height: 28px; border: 3px solid #333; border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite; } .spinner.off { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.k { cursor: pointer; } .k rect { fill: url(#key); stroke: #5a2d00; stroke-width: 5; } .k path, .k circle { fill: #3a1a00; } .k text.klabel { fill: #3a1a00; font: 700 30px system-ui, sans-serif; text-anchor: middle; }
.k:hover rect { filter: brightness(1.08); } .k.pressed rect { fill: url(#keyp); transform: translateY(4px); } .k.pressed path, .k.pressed circle, .k.pressed text { transform: translateY(4px); } .k:focus { outline: none; } .k:focus rect { stroke: #fff; }
.emboss { fill: #000; fill-opacity: .55; font: 900 26px system-ui, sans-serif; letter-spacing: .3em; } .brand { fill: #777; font: 600 22px system-ui, sans-serif; letter-spacing: .05em; }
.hint { color: var(--muted); font-size: 13.5px; text-align: center; margin: 8px 0 0; }
/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; }
.demo-row, .qr-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 12px; }
.b { font: inherit; font-size: 14.5px; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid #444; background: #262626; color: #eee; cursor: pointer; }
.b:hover { border-color: var(--orange); } .b.acc { background: var(--orange); color: #000; border-color: var(--orange); } .b.acc:hover { background: #ffa640; } .b.small { padding: 7px 12px; font-size: 13px; }
.b.file { display: inline-block; } .b.file input { display: none; }
.qr-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
textarea { width: 100%; font: 13.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0d0d0d; color: #eee; border: 1px solid #333; border-radius: 10px; padding: 10px; resize: vertical; }
.qr-btns { flex-direction: column; margin: 0; }
.qstate { color: var(--muted); font-size: 13.5px; min-height: 1.4em; }
.qstate.ok { color: #35c759; } .qstate.bad { color: #ff6b6b; }
.links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0; } .links a { color: var(--orange); text-decoration: none; font-weight: 600; font-size: 14.5px; } .links a:hover { text-decoration: underline; }
.log summary { cursor: pointer; color: var(--muted); font-size: 13.5px; } .log pre { max-height: 220px; overflow: auto; font: 12px/1.4 ui-monospace, monospace; color: #888; background: #0d0d0d; padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.tools { display: flex; align-items: center; gap: 12px; margin-top: 12px; } .lang { margin-left: auto; display: inline-flex; border: 1px solid #444; border-radius: 999px; overflow: hidden; } .lang button, .gatelang button { font: inherit; font-size: 13px; padding: 5px 12px; border: 0; background: #222; color: #bbb; cursor: pointer; } .lang button.on, .gatelang button.on { background: var(--orange); color: #000; }
/* Warn-Schleuse */
.gate { position: fixed; inset: 0; z-index: 50; background: radial-gradient(ellipse at top, #a31414, #4a0000 70%); display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.gate.hidden { display: none; }
.gatebox { max-width: 720px; background: rgba(0,0,0,.35); border: 3px solid #ff8a8a; border-radius: 22px; padding: 30px 32px; color: #fff; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.gateicon { font-size: 64px; line-height: 1; } .gatebox h1 { font-size: clamp(22px, 3.4vw, 34px); line-height: 1.15; margin: 12px 0 16px; } .gatebox p { font-size: 16px; line-height: 1.55; color: #ffe3e3; text-align: left; }
.gatecheck { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-weight: 600; margin: 18px 0 14px; cursor: pointer; } .gatecheck input { width: 22px; height: 22px; margin-top: 2px; }
.gatebtn { font: inherit; font-size: 18px; font-weight: 700; padding: 14px 26px; border-radius: 12px; border: 0; background: #fff; color: #7a0000; cursor: pointer; } .gatebtn:disabled { opacity: .45; cursor: not-allowed; }
.gatelang { margin-top: 16px; display: inline-flex; border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,.4); }
@media (max-width: 720px) { .qr-row { grid-template-columns: 1fr; } .qr-btns { flex-direction: row; } .warnband { font-size: 14.5px; padding: 10px 12px; } .gatebox { padding: 22px 18px; } }

/* Kompakt-Layout (Handy): Bildschirm groß, Tasten als HTML darunter */
.pad { display: none; }
@media (max-width: 720px) {
  .device { aspect-ratio: auto; background: #1e1e1e; border: 6px solid #0a0a0a; border-radius: 22px; padding: 10px; }
  .device svg { display: none; }
  .device canvas, .device .overlay { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: 4/3; }
  .device .overlay { position: absolute; left: 10px; top: 10px; width: calc(100% - 20px); }
  .pad { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 14px 2px 0; }
  .dpad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 58px); gap: 6px; }
  .dpad .k:nth-child(1) { grid-column: 2; grid-row: 1; } .dpad .k:nth-child(2) { grid-column: 1; grid-row: 2; } .dpad .k:nth-child(3) { grid-column: 2; grid-row: 2; } .dpad .k:nth-child(4) { grid-column: 3; grid-row: 2; } .dpad .k:nth-child(5) { grid-column: 2; grid-row: 3; }
  .keys3 { display: grid; gap: 10px; } .keys3 .k { width: 74px; height: 54px; }
  button.k { font: 700 22px system-ui, sans-serif; color: #3a1a00; background: linear-gradient(#ffb14d, #f07f00); border: 3px solid #5a2d00; border-radius: 14px; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; }
  button.k.pressed { background: linear-gradient(#e58a1a, #b85f00); transform: translateY(3px); }
  .device-wrap { margin-top: 14px; }
}
