﻿/*!
 * KRYON — the world and its chrome.
 *
 * One surface language for the game: a hairline interface laid over the pixel
 * world.  The world is drawn by the canvas; everything here is graphite, one
 * warm signal colour, rectangular controls and type that is meant to be read.
 *
 * Two faces only:
 *   Roboto Condensed  the interface: headings, navigation, labels, numbers
 *   Manrope           long text: descriptions, messages, hints
 *
 * Both are self-hosted (SIL Open Font License).  The pixel faces stay in
 * tokens.css for the public site; they are not part of the game UI.
 */

/* ------------------------------------------------------------- type faces */

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/web/fonts/roboto-condensed-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/web/fonts/roboto-condensed-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/static/web/fonts/roboto-condensed-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/static/web/fonts/roboto-condensed-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/static/web/fonts/roboto-condensed-cyrillic-700-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Roboto Condensed";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/static/web/fonts/roboto-condensed-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ----------------------------------------------------------------- tokens */

.page-game,
.game {
  --ui-bg: #060708;
  --ui-bg-raise: #0a0c0d;
  --ui-panel: rgba(9, 11, 12, 0.9);
  --ui-line: rgba(233, 240, 241, 0.1);
  --ui-line-2: rgba(233, 240, 241, 0.18);
  --ui-line-3: rgba(233, 240, 241, 0.32);
  --ui-ink: #e7edee;
  --ui-ink-2: #a4aeb1;
  --ui-ink-3: #7b8689;
  --ui-signal: #d9b464;
  --ui-signal-hi: #e8c986;
  --ui-alert: #cf6a52;
  --ui-face: "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --ui-text: "Manrope Variable", "Manrope", system-ui, sans-serif;
  --ui-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ui-shadow-window: 0 40px 100px rgba(0, 0, 0, 0.7), 0 2px 10px rgba(0, 0, 0, 0.5);
  --ui-shadow-panel: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

/* `hidden` is how the page shows and hides things: the menu panes, the fold
   control, the pending proposals.  The browser's own rule is weaker than any
   author `display`, so the guard has to outrank every layout rule below. */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------- page */

.page-game {
  height: 100vh;
  height: 100dvh;
  height: var(--game-height, 100dvh);
  position: fixed;
  inset: 0;
  overflow: hidden;
  margin: 0;
  background-color: var(--ui-bg);
  background-image: linear-gradient(180deg, #090b0c 0%, #060708 48%, #050607 100%);
}

.page-game main {
  height: 100%;
}

.page-game ::selection {
  background: rgba(217, 180, 100, 0.28);
  color: #ffffff;
}

.page-game :focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: 2px;
}

.game {
  position: relative;
  height: 100%;
  width: 100%;
}

.game__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* The room sits over the map at native pixel resolution. */
.game__room {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: var(--ui-bg);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.game__noscript {
  padding: 24px;
  color: var(--ui-ink);
  font: 400 14px/1.6 var(--ui-text);
}

/* -------------------------------------------------------------------- HUD */

.game__hud {
  position: absolute;
  inset: 0 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

/* The place card.  It is a piece of the interface, not a window: one hairline,
   a dark translucent fill, no glow and no second border. */
.game__place {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  width: max-content;
  max-width: 440px;
  max-height: min(56vh, 420px);
  overflow: hidden;
  padding: 20px 24px;
  border: 1px solid var(--ui-line);
  border-radius: 0;
  background: rgba(6, 8, 9, 0.90);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.game__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ui-ink-2);
  font: 600 10px/1 var(--ui-face);
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.game__brand-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink);
  font: 600 10.5px/1 var(--ui-face);
  letter-spacing: 0;
}

.game__room-title {
  margin: 0;
  color: var(--ui-ink);
  font: 600 27px/1.05 var(--ui-face);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.game__room-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  color: var(--ui-ink-2);
  font: 400 12.5px/1.55 var(--ui-text);
}

/* Board and workflow are hairline read-outs, not coloured plates. */
.game__board,
.game__workflow {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 68px;
  overflow: hidden;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--ui-line);
  background: none;
}

.game__board-line,
.game__workflow-line {
  display: block;
  padding: 2px 0;
  color: var(--ui-ink-3);
  font: 400 11px/1.5 var(--ui-text);
  overflow-wrap: anywhere;
}

.game__workflow-line {
  color: var(--ui-ink-2);
}

.game__status {
  min-height: 16px;
  margin: 5px 0 0;
  color: var(--ui-ink-2);
  font: 400 11px/1.45 var(--ui-text);
}

/* The two ways out of a room. */
.game__links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
}

.game__links button,
.game__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(6, 8, 9, 0.55);
  color: var(--ui-ink-2);
  font: 600 10px/1 var(--ui-face);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.game__links button:hover,
.game__links a:hover {
  border-color: var(--ui-line-3);
  background: rgba(12, 15, 16, 0.72);
  color: var(--ui-ink);
}

.game__links .game__map-back {
  border-color: var(--ui-line-2);
  background: rgba(6, 8, 9, 0.55);
  color: var(--ui-ink-2);
}

/* ------------------------------------------------------------------- dock */

.game__dock {
  position: absolute;
  inset: 0;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

/* A soft darkening, not a plate: the world keeps its horizon. */
.game__dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 230px;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 6, 7, 0.55) 46%, rgba(5, 6, 7, 0.96) 100%);
  pointer-events: none;
}

.game__dock-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.game__hint {
  margin: 0;
  max-width: 70ch;
  color: var(--ui-ink-3);
  font: 400 11px/1.55 var(--ui-text);
  text-align: center;
  text-wrap: balance;
}

/* --------------------------------------------------------------- proposals */

.game__pending {
  pointer-events: auto;
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game__card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(8, 10, 11, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

.game__card-summary {
  color: var(--ui-ink-2);
  font: 400 12.5px/1.55 var(--ui-text);
}

.game__card-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.game__card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9.5px/1 var(--ui-face);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.game__card-button:hover {
  border-color: var(--ui-line-3);
  color: var(--ui-ink);
}

.game__card-button--confirm {
  border-color: var(--ui-signal);
  background: var(--ui-signal);
  color: #0a0b0c;
}

.game__card-button--confirm:hover {
  border-color: var(--ui-signal-hi);
  background: var(--ui-signal-hi);
  color: #0a0b0c;
}

.game__card-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ panel */

.game__panel {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  pointer-events: auto;
  transform: translate(var(--panel-x, 0px), var(--panel-y, 0px));
  width: min(760px, calc(100% - 32px));
  max-height: calc(100% - 104px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(8, 10, 11, 0.96);
  -webkit-backdrop-filter: blur(20px) saturate(0.9);
  backdrop-filter: blur(20px) saturate(0.9);
  box-shadow: var(--ui-shadow-panel);
}

.game__panel.is-dragging {
  border-color: var(--ui-line-3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
}

.game__panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.game__panel.is-dragging .game__panel-head {
  cursor: grabbing;
}

/* The grip is three pairs of 1px dots, not a checkerboard. */
.game__grip {
  flex: 0 0 auto;
  width: 10px;
  height: 16px;
  border-radius: 0;
  background-image: radial-gradient(circle, var(--ui-ink-3) 0.9px, transparent 1.1px);
  background-size: 5px 5px;
  background-position: 0 1px;
  opacity: 0.75;
}

.game__agent-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ui-ink);
  font: 600 11px/1.3 var(--ui-face);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__agent-name::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  background: var(--ui-signal);
  vertical-align: 1px;
}

.game__panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.game__share,
.game__voice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: var(--ui-ink-2);
  font: 400 11px/1.3 var(--ui-text);
  cursor: pointer;
  user-select: none;
}

.game__share input,
.game__voice input {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.game__share input:checked,
.game__voice input:checked {
  border-color: var(--ui-signal);
  background-color: var(--ui-signal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%230a0b0c' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

.game__share input:focus-visible,
.game__voice input:focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: 2px;
}

.game__settings,
.game__fold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9.5px/1 var(--ui-face);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.game__settings:hover,
.game__fold:hover {
  border-color: var(--ui-line-3);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.game__panel-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.game__panel.is-folded .game__panel-body {
  display: none;
}

.game__panel.is-folded .game__panel-head {
  border-bottom: 0;
}

/* The log is a transcript: rule-separated lines, role labels, no bubbles. */
.game__log {
  list-style: none;
  margin: 0;
  padding: 2px 18px 4px;
  max-height: min(36vh, 300px);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.game__log:empty::after {
  content: "Здесь начинается разговор";
  display: block;
  padding: 24px 0 20px;
  color: var(--ui-ink-3);
  font: 600 9.5px/1.5 var(--ui-face);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.game__msg {
  margin: 0;
  padding: 13px 0 14px;
  border-bottom: 1px solid var(--ui-line);
  background: none;
  color: var(--ui-ink);
  font: 400 14px/1.6 var(--ui-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.game__msg:last-child {
  border-bottom: 0;
}

.game__msg::before {
  display: block;
  margin-bottom: 5px;
  color: var(--ui-ink-3);
  font: 600 9px/1.2 var(--ui-face);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.game__msg--user::before {
  content: "Вы";
  color: var(--ui-signal);
}

.game__msg--assistant::before {
  content: "Агент";
}

.game__msg--system {
  padding: 12px 0;
  color: var(--ui-ink-3);
  font: 400 12px/1.6 var(--ui-text);
  text-align: center;
}

.game__msg--system::before {
  content: none;
}

.game__msg-play {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin-top: 8px;
  padding: 0 8px;
  border: 1px solid rgba(217, 180, 100, 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--ui-signal);
  font: 600 9px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.game__msg-play:hover {
  border-color: var(--ui-signal);
  background: rgba(217, 180, 100, 0.06);
  color: var(--ui-signal-hi);
}

/* The composer: a field, a quiet microphone and one filled action. */
.game__form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ui-line-2);
}

.game__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 12px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.34);
  color: var(--ui-ink);
  font: 400 14px/1.45 var(--ui-text);
  resize: none;
  outline: none;
}

.game__input::placeholder {
  color: var(--ui-ink-3);
  opacity: 1;
}

.game__input:focus {
  border-color: var(--ui-signal);
  box-shadow: inset 0 0 0 1px var(--ui-signal);
}

.game__input:disabled {
  opacity: 0.55;
}

.game__send {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ui-signal);
  border-radius: 0;
  background: var(--ui-signal);
  color: #0a0b0c;
  font: 600 10px/1 var(--ui-face);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 120ms linear, border-color 120ms linear;
}

.game__send:hover:not(:disabled) {
  border-color: var(--ui-signal-hi);
  background: var(--ui-signal-hi);
}

.game__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.game__mic {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 11px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9.5px/1 var(--ui-face);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.game__mic:hover:not(:disabled) {
  border-color: var(--ui-line-3);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.game__mic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game__mic--recording {
  border-color: var(--ui-alert);
  background: transparent;
  color: var(--ui-alert);
}

/* ------------------------------------------------------- keyboard access */

.game__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.game__sr:focus-within {
  position: absolute;
  top: 96px;
  left: 24px;
  z-index: 5;
  width: min(340px, calc(100vw - 48px));
  height: auto;
  max-height: 44vh;
  margin: 0;
  padding: 14px;
  overflow-y: auto;
  clip: auto;
  clip-path: none;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: var(--ui-bg-raise);
}

.game__sr h2 {
  margin: 0 0 8px;
  color: var(--ui-ink-2);
  font: 600 9.5px/1.3 var(--ui-face);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.game__rooms,
.game__agents {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.game__agents {
  margin-top: 10px;
}

.game__room,
.game__agent {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 400 12px/1 var(--ui-text);
  cursor: pointer;
}

.game__room.is-active,
.game__agent.is-active {
  border-color: var(--ui-signal);
  color: var(--ui-signal);
}

.game__agents-empty {
  color: var(--ui-ink-3);
  font: 400 12px/1.5 var(--ui-text);
}

/* ================================================================ the menu */

.game__menu {
  position: fixed;
  inset: 0;
  width: fit-content;
  height: fit-content;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-ink);
}

.game__menu::backdrop {
  background: rgba(3, 4, 5, 0.78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.is-menu-open,
.is-menu-open body {
  overflow: hidden;
}

.menu {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100vw - 64px));
  height: min(88vh, 820px);
  max-height: min(88dvh, 820px);
  overflow: hidden;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: var(--ui-bg-raise);
  color: var(--ui-ink);
  font-family: var(--ui-text);
  box-shadow:
    inset 0 2px 0 var(--ui-signal),
    var(--ui-shadow-window);
}

/* Two hairline corner ticks; the top edge already carries the signal strip. */
.menu::before,
.menu::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.menu::before {
  top: 6px;
  left: 6px;
  border-top: 1px solid var(--ui-line-3);
  border-left: 1px solid var(--ui-line-3);
}

.menu::after {
  right: 6px;
  bottom: 6px;
  border-right: 1px solid var(--ui-line-3);
  border-bottom: 1px solid var(--ui-line-3);
}

/* ------------------------------------------------------------------ header */

.menu__head {
  flex: 0 0 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
}

.menu__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink);
  font: 600 15px/1 var(--ui-face);
  letter-spacing: 0;
}

.menu__identity-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.menu__eyebrow {
  color: var(--ui-ink-2);
  font: 600 9px/1 var(--ui-face);
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

.menu__heading {
  margin: 0;
  color: var(--ui-ink);
  font: 600 16px/1.15 var(--ui-face);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9.5px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.menu__close:hover {
  border-color: var(--ui-line-3);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

/* A drawn cross, not a glyph. */
.menu__close-icon {
  position: relative;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  font-size: 0;
}

.menu__close-icon::before,
.menu__close-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: 10px;
  height: 1px;
  background: currentColor;
}

.menu__close-icon::before {
  transform: rotate(45deg);
}

.menu__close-icon::after {
  transform: rotate(-45deg);
}

/* ------------------------------------------------------------------- shell */

.menu__shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

/* --------------------------------------------------------------------- nav */

.menu__nav {
  display: flex;
  flex-direction: column;
  flex: 0 0 236px;
  width: 236px;
  min-height: 0;
  padding: 22px 12px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--ui-line);
  background: transparent;
  counter-reset: menu-index;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.menu__nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 26px;
}

.menu__nav-group:last-of-type {
  margin-bottom: 0;
}

.menu__nav-title {
  margin: 0;
  padding: 0 12px;
  color: var(--ui-ink-3);
  font: 600 9px/1.3 var(--ui-face);
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.menu__tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-wrap: nowrap;
}

.menu__tab {
  position: relative;
  counter-increment: menu-index;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 11.5px/1.2 var(--ui-face);
  letter-spacing: 0.13em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms linear, background-color 120ms linear;
}

.menu__tab::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: transparent;
}

.menu__tab::after {
  content: counter(menu-index, decimal-leading-zero);
  flex: 0 0 auto;
  color: var(--ui-ink-3);
  font: 400 9.5px/1 var(--ui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.menu__tab:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.menu__tab--active {
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.menu__tab--active::before {
  background: var(--ui-signal);
}

.menu__tab--active::after {
  color: var(--ui-signal);
}

.menu__nav-note {
  margin: auto 0 0;
  padding: 14px 12px 0;
  border-top: 1px solid var(--ui-line);
  color: var(--ui-ink-3);
  font: 400 10.5px/1.5 var(--ui-text);
}

/* -------------------------------------------------------------------- body */

.menu__body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 32px 34px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.menu__pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.menu__pane:focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: -1px;
}

.menu__pane-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ui-line);
}

.menu__pane-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ui-ink);
  font: 600 27px/1.05 var(--ui-face);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu__pane-title::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  background: var(--ui-signal);
}

.menu__pane-desc {
  margin: 0;
  max-width: 62ch;
  color: var(--ui-ink-2);
  font: 400 13px/1.6 var(--ui-text);
}

/* ------------------------------------------------------------------- cards */

.menu__card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--ui-line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.018);
  box-shadow: none;
}

.menu__card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.menu__card-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.menu__card-title {
  margin: 0;
  color: var(--ui-ink);
  font: 600 15px/1.3 var(--ui-text);
  overflow-wrap: anywhere;
}

.menu__card-sub {
  margin: 0;
  color: var(--ui-ink-2);
  font: 400 12.5px/1.55 var(--ui-text);
  overflow-wrap: anywhere;
}

.menu__card-stats {
  margin: 0;
  padding: 3px 0;
  color: var(--ui-ink-2);
  font: 400 10.5px/1.4 var(--ui-mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.menu__section-title {
  margin: 0;
  color: var(--ui-ink-2);
  font: 600 10px/1.3 var(--ui-face);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------- lists */

/* One column.  A location is a row, not a tile. */
.menu__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ui-line);
}

.menu__item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--ui-line);
  border-radius: 0;
  background: transparent;
  transition: background-color 120ms linear;
}

.menu__item:hover {
  background: rgba(255, 255, 255, 0.022);
}

.menu__row {
  display: flex;
  flex: 1 1 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

.menu__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.menu__name {
  color: var(--ui-ink);
  font: 600 15px/1.35 var(--ui-text);
  overflow-wrap: anywhere;
}

.menu__slug {
  color: var(--ui-ink-3);
  font: 400 10.5px/1.45 var(--ui-mono);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.menu__note {
  margin: 0;
  color: var(--ui-ink-3);
  font: 400 11.5px/1.55 var(--ui-text);
  overflow-wrap: anywhere;
}

.menu__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.menu__actions > .menu__form,
.menu__actions > .menu__warning {
  flex: 1 1 100%;
  order: -1;
}

.menu__form > .menu__action,
.menu__card > .menu__action {
  align-self: flex-start;
}

.menu__item > .menu__form {
  width: 100%;
}

.menu__item > .menu__action {
  margin-left: auto;
}

.menu__providers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu__presets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
  padding-top: 20px;
  border-top: 1px solid var(--ui-line);
}

.menu__presets > .menu__list {
  margin-top: 4px;
}

.menu__empty {
  margin: 0;
  padding: 26px 18px;
  border: 1px dashed var(--ui-line-2);
  border-radius: 0;
  color: var(--ui-ink-3);
  font: 400 12.5px/1.55 var(--ui-text);
  text-align: center;
}

/* ------------------------------------------------------------------- forms */

.menu__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.menu__form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu__control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.menu__create-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.menu__create-public {
  grid-column: 1 / -1;
}

.menu__create-submit {
  grid-column: 1 / -1;
  justify-self: start;
}

.menu__label {
  display: block;
  color: var(--ui-ink-3);
  font: 600 9.5px/1.3 var(--ui-face);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.menu__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.menu__hint {
  margin: 0;
  color: var(--ui-ink-3);
  font: 400 11.5px/1.55 var(--ui-text);
}

.menu__hint--field {
  color: var(--ui-ink-3);
}

.menu__hint--warn,
.menu__warning {
  color: var(--ui-alert);
  font: 400 12px/1.55 var(--ui-text);
}

.menu__input,
.menu__textarea,
.menu__select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.32);
  color: var(--ui-ink);
  font: 400 14px/1.45 var(--ui-text);
  outline: none;
  transition: border-color 120ms linear, box-shadow 120ms linear;
}

.menu__textarea {
  min-height: 72px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}

.menu__select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237b8689' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  cursor: pointer;
}

.menu__select option {
  background: var(--ui-bg-raise);
  color: var(--ui-ink);
}

.menu__input::placeholder,
.menu__textarea::placeholder {
  color: var(--ui-ink-3);
  opacity: 1;
}

.menu__input:focus,
.menu__textarea:focus,
.menu__select:focus {
  border-color: var(--ui-signal);
  box-shadow: inset 0 0 0 1px var(--ui-signal);
}

.menu__input--slug {
  font: 400 11.5px/1.4 var(--ui-mono);
  letter-spacing: 0.04em;
}

.menu__input--field {
  flex: 1 1 160px;
}

.menu__input--options {
  font-family: var(--ui-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.menu__textarea--code {
  min-height: 120px;
  font: 400 12px/1.55 var(--ui-mono);
  letter-spacing: 0.02em;
}

.menu__select--place,
.menu__select--type {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 40px;
  font-size: 12.5px;
}

.menu__check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--ui-ink-2);
  font: 400 12.5px/1.45 var(--ui-text);
  cursor: pointer;
  user-select: none;
}

.menu__check--inline {
  min-height: 32px;
}

.menu__check input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.32);
  cursor: pointer;
}

.menu__check input:checked {
  border-color: var(--ui-signal);
  background-color: var(--ui-signal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%230a0b0c' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

.menu__check input:focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: 2px;
}

/* The purpose block: an input for the AI buttons, set apart by one hairline. */
.menu__form--ai {
  padding: 14px;
  border: 1px solid rgba(217, 180, 100, 0.22);
  border-radius: 0;
  background: rgba(217, 180, 100, 0.025);
}

.menu__props {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-width: 0;
}

.menu__props > .menu__label {
  flex: 1 1 100%;
}

.menu__fields {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
}

.menu__fields--board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.menu__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.012);
}

.menu__field-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.menu__field-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.menu__checks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu__models {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.menu__models li {
  padding: 3px 7px;
  border: 1px solid var(--ui-line-2);
  color: var(--ui-ink-2);
  font: 400 10.5px/1.4 var(--ui-mono);
  letter-spacing: 0.02em;
}

.menu__places {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--ui-line);
}

/* --------------------------------------------------------------- buttons */

.menu__create,
.menu__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink);
  font: 600 10px/1 var(--ui-face);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.menu__create:hover:not(:disabled),
.menu__action:hover:not(:disabled) {
  border-color: var(--ui-line-3);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.menu__action--primary {
  border-color: var(--ui-signal);
  background: var(--ui-signal);
  color: #0a0b0c;
}

.menu__action--primary:hover:not(:disabled) {
  border-color: var(--ui-signal-hi);
  background: var(--ui-signal-hi);
  color: #0a0b0c;
}

.menu__action--danger {
  border-color: rgba(207, 106, 82, 0.5);
  background: transparent;
  color: var(--ui-alert);
}

.menu__action--danger:hover:not(:disabled) {
  border-color: var(--ui-alert);
  background: rgba(207, 106, 82, 0.07);
  color: #e08a76;
}

.menu__action--on {
  border-color: rgba(217, 180, 100, 0.5);
  background: rgba(217, 180, 100, 0.06);
  color: var(--ui-signal);
}

.menu__action--ai {
  min-height: 32px;
  border-color: rgba(217, 180, 100, 0.35);
  background: transparent;
  color: var(--ui-signal);
}

.menu__action--ai:hover:not(:disabled) {
  border-color: var(--ui-signal);
  background: rgba(217, 180, 100, 0.06);
  color: var(--ui-signal-hi);
}

.menu__ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(217, 180, 100, 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--ui-signal);
  font: 600 9px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.menu__ai:hover:not(:disabled) {
  border-color: var(--ui-signal);
  background: rgba(217, 180, 100, 0.06);
  color: var(--ui-signal-hi);
}

.menu__ai-icon {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.menu__create:disabled,
.menu__action:disabled,
.menu__ai:disabled,
.menu__close:disabled,
.menu__badge-x:disabled,
.menu button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.menu__link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* ---------------------------------------------------------------- badges */

.menu__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  padding: 2px 6px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9px/1.2 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu__badge--here {
  border-color: rgba(217, 180, 100, 0.4);
  color: var(--ui-signal);
}

.menu__badge-x {
  position: relative;
  width: 24px;
  height: 24px;
  margin: -4px -6px -4px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-3);
  font-size: 0;
  cursor: pointer;
}

.menu__badge-x::before,
.menu__badge-x::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 7px;
  width: 10px;
  height: 1px;
  background: currentColor;
}

.menu__badge-x::before {
  transform: rotate(45deg);
}

.menu__badge-x::after {
  transform: rotate(-45deg);
}

.menu__badge-x:hover:not(:disabled) {
  color: var(--ui-alert);
}

/* --------------------------------------------------------------- the editor */

/* A provider's "get key" is an outbound link, not the pane's one action: keep
   the signal in its text and border instead of filling half the card. */
.menu__providers .menu__action--primary {
  border-color: rgba(217, 180, 100, 0.4);
  background: transparent;
  color: var(--ui-signal);
}

.menu__providers .menu__action--primary:hover:not(:disabled) {
  border-color: var(--ui-signal);
  background: rgba(217, 180, 100, 0.06);
  color: var(--ui-signal-hi);
}

.menu__danger {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(207, 106, 82, 0.4);
  border-radius: 0;
  background: rgba(207, 106, 82, 0.035);
}

.menu__danger-title {
  margin: 0;
  color: var(--ui-alert);
  font: 600 11px/1.3 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.menu__danger-text {
  margin: 0;
  color: var(--ui-ink-2);
  font: 400 12.5px/1.6 var(--ui-text);
}

.menu__danger .menu__action {
  align-self: flex-start;
}

/* -------------------------------------------------------------- operator */

.menu__operator {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.menu__op-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.menu__subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  border-bottom: 1px solid var(--ui-line);
}

.menu__subtab {
  min-height: 36px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 10px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear;
}

.menu__subtab:hover {
  color: var(--ui-ink);
}

.menu__subtab--active {
  border-bottom-color: var(--ui-signal);
  color: var(--ui-ink);
}

.menu__card--operator,
.menu__card--secret {
  background: rgba(255, 255, 255, 0.018);
}

.menu__card--secret {
  border-color: rgba(217, 180, 100, 0.35);
}

.menu__stat {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
  border-top: 1px solid var(--ui-line);
  border-left: 1px solid var(--ui-line);
}

.menu__stat-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-right: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
}

.menu__stat-value {
  color: var(--ui-ink);
  font: 600 22px/1.1 var(--ui-face);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.menu__kv {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 8px 16px;
  margin: 4px 0;
}

.menu__kv dt {
  color: var(--ui-ink-3);
  font: 600 9px/1.6 var(--ui-face);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.menu__kv dd {
  margin: 0;
  color: var(--ui-ink);
  font: 400 12.5px/1.6 var(--ui-text);
  overflow-wrap: anywhere;
}

.menu__transcript {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(50vh, 460px);
  overflow-y: auto;
  border: 1px solid var(--ui-line);
  background: rgba(0, 0, 0, 0.18);
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.menu__msg {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
}

.menu__msg:last-child {
  border-bottom: 0;
}

.menu__msg-role {
  display: block;
  margin-bottom: 4px;
  color: var(--ui-ink-3);
  font: 600 9px/1.2 var(--ui-face);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.menu__msg--user .menu__msg-role {
  color: var(--ui-signal);
}

.menu__msg--system {
  text-align: center;
}

.menu__msg-text {
  margin: 0;
  color: var(--ui-ink);
  font: 400 13.5px/1.6 var(--ui-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.menu__msg--system .menu__msg-text {
  color: var(--ui-ink-3);
  font-size: 12px;
}

.menu__secret-box {
  padding: 12px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.3);
  color: var(--ui-ink);
  font: 400 12px/1.6 var(--ui-mono);
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  user-select: all;
}

.menu__setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ui-line);
}

.menu__setting:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* --------------------------------------------------------------- focus ring */

.menu button:focus-visible,
.menu a:focus-visible,
.menu input:focus-visible,
.menu textarea:focus-visible,
.menu select:focus-visible,
.menu [tabindex]:focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: 2px;
}

.menu input:focus-visible,
.menu textarea:focus-visible,
.menu select:focus-visible {
  outline: 1px solid var(--ui-signal);
  outline-offset: 2px;
}

/* --------------------------------------------------------------- scrollbars */

.menu__body::-webkit-scrollbar,
.menu__nav::-webkit-scrollbar,
.menu__transcript::-webkit-scrollbar,
.game__log::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.menu__body::-webkit-scrollbar-thumb,
.menu__nav::-webkit-scrollbar-thumb,
.menu__transcript::-webkit-scrollbar-thumb,
.game__log::-webkit-scrollbar-thumb {
  background: var(--ui-line-2);
}

.menu__body::-webkit-scrollbar-track,
.menu__nav::-webkit-scrollbar-track,
.menu__transcript::-webkit-scrollbar-track,
.game__log::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------------------------------------------------------- narrow desktop */

@media (max-width: 999px) {
  .menu {
    width: calc(100vw - 28px);
    height: min(94vh, 900px);
    max-height: min(94dvh, 900px);
  }

  .menu__nav {
    flex-basis: 204px;
    width: 204px;
    padding: 18px 8px 14px;
  }

  .menu__body {
    padding: 22px 22px 30px;
  }
}

/* ------------------------------------------------------------------- phone */

@media (max-width: 720px) {
  .game__hud {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-right: calc(12px + env(safe-area-inset-right));
    padding-left: calc(12px + env(safe-area-inset-left));
    gap: 8px;
  }

  .game__place {
    max-width: calc(100% - 104px);
    max-height: 46vh;
    padding: 12px 13px;
    gap: 3px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  }

  .game__brand {
    margin-bottom: 4px;
    font-size: 9px;
    letter-spacing: 0.3em;
  }

  .game__brand-mark {
    width: 18px;
    height: 18px;
    font-size: 9.5px;
  }

  .game__room-title {
    font-size: 21px;
    letter-spacing: 0.03em;
  }

  .game__room-desc {
    font-size: 12px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .game__status {
    font-size: 10.5px;
  }

  .game__board,
  .game__workflow {
    display: none;
  }

  .game__links {
    gap: 6px;
  }

  .game__links button,
  .game__links a {
    height: 40px;
    padding: 0 10px;
    font-size: 9px;
    letter-spacing: 0.16em;
  }

  .game__dock {
    padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  }

  .game__dock::before {
    height: 190px;
  }

  .game__hint {
    font-size: 10.5px;
  }

  .game__card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .game__card-actions {
    justify-content: flex-end;
  }

  .game__card-button {
    height: 40px;
  }

  /* Panel: same geometry, recomposed head, transcript and composer. */
  .game__panel {
    width: min(760px, calc(100% - 20px));
    max-height: calc(100% - 88px);
  }

  .game__panel-head {
    padding: 10px 12px;
    gap: 8px;
  }

  .game__grip {
    width: 8px;
    height: 14px;
  }

  .game__agent-name {
    font-size: 10.5px;
    letter-spacing: 0.16em;
  }

  .game__panel-tools {
    flex: 1 1 100%;
    gap: 8px 12px;
    justify-content: flex-start;
  }

  .game__share,
  .game__voice {
    min-height: 32px;
    font-size: 11px;
  }

  .game__settings,
  .game__fold {
    height: 38px;
    padding: 0 10px;
  }

  .game__fold {
    margin-left: auto;
  }

  .game__log {
    padding: 0 14px;
    max-height: min(32vh, 260px);
  }

  .game__msg {
    font-size: 13.5px;
    padding: 12px 0 13px;
  }

  .game__form {
    flex-wrap: wrap;
    padding: 8px 10px 10px;
    gap: 7px;
  }

  .game__input {
    flex: 1 1 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .game__send {
    flex: 0 0 auto;
    height: 44px;
    margin-left: auto;
    padding: 0 12px;
  }

  .game__mic {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 10px;
  }

  /* Menu: a full-screen window, not a floating card. */
  .menu {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-top: 2px solid var(--ui-signal);
    box-shadow: none;
  }

  .menu::before,
  .menu::after {
    display: none;
  }

  .menu__head {
    flex-basis: 58px;
    height: 58px;
    padding: 0 12px 0 14px;
    gap: 10px;
  }

  .menu__identity {
    gap: 10px;
  }

  .menu__mark {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .menu__eyebrow {
    font-size: 8.5px;
    letter-spacing: 0.36em;
  }

  .menu__heading {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .menu__close {
    height: 44px;
    padding: 0 10px;
    font-size: 9px;
  }

  .menu__shell {
    flex-direction: column;
  }

  /* One scrolling strip: groups become containers, numbers disappear. */
  .menu__nav {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    gap: 0;
    padding: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--ui-line);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .menu__nav::-webkit-scrollbar {
    display: none;
  }

  .menu__nav-group {
    display: contents;
  }

  .menu__nav-title,
  .menu__nav-note {
    display: none;
  }

  .menu__tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
  }

  .menu__tab {
    width: auto;
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 11px;
    font-size: 10.5px;
    letter-spacing: 0.11em;
    white-space: nowrap;
    border: 0;
    background: transparent;
  }

  .menu__tab::before {
    display: none;
  }

  .menu__tab::after {
    display: none;
  }

  .menu__tab--active {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 -2px 0 var(--ui-signal);
    color: var(--ui-ink);
  }

  .menu__body {
    padding: 18px 15px calc(26px + env(safe-area-inset-bottom));
    gap: 14px;
  }

  .menu__pane {
    gap: 16px;
  }

  .menu__pane-head {
    padding-bottom: 14px;
    gap: 6px;
  }

  .menu__pane-title {
    font-size: 22px;
  }

  .menu__pane-desc {
    font-size: 12.5px;
  }

  .menu__card {
    padding: 15px;
    gap: 14px;
  }

  .menu__create-row,
  .menu__fields--board {
    grid-template-columns: minmax(0, 1fr);
  }

  .menu__create-submit {
    justify-self: start;
  }

  .menu__create-extra {
    display: none;
  }

  .menu__row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .menu__actions {
    justify-content: flex-start;
  }

  .menu__item {
    padding: 14px 0;
    gap: 8px;
  }

  .menu__name {
    font-size: 14.5px;
  }

  .menu__form-row {
    align-items: stretch;
  }

  .menu__form-row > .menu__input,
  .menu__form-row > .menu__select {
    flex: 1 1 100%;
  }

  .menu__form-row > .menu__action,
  .menu__form-row > .menu__create {
    flex: 1 1 auto;
  }

  .menu__input,
  .menu__textarea,
  .menu__select {
    font-size: 16px;
    min-height: 44px;
  }

  .menu__textarea {
    min-height: 88px;
  }

  .menu__select--place,
  .menu__select--type {
    font-size: 16px;
  }

  .menu__action,
  .menu__create {
    min-height: 44px;
    font-size: 10px;
  }

  .menu__ai {
    min-height: 34px;
    font-size: 9.5px;
  }

  .menu__action--ai {
    min-height: 38px;
  }

  .menu__check {
    min-height: 44px;
  }

  .menu__check--inline {
    min-height: 36px;
  }

  .menu__badge-x {
    width: 34px;
    height: 34px;
    margin: -8px -8px -8px 0;
  }

  .menu__badge-x::before,
  .menu__badge-x::after {
    top: 16px;
    left: 11px;
    width: 12px;
  }

  .menu__subnav {
    gap: 0 14px;
  }

  .menu__subtab {
    min-height: 44px;
  }

  .menu__stat {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu__transcript {
    max-height: min(46vh, 380px);
  }
}

/* ------------------------------------------------------- short viewports */

@media (max-height: 780px) and (min-width: 721px) {
  .game__hud {
    padding: 14px 18px;
  }

  .game__place {
    padding: 16px 18px 15px;
  }

  .game__room-title {
    font-size: 24px;
  }

  .menu__body {
    padding-top: 22px;
    padding-bottom: 26px;
  }
}

@media (max-height: 640px) {
  .game__room-desc {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}

/* A phone on its side: the world gets the height, the copy that repeats it
   steps aside. */
@media (max-height: 520px) {
  .game__hud {
    padding: 8px 10px;
  }

  .game__place {
    padding: 10px 12px;
    max-height: 44vh;
  }

  .game__room-desc,
  .game__hint {
    display: none;
  }

  .game__dock {
    padding-bottom: 8px;
  }

  .game__log {
    max-height: 22dvh;
  }

  .game__panel-head {
    padding: 8px 10px;
  }

  .game__form {
    padding: 8px;
  }

  .game__input {
    min-height: 40px;
  }
}

/* ------------------------------------------------------------- touch sizes */

@media (pointer: coarse) {
  .game__links button,
  .game__links a {
    height: 44px;
  }

  .game__card-button {
    height: 44px;
    padding: 0 14px;
  }

  .game__msg-play {
    height: 34px;
  }

  .game__settings,
  .game__fold {
    height: 38px;
  }

  .menu__close,
  .menu__action,
  .menu__create {
    min-height: 44px;
  }

  .menu__close {
    height: 44px;
  }

  .menu__ai,
  .menu__action--ai {
    min-height: 34px;
  }

  .menu__badge-x {
    width: 34px;
    height: 34px;
  }

  .menu__input,
  .menu__textarea,
  .menu__select {
    min-height: 44px;
    font-size: 16px;
  }

  .menu__subtab {
    min-height: 44px;
  }

  .menu__check {
    min-height: 44px;
  }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .game__links button,
  .game__links a,
  .game__place,
  .game__panel,
  .game__card-button,
  .game__msg-play,
  .game__input,
  .game__send,
  .game__mic,
  .menu__close,
  .menu__tab,
  .menu__item,
  .menu__action,
  .menu__create,
  .menu__ai,
  .menu__subtab,
  .menu__badge-x,
  .menu__input,
  .menu__textarea,
  .menu__select {
    transition-duration: 0.01ms;
  }
}

:root.is-quiet .game__links button,
:root.is-quiet .game__links a,
:root.is-quiet .game__place,
:root.is-quiet .game__panel,
:root.is-quiet .game__card-button,
:root.is-quiet .game__msg-play,
:root.is-quiet .game__input,
:root.is-quiet .game__send,
:root.is-quiet .game__mic,
:root.is-quiet .menu__close,
:root.is-quiet .menu__tab,
:root.is-quiet .menu__item,
:root.is-quiet .menu__action,
:root.is-quiet .menu__create,
:root.is-quiet .menu__ai,
:root.is-quiet .menu__subtab,
:root.is-quiet .menu__badge-x,
:root.is-quiet .menu__input,
:root.is-quiet .menu__textarea,
:root.is-quiet .menu__select {
  transition-duration: 0.01ms;
}

/* ====================================================================== */
/* Operational centre: rail, top bar, team strip, phone sheet.            */
/* The panel and the room keep their own geometry; these are overlays.    */
/* ====================================================================== */

.game {
  --rail-w: 264px;
  --topbar-h: 56px;
  overflow: hidden;
}

.game.is-rail-collapsed {
  --rail-w: 56px;
}

/* ------------------------------------------------------------------- rail */

.team {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 6;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--ui-line);
  background: rgba(6, 8, 9, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ui-ink-2);
  font-family: var(--ui-text);
}

.team__head {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--ui-line);
}

.team__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.team__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  color: var(--ui-ink);
  font: 600 15px/1 var(--ui-face);
}

.team__identity-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.team__eyebrow {
  margin: 0;
  color: var(--ui-ink-2);
  font: 600 9px/1 var(--ui-face);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  white-space: nowrap;
}

.team__title {
  color: var(--ui-ink-3);
  font: 600 10px/1.2 var(--ui-face);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}

.team__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-3);
  cursor: pointer;
  transition: color 120ms linear, border-color 120ms linear, background-color 120ms linear;
}

.team__collapse:hover {
  border-color: var(--ui-line-2);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.team__collapse-icon {
  position: relative;
  width: 10px;
  height: 10px;
}

.team__collapse-icon::before,
.team__collapse-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 5px;
  height: 1px;
  background: currentColor;
}

.team__collapse-icon::before {
  left: 0;
  transform: rotate(45deg);
}

.team__collapse-icon::after {
  right: 0;
  transform: rotate(-45deg);
}

.team.is-collapsed .team__collapse-icon {
  transform: rotate(180deg);
}

.team__summary {
  margin: 0;
  padding: 11px 14px 10px;
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-ink-3);
  font: 600 9px/1.4 var(--ui-face);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team__scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.team__section {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0 8px;
}

.team__section--team {
  margin-bottom: 8px;
}

.team__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 8px 0;
}

.team__pane-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 6px;
  color: var(--ui-ink-3);
  font: 600 9.5px/1.3 var(--ui-face);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.team__pane-title::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  background: var(--ui-signal);
}

.team__section-head .team__pane-title {
  margin: 0;
  padding: 0;
}

.team__section-head .team__pane-title::before {
  display: none;
}

.team__badge {
  min-height: 18px;
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.team__rooms {
  list-style: none;
  margin: 0;
  padding: 0;
}

.team__room {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 400 12.5px/1.3 var(--ui-text);
  text-align: left;
  cursor: pointer;
  transition: color 120ms linear, background-color 120ms linear;
}

.team__room::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: transparent;
}

.team__room:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.team__room.is-active {
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.team__room.is-active::before {
  background: var(--ui-signal);
}

.team__room-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team__room-count {
  flex: 0 0 auto;
  color: var(--ui-ink-3);
  font: 400 10px/1 var(--ui-mono);
  font-variant-numeric: tabular-nums;
}

.team__search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 0 8px;
}

.team__search-input {
  width: 100%;
  height: 32px;
  min-width: 0;
  padding: 0 30px 0 10px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.24);
  color: var(--ui-ink);
  font: 400 12px/1 var(--ui-text);
  outline: none;
}

.team__search-input::placeholder {
  color: var(--ui-ink-3);
  opacity: 1;
}

.team__search-input:focus {
  border-color: var(--ui-signal);
  box-shadow: inset 0 0 0 1px var(--ui-signal);
}

.team__search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.team__kbd {
  position: absolute;
  right: 8px;
  padding: 2px 4px;
  border: 1px solid var(--ui-line);
  border-radius: 0;
  color: var(--ui-ink-3);
  font: 400 9px/1 var(--ui-mono);
  pointer-events: none;
}

.team__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 6px 4px;
  color: var(--ui-ink-3);
  font: 600 8.5px/1.3 var(--ui-face);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.team__group-count {
  color: var(--ui-ink-3);
  font: 400 9px/1 var(--ui-mono);
}

.team__rule {
  height: 1px;
  margin: 10px 6px 0;
  background: var(--ui-line);
}

.team__agent {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 5px 6px 5px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink);
  text-align: left;
  cursor: pointer;
  transition: color 120ms linear, background-color 120ms linear;
}

.team__agent::before {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 2px;
  background: transparent;
}

.team__agent:hover {
  background: rgba(255, 255, 255, 0.035);
}

.team__agent.is-active {
  background: rgba(255, 255, 255, 0.055);
}

.team__agent.is-active::before {
  background: var(--ui-signal);
}

.team__agent-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink);
  font: 600 12px/1 var(--ui-face);
  text-transform: uppercase;
}

.team__agent-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.team__agent-name {
  overflow: hidden;
  color: var(--ui-ink);
  font: 600 13px/1.25 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team__agent-role {
  overflow: hidden;
  color: var(--ui-ink-3);
  font: 400 10.5px/1.3 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team__agent-where {
  color: var(--ui-ink-3);
  opacity: 0.8;
}

.team__status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--ui-ink-3);
  font: 600 9px/1.2 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.team__status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: var(--ui-ink-3);
}

.team__status.is-busy {
  color: var(--ui-signal);
}

.team__status.is-busy .team__status-dot {
  background: var(--ui-signal);
}

.team__empty {
  margin: 8px 6px 10px;
  color: var(--ui-ink-3);
  font: 400 11.5px/1.55 var(--ui-text);
}

.team__empty-row {
  padding: 6px;
  color: var(--ui-ink-3);
  font: 400 11.5px/1.5 var(--ui-text);
  list-style: none;
}

.team__foot {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ui-line);
}

.team__foot .game__board,
.team__foot .game__workflow {
  max-height: 58px;
  margin: 0 0 6px;
  padding: 0;
  border-top: 0;
}

.team__foot .game__board-line,
.team__foot .game__workflow-line {
  font-size: 10.5px;
  line-height: 1.4;
}

.team__note {
  margin: 8px 0 0;
  color: var(--ui-ink-3);
  font: 400 10.5px/1.4 var(--ui-text);
}

/* Collapsed: monograms, counts, and no labels. */
.team.is-collapsed .team__head {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
}

.team.is-collapsed .team__identity {
  flex: 0 0 auto;
  gap: 0;
}

.team.is-collapsed .team__identity-text,
.team.is-collapsed .team__summary,
.team.is-collapsed .team__pane-title,
.team.is-collapsed .team__search,
.team.is-collapsed .team__foot,
.team.is-collapsed .team__status-text,
.team.is-collapsed .team__agent-text,
.team.is-collapsed .team__section-head,
.team.is-collapsed .team__group {
  display: none;
}

.team.is-collapsed .team__scroll {
  padding: 10px 0 8px;
}

.team.is-collapsed .team__section {
  margin-bottom: 10px;
  padding: 0 6px;
}

.team.is-collapsed .team__room {
  justify-content: center;
  min-height: 32px;
  padding: 0;
}

.team.is-collapsed .team__room::before {
  top: 4px;
  bottom: 4px;
}

.team.is-collapsed .team__room-name {
  display: none;
}

.team.is-collapsed .team__agent {
  justify-content: center;
  min-height: 40px;
  padding: 4px;
}

.team.is-collapsed .team__agent-mark {
  width: 28px;
  height: 28px;
}

.team.is-collapsed .team__status {
  position: absolute;
  right: 7px;
  bottom: 5px;
  gap: 0;
}

.team.is-collapsed .team__status:not(.is-busy) .team__status-dot {
  background: var(--ui-ink-3);
}

.team.is-collapsed .team__status-dot {
  width: 5px;
  height: 5px;
}

.team.is-collapsed .team__rule {
  margin: 8px 2px 0;
}

/* ---------------------------------------------------------------- top bar */

.game__hud {
  position: absolute;
  inset: 0 0 auto var(--rail-w);
  z-index: 8;
  height: var(--topbar-h);
  min-height: 0;
  max-height: var(--topbar-h);
  padding: 4px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  border-bottom: 1px solid var(--ui-line);
  background: rgba(6, 8, 9, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.game__hud > * {
  pointer-events: auto;
}

.game__top-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.game__crumbs {
  margin: 0;
  overflow: hidden;
  color: var(--ui-ink-3);
  font: 600 9px/1.1 var(--ui-face);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__crumbs-sep {
  margin: 0 4px;
  color: var(--ui-line-3);
}

.game__hud .game__room-title {
  margin: 0;
  overflow: hidden;
  color: var(--ui-ink);
  font: 600 21px/1.05 var(--ui-face);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__hud .game__room-desc {
  margin: 0;
  max-width: 72vw;
  overflow: hidden;
  color: var(--ui-ink-2);
  font: 400 12px/1.25 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__hud .game__status {
  display: none;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ui-ink-2);
  font: 400 11px/1.25 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__hud.has-status .game__room-desc {
  display: none;
}

.game__hud.has-status .game__status {
  display: block;
}

.game__links {
  flex: 0 0 auto;
  gap: 6px;
  min-width: 0;
}

.game__links button,
.game__links a {
  height: 34px;
  padding: 0 10px;
  border-radius: 0;
  font-size: 9.5px;
  letter-spacing: 0.16em;
}

.game__links .game__team-count {
  height: 34px;
  border-color: var(--ui-line);
  background: transparent;
  color: var(--ui-ink-3);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.game__links .game__team-count:hover {
  border-color: var(--ui-line-2);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

/* ------------------------------------------------------------- phone strip */

.game-team-strip {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 7;
  display: none;
  height: 58px;
  border-bottom: 1px solid var(--ui-line);
  background: rgba(6, 8, 9, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.game-team-strip__track {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
  padding: 0 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.game-team-strip__track::-webkit-scrollbar {
  display: none;
}

.game-team-strip__agent {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  width: 64px;
  height: 100%;
  padding: 4px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  cursor: pointer;
}

.game-team-strip__agent::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 2px;
  background: transparent;
}

.game-team-strip__agent.is-active {
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.game-team-strip__agent.is-active::after {
  background: var(--ui-signal);
}

.game-team-strip__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  color: var(--ui-ink);
  font: 600 13px/1 var(--ui-face);
  text-transform: uppercase;
}

.game-team-strip__name {
  max-width: 60px;
  overflow: hidden;
  font: 600 10px/1.2 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-team-strip__dot {
  position: absolute;
  top: 6px;
  right: 12px;
  width: 5px;
  height: 5px;
  background: var(--ui-ink-3);
}

.game-team-strip__agent.is-busy .game-team-strip__dot {
  background: var(--ui-signal);
}

/* -------------------------------------------------------------- phone sheet */

.team-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.team-sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 5, 0.62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.team-sheet__card {
  position: relative;
  width: 100%;
  height: 88%;
  height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 2px solid var(--ui-signal);
  border-radius: 0;
  background: var(--ui-bg-raise);
  box-shadow: var(--ui-shadow-window);
  color: var(--ui-ink);
  touch-action: pan-y;
}

.team-sheet__card::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 34px;
  height: 3px;
  margin-left: -17px;
  background: var(--ui-line-3);
}

.team-sheet__head {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--ui-line);
}

.team-sheet__identity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.team-sheet__title {
  margin: 0;
  color: var(--ui-ink);
  font: 600 18px/1.1 var(--ui-face);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.team-sheet__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ui-ink-2);
  font: 600 9.5px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.team-sheet__close:hover {
  border-color: var(--ui-line-3);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ui-ink);
}

.team-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 10px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line-2) transparent;
}

.team-sheet .team__section {
  padding: 0 4px;
}

.team-sheet .team__pane-title {
  padding: 0;
  font-size: 10px;
}

.team-sheet .team__section-head {
  padding: 0 0 8px;
}

.team-sheet .team__search-input {
  height: 44px;
  font-size: 16px;
}

.team__room--sheet {
  min-height: 52px;
  font-size: 14px;
}

.team__agent--sheet {
  min-height: 52px;
  padding: 8px 4px 8px 8px;
}

.team__agent--sheet .team__agent-mark {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.team__agent--sheet .team__agent-name {
  font-size: 14px;
}

.team__agent--sheet .team__status {
  font-size: 9px;
}

/* ---------------------------------------------------------------- panel head */

.game__agent-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-line-3);
  border-radius: 0;
  color: var(--ui-ink);
  font: 600 12px/1 var(--ui-face);
  text-transform: uppercase;
}

.game__agent-id {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}

.game__panel-head .game__agent-name {
  flex: 0 0 auto;
  overflow: hidden;
  color: var(--ui-ink);
  font: 600 12px/1.2 var(--ui-face);
  letter-spacing: 0.18em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__panel-head .game__agent-name::before {
  content: none;
}

.game__agent-role {
  overflow: hidden;
  color: var(--ui-ink-3);
  font: 400 10.5px/1.3 var(--ui-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__agent-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid var(--ui-line-2);
  border-radius: 0;
  color: var(--ui-ink-3);
  font: 600 9px/1.1 var(--ui-face);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.game__agent-state-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  background: var(--ui-ink-3);
}

.game__agent-state.is-busy {
  border-color: rgba(217, 180, 100, 0.4);
  color: var(--ui-signal);
}

.game__agent-state.is-busy .game__agent-state-dot {
  background: var(--ui-signal);
}

.game__panel {
  width: min(760px, calc(100% - var(--rail-w) - 32px));
  background: rgba(8, 10, 11, 0.92);
  border-color: var(--ui-line-2);
  box-shadow: var(--ui-shadow-panel);
}

.game__brief {
  flex: 0 0 auto;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--ui-line);
}

.game__brief-label {
  margin: 0 0 4px;
  color: var(--ui-ink-3);
  font: 600 9px/1.2 var(--ui-face);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.game__brief-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  margin: 0;
  color: var(--ui-ink-2);
  font: 400 13px/1.55 var(--ui-text);
  overflow-wrap: anywhere;
}

.game__brief:not([hidden]) + .game__log:empty::after {
  content: none;
  display: none;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1023px) {
  .game {
    --rail-w: 0px;
  }

  .team {
    display: none;
  }

  .game__hud {
    left: 0;
  }
}

@media (max-width: 720px) {
  .game__hud {
    height: 52px;
    max-height: 52px;
    padding: 3px 10px;
    padding-top: calc(3px + env(safe-area-inset-top));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-left: calc(10px + env(safe-area-inset-left));
    gap: 8px;
    background: rgba(6, 8, 9, 0.86);
  }

  .game__hud .game__crumbs {
    font-size: 8px;
    letter-spacing: 0.2em;
  }

  .game__hud .game__room-title {
    font-size: 16px;
    letter-spacing: 0.03em;
  }

  .game__hud .game__room-desc {
    display: none;
  }

  .game__hud .game__status {
    font-size: 10px;
  }

  .game__links {
    gap: 4px;
  }

  .game__links button,
  .game__links a {
    height: 40px;
    padding: 0 8px;
    font-size: 8.5px;
    letter-spacing: 0.12em;
  }

  .game__links .game__team-count {
    height: 40px;
    padding: 0 7px;
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .game-team-strip {
    display: block;
  }

  .game-team-strip__agent {
    width: 62px;
  }

  .team-sheet__close {
    height: 44px;
  }

  .game__panel {
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 12;
    width: 100%;
    height: 72%;
    max-height: 72%;
    padding-bottom: env(safe-area-inset-bottom);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    transform: none !important;
    background: rgba(8, 10, 11, 0.96);
  }

  .game__panel::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 34px;
    height: 3px;
    margin-left: -17px;
    background: var(--ui-line-3);
  }

  .game__panel.is-folded {
    height: auto;
    max-height: 72%;
  }

  .game__panel-head {
    padding: 14px 10px 8px;
    gap: 8px;
  }

  .game__grip {
    display: none;
  }

  .game__agent-mark {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .game__panel-tools {
    flex: 1 1 100%;
    gap: 6px 10px;
  }

  .game__share,
  .game__voice {
    min-height: 40px;
  }

  .game__settings,
  .game__fold {
    height: 40px;
    padding: 0 10px;
  }

  .game__log {
    max-height: none;
  }

  .game__brief {
    padding: 14px 14px 10px;
  }

  .game__form {
    position: sticky;
    bottom: 0;
    background: rgba(8, 10, 11, 0.98);
  }
}

@media (max-width: 720px) and (max-height: 620px) {
  .game__panel {
    height: 82%;
    max-height: 82%;
  }
}

@media (pointer: coarse) {
  .team__room {
    min-height: 44px;
  }

  .team__agent {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .team__room,
  .team__agent,
  .team__collapse,
  .team-sheet__close,
  .game-team-strip__agent {
    transition-duration: 0.01ms;
  }
}

