/* LUCOM Doom-Engine Player — Copyright (C) 2026 LUCOM LLC — GPL-2.0-or-later */
.lucom-doom-wrap { width: 100%; max-width: var(--ldp-max, 960px); margin: 1.5em auto; }

.ldp {
  --ldp-bg: #0c0c0e;
  --ldp-panel: #17171b;
  --ldp-btn: rgba(255, 255, 255, 0.09);
  --ldp-btn-line: rgba(255, 255, 255, 0.22);
  --ldp-btn-on: rgba(255, 120, 60, 0.55);
  --ldp-text: #f2efe9;
  --ldp-accent: #e8562a;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--ldp-bg);
  color: var(--ldp-text);
  border-radius: 10px;
  overflow: hidden;
  font: 600 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.04em;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-sizing: border-box;
}
.ldp *, .ldp *::before, .ldp *::after { box-sizing: border-box; }
.ldp:focus-visible { box-shadow: 0 0 0 2px var(--ldp-accent); }

/* ---------- stage + canvas ---------- */
.ldp-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;            /* Doom's 320x200 was shown on 4:3 monitors */
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.ldp-canvas {
  display: block;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* ---------- splash ---------- */
.ldp-splash {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #3a120a 0%, #120606 55%, #000 100%);
  text-align: center; padding: 16px;
}
.ldp-splash[hidden] { display: none; }
.ldp-splash-inner { max-width: 420px; width: 100%; }
.ldp-title { font-size: clamp(20px, 5vw, 34px); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 18px; }
.ldp-play {
  appearance: none; border: 0; cursor: pointer;
  background: var(--ldp-accent); color: #fff;
  font: 700 16px/1 system-ui, sans-serif; letter-spacing: 0.06em;
  padding: 14px 26px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(232, 86, 42, 0.35);
}
.ldp-play[hidden] { display: none; }
.ldp-progress { height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; overflow: hidden; margin: 6px auto 0; max-width: 300px; }
.ldp-progress[hidden] { display: none; }
.ldp-bar { height: 100%; width: 0; background: var(--ldp-accent); transition: width 0.2s; }
.ldp-status { margin-top: 10px; min-height: 1.2em; font-weight: 500; opacity: 0.85; }
.ldp-hint { margin-top: 14px; font-weight: 400; font-size: 12px; opacity: 0.6; }

/* ---------- utility bar ---------- */
.ldp-util {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  display: flex; gap: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.ldp-on .ldp-util { opacity: 1; pointer-events: auto; }
.ldp-u {
  appearance: none; cursor: pointer;
  min-width: 44px; height: 32px; padding: 0 10px;
  background: rgba(0, 0, 0, 0.45); color: var(--ldp-text);
  border: 1px solid var(--ldp-btn-line); border-radius: 8px;
  font: inherit; font-size: 11px;
  touch-action: none;
}
.ldp-u-sm { min-width: 34px; }
.ldp-u.on { background: var(--ldp-btn-on); }
.ldp-fs { font-size: 16px; min-width: 36px; }

/* ---------- touch controls (shared) ---------- */
.ldp-side { display: none; touch-action: none; }
.ldp-b {
  appearance: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--ldp-btn); color: var(--ldp-text);
  border: 1px solid var(--ldp-btn-line); border-radius: 50%;
  font: inherit; touch-action: none;
  transition: background 0.06s, transform 0.06s;
}
.ldp-b.on, .ldp-b.tap { background: var(--ldp-btn-on); transform: scale(0.95); }
.ldp-b-sm { border-radius: 10px; height: 40px; padding: 0 12px; flex: 1; font-size: 12px; }
.ldp-run.on { background: rgba(255, 190, 70, 0.4); border-color: rgba(255, 190, 70, 0.8); }

.ldp-pad {
  position: relative; border-radius: 50%;
  width: var(--pad, 150px); height: var(--pad, 150px);
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0 34%, rgba(255,255,255,0.1) 35% 100%);
  border: 1px solid var(--ldp-btn-line);
  touch-action: none; flex: none;
}
.ldp-arrow { position: absolute; font-size: 14px; opacity: 0.7; pointer-events: none; }
.ldp-a-up { top: 8%; left: 50%; transform: translateX(-50%); }
.ldp-a-down { bottom: 8%; left: 50%; transform: translateX(-50%); }
.ldp-a-left { left: 9%; top: 50%; transform: translateY(-50%); }
.ldp-a-right { right: 9%; top: 50%; transform: translateY(-50%); }
.ldp-pad.d-up .ldp-a-up, .ldp-pad.d-down .ldp-a-down,
.ldp-pad.d-left .ldp-a-left, .ldp-pad.d-right .ldp-a-right { opacity: 1; color: var(--ldp-accent); }
.ldp-knob {
  position: absolute; left: 50%; top: 50%;
  width: 38%; height: 38%; margin: -19% 0 0 -19%;
  border-radius: 50%; background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  pointer-events: none;
}
.ldp-strafe { display: flex; gap: 8px; width: var(--pad, 150px); margin-top: 10px; }

.ldp-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "use fire" "wpn fire" "run run";
  gap: 10px; align-items: center; justify-items: center;
}
.ldp-fire { grid-area: fire; width: var(--fire, 92px); height: var(--fire, 92px); font-size: 15px; background: rgba(232, 86, 42, 0.28); border-color: rgba(232, 86, 42, 0.75); }
.ldp-use { grid-area: use; width: var(--small, 60px); height: var(--small, 60px); font-size: 11px; }
.ldp-wpn { grid-area: wpn; width: var(--small, 60px); height: var(--small, 60px); font-size: 11px; }
.ldp-run { grid-area: run; width: 100%; height: 36px; border-radius: 10px; font-size: 11px; }

/* ---------- PORTRAIT: game on top, controls in a panel below ---------- */
.ldp-portrait .ldp-side { display: flex; }
.ldp-portrait {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas: "stage stage" "left right";
}
.ldp-portrait .ldp-stage { grid-area: stage; }
.ldp-portrait .ldp-left, .ldp-portrait .ldp-right {
  background: var(--ldp-panel);
  padding: 16px 12px max(16px, env(safe-area-inset-bottom));
  flex-direction: column; align-items: center; justify-content: center;
}
.ldp-portrait .ldp-left { grid-area: left; --pad: min(40vw, 170px); }
.ldp-portrait .ldp-right { grid-area: right; --fire: min(24vw, 100px); --small: min(15vw, 64px); }

/* ---------- LANDSCAPE: controls float over the left/right, middle-to-bottom ---------- */
.ldp-landscape { flex-direction: row; justify-content: center; border-radius: 0; }
.ldp-landscape .ldp-stage { height: 100%; width: auto; max-width: 100%; }
.ldp-landscape .ldp-side {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  position: absolute; z-index: 3;
  top: 34%; bottom: max(10px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.ldp-landscape .ldp-side > * { pointer-events: auto; }
.ldp-landscape .ldp-left { left: max(12px, env(safe-area-inset-left)); --pad: min(38vh, 146px); }
.lucom-doom-wrap:has(.ldp-landscape) { margin-top: 0; margin-bottom: 0; }
.ldp-landscape .ldp-right { right: max(12px, env(safe-area-inset-right)); --fire: min(22vh, 84px); --small: min(14vh, 52px); }
.ldp-landscape .ldp-actions { gap: 8px; }
.ldp-landscape .ldp-run { height: 32px; }
.ldp-landscape .ldp-pad { background: radial-gradient(circle, rgba(255,255,255,0.05) 0 34%, rgba(255,255,255,0.09) 35% 100%); backdrop-filter: blur(2px); }
.ldp-landscape .ldp-b { background: rgba(20, 20, 24, 0.35); }
.ldp-landscape .ldp-fire { background: rgba(232, 86, 42, 0.3); }
.ldp-landscape .ldp-strafe .ldp-b-sm { height: 34px; }

/* ---------- full screen ---------- */
.ldp:fullscreen, .ldp.ldp-is-fs { width: 100vw; height: 100vh !important; border-radius: 0; }
.ldp:-webkit-full-screen { width: 100vw; height: 100vh !important; }
.ldp.ldp-pseudo-fs {
  position: fixed; inset: 0; z-index: 2147483000;
  width: 100vw; height: 100vh !important; height: 100dvh !important; border-radius: 0;
}
html.ldp-noscroll, html.ldp-noscroll body { overflow: hidden !important; }
.ldp-desktop:fullscreen .ldp-stage, .ldp-desktop.ldp-pseudo-fs .ldp-stage { height: 100%; width: auto; margin: 0 auto; }
.ldp-portrait:fullscreen, .ldp-portrait.ldp-pseudo-fs { align-content: center; }
