:root { color-scheme: dark; --ink: #ddd9cc; --muted: #a0a69f; --accent: #9baf96; --line: #303831; --surface: #101410; font-family: ui-monospace, 'Cascadia Mono', 'Liberation Mono', monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #000; color: var(--ink); overflow: hidden; font-size: 16px; }
button, input { font: inherit; }
button { min-height: 48px; padding: .65rem 1rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: background .16s, border-color .16s; border-radius: 3px; }
button:hover:not(:disabled) { background: #202820; border-color: var(--accent); }
button:active:not(:disabled) { background: #303a30; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input { min-width: 0; width: 100%; min-height: 48px; padding: .75rem; color: var(--ink); background: #0b0e0b; border: 1px solid var(--line); border-radius: 3px; }
input::placeholder { color: #8e968e; }
p { line-height: 1.55; margin: 0; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; }
#scene, #labels { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene { display: block; touch-action: none; }
#labels { pointer-events: none; overflow: hidden; }
.player-label { position: absolute; left: 0; top: 0; font-size: 12px; line-height: 1; white-space: nowrap; color: #a8b0a5; text-shadow: 0 1px 3px #000; }
.player-speech { position: absolute; left: 0; top: 0; width: max-content; max-width: min(240px, calc(100vw - 32px)); text-align: center; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; line-height: 1.4; color: var(--ink); text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.player-speech[data-state=pending] { color: var(--muted); }
.player-speech[data-state=pending]::after { content: ' ···'; }
.player-speech[data-state=error]::after { content: ' !'; color: #bea56f; }
#entry { position: fixed; inset: 0; padding: max(28px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.entry-copy, #entry-form { width: min(100%, 380px); margin-inline: auto; }
.entry-copy { padding-top: 3dvh; }
.eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 500; letter-spacing: -.055em; line-height: 1.2; margin: 0 0 14px; text-wrap: balance; }
.entry-copy > p:last-child { color: var(--muted); font-size: 14px; }
#entry-form { pointer-events: auto; background: #000; padding-top: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 9px; }
.entry-actions { display: flex; gap: 12px; margin: 12px 0; }
.entry-actions button { flex: 1; }
#previous-look { flex: 0; padding-inline: .65rem; }
#join { background: var(--accent); color: #101510; border-color: var(--accent); }
#join:hover:not(:disabled) { background: #b0c0aa; }
.note { color: var(--muted); font-size: 12px; }
#hud { position: fixed; top: max(24px, env(safe-area-inset-top)); left: 24px; right: 24px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; pointer-events: none; }
#presence { color: var(--muted); }
#connection { position: fixed; top: max(82px, calc(env(safe-area-inset-top) + 56px)); left: 24px; right: 24px; margin-inline: auto; max-width: 440px; padding: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; z-index: 3; }
#retry { display: block; margin-top: 12px; }
#controls { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 24px; right: 24px; display: flex; align-items: end; justify-content: space-between; gap: 22px; pointer-events: none; }
#controls button { pointer-events: auto; }
#stick { flex: 0 0 104px; width: 104px; height: 104px; padding: 0; border-radius: 50%; background: #0b0e0ba8; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
#stick-knob { position: absolute; left: 34px; top: 34px; width: 34px; height: 34px; border: 1px solid #788875; background: #263024; border-radius: 50%; pointer-events: none; }
#move-help { padding-bottom: 14px; }
.conversation-control { margin-left: auto; }
#open-chat { display: flex; align-items: center; gap: 8px; border-color: transparent; background: transparent; color: var(--muted); padding-inline: 8px; font-size: 14px; }
#unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
#conversation { position: fixed; bottom: calc(var(--keyboard-inset, 0px) + max(24px, env(safe-area-inset-bottom))); right: 24px; width: min(20rem, calc(100vw - 48px)); display: flex; flex-direction: column; gap: 8px; z-index: 2; font-size: 14px; color: #bec3b9; text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; }
#conversation > * { pointer-events: auto; }
#conversation.expanded { width: min(36rem, calc(100vw - 48px)); height: 75dvh; padding: 12px; background: #0b0f0bf5; border: 1px solid var(--line); border-radius: 3px; pointer-events: auto; }
#conversation header { flex-shrink: 0; }
#conversation:not(.expanded) header { display: none; }
h2 { font-size: 16px; font-weight: 500; margin: 0; }
#messages { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; min-height: 21px; max-height: 88px; overscroll-behavior: contain; scrollbar-width: thin; }
#conversation.expanded #messages { max-height: none; }
#conversation:not(.expanded) #messages, #conversation:not(.expanded) #history-controls { display: none; }
#messages li { margin-bottom: 4px; line-height: 1.5; overflow-wrap: anywhere; }
#messages li:last-child { margin-bottom: 0; }
#messages .author { color: var(--accent); }
#messages .author::after { content: ': '; }
#messages time { color: var(--muted); font-size: 12px; }
#history-controls { display: flex; gap: 8px; }
#conversation:not(.expanded) #history-status:not(.error), #conversation:not(.expanded) #earlier { display: none; }
#history-controls:not(:has(button:not([hidden]):not(#earlier))) { display: none; }
#conversation.expanded #history-controls:not([hidden]) { display: flex; }
#history-controls button { padding: .4rem .7rem; font-size: 12px; }
#message-form { display: flex; border-bottom: 1px solid var(--line); }
#message { min-height: 44px; padding: .5rem 0; background: transparent; border: 0; border-radius: 0; font-size: 16px; }
#message:focus { background: #000b; }
#message-form button { flex: 0 0 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
#message-form button:hover:not(:disabled) { color: var(--ink); background: #202820; }
#delivery:empty, #delivery[data-state=saved] { display: none; }
#history-status, #delivery, #message-form, #history-controls { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (pointer: fine) and (min-width: 761px) { #stick { display: none; } }
@media (pointer: coarse), (max-width: 760px) { #move-help { display: none; } }
@media (max-width: 600px) {
  #conversation { right: 16px; width: min(20rem, calc(100vw - 32px)); bottom: calc(var(--keyboard-inset, 0px) + max(144px, calc(env(safe-area-inset-bottom) + 128px))); }
  #conversation.expanded, .typing #conversation { bottom: calc(var(--keyboard-inset, 0px) + max(8px, env(safe-area-inset-bottom))); }
  #conversation.expanded { width: calc(100vw - 32px); }
  .entry-actions { gap: 6px; }
  .entry-actions button { padding-inline: .55rem; font-size: 14px; }
}
@media (max-height: 560px) { #entry { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); } .entry-copy { padding-top: 0; } .entry-copy .eyebrow { display: none; } .entry-copy > p:last-child { display: none; } h1 { margin-bottom: 0; } #conversation.expanded { height: 85dvh; } }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
