@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/geist-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #141922;
  --panel: #1c2430;
  --panel2: #252f3d;
  --line: #354252;
  --ink: #eef1ed;
  --dim: #bac5d0;
  --gold: #e7c584;
  --ok: #9acd9d;
  --danger: #f5a493;
  --shadow: #080c1380;
}
[data-theme="midnight"] {
  --bg: #101a27;
  --panel: #162637;
  --panel2: #203449;
  --line: #36506a;
  --gold: #a8d5e8;
}
[data-theme="amber"] {
  --bg: #231d18;
  --panel: #2d2720;
  --panel2: #3b3228;
  --line: #554737;
  --gold: #eec58d;
}
[data-theme="juniper"] {
  --bg: #14211d;
  --panel: #1c2d27;
  --panel2: #293e34;
  --line: #456052;
  --gold: #d0dab0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  font-size: 15px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: var(--gold);
}
[hidden] {
  display: none !important;
}
#wrap {
  height: 100dvh;
  min-height: 760px;
  display: flex;
  flex-direction: column;
}
#hdr {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 20px 32px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand img {
  width: 40px;
  height: 40px;
}
h1 {
  font-size: 22px;
  letter-spacing: -0.4px;
  margin: 0;
  line-height: 1.3;
}
.edition {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: var(--dim);
  border-left: 1px solid var(--line);
  padding-left: 12px;
  margin-left: 12px;
  vertical-align: middle;
}
.tagline {
  font-size: 14px;
  color: var(--dim);
}
.connection {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  margin-left: auto;
  color: var(--dim);
}
#connection-dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.offline #connection-dot {
  background: var(--danger);
}
#mode {
  color: var(--gold);
  border: 1px solid var(--line);
  padding: 4px 6px;
  font-size: 11px;
}
.rankbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 120px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
}
#xpbar {
  height: 3px;
  background: var(--line);
  width: 100%;
}
#xpfill {
  display: block;
  height: 100%;
  background: var(--gold);
  width: 0;
  transition: width 0.2s;
}
.repo-link {
  font-size: 14px;
  text-decoration: none;
  color: var(--dim);
}
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 32px;
  flex-wrap: wrap;
}
.cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.btn,
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 6px 11px;
  white-space: nowrap;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover,
.seg button:hover {
  background: var(--panel2);
  border-color: var(--dim);
}
.btn[aria-expanded="true"],
.btn.on,
.seg button[aria-pressed="true"] {
  background: var(--panel2);
  color: var(--gold);
  border-color: var(--gold);
}
.btn span {
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
}
select.btn {
  background: var(--bg);
}
#workspace {
  display: flex;
  flex: 1;
  min-height: min-content;
  flex-direction: column;
  padding: 8px 32px 0;
}
.scene-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.scene-heading > :first-child {
  min-width: 0;
}
#room-name {
  overflow-wrap: anywhere;
}
.eyebrow {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--dim);
}
h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
  margin: 5px 0 0;
}
#summary {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  max-width: 100%;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
}
#waiting-count {
  color: var(--danger);
}
#waiting-count[aria-disabled="true"] {
  color: var(--dim);
  cursor: default;
}
#stage {
  position: relative;
  contain: size;
  flex: 1;
  min-height: 240px;
  background: #111720;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 16px 40px var(--shadow);
}
#c {
  display: block;
  width: 100%;
  height: 100%;
  outline-offset: -4px;
  touch-action: pan-y;
}
#empty-state {
  flex-shrink: 0;
  margin-top: 10px;
  background: var(--panel);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px var(--shadow);
}
#empty-state h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
#empty-state p {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.4;
}
code {
  font-family: ui-monospace, monospace;
  background: var(--bg);
  color: var(--gold);
  padding: 3px 6px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.scene-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  flex-wrap: wrap;
}
.hint {
  color: var(--dim);
  font-size: 14px;
  font-weight: 500;
}
.scene-controls .hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.scene-controls .btn {
  min-height: 40px;
  padding: 3px 10px;
  font-size: 13px;
}
footer {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 41px;
  padding: 8px 32px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
}
.room-view-setting {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Optional room-first HUD. Keep native controls and their accessible names. */
.room-focus #wrap {
  min-height: 0;
  height: 100dvh;
}
.room-focus #preview-notice,
.room-focus #hdr,
.room-focus #achbtn,
.room-focus #themeNextbtn,
.room-focus #sound,
.room-focus #helpbtn,
.room-focus #attention,
.room-focus .scene-heading > :first-child,
.room-focus .scene-controls .hint,
.room-focus #arcade-open,
.room-focus #room-lights,
.room-focus #capturebtn {
  display: none;
}
.room-focus #toolbar {
  padding: 4px 8px;
  gap: 6px;
  flex-wrap: nowrap;
  flex-direction: row;
}
.room-focus #toolbar > .cluster {
  display: flex;
  width: auto;
  flex-wrap: nowrap;
  gap: 6px;
}
.room-focus #toolbar > .cluster:first-child .btn {
  flex: 0 0 42px;
}
.room-focus #toolbar button {
  font-size: 0;
  gap: 0;
  width: 42px;
  padding: 6px;
}
.room-focus #agent-total {
  display: none;
}
.room-focus #filterbtn {
  width: 104px;
  font-size: 12px;
}
.room-focus #workspace {
  min-height: 0;
  padding: 0 8px;
  overflow: auto;
}
.room-focus .scene-heading {
  margin-bottom: 4px;
  gap: 4px;
}
.room-focus #summary {
  width: 100%;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.room-focus #count {
  margin-right: auto;
}
.room-focus #stage {
  min-height: 80px;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  flex: 1;
}
.room-focus #empty-state {
  margin-top: 4px;
  padding: 4px 8px;
}
.room-focus #empty-state h3,
.room-focus #empty-state p {
  display: none;
}
.room-focus .scene-controls {
  justify-content: center;
  padding: 4px 0;
  gap: 4px;
}
.room-focus .scene-controls > .cluster {
  justify-content: center;
  gap: 4px;
}
.room-focus .scene-controls .btn {
  min-height: 42px;
  padding: 4px 8px;
}
.room-focus #zoom-fit,
.room-focus #pausebtn {
  font-size: 0;
  gap: 0;
  width: 42px;
}
.room-focus #furniture-status {
  margin: 2px 0;
  max-height: 50px;
  overflow: auto;
  font-size: 12px;
}
.room-focus footer {
  min-height: 26px;
  padding: 3px 8px;
  gap: 6px;
  font-size: 12px;
}
.room-focus footer .footer-note {
  display: none;
}
.room-focus footer .connection {
  flex-shrink: 0;
  font-size: 11px;
  gap: 4px;
}
.room-focus footer #mode {
  padding: 2px 4px;
  font-size: 10px;
}
.room-landscape #toolbar {
  flex-wrap: wrap;
}
.room-landscape #toolbar > .secondary {
  margin-left: auto;
}
.room-landscape .scene-heading,
.room-landscape #count {
  display: none;
}
.room-landscape #toolbar > #summary {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
}
.room-landscape #toolbar #summary button {
  width: auto;
  font-size: 12px;
  padding: 6px 9px;
}
.live-label {
  font-size: 11px;
  color: var(--ok);
  white-space: nowrap;
  letter-spacing: 1px;
}
#latest-event {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.footer-note {
  margin-left: auto;
  white-space: nowrap;
  font-size: 12px;
}
#toast {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
#toast:empty {
  display: none;
}
#notice-slot {
  position: fixed;
  z-index: 4;
  top: 170px;
  right: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#notice-slot:empty,
#notice-slot:has(#toast:empty):not(:has(#settings-save-notice:not([hidden]))) {
  display: none;
}
#notice-slot .toast {
  padding: 6px 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow);
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 14px;
  animation: appear 0.2s ease-out;
}
.toast-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.toast-repeat {
  display: block;
  color: var(--dim);
}
.toast-repeat:empty {
  display: none;
}
.toast-dismiss {
  flex: 0 0 auto;
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
}
html.panel-open {
  overflow: hidden;
  overscroll-behavior: none;
}
#backdrop {
  position: fixed;
  inset: 0;
  background: #05091088;
  z-index: 5;
  backdrop-filter: blur(2px);
}
.sheet {
  --sheet-padding: 26px;
  position: fixed;
  z-index: 6;
  right: 18px;
  top: 18px;
  bottom: 18px;
  width: min(520px, calc(100% - 36px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: 0 24px 90px #0008;
  scrollbar-width: thin;
}
.sheet-header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 18px var(--sheet-padding) 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet .sheet-header h2 {
  margin: 0;
  padding: 0;
  min-width: 0;
}
.sheet-back {
  margin-bottom: 12px;
}
.sheet-section-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--dim);
  white-space: nowrap;
}
.sheet-section-navigation .txt {
  flex: 1;
  min-width: 0;
  width: 0;
  min-height: 44px;
  margin: 0;
}
.sheet-body {
  padding: 0 var(--sheet-padding) var(--sheet-padding);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
#sound-prefs-form .setting-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-right: 8px;
  cursor: pointer;
}
#sound-prefs-form input {
  flex-shrink: 0;
  margin: 0;
}
.recap-controls {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.recap-controls legend {
  float: left;
  padding: 0;
}
.recap-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.recap-summary dt {
  color: var(--muted);
}
.recap-summary dd {
  margin: 0;
}
.recap-events {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}
.recap-events li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9em;
}
.recap-events li:last-child {
  border-bottom: 0;
}
.recap-events li[data-kind="needs_input"] {
  border-left: 3px solid var(--gold);
}
.recap-events li[data-kind="error"] {
  border-left: 3px solid #c45;
}
.recap-events time {
  color: var(--muted);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}
.sheet-body :focus,
.sheet-body .settings-section,
.sheet-body .settings-section h3 {
  scroll-margin-top: calc(var(--sheet-header-height, 0px) + 18px);
  scroll-margin-bottom: var(--sheet-padding);
}
.sheet-notices:has(#toast:not(:empty)),
.sheet-notices:has(#settings-save-notice:not([hidden])) {
  margin-top: 14px;
}
.settings-warning {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.settings-readiness {
  display: contents;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.inspector-summary {
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--panel2);
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.inspector-live-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.inspector-live-heading strong {
  min-width: 0;
  flex: 1 1 140px;
}
.inspector-summary p {
  margin: 8px 0 0;
  font-size: 14px;
}
.storage-diagnostics {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.storage-diagnostics summary {
  cursor: pointer;
  font-weight: 600;
}
#storage-measurements {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px 12px;
  font-size: 13px;
}
#storage-measurements dt {
  color: var(--dim);
}
#storage-measurements dd {
  margin: 0;
  text-align: right;
}
.task-board {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  overflow-wrap: anywhere;
}
.task-board-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 16px;
}
.task-board-heading h3 {
  margin: 0;
  font-size: 16px;
}
.task-board-owner {
  font-size: 14px;
  font-weight: 600;
}
.task-agent-link {
  max-width: 100%;
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}
.task-board-meta {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task-board-meta,
.task-board-summary {
  font-size: 13px;
  color: var(--dim);
}
.task-list {
  list-style: none;
  padding: 0;
  margin: 14px 0;
}
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.task-state {
  flex: 0 0 78px;
  font-size: 12px;
  color: var(--dim);
}
.task-row[data-status="in_progress"] .task-state {
  color: var(--gold);
}
.task-row[data-status="completed"] .task-state {
  color: var(--ok);
}
.task-copy {
  min-width: 0;
  flex: 1;
}
.task-content {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.task-priority {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-size: 12px;
}
.task-empty {
  margin: 18px 0;
  color: var(--dim);
}
.sheet-notices {
  max-height: min(30dvh, 240px);
  overflow: auto;
  overscroll-behavior: contain;
}
.sheet h2 {
  padding-right: 38px;
  font-size: 24px;
  margin: 0 0 12px;
}
.sheet h3 {
  font-size: 15px;
  margin: 24px 0 12px;
}
.sheet p {
  line-height: 1.65;
}
.setup-label {
  display: block;
  margin: 20px 0 8px;
  font-weight: 600;
}
.setup-status {
  border-left: 3px solid var(--gold);
  background: var(--panel2);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 18px 0;
}
.setup-status p {
  margin: 6px 0 0;
  font-size: 14px;
}
.setup-steps {
  list-style: none;
  counter-reset: setup;
  padding: 0;
  margin: 0;
}
.setup-steps li {
  counter-increment: setup;
  border-top: 1px solid var(--line);
  padding: 18px 0;
}
.setup-steps h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 16px;
}
.setup-steps h3::before {
  content: counter(setup);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-size: 13px;
  flex-shrink: 0;
}
.setup-steps p:last-child {
  margin-bottom: 0;
}
.setup-command {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}
.setup-command code {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}
.setup-help {
  border-top: 1px solid var(--line);
  padding: 16px 0;
  font-size: 14px;
}
.setup-help summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 600;
}
#setup-detail {
  font-size: 14px;
}
#setup-copy-status:empty {
  display: none;
}
#setup-done {
  width: 100%;
  margin-top: 10px;
}
.sheet .close {
  position: static;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  font-size: 20px;
  padding: 0;
}
.h {
  color: var(--dim);
  font-size: 14px;
  line-height: 1.6;
}
.txt {
  display: block;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 12px 0;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.setting-label {
  font-size: 14px;
}
.seg {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.seg button {
  font-size: 13px;
  padding: 5px 9px;
  min-height: 40px;
}
.row .txt {
  width: 65px;
  margin: 0;
}
.agent-card {
  display: flex;
  text-align: left;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--ink);
  padding: 12px;
  border-radius: 7px;
  margin-top: 8px;
  cursor: pointer;
}
.agent-card:hover {
  border-color: var(--gold);
}
.agent-usage {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--dim);
  overflow-wrap: anywhere;
}
.token-composition {
  display: flex;
  width: 100%;
  max-width: 220px;
  height: 5px;
  margin-top: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--line);
}
.token-input {
  background: var(--gold);
}
.token-output {
  background: #8baeb3;
}
.agent-usage .token-legend {
  font-size: 11px;
}
.portrait {
  width: 32px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.agent-copy {
  min-width: 0;
  flex: 1;
}
.agent-copy strong {
  font-size: 14px;
  display: block;
  overflow-wrap: anywhere;
}
.agent-copy small {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 14px;
  font-weight: 500;
}
.status::before {
  content: "●";
  font-size: 11px;
}
.status.waiting {
  color: var(--danger);
}
.status.idle,
.status.gone {
  color: var(--dim);
}
.status.thinking {
  color: var(--gold);
}
.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.kv span {
  color: var(--dim);
}
.kv b {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.ach {
  border: 1px solid var(--line);
  padding: 13px;
  border-radius: 7px;
  background: var(--bg);
}
.ach.have {
  border-color: #738a69;
}
.ach strong {
  font-size: 14px;
}
.ach .h {
  font-size: 13px;
}
.ach small {
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
}
.progress-track {
  height: 4px;
  background: var(--line);
  margin-top: 12px;
  overflow: hidden;
  border-radius: 2px;
}
.progress-track i {
  display: block;
  height: 100%;
  background: var(--gold);
}
.ach.have .progress-track i {
  background: var(--ok);
}
.event {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.event header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 5px;
}
.event time {
  color: var(--dim);
  font-size: 14px;
  font-weight: 500;
}
.event p {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
}
.danger {
  color: var(--danger);
  border-color: #82554c;
}
#edit-hint {
  position: relative;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px;
  font-size: 14px;
  border-radius: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.task-heading {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 14px;
  font-weight: 500;
  margin: 20px 0 8px;
}
.empty {
  padding: 24px 4px;
  color: var(--dim);
  font-size: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 1000px) {
  #hdr {
    gap: 16px;
  }
  .edition {
    display: none;
  }
  #toolbar {
    gap: 8px;
  }
  .secondary {
    margin-left: auto;
  }
  .repo-link {
    display: none;
  }
}
@media (min-width: 601px) {
  .scene-heading > :first-child {
    flex: 1 1 240px;
  }
}
@media (max-height: 480px) {
  .sheet-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .sheet-back {
    margin: 0;
    align-self: center;
  }
  .sheet-title-row {
    grid-column: 2;
    min-width: 0;
  }
  .sheet-back[hidden] + .sheet-title-row {
    grid-column: 1 / -1;
  }
  .sheet .sheet-header h2 {
    font-size: 20px;
  }
  .sheet-section-navigation,
  .sheet-notices {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .sheet-notices:has(#toast:not(:empty)),
  .sheet-notices:has(#settings-save-notice:not([hidden])) {
    margin-top: 0;
  }
  .sheet-notices {
    max-height: max(44px, 16dvh);
  }
}
@media (max-width: 600px) {
  #wrap {
    min-height: 980px;
    height: auto;
  }
  #hdr {
    padding: 14px 16px;
    gap: 10px;
  }
  .brand img {
    width: 34px;
    height: 34px;
  }
  h1 {
    font-size: 20px;
  }
  .tagline {
    font-size: 12px;
  }
  .connection {
    font-size: 11px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 110px;
  }
  .rankbox {
    display: none;
  }
  #toolbar {
    padding: 10px 12px;
    gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    white-space: normal;
  }
  .cluster {
    gap: 5px;
  }
  #toolbar > .cluster {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
  }
  #toolbar .btn {
    min-height: 44px;
    font-size: 13px;
    padding: 6px 9px;
  }
  #workspace {
    padding: 6px 12px 0;
  }
  #stage {
    flex: none;
    height: auto;
    aspect-ratio: var(--office-room-aspect, 210 / 238);
    max-height: 500px;
  }
  #toolbar > .cluster:first-child .btn {
    flex: 1 1 28%;
  }
  #toolbar .secondary .btn {
    flex: 1 1 auto;
  }
  .scene-heading {
    margin-bottom: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  h2 {
    font-size: 18px;
  }
  #summary {
    font-size: 12px;
    gap: 5px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    text-align: left;
  }
  #summary .btn {
    padding: 6px 9px;
    font-size: 12px;
  }
  #summary #count {
    margin-right: auto;
  }
  .eyebrow {
    font-size: 11px;
  }
  .scene-controls {
    padding: 10px 0;
    justify-content: center;
  }
  .scene-controls .hint {
    display: none;
  }
  .scene-controls .btn {
    min-height: 44px;
    padding: 6px 9px;
  }
  .sheet {
    inset: 8px;
    width: auto;
    --sheet-padding: 18px;
  }
  .sheet h2 {
    font-size: 21px;
  }
  .sheet .row {
    flex-wrap: wrap;
  }
  footer {
    padding: 8px 12px;
    gap: 9px;
  }
  .footer-note {
    display: none;
  }
  .grid {
    gap: 8px;
  }
  .ach {
    padding: 10px;
  }
  #toast {
    font-size: 13px;
  }
  #notice-slot {
    right: 12px;
    width: calc(100vw - 24px);
  }
  .btn {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn .button-label {
  font: inherit;
  color: inherit;
}
#agent-total {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--panel2);
  font-size: 12px;
}
#furniture-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.furniture-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.furniture-filters label {
  flex: 1 1 120px;
  min-width: 0;
}
.furniture-filters label:first-child {
  flex-basis: 180px;
}
.furniture-filters .txt {
  display: block;
  width: 100%;
  margin-top: 6px;
}
#furniture-picker-label {
  display: flex;
  flex: 1 1 230px;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  text-align: left;
}
#furniture-picker {
  flex: 1 1 150px;
  min-width: 0;
  max-width: 100%;
}
.furniture-card {
  min-width: 0;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--bg);
  padding: 8px 4px;
  font-size: 13px;
}
.furniture-card:hover {
  border-color: var(--gold);
  background: var(--panel2);
}
.furniture-card canvas {
  width: 60px;
  height: 52px;
  image-rendering: pixelated;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#edit-message {
  flex: 1 1 200px;
  text-align: left;
}
#edit-hint {
  margin-top: 10px;
  box-shadow: 0 6px 20px #0006;
}
@media (max-width: 380px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .tagline {
    display: none;
  }
  #hdr {
    padding: 12px;
  }
  .sheet {
    --sheet-padding: 16px;
  }
}
@media (max-width: 600px) {
  #toolbar > .secondary {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 44px 44px;
    width: 100%;
  }
  #toolbar .secondary .btn {
    min-width: 0;
    padding: 6px;
  }
  #sound .button-label,
  #helpbtn .button-label {
    display: none;
  }
  #themeNextbtn {
    gap: 5px;
  }
  #wrap {
    min-height: 920px;
  }
}

#badgeSearch {
  width: 100%;
  margin: 8px 0 16px;
}
#badge-tabs {
  flex-wrap: wrap;
}
.achievement-reward {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--text);
  font-size: 14px;
}
.achievement-reward .icon {
  flex-shrink: 0;
  color: var(--gold);
}
.achievement-xp {
  display: block;
  margin-top: 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
}
#edit-hint .btn {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  #edit-hint {
    gap: 6px;
    font-size: 13px;
  }
  #edit-hint .btn {
    gap: 6px;
    padding: 6px 8px;
    font-size: 13px;
  }
}
@media (max-height: 450px) and (min-width: 550px) {
  .room-focus #edit-hint {
    gap: 4px;
    padding: 6px;
  }
  .room-focus #edit-message {
    flex-basis: 100%;
    font-size: 12px;
  }
  .room-focus #edit-hint .btn {
    padding: 4px 7px;
    font-size: 12px;
  }
  .room-focus #edit-hint .icon {
    display: none;
  }
  .room-focus #furniture-picker-label {
    flex-basis: 190px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .room-focus #furniture-picker {
    flex-basis: 110px;
  }
}

.attention {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 32px 0;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--panel);
}
.attention-copy {
  min-width: 0;
  flex: 1;
}
.attention strong {
  color: var(--gold);
  font-size: 14px;
}
.attention p {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 13px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.runtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
  vertical-align: middle;
}
.runtime-badge img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  padding: 1px;
  flex-shrink: 0;
}
#setup-brand {
  margin: 4px 0 12px;
}
.name-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.name-form .txt {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.name-form .btn {
  flex-shrink: 0;
}
.agent-name-form {
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.agent-name-form p:empty,
#storage-status:empty {
  display: none;
}
.settings-section {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.settings-section h3:first-child {
  margin-top: 0;
}
.settings-section p:last-child {
  margin-bottom: 0;
}
.panel-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 24px;
}
.panel-heading h3 {
  margin: 0 0 12px;
}
.panel-heading .eyebrow {
  font-size: 10px;
}
.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.usage-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow-wrap: anywhere;
}
.usage-card > span {
  font-size: 12px;
  color: var(--dim);
}
.usage-card strong {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
}
.usage-card small {
  font-size: 11px;
  color: var(--dim);
  margin-top: auto;
}
.usage-note {
  margin: 12px 0;
}
.usage-breakdown {
  margin: 18px 0;
}
.usage-breakdown summary {
  color: var(--gold);
  cursor: pointer;
  font-size: 14px;
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 16px 0;
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.usage-table caption {
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}
.usage-table th,
.usage-table td {
  text-align: left;
  vertical-align: top;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.usage-table th {
  font-weight: 500;
}
.usage-table th:first-child {
  width: 38%;
}
.usage-table td small {
  display: block;
  color: var(--dim);
  font-size: 10px;
  margin-top: 4px;
}
.history-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.history-tools .txt {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.history-tools .btn {
  flex-shrink: 0;
}
.event-identity {
  display: block;
  color: var(--dim);
  font-size: 11px;
  overflow-wrap: anywhere;
  margin-top: 8px;
}
.event time {
  flex-shrink: 0;
  font-size: 11px;
}
#history-more,
#export-history {
  margin-top: 14px;
}
.waiting-note {
  padding: 12px;
  border-left: 3px solid var(--gold);
  background: var(--bg);
  color: var(--dim);
  font-size: 13px;
}
#room-actions {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .attention {
    margin: 10px 12px 0;
    flex-wrap: wrap;
    gap: 10px;
  }
  .attention-copy {
    flex-basis: 100%;
  }
  .settings-section {
    padding: 12px;
  }
  #history-settings .row {
    flex-wrap: wrap;
  }
  .usage-card {
    padding: 11px;
  }
  .usage-card strong {
    font-size: 18px;
  }
  .event header {
    align-items: flex-start;
  }
  .event time {
    max-width: 45%;
    text-align: right;
  }
}
@media (max-width: 380px) {
  .name-form,
  .history-tools {
    flex-wrap: wrap;
  }
  .name-form .txt,
  .history-tools .txt {
    flex-basis: 100%;
  }
}
/* Room activities share the existing dialog and control styles. */
#room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.jukebox-art {
  display: grid;
  place-items: center;
  height: 150px;
  margin: 16px 0;
  border-radius: 16px;
  background: linear-gradient(145deg, #35484b, #1c2530);
  overflow: hidden;
}
#jukebox-disc {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 10px solid #11151c;
  border-radius: 50%;
  background: repeating-radial-gradient(#1b2027 0 2px, #303641 3px 4px);
}
#jukebox-disc span {
  width: 35px;
  height: 35px;
  border: 12px solid #d3b786;
  border-radius: 50%;
  background: #151d25;
  box-shadow: 0 -35px 0 -13px #98b6a5;
}
#jukebox-disc.is-playing {
  animation: office-record 8s linear infinite;
}
.jukebox-volume-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
#jukebox-volume {
  width: 100%;
  min-height: 36px;
  margin: 6px 0 16px;
  accent-color: #9fbea9;
}
#jukebox-tracks {
  width: 100%;
}
@keyframes office-record {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #jukebox-disc.is-playing {
    animation: none;
  }
}

#agent-preference-form > label {
  display: block;
  margin: 14px 0 6px;
}
#agent-preference-form > select {
  display: block;
  width: 100%;
  max-width: 100%;
}
#agent-preference-form > .cluster {
  margin-top: 14px;
}

/* Drafts share the existing Tasks sheet, never a competing overlay. */
.task-draft .txt {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.task-draft textarea {
  min-height: 16rem;
  resize: vertical;
  font: inherit;
  line-height: 1.6;
}
.task-draft-actions {
  flex-wrap: wrap;
  margin-block: 0.75rem;
}
.task-draft-actions .btn {
  white-space: normal;
  overflow-wrap: anywhere;
}
.task-draft-remember {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-block: 1rem;
  cursor: pointer;
}
.task-draft-remember input {
  flex: 0 0 auto;
}

/* Session triage controls stay separate from the canvas's runtime filter. */
.roster-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.roster-toolbar .txt {
  flex: 1;
  width: auto;
  min-width: 0;
  margin: 0;
}
#roster-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 8px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
#roster-filters button {
  flex: 1 0 auto;
  min-height: 44px;
  font-size: 13px;
  white-space: nowrap;
}
#roster-summary {
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.5;
}
.connection-notice {
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--panel2);
}
.connection-notice p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.connection-notice .btn {
  min-height: 44px;
}
.connection-notice [aria-disabled="true"] {
  opacity: 0.7;
  cursor: progress;
}

/* Keep sessions visible before secondary metrics or personalization. */
#sheet-floor #roster-description {
  font-size: 12px;
  margin: 0 0 8px;
}
#sheet-floor #trackSearch {
  margin: 8px 0;
  min-height: 44px;
}
.roster-toolbar .txt,
.roster-toolbar .btn {
  min-height: 44px;
}
.agent-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 10px;
}
.agent-heading strong {
  flex: 1 1 100%;
}
.agent-heading .status {
  font-size: 12px;
}
.inspector-actions {
  flex-wrap: wrap;
  margin: 12px 0;
}
.inspector-actions .btn {
  min-height: 44px;
  font-size: 13px;
  padding: 8px 10px;
  white-space: normal;
}
#inspector-copy-status:empty {
  display: none;
}
#inspector-report-text {
  font-family: ui-monospace, monospace;
}
@media (max-width: 560px) {
  .inspector-summary {
    padding: 8px 12px;
    margin-bottom: 12px;
  }
  .inspector-actions {
    margin-block: 8px;
  }
  #trackSearch,
  #roster-runtime {
    font-size: 16px;
  }
  .roster-toolbar .btn {
    padding-inline: 8px;
  }
  #roster-filters button {
    font-size: 12px;
    padding-inline: 9px;
  }
  .inspector-actions .btn {
    flex: 1 1 calc(50% - 8px);
  }
}

.history-export-actions {
  flex-wrap: wrap;
  margin: 12px 0 18px;
}
.history-export-actions .btn {
  min-height: 44px;
}
