:root {
  color-scheme: light;
  /* Neutral QA controls until original screen roles and fonts are verified. */
  --app-font: "Segoe UI", Arial, sans-serif;
  --background: #f4f4f6;
  --surface: #ffffff;
  --foreground: #181818;
  --muted: #626267;
  --border: #eaeaec;
  --border-strong: #d8d8dc;
  --primary: #181818;
  --primary-hover: #37373a;
  --primary-foreground: #ffffff;
  --button-hover: #f1f1f3;
  --danger: #a61c42;
  --danger-bg: #fff0f3;
  --danger-hover: #ffe2ea;
  --success: #17603b;
  --success-bg: #eaf7ef;
  --focus: #68686f;
  --ring-focus: #1818181a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: #151518;
  color: var(--foreground);
  font: 14px/1.5 var(--app-font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, input { height: 40px; min-height: 40px; border-radius: 12px; }
button {
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--foreground);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms;
}
button:hover { background: var(--button-hover); }
button.primary { border-color: transparent; background: var(--primary); color: var(--primary-foreground); }
button.primary:hover { background: var(--primary-hover); }
button.danger { border-color: transparent; background: var(--danger-bg); color: var(--danger); }
button.danger:hover { background: var(--danger-hover); }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--foreground);
  font-size: 16px;
}
input::placeholder { color: var(--muted); }
input:focus { outline: 2px solid var(--ring-focus); border-color: var(--focus); }
input:disabled { background: var(--background); }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.35; font-weight: 700; }
.brand-title { display: block; width: 250.5px; height: 57px; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 18px; line-height: 1.4; font-weight: 600; }
ul { list-style: none; margin: 0; padding: 0; }
.game-shell {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
  transform-origin: top left;
}
.masthead { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 16px; }
.eyebrow { margin-bottom: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.connection { color: var(--muted); font-size: 12px; text-align: right; }
.connection[data-state="online"] { color: var(--success); }
.connection[data-state="offline"] { color: var(--danger); }
.notice { flex-shrink: 0; padding: 8px 16px; margin-bottom: 8px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); overflow-wrap: anywhere; }
.retry-bar { flex-shrink: 0; margin-bottom: 8px; }
.account-view { display: grid; flex: 1; min-height: 0; place-items: center; padding: 8px 0; }
.account-panel { width: 100%; max-width: 380px; }
.account-panel button, .account-panel input { height: 48px; min-height: 48px; }
.account-panel > .muted { margin: 8px 0 16px; }
.muted, .field-help, .version, .qa-note { color: var(--muted); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.auth-switch button { border-color: transparent; background: transparent; }
.auth-switch button[aria-pressed="true"] { background: var(--surface); border-color: var(--border-strong); }
.field { margin-bottom: 16px; }
label { display: block; margin-bottom: 8px; font-weight: 600; }
.field-help { margin-top: 8px; font-size: 12px; }
.full { width: 100%; }
#lobby-view { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.lobby-heading { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.identity { margin-top: 4px; overflow-wrap: anywhere; }
.identity strong { color: var(--foreground); font-weight: 600; }
.lobby-grid { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.section-heading { display: flex; flex-shrink: 0; gap: 12px; align-items: center; justify-content: space-between; padding-bottom: 16px; }
.version { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-state { padding: 24px 0; color: var(--muted); }
.room-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.room-list li { display: flex; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--border); }
.room-list .room-info { min-width: 0; flex: 1; }
.room-list .room-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.room-list .room-detail { color: var(--muted); margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.room-list .room-label { font-size: 12px; color: var(--muted); text-align: right; }
.create-room { flex-shrink: 0; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.create-row { display: flex; gap: 8px; align-items: start; }
.create-row input { flex: 1; }
#own-room-content { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.room-name { font-size: 16px; font-weight: 600; margin-bottom: 12px; overflow-wrap: anywhere; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.member-list .member-info { min-width: 0; flex: 1; }
.member-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.member-role { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.member-status { flex-shrink: 0; padding: 4px 8px; background: var(--background); border-radius: 8px; font-size: 12px; }
.member-status.is-ready { background: var(--success-bg); color: var(--success); }
.room-actions { display: flex; gap: 8px; margin-top: 16px; }
.gameplay-note { margin-top: 16px; }
.qa-note { flex-shrink: 0; max-width: 75ch; padding: 16px 0 0; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
