/* LAN Party '98 — UI chrome borrows from the Win98 shell; the world is the 3D room.
   Every value comes from tokens.css. Don't add raw colours here: add a token first. */
@import url("tokens.css");

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--basement); color: var(--w98-text); font: var(--text-ui)/var(--leading-ui) var(--font-ui); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

/* ---- Win98 widgets ---- */
.w98-window {
  background: var(--w98-face); color: var(--w98-text);
  box-shadow: var(--bevel-raised);
  padding: 3px; max-width: 480px; width: calc(100vw - 32px);
}
.w98-title {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--title-gradient);
  color: var(--w98-light); font-weight: bold; padding: 3px 4px 3px 6px; letter-spacing: .02em;
}
.w98-title b { background: var(--w98-face); color: var(--w98-text); width: 16px; height: 14px; line-height: 12px; text-align: center; font-size: 12px;
  box-shadow: var(--bevel-small); }
.w98-body { padding: 14px 16px 12px; }
.w98-body h1 { font: var(--text-crt-xl)/1 var(--font-crt); margin: 0 0 10px; color: var(--w98-title); text-wrap: balance; }
.w98-body p { margin: 0 0 12px; max-width: 60ch; }
.w98-panel {
  background: var(--w98-face); color: var(--w98-text);
  box-shadow: var(--bevel-raised);
}
.w98-btn {
  font: inherit; background: var(--w98-face); color: var(--w98-text); border: 0; padding: 5px 16px; min-width: 88px; cursor: pointer;
  box-shadow: var(--bevel-raised);
}
.w98-btn:active { box-shadow: var(--bevel-pressed); }
.w98-btn:focus-visible { outline: 1px dotted var(--w98-text); outline-offset: -5px; }
.w98-btn.default { outline: 1px solid var(--w98-text); }
.w98-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; }
.w98-link { margin-right: auto; font-size: var(--text-ui-sm); color: var(--w98-title); }
.w98-link:focus-visible { outline: 1px dotted var(--w98-text); outline-offset: 2px; }
kbd { display: inline-block; font: var(--text-ui-sm)/1 var(--font-ui); background: var(--w98-key); padding: 2px 5px; margin-right: 2px;
  box-shadow: var(--bevel-key); color: var(--w98-text); }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 3px 0; vertical-align: middle; }
.keys td:first-child { white-space: nowrap; padding-right: 14px; }

/* ---- Intro ---- */
#intro { position: fixed; inset: 0; display: grid; place-items: center; background: var(--scrim); z-index: var(--z-dialog); padding: var(--gutter); }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-hud); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
#prompt { position: absolute; left: 50%; top: calc(50% + 28px); transform: translateX(-50%);
  font: var(--text-crt-md)/1 var(--font-crt); color: var(--phosphor); background: var(--hud-bg); padding: 6px 10px; white-space: nowrap; }
#meters { position: absolute; left: 16px; bottom: 16px; padding: 8px 10px; display: grid; gap: 5px; min-width: 180px; }
.meter { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: var(--text-ui-xs); font-weight: bold; letter-spacing: .04em; }
.bar { height: 10px; background: var(--w98-light); box-shadow: var(--bevel-sunken); padding: 2px; }
.bar i { display: block; height: 100%; width: 0; transition: width var(--dur-fast); }
#m-caffeine { background: repeating-linear-gradient(90deg, var(--volt) 0 7px, transparent 7px 9px); }
#m-snacks { background: repeating-linear-gradient(90deg, var(--nacho) 0 7px, transparent 7px 9px); }
#clock { font: var(--text-crt)/1 var(--font-crt); text-align: right; color: var(--w98-text); }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font: var(--text-crt-lg)/1.1 var(--font-crt); color: var(--toast);
  text-shadow: var(--text-shadow-hard); text-align: center; max-width: calc(100vw - 32px); }

/* ---- Your monitor ---- */
#monitor { position: fixed; z-index: var(--z-monitor); background: var(--crt-black); overflow: hidden; border-radius: 6px / 8px; }
#dos { position: absolute; inset: 0; background: var(--crt-black); }
#dos > * { background: var(--crt-black) !important; }
#crt-fx { position: absolute; inset: 0; pointer-events: none;
  background:
    var(--scanlines),
    var(--vignette);
  box-shadow: inset 0 0 40px rgba(120, 255, 200, .06); }
#dust { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity var(--dur-slow);
  background:
    radial-gradient(circle at 28% 62%, rgba(242,138,28,.35) 0 18px, transparent 34px),
    radial-gradient(circle at 34% 58%, rgba(242,138,28,.25) 0 10px, transparent 22px),
    radial-gradient(circle at 71% 40%, rgba(242,138,28,.3) 0 14px, transparent 28px); }
#seated-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: var(--z-seated);
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center;
  color: var(--paper); font-size: var(--text-ui-sm); max-width: calc(100vw - 32px);
  background: var(--bar-bg); padding: 6px 10px; }
#seated-status { font: var(--text-crt-sm)/1 var(--font-crt); color: var(--phosphor); min-width: 22ch; }

#netstatus { font-size: var(--text-ui-xs); color: var(--w98-text); border-top: 1px solid var(--w98-shadow); padding-top: var(--space-1); }
#netstatus.online::before { content: ""; display: inline-block; width: var(--space-2); height: var(--space-2); margin-right: var(--space-1h); vertical-align: -1px; background: var(--link-led); box-shadow: var(--bevel-sunken); }

/* ---- Handle entry ---- */
.handle { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-3); font-weight: bold; }
.handle input { flex: 1; min-width: 0; font: var(--text-crt-md)/1 var(--font-crt); padding: var(--space-1) var(--space-1h); border: 0; background: var(--w98-light); color: var(--w98-text); text-transform: uppercase; box-shadow: var(--bevel-sunken); }
.handle input:focus-visible { outline: 1px dotted var(--w98-text); outline-offset: -4px; }

/* ---- Chat: in-world text over the basement, typed on a phosphor line ---- */
#chat { position: fixed; left: var(--gutter); bottom: 140px; z-index: var(--z-seated); width: min(420px, calc(100vw - 2 * var(--gutter))); pointer-events: none; }
#chat-log { display: flex; flex-direction: column; gap: var(--space-0); font: var(--text-crt)/1.15 var(--font-crt); color: var(--paper); text-shadow: var(--text-shadow-hard); }
#chat-log div { transition: opacity var(--dur-slow); overflow-wrap: anywhere; }
#chat-log div.old { opacity: 0; }
#chat-log b { font-weight: normal; }
#chat-log .sys { color: var(--toast); }
#chat-form { pointer-events: auto; margin-top: var(--space-1h); }
#chat-input { width: 100%; box-sizing: border-box; font: var(--text-crt)/1 var(--font-crt); padding: var(--space-1) var(--space-1h); border: 0; background: var(--crt-black); color: var(--phosphor); box-shadow: var(--bevel-sunken); }
#chat-input:focus-visible { outline: 1px dotted var(--phosphor); outline-offset: -4px; }

/* ---- Deathmatch controls on the seated bar ---- */
#dm { display: inline-flex; gap: var(--space-2); align-items: center; padding-left: var(--space-3); border-left: 1px solid var(--w98-shadow); }
#dm-text { font: var(--text-crt-sm)/1 var(--font-crt); color: var(--amber); }
.w98-btn:disabled { color: var(--w98-shadow); text-shadow: 1px 1px 0 var(--w98-light); cursor: default; }

@media (prefers-reduced-motion: reduce) {
  #chat-log div { transition: none; } .bar i, #dust { transition: none; } }
