:root {
  --bg: #0f0f12;
  --panel: rgb(20 20 24 / 0.92);
  --text: #f1f1f3;
  --muted: #b3b3bd;
  --accent: #3ecf8e;
  --accent-ink: #0b1f16;
  --warn: #fdba74;
  --line: rgb(255 255 255 / 0.14);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
a { color: var(--accent); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.panel { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); }
.intro { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); padding: 24px; z-index: 10; }
.intro h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.intro p { color: var(--muted); margin: 6px 0; }
.intro label { display: block; font-weight: 600; margin: 14px 0 6px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #1b1b20; color: var(--text); }
button { font: inherit; cursor: pointer; }
.row button, .hud button { padding: 10px 14px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.hud button { padding: 6px 10px; font-size: 13px; background: rgb(255 255 255 / 0.12); color: var(--text); }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin: 0 1px; }
.hint.touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint.desktop { display: none; } .hint.touch { display: block; } }
.status { min-height: 1.5em; color: var(--accent); }
.links { font-size: 13px; }

.hud { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; z-index: 5; }
.hud #hud-title { flex: 1; font-weight: 600; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.info, .credits { right: 12px; top: 64px; width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 88px); overflow: auto; padding: 18px; z-index: 8; }
.info img { width: 100%; border-radius: 8px; }
.info h3 { margin: 10px 32px 4px 0; }
.close { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 24px; }
.evidence { font-size: 13px; background: rgb(255 255 255 / 0.06); border-radius: 8px; padding: 10px; overflow-wrap: anywhere; }
.warn { color: var(--warn); }
.muted { color: var(--muted); font-size: 13px; }
.credits h2 { margin: 0 32px 6px 0; }
.credits ul { padding-left: 18px; font-size: 13px; }
.credits li { margin: 8px 0; overflow-wrap: anywhere; }

.crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgb(255 255 255 / 0.8); z-index: 4; pointer-events: none; }
.joystick { position: fixed; left: max(20px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%;
  background: rgb(255 255 255 / 0.10); border: 1px solid rgb(255 255 255 / 0.25); backdrop-filter: blur(4px); z-index: 6; touch-action: none; user-select: none; -webkit-user-select: none; }
.joystick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: rgb(255 255 255 / 0.55); box-shadow: 0 2px 8px rgb(0 0 0 / 0.35); will-change: transform; }
.joystick.active .joystick-knob { background: rgb(255 255 255 / 0.8); }

.engine { font-size: 13px; color: var(--muted); }
.engine.error { color: var(--warn); }
.row button:disabled { opacity: 0.6; cursor: wait; }

.loading { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); padding: 20px; z-index: 11; }
.loading-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.loading-head #loading-pct { font-variant-numeric: tabular-nums; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: rgb(255 255 255 / 0.1); margin: 12px 0 14px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }
.steps { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; }
.steps li { padding: 4px 0 4px 24px; position: relative; color: var(--muted); }
.steps li::before { content: "○"; position: absolute; left: 0; }
.steps li.active { color: var(--text); }
.steps li.active::before { content: "◌"; animation: spin 1s linear infinite; display: inline-block; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓"; color: var(--accent); }
.steps li.failed::before { content: "!"; color: var(--warn); }
.steps .count { color: var(--muted); font-variant-numeric: tabular-nums; }
#enter { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.active::before { animation: none; } .bar > div { transition: none; } }

.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: rgb(255 255 255 / 0.12); color: var(--muted); white-space: nowrap; }
.hud-loading { font-size: 12px; color: var(--muted); white-space: nowrap; }
