:root {
  --bg: #0b0614;
  --ink: #efe6d8;
  --muted: #9a8fae;
  --pumpkin: #ff7a1a;
  --pumpkin-2: #ffb347;
  --slime: #9be564;
  --panel: rgba(16, 9, 26, 0.86);
  --line: rgba(255, 122, 26, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; height: 100%; background: var(--bg); color: var(--ink); font-family: 'Space Mono', ui-monospace, monospace; overflow: hidden; }
#wrap { position: fixed; inset: 0; display: grid; place-items: center; height: 100vh; height: 100dvh; }
canvas#game { display: block; background: #000; image-rendering: auto; width: min(100vw, calc(100vh * 16 / 9)); width: min(100vw, calc(100dvh * 16 / 9)); height: auto; aspect-ratio: 16 / 9; }

.hidden { display: none !important; }

#hud {
  position: absolute; pointer-events: none; display: flex; justify-content: space-between; align-items: center;
  top: max(8px, calc((100dvh - 100vw * 9 / 16) / 2 + 8px)); left: 50%; transform: translateX(-50%);
  width: min(100vw, calc(100dvh * 16 / 9)); padding: 0 16px; font-size: clamp(11px, 1.6vw, 16px);
  text-shadow: 0 2px 0 #000;
}
#hud .hud-right { display: flex; gap: 18px; }
#hud b { color: var(--pumpkin-2); font-weight: 700; }
#hud .time { font-variant-numeric: tabular-nums; min-width: 7.5ch; text-align: right; color: var(--ink); }
#hud-level { letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.screen { z-index: 10;
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 24px); overflow: auto;
  padding: 28px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 0 60px rgba(255, 122, 26, .12), inset 0 0 40px rgba(0,0,0,.5); backdrop-filter: blur(3px); text-align: center;
}
.screen.small { width: min(420px, calc(100vw - 32px)); }
h1 { font-family: 'Creepster', cursive; font-weight: 400; margin: 0; font-size: clamp(42px, 9vw, 76px); line-height: .9; color: var(--pumpkin); text-shadow: 0 0 24px rgba(255,122,26,.55), 0 4px 0 #3a1400; letter-spacing: .03em; }
h1 span { color: var(--ink); text-shadow: 0 0 18px rgba(155,229,100,.35), 0 4px 0 #1a0f22; }
h2 { margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
h2.big { font-family: 'Creepster', cursive; font-size: 48px; letter-spacing: .03em; text-transform: none; color: var(--pumpkin); }
p { margin: 0; line-height: 1.5; }
.tag { color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.keys { color: var(--muted); font-size: 11px; line-height: 1.6; }

label.name { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
input { font: inherit; font-size: 18px; color: var(--ink); background: #150c22; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; text-align: center; width: 240px; outline: none; }
input:focus { border-color: var(--pumpkin); box-shadow: 0 0 0 3px rgba(255,122,26,.2); }

button { font: inherit; font-size: 15px; cursor: pointer; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 10px 22px; transition: transform .08s, background .15s; }
button:hover { background: rgba(255,122,26,.1); }
button:active { transform: translateY(1px); }
button.primary { background: var(--pumpkin); color: #1b0b00; border-color: var(--pumpkin); font-weight: 700; box-shadow: 0 0 22px rgba(255,122,26,.4); }
button.primary:hover { background: var(--pumpkin-2); }

.board { width: 100%; }
.board ol { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; counter-reset: r; }
.board li { display: grid; grid-template-columns: 2.2em 1fr auto auto auto; gap: 10px; padding: 5px 8px; border-bottom: 1px dashed rgba(255,255,255,.07); text-align: left; counter-increment: r; font-variant-numeric: tabular-nums; }
.board li::before { content: counter(r) "."; color: var(--muted); }
.board li.muted::before { content: ""; }
.board li.me { color: var(--slime); }
.board li .lv { color: var(--pumpkin-2); }
.board li .t { min-width: 7ch; text-align: right; }
.board li .d { color: var(--muted); min-width: 5ch; text-align: right; }
.board li.muted { grid-template-columns: 1fr; }


/* ---------- Touch-Steuerung ---------- */
#touch { position: absolute; inset: 0; touch-action: none; z-index: 5; }
.tz-hint {
  position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); pointer-events: none; transition: background .08s, transform .08s;
}
.tz-hint.on { background: rgba(255,122,26,.35); border-color: rgba(255,122,26,.7); color: #fff; transform: scale(.94); }
.tz-left { left: max(16px, env(safe-area-inset-left)); }
.tz-right { left: calc(max(16px, env(safe-area-inset-left)) + 100px); }
.tz-jump { right: max(20px, env(safe-area-inset-right)); width: 100px; height: 100px; font-size: 38px; }
#touch-top { position: absolute; top: max(36px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 6; }
#touch-top button { width: 44px; height: 44px; padding: 0; font-size: 18px; background: rgba(16,9,26,.6); border-color: rgba(255,255,255,.2); }
.keys.mob { display: none; }
@media (pointer: coarse) { .keys.desk { display: none; } .keys.mob { display: block; } .keys-hint { display: none; } }

#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  body.playing #rotate {
    display: flex; position: fixed; inset: 0; z-index: 20; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: rgba(11,6,20,.94); color: var(--ink); font-size: 18px; text-align: center; padding: 24px;
  }
  body.playing #rotate div { font-size: 56px; animation: rot 1.6s ease-in-out infinite; }
}
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

/* Querformat auf kleinen Bildschirmen: Menüs kompakter */
@media (max-height: 480px) {
  .screen { padding: 14px 18px; gap: 8px; }
  h1 { font-size: 40px; }
  h2.big { font-size: 34px; }
  .board ol { font-size: 12px; }
  .board li { padding: 2px 6px; }
  input { font-size: 16px; padding: 6px 10px; }
  .tag { display: none; }
}

.install { font-size: 12px; color: var(--pumpkin-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; line-height: 1.5; }
