:root { color-scheme: dark; font-family: Inter, sans-serif; --accent: #ff6848; --line: rgba(255,255,255,.13); --text: #f5f2ec; --muted: rgba(255,255,255,.56); background: #08080c; color: var(--text); }
* { box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; width: 100%; min-height: 100%; overflow: hidden; background: radial-gradient(circle at 70% 15%, rgba(255,104,72,.16), transparent 35%), #08080c; touch-action: none; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
#controller { height: 100dvh; min-height: 620px; display: grid; grid-template-rows: auto auto 1fr auto auto; padding: max(16px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); gap: 14px; }
header { display: flex; justify-content: space-between; align-items: center; }
.controller-brand { display: flex; align-items: center; gap: 10px; }
.controller-brand > span { width: 38px; aspect-ratio: 1; display: grid; place-items: center; background: #f5f2ec; color: #08080c; border-radius: 50%; font: 700 18px Space Grotesk; }
.controller-brand div { display: flex; flex-direction: column; line-height: 1; }
.controller-brand strong { font: 700 13px Space Grotesk; }
.controller-brand small { font-size: 7px; letter-spacing: .18em; color: rgba(255,255,255,.5); margin-top: 4px; }
#connection { display: flex; align-items: center; gap: 7px; font-size: 8px; letter-spacing: .12em; color: rgba(255,255,255,.55); }
#connection i { width: 7px; height: 7px; border-radius: 50%; background: #d4a34f; box-shadow: 0 0 12px #d4a34f; }
#connection.connected i { background: #65eba5; box-shadow: 0 0 12px #65eba5; }
#connection.error i { background: #ff5c5c; box-shadow: 0 0 12px #ff5c5c; }
.controller-world { padding: 8px 2px 0; }
.eyebrow { color: var(--accent); font-size: 8px; font-weight: 700; letter-spacing: .16em; }
h1 { font: 600 clamp(38px, 12vw, 62px)/.86 Space Grotesk; letter-spacing: -.065em; margin: 10px 0 12px; }
#room-label { font-size: 8px; letter-spacing: .14em; color: rgba(255,255,255,.43); }
.controls { min-height: 0; display: grid; grid-template-columns: 1.1fr .9fr; gap: 12px; }
.joystick-zone, .look-zone { min-height: 200px; position: relative; border: 1px solid var(--line); border-radius: 25px; background: rgba(255,255,255,.035); display: grid; place-items: center; overflow: hidden; }
.joystick-zone::before, .look-zone::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 34px 34px; }
.joystick-zone small, .look-zone small { position: absolute; bottom: 12px; font-size: 7px; letter-spacing: .16em; color: rgba(255,255,255,.42); }
.joystick-ring { width: min(32vw, 150px); aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: radial-gradient(circle, rgba(255,255,255,.06), transparent 60%); display: grid; place-items: center; position: relative; }
.joystick-ring::after { content: ''; position: absolute; inset: 28%; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
#joystick-knob { width: 52px; aspect-ratio: 1; border-radius: 50%; background: #f5f2ec; box-shadow: 0 12px 30px rgba(0,0,0,.4); transform: translate3d(0,0,0); position: relative; z-index: 2; }
.look-grid { width: 74%; height: 58%; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; position: relative; }
.look-grid::before, .look-grid::after { content: ''; position: absolute; background: rgba(255,255,255,.1); }
.look-grid::before { width: 1px; top: 0; bottom: 0; left: 50%; }
.look-grid::after { height: 1px; left: 0; right: 0; top: 50%; }
.look-grid span { width: 17px; aspect-ratio: 1; border: 1px solid var(--accent); border-radius: 50%; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 18px rgba(255,104,72,.5); }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-grid button { min-height: 62px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.04); display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.action-grid button:active, .action-grid button.is-held { transform: scale(.96); background: rgba(255,255,255,.11); }
.action-grid button span { font-size: 18px; }
.action-grid button strong { font-size: 7px; letter-spacing: .11em; }
.action-grid .primary-action { background: var(--accent); color: #09090c; border-color: var(--accent); }
.action-grid [data-command="exit"] { grid-column: 1 / -1; min-height: 48px; flex-direction: row; gap: 10px; }
footer { display: flex; justify-content: space-between; color: rgba(255,255,255,.36); font-size: 7px; letter-spacing: .08em; }
@media (max-height: 690px) { #controller { gap: 8px; } .controller-world h1 { font-size: 38px; } .controls { min-height: 160px; } .joystick-zone, .look-zone { min-height: 160px; } .action-grid button { min-height: 52px; } }
#context-label { margin-top: 4px !important; color: var(--accent) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.companion-dialog { position: relative; touch-action: pan-y; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: 24px; padding: 30px 24px 24px; color: var(--text); background: rgba(10,10,15,.97); box-shadow: 0 35px 120px rgba(0,0,0,.75); }
.companion-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(10px); }
.companion-dialog h2 { font: 650 36px/.95 Space Grotesk, Inter, sans-serif; letter-spacing: -.05em; margin: 10px 0 12px; }
.companion-dialog > p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.5; }
.companion-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 22px; }
#companion-form { display: grid; gap: 12px; margin-top: 20px; }
#companion-form label { display: grid; gap: 6px; }
#companion-form label span { color: var(--muted); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
#companion-form input, #companion-form textarea { width: 100%; user-select: text; -webkit-user-select: text; touch-action: manipulation; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.055); color: var(--text); padding: 13px 14px; font: inherit; resize: vertical; }
#companion-form input:focus, #companion-form textarea:focus { outline: none; border-color: var(--accent); }
.companion-submit { min-height: 52px; border: 0; border-radius: 999px; background: var(--accent); color: #09090c; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
#companion-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.honeypot { position: absolute !important; left: -9999px !important; }
#controller-toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 20; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(8,8,12,.92); font-size: 8px; letter-spacing: .1em; transition: .24s; white-space: nowrap; }
#controller-toast.show { opacity: 1; transform: translate(-50%, 0); }
