@font-face { font-family: Geist; src: url('/assets/fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  color-scheme: dark;
  font-family: Geist, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8eaed;
  background: #0d0f11;
  --mono: 'Geist Mono', ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --panel: #101215;
  --line: #23262b;
  --rule: #ffffff0d;
  --muted: #828a95;
  --body: #a8b0ba;
  --accent: #2f6fed;
  --focus: #4f8bf0;
  --mobile-tabs-height: calc(52px + max(14px, env(safe-area-inset-bottom)));
}
* { box-sizing: border-box; }
html { min-width: 0; }
body { margin: 0; height: 100vh; height: 100dvh; min-height: 760px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, input, select { min-height: 44px; border: 1px solid #2a2e34; border-radius: 4px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; color: #e8eaed; background: transparent; cursor: pointer; transition: color .18s, background-color .18s, border-color .18s; }
button:hover:enabled { background: #15181c; border-color: #454c56; }
button:active:enabled { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
input:focus-visible, select:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 2px #4f8bf033; outline: none; }
input, select { width: 100%; min-width: 0; padding: 0 12px; color: #e8eaed; background: #0b0d0f; font-size: 15px; }
input::placeholder { color: var(--muted); }
a { color: #6fa8fa; }
a:hover { color: #b4d0ee; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #e8eaed; font-size: 15px; font-weight: 900; letter-spacing: .5px; }
.brand img { width: auto; height: 32px; object-fit: contain; }
.brand small { display: block; margin-top: 2px; color: #8fb6f5; font: 9px var(--mono); letter-spacing: 4.4px; }
.status { display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 45%; font: 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .9px; }
#status-text { overflow-wrap: anywhere; }
.status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--muted); }
.status[data-state="active"] .status-dot, .status[data-state="loading"] .status-dot { background: var(--accent); }

.players-directory { flex: none; display: flex; flex-direction: column; gap: 9px; padding: 10px 22px 0; }
.players-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.players-overview { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; min-width: 0; color: #8fb6f5; font: 10px/1.5 var(--mono); letter-spacing: 1.1px; text-transform: uppercase; }
.players-overview h2 { margin: 0; font: inherit; }
.players-refresh { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font: 11px/1.5 var(--mono); }
.players-refresh p { margin: 0; }
.players-refresh button { width: 44px; min-width: 44px; margin: -8px 0; padding: 0; border-color: transparent; color: var(--muted); }
.players-servers { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 7px; }
.player-server { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px; min-width: 0; padding: 9px 12px; border: 1px solid #ffffff14; border-radius: 5px; text-align: left; }
.player-server:hover:enabled, .player-server[aria-pressed="true"] { background: #15181c; border-color: #ffffff14; }
.player-server[aria-pressed="true"] { box-shadow: inset 2px 0 var(--accent); }
.player-server-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; line-height: 1.3; }
.player-server-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; min-width: 0; font: 11px/1.4 var(--mono); color: var(--muted); }
.player-server-map { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-server-count { flex: none; white-space: nowrap; }
.player-server[data-populated="true"] .player-server-count { color: #8fb6f5; }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); gap: 14px; padding: 14px 22px 10px; }
.viewer { display: flex; flex-direction: column; gap: 9px; min-width: 0; min-height: 0; }
.screen { position: relative; flex: 1; display: flex; min-height: 0; overflow: auto; border: 1px solid #ffffff14; border-radius: 7px; background: #ffffff05; }
.screen.running { overflow: hidden; background: #000; }
.welcome { width: 460px; max-width: calc(100% - 48px); flex: none; display: flex; flex-direction: column; gap: 18px; padding: 24px 0; margin: auto; }
.welcome-heading { display: flex; flex-direction: column; gap: 7px; }
.eyebrow { font: 10px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 1.1px; color: #8fb6f5; }
h1 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: -1.2px; line-height: 1.1; }
h1 span { color: #7fb0ff; }
#join-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.server-field, .nickname-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.server-field > label, .nickname-field > label { font-size: 13px; color: var(--body); }
.selected-server { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; background: #0b0d0f; border: 1px solid #2a2e34; border-radius: 4px; box-shadow: inset 2px 0 var(--accent); }
.selected-server-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#selected-server-name { font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }
#selected-server-meta { color: var(--muted); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.change-server { flex: none; color: var(--muted); font: 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .9px; text-decoration: none; }
.nickname-help { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.nickname-preview { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font: 10px/1.5 var(--mono); }
.nickname-preview output { color: #8fb6f5; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
#nickname[aria-invalid="true"] { border-color: #ed9b97; }
details { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 12px 0; cursor: pointer; font-size: 14px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary:hover { color: #6fa8fa; }
.advanced-label { display: flex; align-items: center; gap: 7px; flex: none; }
.advanced-label svg { width: 15px; height: 15px; }
details[open] .advanced-label svg { transform: rotate(90deg); }
#asset-count { min-width: 0; color: var(--muted); font: 11px/1.5 var(--mono); text-align: right; text-transform: uppercase; overflow-wrap: anywhere; }
.advanced-content { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.advanced-content p, .advanced-content small { display: block; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.demo-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.demo-choice button { font-size: 12px; }
.file-field { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: center; gap: 12px; }
.file-label { color: var(--body); font-size: 13px; }
input[type="file"] { padding: 0; background: transparent; border: 0; border-radius: 0; color: #dfe4ea; font: 11px/44px var(--mono); }
input::file-selector-button { min-height: 44px; margin-right: 9px; padding: 0 10px; border: 1px solid #2a2e34; border-radius: 4px; color: #e8eaed; background: transparent; font: 12px Geist, system-ui, sans-serif; cursor: pointer; }
input::file-selector-button:hover { background: #15181c; }
.license-note { margin: -7px 0; font-size: 11px; line-height: 1.6; color: var(--muted); }
.join-actions { display: flex; flex-direction: column; gap: 7px; }
.primary { width: 100%; justify-content: space-between; min-height: 44px; color: #fff; background: var(--accent); border-color: var(--accent); font-size: 14px; font-weight: 550; }
.primary:hover:enabled { background: #4180f5; border-color: #4180f5; }
.form-message { margin: 0; min-height: 17px; color: var(--muted); font: 11px/1.6 var(--mono); overflow-wrap: anywhere; }
.form-message.error, #chat-error { color: #ed9b97; }
#chat-error:empty { display: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 22px; background: #0d0f11eb; text-align: center; font-size: 13px; }
.loading p { margin: 0; }
.spinner { width: 25px; height: 25px; border: 2px solid #353b44; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.controls { display: flex; flex: none; flex-wrap: wrap; justify-content: space-between; gap: 7px; }
.control-group { display: flex; flex-wrap: wrap; gap: 7px; }
.controls button { font-size: 12px; padding: 9px 10px; }
.controls .quiet { color: var(--body); }
.viewer-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.side-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid #ffffff14; border-radius: 7px; overflow: hidden; background: #ffffff08; backdrop-filter: blur(16px) saturate(1.3); }
.side-tabs { display: flex; flex: none; border-bottom: 1px solid var(--rule); }
.side-tabs button { min-width: 0; border: 0; border-radius: 0; padding: 14px 18px; color: var(--muted); font-size: 14px; }
.side-tabs button[aria-selected="true"] { color: #e8eaed; box-shadow: inset 0 -2px var(--accent); }
.tab-count { font: 10px var(--mono); white-space: nowrap; }
.chat-panel, .players-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; }
body[data-side="chat"] .players-panel, body[data-side="players"] .chat-panel { display: none; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; overscroll-behavior: contain; }
.chat-empty { margin: 0; color: var(--body); font-size: 14px; line-height: 1.8; }
.feed-line { margin: 0 0 10px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-line.system { color: var(--body); font-size: 12px; }
.feed-time { margin-right: 7px; color: var(--muted); font: 10px var(--mono); }
#chat-form { flex: none; display: flex; flex-direction: column; gap: 7px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.chat-compose { display: flex; gap: 7px; }
.chat-compose input { min-width: 0; font-size: 14px; }
.chat-compose button { flex: none; width: 44px; padding: 0; }
#chat-form small { color: var(--muted); font: 11px/1.5 var(--mono); }
.roster-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); color: var(--muted); font: 12px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .5px; }
.roster-heading h2 { margin: 0; min-width: 0; font: inherit; overflow-wrap: anywhere; }
#selected-players-count { white-space: nowrap; }
.roster-body { flex: 1; min-height: 0; overflow-y: auto; }
#selected-players-list { margin: 0; padding: 0; list-style: none; }
#selected-players-list li { padding: 12px 18px; border-bottom: 1px solid #1b1e22; color: #dfe4ea; font: 14px/1.5 var(--mono); overflow-wrap: anywhere; }
#selected-players-list:empty { display: none; }
#selected-players-state { margin: 0; padding: 18px; font-size: 14px; line-height: 1.8; color: var(--body); }
.roster-note { margin: 0; padding: 12px 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.in-game-players { margin: 0 18px 18px; font-size: 12px; }
.site-footer { flex: none; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px 18px; padding: 0 22px 10px; color: var(--muted); font: 9px/1.5 var(--mono); }
.mobile-tabs { display: none; }
body:not([data-view]) { height: auto; min-height: 100vh; display: block; overflow: auto; }
body:not([data-view]) > .welcome { width: 680px; max-width: calc(100% - 36px); margin: 0 auto; padding: 28px 0; line-height: 1.7; }
body:not([data-view]) > .welcome p { margin: 0; color: var(--body); overflow-wrap: anywhere; }

@media (max-width: 1050px) and (min-width: 801px) {
  main { grid-template-columns: minmax(0, 1fr) 280px; }
  .welcome { max-width: calc(100% - 36px); }
  h1 { font-size: 30px; }
  .selected-server { flex-wrap: wrap; }
  .change-server { font-size: 10px; }
  .side-tabs button { padding: 14px; }
  .controls button { padding: 9px 8px; font-size: 11px; }
}
@media (min-width: 801px) and (max-height: 900px) {
  .welcome { padding-block: 12px; gap: 10px; }
  #join-form { gap: 10px; }
  h1 { font-size: 30px; }
  .nickname-field { gap: 5px; }
  .nickname-preview { font-size: 10px; }
  summary { padding-block: 10px; }
}
@media (max-width: 800px) {
  .players-response-detail, .players-interval, .player-server-count-label { display: none; }
  body { min-height: 0; overflow: hidden; }
  .topbar { height: 56px; padding: 0 18px; gap: 12px; }
  .brand { gap: 9px; font-size: 14px; }
  .brand img { height: 28px; }
  .brand small { font-size: 8px; letter-spacing: 3px; }
  .status { gap: 7px; max-width: 43%; font-size: 10px; letter-spacing: .6px; }
  .players-directory { gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .players-heading { gap: 7px; min-height: 16px; padding: 0 18px; }
  .players-overview { gap: 4px; font-size: 9px; letter-spacing: .5px; }
  .players-refresh { gap: 0; font-size: 9px; max-width: 40%; }
  #players-updated { overflow-wrap: anywhere; }
  .players-refresh button { display: none; }
  .players-servers { display: flex; overflow-x: auto; gap: 7px; padding: 4px 18px; margin: -4px 0; scrollbar-width: none; scroll-padding-inline: 18px; }
  .players-servers::-webkit-scrollbar { display: none; }
  .player-server { flex: 0 0 156px; width: 156px; padding: 9px 12px; }
  .player-server-name { font-size: 13px; }
  .player-server-meta { font-size: 11px; }
  main { position: relative; flex: 1; display: block; min-height: 0; padding: 0; }
  .viewer { position: absolute; inset: 0; gap: 0; overflow-y: auto; }
  body:not([data-view="watch"]) .viewer { visibility: hidden; pointer-events: none; }
  .screen { border: 0; border-radius: 0; background: transparent; overscroll-behavior: contain; }
  .welcome { width: 100%; max-width: none; margin: 0; padding: 22px 18px 140px; gap: 18px; }
  h1 { font-size: 28px; }
  .selected-server { flex-direction: column; align-items: flex-start; gap: 7px; }
  .change-server { display: none; }
  input, select, .chat-compose input { font-size: 16px; }
  .nickname-preview { font-size: 10px; }
  .license-note { font-size: 11px; }
  .join-actions { position: fixed; left: 0; right: 0; bottom: var(--mobile-tabs-height); z-index: 3; padding: 12px 18px; border-top: 1px solid var(--rule); background: #0d0f11e8; backdrop-filter: blur(16px) saturate(1.3); }
  .file-field { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  #asset-count { max-width: 45%; font-size: 10px; }
  .advanced-label { font-size: 13px; }
  .screen:not(.running) ~ .controls, .screen:not(.running) ~ .viewer-note { display: none; }
  .screen.running { min-height: 160px; }
  .controls { padding: 9px 18px 0; }
  .controls button { font-size: 11px; padding: 9px; }
  .viewer-note { padding: 7px 18px 9px; }
  .side-panel { position: absolute; inset: 0; border: 0; border-radius: 0; background: transparent; backdrop-filter: none; }
  body[data-view="watch"] .side-panel { display: none; }
  .side-tabs { display: none; }
  body[data-view="chat"] .chat-panel, body[data-view="players"] .players-panel { display: flex; }
  body[data-view="chat"] .players-panel, body[data-view="players"] .chat-panel { display: none; }
  .chat-log { padding: 22px 18px; }
  #chat-form { padding: 12px 18px; }
  .roster-heading { padding: 12px 18px; }
  .site-footer { display: none; }
  .mobile-tabs { position: relative; z-index: 4; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: none; min-height: var(--mobile-tabs-height); padding-bottom: max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
  .mobile-tabs button { height: 52px; padding: 0 7px; border: 0; border-radius: 0; font-size: 14px; font-weight: 550; color: var(--muted); }
  .mobile-tabs button[aria-selected="true"] { color: #e8eaed; box-shadow: inset 0 2px var(--accent); }
  .mobile-tabs button:focus-visible { outline-offset: -5px; }
}
@media (max-width: 800px) and (max-height: 540px) {
  .join-actions { position: static; padding: 12px 0 0; border: 0; background: transparent; backdrop-filter: none; }
  .welcome { padding-bottom: 22px; }
}
@media (max-width: 360px) {
  .topbar { padding-inline: 14px; }
  .brand { gap: 7px; }
  .brand small { letter-spacing: 2px; }
  .status { max-width: 42%; font-size: 9px; }
  .players-heading { padding-inline: 14px; }
  .players-overview { font-size: 8px; }
  .players-refresh { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  button:active:enabled { transform: none; }
  .spinner { animation: none; }
}
