:root {
  color-scheme: dark;
  --bg: #101114;
  --surface-1: #191b20;
  --surface-2: #20242b;
  --surface-3: #262b33;
  --surface-subtle: var(--neutral-a025);
  --surface-raised: linear-gradient(180deg, var(--neutral-a045), var(--neutral-a015));
  --panel: var(--surface-1);
  --panel-2: var(--surface-2);
  --line: #303640;
  --line-strong: #44505d;
  --text: #f4f7fb;
  --muted: #aab4c0;
  --soft: #d7dde5;
  --teal: #14b8a6;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --rose: #fb7185;
  --green: #22c55e;
  --accent-contrast: #031311;
  --positive-text: #bbf7d0;
  --danger-text: #fecdd3;
  --warning-text: #fde68a;
  --accent-soft-text: #99f6e4;
  --topbar-bg: rgba(16, 17, 20, 0.92);
  --field-bg: #11151a;
  --card-bg: #151a20;
  --dialog-bg: #15181e;
  --menu-bg: rgba(17, 19, 24, 0.98);
  --panel-bg: rgba(25, 27, 32, 0.88);
  --surface-inset: rgba(15, 23, 42, 0.35);
  --surface-inset-strong: rgba(8, 14, 22, 0.55);
  --surface-floating: rgba(8, 14, 22, 0.92);
  --scrim: rgba(6, 8, 12, 0.68);
  --neutral-a015: rgba(255, 255, 255, 0.015);
  --neutral-a02: rgba(255, 255, 255, 0.02);
  --neutral-a022: rgba(255, 255, 255, 0.022);
  --neutral-a025: rgba(255, 255, 255, 0.025);
  --neutral-a028: rgba(255, 255, 255, 0.028);
  --neutral-a03: rgba(255, 255, 255, 0.03);
  --neutral-a035: rgba(255, 255, 255, 0.035);
  --neutral-a04: rgba(255, 255, 255, 0.04);
  --neutral-a045: rgba(255, 255, 255, 0.045);
  --neutral-a05: rgba(255, 255, 255, 0.05);
  --neutral-a055: rgba(255, 255, 255, 0.055);
  --neutral-a06: rgba(255, 255, 255, 0.06);
  --neutral-a07: rgba(255, 255, 255, 0.07);
  --neutral-a08: rgba(255, 255, 255, 0.08);
  --neutral-a09: rgba(255, 255, 255, 0.09);
  --neutral-a1: rgba(255, 255, 255, 0.1);
  --neutral-a12: rgba(255, 255, 255, 0.12);
  --neutral-a14: rgba(255, 255, 255, 0.14);
  --focus-ring: color-mix(in srgb, var(--cyan) 38%, transparent);
  --status-live: var(--teal);
  --status-replay: var(--cyan);
  --status-waiting: var(--amber);
  --status-settled: var(--muted);
  --status-danger: var(--rose);
  --radius: 8px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --editor-mobile-publish-bar-height: 64px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --font: Inter, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface-1: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f5;
  --surface-subtle: rgba(15, 23, 42, 0.025);
  --surface-raised: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 251, 0.96));
  --panel: var(--surface-1);
  --panel-2: var(--surface-2);
  --line: #d9e0e7;
  --line-strong: #b7c2cd;
  --text: #17212b;
  --muted: #5f6d7a;
  --soft: #344250;
  --teal: #087f73;
  --cyan: #147aa8;
  --amber: #ad5f00;
  --rose: #c23f59;
  --green: #18783a;
  --accent-contrast: #ffffff;
  --positive-text: #176c35;
  --danger-text: #a92f48;
  --warning-text: #8a5200;
  --accent-soft-text: #087568;
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --field-bg: #ffffff;
  --card-bg: #f8fafb;
  --dialog-bg: #ffffff;
  --menu-bg: rgba(255, 255, 255, 0.98);
  --panel-bg: rgba(255, 255, 255, 0.96);
  --surface-inset: #f6f8fa;
  --surface-inset-strong: #eef2f5;
  --surface-floating: rgba(255, 255, 255, 0.96);
  --scrim: rgba(23, 33, 43, 0.42);
  --neutral-a015: rgba(15, 23, 42, 0.015);
  --neutral-a02: rgba(15, 23, 42, 0.02);
  --neutral-a022: rgba(15, 23, 42, 0.022);
  --neutral-a025: rgba(15, 23, 42, 0.025);
  --neutral-a028: rgba(15, 23, 42, 0.028);
  --neutral-a03: rgba(15, 23, 42, 0.03);
  --neutral-a035: rgba(15, 23, 42, 0.035);
  --neutral-a04: rgba(15, 23, 42, 0.04);
  --neutral-a045: rgba(15, 23, 42, 0.045);
  --neutral-a05: rgba(15, 23, 42, 0.05);
  --neutral-a055: rgba(15, 23, 42, 0.055);
  --neutral-a06: rgba(15, 23, 42, 0.06);
  --neutral-a07: rgba(15, 23, 42, 0.07);
  --neutral-a08: rgba(15, 23, 42, 0.08);
  --neutral-a09: rgba(15, 23, 42, 0.09);
  --neutral-a1: rgba(15, 23, 42, 0.1);
  --neutral-a12: rgba(15, 23, 42, 0.12);
  --neutral-a14: rgba(15, 23, 42, 0.14);
  --shadow: 0 16px 42px rgba(23, 33, 43, 0.1);
  --focus-ring: color-mix(in srgb, var(--cyan) 28%, transparent);
}

.player-editor-react-root,
.player-editor-react-shell,
.player-editor-chat-column,
.player-editor-side-column,
.agent-turn,
.agent-message,
.agent-message__parts,
.agent-markdown {
  min-width: 0;
}

.player-editor-react-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.player-editor-chat-column,
.player-editor-side-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-editor-route__loading {
  display: block;
  min-width: 0;
}

.player-editor-route__loading .agent-thread-viewport {
  display: grid;
  place-items: center;
}

.agent-thread-viewport {
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
  max-height: min(68vh, 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  padding: 12px;
}

.agent-thread-first-use {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: 8px;
  background: var(--neutral-a025);
}

.agent-thread-first-use p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.agent-thread-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-thread-quick-prompts button {
  min-height: 40px;
  white-space: normal;
  text-align: left;
}

.agent-artifact-panel__result {
  margin: 0;
  color: var(--positive-text);
  font-size: 13px;
}

.agent-artifact-panel__result.is-error {
  color: var(--danger-text);
}

.agent-artifact-panel__mobile-summary {
  display: none;
}

.agent-turn {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-turn + .agent-turn {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.agent-message {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-message--user {
  background: rgba(59, 130, 246, 0.08);
}

.agent-message--assistant {
  background: rgba(15, 23, 42, 0.55);
}

.agent-message--pending {
  color: var(--muted);
}

.agent-message__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
}

.agent-markdown,
.agent-markdown p,
.agent-markdown li,
.agent-process-summary {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-markdown p {
  margin: 0 0 8px;
}

.agent-markdown p:last-child {
  margin-bottom: 0;
}

.agent-markdown ul,
.agent-markdown ol {
  margin: 8px 0;
  padding-left: 20px;
}

.agent-markdown li + li {
  margin-top: 4px;
}

.agent-markdown blockquote {
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--teal);
  background: rgba(20, 184, 166, 0.08);
  color: var(--soft);
}

.agent-markdown a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.agent-markdown input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  accent-color: var(--teal);
}

.agent-markdown pre {
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(2, 6, 23, 0.42);
}

.agent-markdown code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-markdown pre code {
  overflow-wrap: normal;
  word-break: normal;
}

.agent-markdown__table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 10px 0;
}

.agent-markdown table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.agent-markdown th,
.agent-markdown td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.agent-markdown th {
  background: var(--neutral-a06);
  color: var(--soft);
}

.agent-process {
  min-width: 0;
  border-left: 3px solid rgba(34, 197, 94, 0.55);
  padding-left: 8px;
}

.agent-process-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0;
}

.agent-process-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 0;
  padding-left: 18px;
}

.agent-process-item {
  min-width: 0;
}

.agent-process-title {
  display: block;
  font-weight: 700;
}

.agent-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.agent-composer textarea {
  min-width: 0;
  width: 100%;
  resize: vertical;
}

.agent-composer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.35);
  min-width: 0;
}

.editor-panel h2 {
  font-size: 16px;
  margin: 0;
}

.release-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.release-history-list li {
  display: grid;
  gap: 6px;
}

.release-history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.25);
  color: var(--text);
  padding: 8px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.release-history-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.release-history-toggle {
  white-space: nowrap;
}

.release-history-collapsed-note {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 2px;
}

@media (max-width: 720px) {
  .player-editor-react-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 0;
  }

  .player-editor-chat-column {
    order: 1;
  }

  .player-editor-side-column {
    order: 2;
  }

  .player-editor-react-shell.is-publishable {
    padding-bottom: calc(var(--editor-mobile-publish-bar-height) + env(safe-area-inset-bottom));
  }

  .agent-artifact-panel.is-publishable .agent-artifact-panel__actions {
    position: fixed;
    z-index: 18;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    min-height: calc(var(--editor-mobile-publish-bar-height) + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-1) 96%, transparent);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
  }

  .agent-artifact-panel.is-publishable .agent-artifact-panel__mobile-summary {
    display: inline;
    min-width: 0;
    margin-right: auto;
    color: var(--soft);
    font-size: 13px;
  }

  .agent-artifact-panel.is-publishable .agent-artifact-panel__actions button {
    width: auto;
    min-height: 44px;
    flex: 0 0 auto;
  }

  .agent-composer {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-composer-actions {
    justify-content: flex-end;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cyan) 70%, white);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Keep Arena's foreground token scoped inside the app when a host injects global body styles. */
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(280px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.brand:focus-visible {
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--neutral-a1);
  border-radius: 8px;
  background: var(--neutral-a035);
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.brand h1,
.brand p,
.section-head h2,
.section-head p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 1rem;
  line-height: 1.1;
  white-space: nowrap;
}

.brand p {
  display: none;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a03);
}

.nav-tab {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.nav-tab.active {
  background: var(--neutral-a06);
  color: var(--teal);
  font-weight: 600;
}

.user-panel {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}

.theme-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.theme-control__label {
  font-weight: 600;
}

.theme-control__options {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(38px, 1fr));
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--neutral-a025);
}

.theme-control__options button {
  min-width: 38px;
  min-height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
}

.theme-control__options button:hover {
  background: var(--neutral-a05);
  color: var(--text);
}

.theme-control__options button.active,
.theme-control__options button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
}

.theme-control:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-control__options button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.user-identity {
  flex-shrink: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

.dev-restart-btn {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px;
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

.dev-restart-btn:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, 0.75);
  background: rgba(251, 191, 36, 0.1);
}

.dev-restart-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-open-btn {
  flex-shrink: 0;
}

.login-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  min-width: min(100%, 360px);
  gap: 8px;
}

.login-form input,
.login-form button {
  font: inherit;
}

.login-form button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--neutral-a04);
  color: var(--soft);
}

.login-form input {
  flex: 1 1 120px;
  width: 140px;
  min-width: 120px;
}

.login-form button {
  flex-shrink: 0;
  white-space: nowrap;
}

.login-form input {
  width: 140px;
}

.profile-form {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.profile-form input,
.profile-form button,
.ghost-button {
  min-height: 38px;
  border-radius: var(--radius);
}

.profile-form input {
  width: 150px;
  min-width: 0;
}

.profile-form button,
.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--neutral-a04);
  color: var(--soft);
}

.profile-form button {
  padding: 0 11px;
}

.auth-surface {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-surface__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.auth-surface__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--dialog-bg);
  box-shadow: var(--shadow);
}

.auth-surface__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-surface__head h2 {
  margin: 0;
  font-size: 1rem;
}

.auth-surface .login-form {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: stretch;
  min-width: 0;
}

.auth-surface .login-form input,
.auth-surface .login-form button {
  width: 100%;
  min-width: 0;
}

.auth-provider-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-provider-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--neutral-a06);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.auth-provider-button:hover {
  background: var(--neutral-a1);
}

.auth-provider-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.arena-state-recovery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--status-danger) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--status-danger) 9%, var(--panel));
}

.arena-state-recovery[hidden] {
  display: none;
}

.arena-state-recovery h3,
.arena-state-recovery p {
  margin: 0;
}

.arena-state-recovery p {
  margin-top: 4px;
  color: var(--soft);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--neutral-a04);
  color: var(--soft);
  font-size: 1.2rem;
  line-height: 1;
}

main {
  flex: 1 0 auto;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.app-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 14px 22px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
}

.language-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.language-control select {
  min-height: 28px;
  border: 0;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
}

.language-control:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.app-footer .theme-control {
  opacity: 0.84;
}

.app-footer .theme-control:hover,
.app-footer .theme-control:focus-within {
  opacity: 1;
}

.footer-theme-group {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.footer-github-link {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  opacity: 0.84;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.footer-github-link:hover {
  border-color: var(--line-strong);
  background: var(--neutral-a04);
  color: var(--text);
  opacity: 1;
}

.footer-github-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  opacity: 1;
}

.footer-github-link svg {
  width: 18px;
  height: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 1.45rem;
}

.section-head p {
  margin-top: 4px;
  color: var(--muted);
}

.arena-home {
  display: grid;
  gap: 16px;
}

.arena-home__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.arena-home__eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.arena-home__head h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.home-chip-row {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a03);
}

.home-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--soft);
  white-space: nowrap;
}

.home-chip.is-active {
  border-color: color-mix(in srgb, var(--teal) 35%, transparent);
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  color: var(--text);
}

.home-room-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-room-card {
  overflow: hidden;
  border: 1px solid var(--neutral-a08);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--neutral-a035), var(--neutral-a015)), var(--surface-1);
  box-shadow: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.home-room-card:hover {
  border-color: var(--neutral-a14);
  background: linear-gradient(180deg, var(--neutral-a05), var(--neutral-a02)), var(--surface-1);
  transform: translateY(-1px);
}

.home-room-card__link {
  display: grid;
  color: inherit;
  text-decoration: none;
}

.home-room-card__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #0c1014;
}

.home-room-card__stage .game-panel,
.home-room-card__stage canvas {
  width: 100%;
  height: 100%;
}

.home-room-card__stage * {
  pointer-events: none;
}

.home-room-card__stage .game-panel {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.home-room-card__stage .game-panel--preview {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-content: stretch;
  background: #0c1014;
}

.home-room-card__stage .js-pong-panel--preview .pong-canvas-wrap {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.home-room-card__stage .js-snake-panel--preview {
  align-content: center;
  gap: 6px;
  padding: 10px;
}

.home-room-card__stage .js-snake-panel--preview .snake-score-legend {
  margin: 0;
  padding: 6px 8px;
  gap: 6px 8px;
  font-size: 0.72rem;
}

.home-room-card__stage .js-snake-panel--preview .snake-board-wrap {
  display: grid;
  min-height: 0;
  overflow: hidden;
  place-items: center;
}

.home-room-card__stage .js-snake-panel--preview .snake-board-canvas {
  display: block;
  width: min(100%, 560px);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--snake-board-aspect, 1 / 1);
}

.home-room-card__stage .js-bomberman-panel--preview {
  align-content: center;
  padding: 10px;
}

.home-room-card__stage .js-bomberman-panel--preview .js-bomberman-layout {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
}

.home-room-card__stage .js-bomberman-panel--preview .js-bomberman-board {
  --bm-cell-min: 0;
  width: min(100%, 720px);
  max-width: 100%;
  max-height: 100%;
  padding: 8px;
}

.home-room-card__stage .js-bomberman-panel--preview .bm-cell {
  overflow: hidden;
}

.home-room-card__stage .js-texas-holdem-panel--preview {
  padding: 10px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-stage {
  display: grid;
  height: 100%;
  min-height: 0;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-felt {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-regions {
  min-height: 0;
  height: 100%;
  gap: 6px;
  padding: 12px;
  grid-template-columns: minmax(82px, 0.7fr) minmax(116px, 0.95fr) minmax(82px, 0.7fr);
  grid-template-rows: minmax(78px, 0.75fr) minmax(112px, 1fr) minmax(78px, 0.75fr);
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-board-zone {
  gap: 7px;
  padding: 9px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-meta {
  gap: 5px;
  font-size: 0.68rem;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-meta span,
.home-room-card__stage .js-texas-holdem-panel--preview .holdem-pot-chip {
  padding: 3px 7px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-badge {
  width: min(100%, 156px);
  gap: 5px;
  padding: 7px;
  border-radius: 12px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-head,
.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-stats {
  gap: 5px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-pill {
  min-width: 28px;
  height: 22px;
  font-size: 0.7rem;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-name {
  font-size: 0.78rem;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-hole-card-backs span {
  width: 22px;
  height: 30px;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-card {
  width: 30px;
  height: 42px;
  border-radius: 7px;
  font-size: 0.82rem;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-line,
.home-room-card__stage .js-texas-holdem-panel--preview .status-badge {
  display: none;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-stats dt {
  font-size: 0.62rem;
}

.home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-stats dd {
  font-size: 0.78rem;
}

.home-room-card__stage-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.home-room-card__meta {
  display: grid;
  grid-template-rows: 22px minmax(22px, auto) minmax(24px, auto);
  gap: 8px;
  min-height: 118px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(12, 14, 18, 0.52);
}

.home-room-card__meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.home-room-card__title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
}

.home-room-card__sub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.home-room-card__sub span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-room-card__type,
.home-room-card__status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.home-room-card__type {
  max-width: min(52%, 180px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--neutral-a035);
}

.home-room-card__status {
  white-space: nowrap;
}

.home-room-card__status--live {
  border-color: color-mix(in srgb, var(--status-live) 45%, transparent);
  background: color-mix(in srgb, var(--status-live) 18%, transparent);
  color: var(--text);
}

.home-room-card__status--replay {
  border-color: color-mix(in srgb, var(--status-replay) 38%, transparent);
  background: color-mix(in srgb, var(--status-replay) 16%, transparent);
  color: var(--soft);
}

.home-room-card__status--waiting {
  border-color: color-mix(in srgb, var(--status-waiting) 38%, transparent);
  background: color-mix(in srgb, var(--status-waiting) 16%, transparent);
  color: #ffe0a6;
}

.home-room-card__status--settled {
  border-color: var(--line);
  background: var(--neutral-a035);
  color: var(--muted);
}

.home-room-card__status--danger {
  border-color: color-mix(in srgb, var(--status-danger) 38%, transparent);
  background: color-mix(in srgb, var(--status-danger) 16%, transparent);
  color: var(--danger-text);
}

.room-switcher {
  position: relative;
  z-index: 12;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
}

.room-switcher-shell {
  position: relative;
}

.room-switcher-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.room-switcher-button {
  display: inline-flex;
  min-height: 34px;
  gap: 6px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a03);
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
}

.room-home-link {
  display: inline-flex;
  min-height: 34px;
  gap: 6px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a03);
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
}

.room-home-link:hover,
.room-switcher-button:hover,
.room-switcher-shell.is-open .room-switcher-button {
  border-color: rgba(20, 184, 166, 0.38);
  background: rgba(20, 184, 166, 0.08);
  color: var(--text);
}

.room-switcher-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-a06);
  color: var(--muted);
  font-size: 0.78rem;
}

.room-switcher-button__chevron {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: currentColor;
  font-size: 0.78rem;
  transition: transform 0.16s ease;
}

.room-switcher-shell.is-open .room-switcher-button__chevron {
  transform: rotate(180deg);
}

.room-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: 360px;
  min-width: 320px;
  max-height: min(430px, calc(100vh - 180px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--menu-bg);
  box-shadow: var(--shadow);
}

.room-switcher-shell.is-open .room-switcher-menu {
  display: grid;
  gap: 10px;
}

.room-switcher-menu__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 0 2px 2px;
}

.ghost-button {
  padding: 0 14px;
}

.primary-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--teal) 70%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--teal) 88%, var(--accent-contrast));
  color: var(--accent-contrast);
  font-weight: 600;
}

.primary-button:disabled,
.small-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.arena-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr);
  gap: 14px;
  align-items: start;
}

.arena-grid--detail-only {
  grid-template-columns: minmax(0, 1fr);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.panel,
.room-detail {
  padding: 16px;
}

.room-detail {
  min-width: 0;
  max-width: 100%;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.panel h3 {
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.selectable-text,
.copyable-pre,
.raw-response,
.debug-raw,
.prepare-io-block,
.prepare-round-body,
.debug-lines,
.debug-line span,
.debug-text,
.debug-error,
.event-row,
.event-row span,
.loadout-brief-headline,
.loadout-brief-list li,
.prepare-rounds-summary,
.game-text-brief-panel,
.debug-card dd,
.room-detail {
  user-select: text;
  -webkit-user-select: text;
}

::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #f8fafc;
}

.copyable-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.copyable-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.copyable-block-head--solo {
  justify-content: flex-end;
}

.copyable-label {
  font-size: 0.72rem;
}

.copy-text-btn {
  flex: 0 0 auto;
  padding: 2px 8px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.prepare-round summary,
.debug-details summary,
.room-switcher-button,
.nav-tab,
.small-button,
.primary-button,
.ghost-button:not(.copy-text-btn) {
  user-select: none;
  -webkit-user-select: none;
}

.prepare-round-body,
.copyable-pre {
  user-select: text;
  -webkit-user-select: text;
}

.table-wrap,
.model-list,
.metric-grid,
#providerView,
#opsView {
  user-select: text;
  -webkit-user-select: text;
}

.table-wrap th,
.nav-tab,
.small-button:not(.copy-text-btn),
.room-switcher-button {
  user-select: none;
  -webkit-user-select: none;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stack-form label .field-hint {
  font-size: 0.8rem;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 8px !important;
  align-items: center;
}

.model-field-group {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-hint {
  margin: 0;
  line-height: 1.45;
  font-size: 0.82rem;
}

.check-row input {
  width: 16px;
  min-height: 16px;
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.room-list,
.model-list {
  display: grid;
  gap: 10px;
}

.room-card,
.model-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.room-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
}

.room-card.selected {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.65);
}

.room-card button {
  all: unset;
  cursor: pointer;
}

.room-list--switcher .room-card {
  padding: 10px 12px;
}

.room-list--switcher .room-card button {
  display: grid;
  width: 100%;
  gap: 5px;
}

.room-list--switcher .room-title-row strong {
  font-size: 0.95rem;
}

.room-title-row,
.status-row,
.contestant-row,
.model-title-row,
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.room-title-row strong,
.model-title-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  min-width: 76px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent-contrast);
  background: color-mix(in srgb, var(--status-live) 75%, var(--surface-1));
  text-align: center;
  font-size: 0.76rem;
  font-weight: 600;
}

.status-playing {
  background: var(--amber);
}

.status-settled {
  background: #94a3b8;
}

.status-waiting {
  background: var(--green);
}

.pool-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.room-detail.empty-state,
.empty-state {
  color: var(--muted);
}

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.detail-head__main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-head__status {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.detail-head__status strong {
  color: var(--soft);
  font-size: 0.9rem;
}

.room-match-head .detail-head__status {
  align-items: flex-end;
}

.room-match-overview__summary,
[data-room-detail-summary] {
  color: var(--muted);
}

.detail-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.meta-chip {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--neutral-a03);
  font-size: 0.82rem;
}

.contestant-list {
  display: grid;
  gap: 10px;
}

.contestant-row {
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.contestant-name {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  flex: 1 1 220px;
}

.color-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 75%, var(--surface-1));
}

.contestant-name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contestant-persona {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.contestant-stats {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.match-player-card-list {
  gap: 10px;
}

.match-player-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.next-match-box .match-player-card {
  border-left: 3px solid var(--amber);
}

.match-player-card--loadout {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.match-player-card__main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.match-player-card__text {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.match-player-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-player-card__name {
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-player-card__owner {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.match-player-card__seat {
  color: var(--muted);
  font-weight: 600;
}

.match-player-card__model {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.match-player-card__persona {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-player-card__badge--me {
  flex: 0 0 auto;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: var(--green);
  font-weight: 600;
}

.match-player-card__aside {
  flex: 0 0 auto;
  align-self: flex-start;
}

.loadout-brief-head .match-player-card--loadout {
  width: 100%;
}

.bet-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bet-controls input {
  width: 92px;
}

.contestant-prompt-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  flex: 1 1 100%;
  gap: 8px;
  align-items: start;
}

.contestant-prompt-form input[name="label"] {
  grid-column: 1 / -1;
}

.contestant-prompt-form textarea {
  min-height: 54px;
  resize: vertical;
}

.player-create-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-1);
}

.player-create-console .contestant-prompt-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px;
}

.player-create-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.player-create-field > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.player-create-field small,
.player-create-runtime-description,
.player-create-next-step {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.player-create-next-step {
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  background: color-mix(in srgb, var(--teal) 7%, transparent);
}

.runtime-segmented-control {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.runtime-segmented-control legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.runtime-segmented-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.runtime-segmented-option {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--neutral-a035);
  color: var(--soft);
  cursor: pointer;
  text-align: center;
}

.runtime-segmented-option input {
  position: absolute;
  inline-size: 1px;
  min-height: 1px;
  block-size: 1px;
  opacity: 0;
}

.runtime-segmented-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--teal) 58%, var(--line));
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  color: var(--teal);
}

.runtime-segmented-option:has(input:focus-visible) {
  outline: 2px solid color-mix(in srgb, var(--cyan) 70%, white);
  outline-offset: 2px;
}

.player-create-console :where(input, select, textarea, button) {
  min-height: 44px;
  max-width: 100%;
}

.player-create-actions {
  grid-template-columns: auto auto;
  justify-content: end;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.player-create-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
}

.player-create-console .player-create-submit {
  min-width: 120px;
  min-height: 44px;
}

@media (max-width: 720px) {
  .player-create-console {
    grid-template-columns: 1fr;
  }

  .player-create-actions {
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }

  .player-create-actions > a,
  .player-create-submit {
    width: 100%;
  }
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--neutral-a035);
  color: var(--soft);
}

.small-button.primary-button {
  border-color: color-mix(in srgb, var(--teal) 68%, var(--accent-contrast));
  background: color-mix(in srgb, var(--teal) 88%, var(--accent-contrast));
  color: var(--accent-contrast);
  font-weight: 600;
}

.room-back-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 6px;
  color: var(--teal);
  text-decoration-color: color-mix(in srgb, var(--teal) 46%, transparent);
  text-underline-offset: 3px;
}

.danger-button,
.small-button.danger {
  border-color: color-mix(in srgb, var(--rose) 42%, transparent);
  background: color-mix(in srgb, var(--rose) 12%, transparent);
  color: var(--danger-text);
}

.small-button.on {
  background: rgba(34, 197, 94, 0.12);
  color: var(--positive-text);
  border-color: rgba(34, 197, 94, 0.45);
}

.small-button.off {
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger-text);
  border-color: rgba(251, 113, 133, 0.45);
}

.ok-chip {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--positive-text);
  background: rgba(34, 197, 94, 0.1);
}

.warn-chip {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--danger-text);
  background: rgba(251, 113, 133, 0.1);
}

.settlement-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius);
  background: rgba(245, 158, 11, 0.1);
}

.next-match-box {
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(45, 212, 191, 0.08);
}

.player-match-layout,
.game-loadout-layout {
  display: grid;
  gap: 14px;
  margin: 14px 0;
  align-items: start;
  min-width: 0;
}

.player-match-layout {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 1fr);
}

.player-match-layout > .settlement-box,
.game-loadout-layout > .game-panel,
.game-loadout-layout > .loadout-brief-panel {
  margin: 0;
}

.room-page-shell {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.room-page-shell__priority {
  display: grid;
  gap: var(--space-2);
}

.room-page-shell__priority > .settlement-box {
  border-color: color-mix(in srgb, var(--teal) 34%, transparent);
  background: color-mix(in srgb, var(--teal) 8%, var(--surface-1));
}

.room-page-shell--playing .room-live-stage {
  padding: var(--space-1);
  border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
  border-radius: 12px;
  background: var(--surface-raised), var(--surface-1);
}

.room-page-shell > .game-panel,
.room-page-shell > .settlement-box {
  margin: 0;
}

.room-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  align-items: center;
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--neutral-a08);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--neutral-a035), var(--neutral-a015)), var(--surface-1);
  box-shadow: none;
}

.room-hud__main,
.room-hud__state {
  min-width: 0;
}

.room-hud__main {
  display: grid;
  gap: 2px;
  align-content: center;
}

.room-hud__label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.room-hud__main strong {
  overflow-wrap: anywhere;
  color: var(--soft);
  font-size: 0.96rem;
}

.room-hud__state {
  justify-self: end;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--status-live) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-live) 14%, transparent);
  color: var(--soft);
  font-weight: 700;
  white-space: nowrap;
}

.room-hud__mode,
.room-hud__metric span,
.room-hud__secondary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.room-hud__mode {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--status-live) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-live) 14%, transparent);
  color: var(--soft);
}

.room-hud__secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
}

.room-hud__secondary span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--neutral-a03);
}

.room-hud__event {
  border: 1px solid var(--neutral-a08);
  background: var(--neutral-a035);
  color: var(--soft);
}

.room-intelligence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.room-intelligence__section {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.room-intelligence__summary {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--soft);
  cursor: pointer;
  list-style: none;
}

.room-intelligence__summary::-webkit-details-marker {
  display: none;
}

.room-intelligence__summary::after {
  content: "▾";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.room-intelligence__section[open] > .room-intelligence__summary::after {
  transform: rotate(0deg);
}

.room-intelligence__summary span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  font-weight: 700;
}

.room-intelligence__summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.room-intelligence__section h3 {
  margin: 0;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
}

.room-intelligence__body {
  min-width: 0;
}

.room-intelligence__body > :first-child {
  margin-top: 0;
}

.room-intelligence__body > :last-child {
  margin-bottom: 0;
}

.room-care-tabs {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.room-care-tabs__list {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a03);
}

.room-care-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--soft);
  font-weight: 500;
}

.room-care-tab.is-active {
  border-color: color-mix(in srgb, var(--status-live) 35%, transparent);
  background: color-mix(in srgb, var(--status-live) 14%, transparent);
  color: var(--text);
  font-weight: 600;
}

.room-care-tab-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--neutral-a025), rgba(255, 255, 255, 0.01)), var(--surface-1);
}

.room-care-tab-panel > .settlement-box:first-child {
  margin-top: 0;
}

.room-players {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.game-leaderboard {
  display: grid;
  gap: 10px;
}

.game-leaderboard--collapsed {
  margin: 0;
}

.game-leaderboard-entry {
  display: flex;
  min-width: 0;
  min-height: 40px;
  width: 100%;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: 8px;
  color: var(--soft);
  text-align: left;
  background: var(--neutral-a035);
  cursor: pointer;
}

.game-leaderboard-entry:hover,
.game-leaderboard-entry:focus-visible {
  border-color: rgba(45, 212, 191, 0.34);
  background: rgba(45, 212, 191, 0.07);
}

.game-leaderboard-entry__title {
  flex: 0 0 auto;
  font-weight: 800;
}

.game-leaderboard-entry__summary {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-leaderboard-entry__action {
  flex: 0 0 auto;
  color: var(--accent-soft-text);
  font-size: 0.8rem;
  font-weight: 800;
}

.game-leaderboard__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.game-leaderboard__live-note {
  color: var(--warning-text);
}

.game-leaderboard__list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.game-leaderboard__row {
  display: grid;
  grid-template-columns: 42px minmax(120px, 1fr) repeat(3, minmax(54px, auto)) minmax(74px, auto);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: 6px;
  background: var(--neutral-a035);
}

.game-leaderboard__row--mine {
  border-color: rgba(45, 212, 191, 0.38);
  background: rgba(45, 212, 191, 0.08);
}

.game-leaderboard__row--highlight {
  border-color: rgba(45, 212, 191, 0.56);
  background: rgba(45, 212, 191, 0.1);
}

.game-leaderboard__row--compact {
  min-height: 38px;
}

.game-leaderboard__rank,
.game-leaderboard__result {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.game-leaderboard__player {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--soft);
  font-weight: 800;
}

.game-leaderboard__metric {
  display: grid;
  gap: 1px;
  justify-items: end;
  min-width: 0;
}

.game-leaderboard__metric strong {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
}

.game-leaderboard__metric small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.game-leaderboard__mine {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.game-leaderboard__mine > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.game-leaderboard__details,
.game-leaderboard__rules {
  color: var(--muted);
  font-size: 0.82rem;
}

.game-leaderboard__details summary,
.game-leaderboard__rules summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 800;
}

.game-leaderboard__list--all {
  margin-top: 8px;
}

.game-leaderboard__rules p {
  margin: 6px 0 0;
}

.game-leaderboard__empty {
  margin: 0;
}

.match-player-card__rank,
.match-seat-card__rank {
  margin: 0;
}

.player-rank-link {
  display: inline-flex;
  width: fit-content;
  min-width: 0;
  align-items: center;
  padding: 0;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.player-rank-link:hover,
.player-rank-link:focus-visible {
  color: var(--accent-soft-text);
  text-decoration: underline;
}

.player-rank-link--muted {
  cursor: default;
}

.player-rank-link--muted:hover,
.player-rank-link--muted:focus-visible {
  color: var(--muted);
  text-decoration: none;
}

.room-strategy {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.room-strategy__head {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.room-debug {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--neutral-a08);
  border-radius: 6px;
  background: var(--neutral-a02);
}

.room-debug__head {
  display: flex;
  min-height: 42px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  list-style: none;
}

.room-debug__head::-webkit-details-marker {
  display: none;
}

.room-debug__head::after {
  margin-left: auto;
  color: var(--muted);
  content: var(--i18n-expand, '展开');
  font-weight: 500;
}

.room-debug[open] > .room-debug__head::after {
  content: var(--i18n-collapse, '收起');
}

.room-debug__badge {
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--cyan) 26%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--cyan) 72%, var(--soft));
  font-size: 0.7rem;
  font-weight: 700;
}

.room-debug__body {
  min-width: 0;
  padding: 0 10px 10px;
  border-top: 1px solid var(--neutral-a06);
}

.room-strategy > .loadout-brief-panel,
.room-debug__body > .debug-panel,
.room-debug__body > .snake-debug-panel,
.room-debug__body > .holdem-debug-panel {
  margin: 0;
}

.room-events-feed {
  display: grid;
  gap: 6px;
}

.room-event-row {
  display: grid;
  grid-template-columns: 72px minmax(160px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.room-event-row span,
.room-replay-panel .pool-line {
  min-width: 0;
  overflow-wrap: anywhere;
}

.room-event-row__tick {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.room-event-row__detail {
  color: var(--muted);
}

.room-replay-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.room-replay-panel__head,
.room-replay-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.room-replay-panel__head p {
  margin: 4px 0 0;
}

.room-replay-controls {
  display: flex;
  justify-content: flex-start;
}

.room-replay-controls label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a035);
}

.room-replay-controls span {
  color: var(--muted);
  font-size: 0.82rem;
}

.room-replay-controls select {
  min-width: 84px;
  max-width: 220px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.room-replay-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--neutral-a06);
}

.room-replay-progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--status-replay) 48%, transparent);
}

.room-replay-scrub {
  width: 100%;
  margin: -2px 0 0;
  accent-color: var(--status-replay);
}

.room-replay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.replay-room {
  display: grid;
  gap: 16px;
}

.replay-room__header,
.replay-room__player,
.replay-room__loading,
.replay-room__strategy,
.replay-room__debug,
.replay-room__texas-hand-nav {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.replay-room__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.replay-room__loading {
  min-height: 180px;
  place-content: center;
}

.replay-room__stage-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 14px;
  align-items: start;
}

.replay-room__stage-shell--solo {
  grid-template-columns: minmax(0, 1fr);
}

.replay-room__stage-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.replay-room__stage {
  min-width: 0;
}

.replay-room__stage .game-panel,
.replay-room__stage canvas {
  max-width: 100%;
}

.replay-room__moment,
.replay-room__ranking {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.replay-room__moment {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.replay-room__moment span,
.replay-room__player-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.replay-room__ranking-head,
.replay-room__transport,
.replay-room__player-row,
.replay-room__texas-hand-head {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.replay-room__ranking-head,
.replay-room__transport,
.replay-room__texas-hand-head {
  justify-content: space-between;
}

.replay-room__player-row {
  display: grid;
  grid-template-columns: 22px 12px minmax(0, 1fr) minmax(44px, auto) minmax(48px, auto);
  min-height: 32px;
}

.replay-room__rank-index,
.replay-room__player-score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.replay-room__player-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--player-color, var(--status-replay));
}

.replay-room__player-status {
  color: var(--green);
  font-size: 0.82rem;
}

.replay-room__player-status--out {
  color: var(--muted);
}

.replay-room__transport {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.replay-room__transport label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a035);
}

.replay-room__transport select {
  min-width: 74px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.replay-room__texas-hand-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
}

.replay-room__texas-hand {
  display: grid;
  gap: 3px;
  min-width: 132px;
  max-width: 220px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: 6px;
  background: var(--neutral-a035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.replay-room__texas-hand span {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.replay-room__texas-hand--current {
  border-color: color-mix(in srgb, var(--status-replay) 62%, transparent);
  background: color-mix(in srgb, var(--status-replay) 16%, transparent);
}

.replay-view-entry {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 820px) {
  .replay-room__header,
  .replay-room__stage-shell,
  .replay-room__moment {
    grid-template-columns: 1fr;
  }

  .replay-room__header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .replay-room__player-row {
    grid-template-columns: 22px 12px minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 2px;
  }

  .replay-room__player-score,
  .replay-room__player-status {
    grid-column: 3;
    grid-row: 2;
  }

  .replay-room__player-score {
    justify-self: start;
  }

  .replay-room__player-status {
    justify-self: end;
  }

  .replay-room__transport {
    flex-wrap: wrap;
  }
}

.my-player-panel {
  display: grid;
  gap: 12px;
}

.my-player-panel--compact,
.match-players-panel {
  margin: 0;
  border-color: var(--neutral-a09);
  background: var(--neutral-a025);
}

.my-player-panel--compact {
  gap: 8px;
  padding: 10px 12px;
}

.my-player-panel--compact .room-title-row {
  align-items: center;
}

.my-player-panel__identity {
  min-width: 0;
}

.my-player-panel__identity p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.my-player-panel__manage {
  flex: 0 0 auto;
}

.my-player-panel .room-title-row {
  align-items: flex-start;
  gap: 10px;
}

.my-participation-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.my-player-panel__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(100%, 220px);
}

.my-player-panel__action {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.my-player-panel__action .small-button {
  white-space: normal;
}

.player-journey-status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  min-width: 0;
}

.my-player-panel--compact .player-journey-status-panel {
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--neutral-a07);
}

.my-player-panel--compact .player-journey-status-panel__copy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.my-player-panel--compact .player-journey-status-panel__copy > strong {
  font-size: 0.82rem;
}

.my-player-panel--compact .player-journey-status-panel__copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.my-player-panel--compact .my-player-panel__action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-journey-status-panel__copy {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.player-journey-status-panel .small-button {
  min-height: 44px;
}

.external-agent-details {
  border-top: 1px solid var(--neutral-a08);
  padding-top: 8px;
  min-width: 0;
}

.external-agent-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.my-player-edit-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--neutral-a08);
  padding-top: 10px;
  min-width: 0;
}

.external-agent-details__content {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  min-width: 0;
}

.runtime-select-row,
.hosted-player-field {
  display: grid;
  gap: 6px;
}

.runtime-select-row span,
.hosted-player-field span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.match-players-panel__action {
  display: flex;
  justify-content: flex-end;
}

.match-players-panel .room-title-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.match-players-panel__action .small-button {
  white-space: normal;
}

.match-players-panel__empty {
  margin: 12px 0 0;
}

.match-players-panel {
  padding: 10px 12px;
}

.my-player-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.my-player-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.my-player-summary-header > strong {
  color: var(--soft);
  font-size: 0.9rem;
}

.my-player-summary-header .small-button {
  flex: 0 0 auto;
}

.my-player-summary div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.55);
  min-width: 0;
}

.my-player-summary span,
.player-edit-form span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.my-player-summary strong,
.my-player-summary p {
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.my-player-summary p {
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.external-agent-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.5);
}

.strategy-release-history {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--neutral-a08);
}

.strategy-release-history__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.strategy-release-history__item p {
  margin: 6px 0 0;
}

.strategy-next-action {
  white-space: normal;
  text-align: left;
}

.player-editor-route {
  display: block;
}

.player-editor-route__context {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  min-width: 0;
}

.player-editor-route__crumb {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.player-editor-route__crumb span,
.player-editor-route__crumb strong {
  min-width: 0;
}

.player-editor-route__crumb strong {
  color: var(--text);
  font-weight: 650;
}

.player-editor-route__back,
.player-editor-route__room-cta {
  flex: 0 0 auto;
  white-space: nowrap;
}

.player-editor-shell {
  display: grid;
  gap: 12px;
}

.player-editor-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.5);
}

.player-editor-header h2 {
  margin: 6px 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.player-editor-mobile-tabs {
  display: none;
}

.player-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: start;
}

.player-editor-agent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.player-editor-main,
.player-editor-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.player-editor-agent-main,
.player-editor-agent-side {
  min-width: 0;
}

.player-editor-agent-side {
  display: grid;
  gap: 12px;
  max-height: min(72vh, 820px);
  overflow-y: auto;
  padding-right: 2px;
  align-self: start;
}

.agent-thread-shell {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
  min-height: min(760px, calc(100vh - 190px));
  min-width: 0;
}

.agent-thread-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.agent-thread-header p {
  margin: 3px 0 0;
}

.player-editor-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a025);
}

.player-editor-panel h3,
.player-editor-panel p {
  margin: 0;
}

.player-editor-strategy-panel {
  border-color: color-mix(in srgb, var(--green) 22%, var(--neutral-a08));
  background: color-mix(in srgb, var(--green) 5%, var(--neutral-a025));
}

.agent-artifact-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  align-self: start;
}

.agent-artifact-panel .status-row {
  align-items: stretch;
}

.agent-artifact-panel .status-row button {
  min-width: 0;
  white-space: normal;
}

.agent-resource-card {
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.28);
}

.strategy-release-panel__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.player-editor-strategy-panel__dynamic {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.36);
}

.player-editor-strategy-panel__dynamic ul {
  margin: 0;
  padding-left: 18px;
  color: var(--soft);
}

.player-editor-strategy-panel__dynamic li {
  margin: 3px 0;
}

.player-editor-profile {
  display: grid;
  gap: 10px;
  margin: 0;
}

.player-editor-profile div {
  display: grid;
  gap: 4px;
}

.player-editor-profile dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.player-editor-profile dd {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
}

.player-editor-thread {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-height: min(64vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
}

.agent-thread-frame {
  display: grid;
  gap: 4px;
  min-width: 0;
  position: relative;
}

.agent-thread-viewport-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.agent-thread-viewport {
  height: clamp(340px, 52vh, 680px);
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.agent-thread-resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 14px;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: row-resize;
}

.agent-thread-resize-handle span {
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
}

.agent-thread-resize-handle:hover span,
.agent-thread-resize-handle:focus-visible span {
  background: color-mix(in srgb, var(--cyan) 55%, rgba(148, 163, 184, 0.45));
}

.agent-thread-jump-button {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  max-width: calc(100% - 28px);
  padding: 6px 10px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  background: rgba(8, 14, 22, 0.92);
  color: var(--soft);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.agent-thread-jump-button:hover,
.agent-thread-jump-button:focus-visible {
  border-color: color-mix(in srgb, var(--cyan) 60%, rgba(56, 189, 248, 0.28));
  color: var(--text);
}

.agent-thread-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 2px 2px 8px;
  color: var(--soft);
  font-size: 0.84rem;
  font-weight: 800;
}

.agent-thread-toolbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.agent-thread-session-history {
  position: relative;
  flex: 0 0 auto;
}

.agent-thread-session-history__button,
.agent-thread-session-button {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.agent-thread-session-history__button {
  color: var(--soft);
}

.agent-thread-session-history__button:hover,
.agent-thread-session-history__button:focus-visible,
.agent-thread-session-button:hover:not(:disabled),
.agent-thread-session-button:focus-visible {
  border-color: color-mix(in srgb, var(--cyan) 55%, rgba(148, 163, 184, 0.22));
}

.agent-thread-session-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.agent-thread-session-history__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  width: min(340px, 82vw);
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(8, 14, 22, 0.98);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

.agent-thread-session-history__head {
  display: grid;
  gap: 2px;
}

.agent-thread-session-history__head strong {
  color: var(--text);
}

.agent-thread-session-history__head span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-thread-session-history__menu ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-thread-session-history__menu li {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.agent-thread-session-history__menu li span,
.agent-thread-session-history__menu li strong,
.agent-thread-session-history__menu li p,
.agent-thread-session-history__menu > p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-thread-session-history__menu li span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.agent-thread-session-history__menu li strong {
  color: var(--soft);
  font-size: 0.82rem;
}

.agent-thread-session-history__menu li p,
.agent-thread-session-history__menu > p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.agent-thread-session-history__audit-button {
  justify-self: start;
  margin-top: 4px;
  padding: 4px 8px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 7px;
  background: rgba(20, 184, 166, 0.08);
  color: var(--cyan);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
}

.agent-thread-session-history__audit-button:hover:not(:disabled),
.agent-thread-session-history__audit-button:focus-visible {
  border-color: rgba(45, 212, 191, 0.58);
}

.agent-thread-session-history__audit-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.agent-thread-session-history__transcript {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 9px;
  border: 1px solid rgba(45, 212, 191, 0.16);
  border-radius: 8px;
  background: rgba(8, 18, 24, 0.7);
}

.agent-thread-session-history__transcript > strong {
  color: var(--text);
  font-size: 0.82rem;
}

.agent-thread-session-history__transcript ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-thread-session-history__transcript li {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a022);
}

.agent-thread-session-history__transcript span,
.agent-thread-session-history__transcript p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-thread-session-history__transcript span {
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 850;
}

.agent-thread-session-history__transcript p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.agent-composer {
  position: static;
  padding-top: 2px;
  background: transparent;
}

.agent-composer__input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: 220px;
  resize: vertical;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

.agent-run-control {
  flex: 0 0 auto;
}

.player-editor-message {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.45);
}

.player-editor-message p {
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.player-editor-message--user {
  border-color: color-mix(in srgb, var(--cyan) 20%, transparent);
  background: color-mix(in srgb, var(--cyan) 8%, rgba(8, 14, 22, 0.45));
}

.player-editor-message--assistant {
  border-color: var(--neutral-a09);
}

.agent-message {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.45);
}

.agent-message--user {
  border-color: color-mix(in srgb, var(--cyan) 20%, transparent);
  background: color-mix(in srgb, var(--cyan) 8%, rgba(8, 14, 22, 0.45));
}

.agent-message__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.agent-message__meta strong {
  color: var(--text);
  font-size: 0.86rem;
}

.agent-message__copy-button {
  min-width: 0;
  padding: 3px 8px;
  border: 1px solid var(--neutral-a1);
  border-radius: 6px;
  background: var(--neutral-a04);
  color: var(--muted);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
}

.agent-message__copy-button:hover,
.agent-message__copy-button:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--cyan) 34%, transparent);
  outline: none;
}

.agent-message__copy-button.is-copied {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 38%, transparent);
}

.agent-message__parts {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.agent-tool-steps {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0 0 2px;
}

.agent-tool-step {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a025);
}

.agent-tool-step__summary-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  min-width: 0;
  cursor: pointer;
  list-style: none;
}

.agent-tool-step__summary-row::-webkit-details-marker {
  display: none;
}

.agent-tool-step__summary-row::after {
  content: var(--i18n-expand, "展开");
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
}

.agent-tool-step[open] > .agent-tool-step__summary-row::after {
  content: var(--i18n-collapse, "收起");
}

.agent-tool-step__status {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.agent-tool-step__label,
.agent-tool-step__summary {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-tool-step__label {
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.agent-tool-step__summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.agent-tool-groups {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.agent-tool-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: calc(var(--radius) - 3px);
  background: var(--neutral-a025);
}

.agent-tool-group__name,
.agent-tool-group__summary {
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-tool-group__name {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.agent-tool-group__status {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.agent-tool-group__summary {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
}

.agent-tool-step--running {
  border-color: color-mix(in srgb, var(--cyan) 28%, var(--neutral-a08));
}

.agent-tool-step--failed {
  border-color: color-mix(in srgb, var(--rose) 42%, var(--neutral-a08));
}

.agent-tool-step--changed,
.agent-tool-step--completed {
  border-color: color-mix(in srgb, var(--green) 22%, var(--neutral-a08));
}

.agent-part-text {
  margin: 0;
  color: var(--soft);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.agent-markdown {
  color: var(--soft);
  line-height: 1.55;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-markdown > * {
  margin: 0;
}

.agent-markdown > * + * {
  margin-top: 8px;
}

.agent-markdown h1,
.agent-markdown h2,
.agent-markdown h3,
.agent-markdown h4 {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.3;
}

.agent-markdown ul,
.agent-markdown ol {
  padding-left: 1.25rem;
}

.agent-markdown li + li {
  margin-top: 4px;
}

.agent-markdown__table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
}

.agent-markdown table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.agent-markdown th,
.agent-markdown td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--neutral-a08);
  text-align: left;
  vertical-align: top;
}

.agent-markdown th {
  color: var(--text);
  background: var(--neutral-a055);
  font-weight: 700;
}

.agent-markdown tr:last-child td {
  border-bottom: 0;
}

.agent-markdown code {
  max-width: 100%;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--neutral-a08);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
}

.agent-markdown pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(0, 0, 0, 0.24);
}

.agent-markdown pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.agent-markdown a {
  color: var(--cyan);
  text-decoration: none;
}

.agent-markdown a:hover {
  text-decoration: underline;
}

.agent-part {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a025);
}

.agent-part--running {
  border-color: color-mix(in srgb, var(--cyan) 34%, var(--neutral-a08));
  background: rgba(56, 189, 248, 0.055);
}

.agent-part--failed {
  border-color: color-mix(in srgb, var(--rose) 42%, var(--neutral-a08));
  background: rgba(251, 113, 133, 0.055);
}

.agent-part--release-candidate,
.agent-part--version-change {
  border-color: color-mix(in srgb, var(--cyan) 28%, var(--neutral-a08));
  background: rgba(56, 189, 248, 0.04);
}

.agent-part span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-part strong {
  color: var(--soft);
}

.agent-part p {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.agent-tool-process {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--cyan) 26%, var(--neutral-a08));
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--cyan) 4%, var(--neutral-a025));
}

.agent-tool-process > summary,
.agent-decision-code > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

.agent-tool-process > summary::marker,
.agent-decision-code > summary::marker {
  color: var(--muted);
}

.agent-tool-process > summary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.agent-tool-process > summary strong {
  font-size: 0.84rem;
}

.agent-tool-process__steps {
  display: grid;
  gap: 6px;
}

.agent-decision-code {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.agent-decision-code > summary {
  justify-content: flex-start;
  color: var(--teal);
  font-size: 0.84rem;
}

.agent-decision-code pre {
  max-height: 360px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--neutral-a09);
  border-radius: calc(var(--radius) - 4px);
  background: rgba(4, 10, 18, 0.62);
  color: var(--soft);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
}

.agent-part__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  margin: 2px 0 0;
  min-width: 0;
}

.agent-part__facts div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-part__facts dt,
.agent-part__facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-part__facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.agent-part__facts dd {
  color: var(--soft);
  font-size: 0.82rem;
}

.agent-part--reasoning {
  border-left: 3px solid color-mix(in srgb, var(--cyan) 36%, transparent);
}

.agent-part--decision {
  border-left: 3px solid color-mix(in srgb, var(--amber) 42%, transparent);
}

.agent-part--tool {
  border-left: 3px solid color-mix(in srgb, var(--green) 36%, transparent);
}

.agent-side-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.38);
}

.agent-manual-list {
  display: grid;
  gap: 7px;
}

.agent-manual-list p {
  display: grid;
  gap: 2px;
  margin: 0;
  color: var(--soft);
  line-height: 1.42;
}

.agent-manual-list strong {
  color: var(--muted);
  font-size: 0.75rem;
}

.player-editor-activity {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-editor-activity__step {
  padding: 4px 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--neutral-a035);
}

.player-editor-agent-transcript,
.player-editor-output-cards {
  display: grid;
  gap: 6px;
}

.player-editor-agent-transcript > summary,
.player-editor-agent-transcript__more > summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

.player-editor-agent-timeline {
  padding: 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a02);
}

.player-editor-agent-transcript__more {
  display: grid;
  gap: 6px;
}

.player-editor-agent-event,
.player-editor-output-card {
  padding: 8px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a025);
}

.player-editor-agent-event {
  display: grid;
  gap: 4px;
}

.player-editor-agent-event summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

.player-editor-agent-event--tool-call {
  border-left: 3px solid color-mix(in srgb, var(--cyan) 38%, transparent);
}

.player-editor-agent-event--tool-result {
  border-left: 3px solid color-mix(in srgb, var(--green) 36%, transparent);
}

.player-editor-output-cards > strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.player-editor-output-card {
  display: grid;
  gap: 6px;
}

.player-editor-output-card dl {
  display: grid;
  gap: 4px;
  margin: 0;
}

.player-editor-output-card dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.player-editor-output-card dd {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.player-editor-reasoning {
  display: grid;
  gap: 6px;
}

.player-editor-reasoning details {
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  padding: 8px;
  background: var(--neutral-a025);
}

.player-editor-reasoning summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

.player-editor-reasoning dl,
.player-manual {
  display: grid;
  gap: 8px;
}

.player-editor-reasoning dt,
.player-manual-section h4 {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.player-editor-reasoning dd,
.player-editor-reasoning ul,
.player-manual-section p,
.player-manual-section ul {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.player-manual-section {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.32);
}

.player-manual-empty {
  padding: 10px;
  border: 1px dashed var(--neutral-a12);
  border-radius: calc(var(--radius) - 2px);
}

.player-editor-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.player-editor-composer textarea {
  min-height: 72px;
  min-width: 0;
  resize: vertical;
}

.player-editor-diff {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--amber) 24%, transparent);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
}

.player-editor-diff__row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.player-editor-diff__row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.player-editor-diff__row p {
  color: var(--soft);
  overflow-wrap: anywhere;
}

.player-editor-diff del {
  color: var(--muted);
  text-decoration-color: var(--rose);
}

.player-editor-diff ins {
  color: var(--soft);
  text-decoration-color: var(--green);
}

.player-editor-draft-state {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--cyan) 6%, transparent);
}

.player-editor-draft-state p {
  margin: 0;
}

.player-editor-workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.player-editor-workflow span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a04);
  color: var(--soft);
  font-weight: 700;
  text-align: center;
}

.player-editor-artifact {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.38);
}

.player-editor-artifact details {
  display: grid;
  gap: 8px;
}

.player-editor-artifact summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

.player-editor-publish-notes {
  display: grid;
  gap: 6px;
}

.player-editor-publish-notes span,
.strategy-release-compare strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.player-editor-publish-notes textarea {
  min-height: 64px;
  resize: vertical;
}

.strategy-release-compare {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--neutral-a07);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.32);
}

.external-agent-actions {
  justify-content: flex-start;
}

.external-agent-ready-state {
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.external-prepare-time {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.external-agent-token-box {
  display: grid;
  gap: 8px;
}

.external-agent-config-box {
  padding-top: 4px;
}

.agent-config-tabs {
  display: flex;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(2, 6, 12, 0.45);
}

.agent-config-tab {
  flex: 1 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.agent-config-tab:last-child {
  border-right: 0;
}

.agent-config-tab.is-active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.14);
}

.agent-mcp-config {
  max-height: 240px;
}

.external-agent-context {
  max-height: 360px;
}

.external-create-hint {
  margin: 0;
  line-height: 1.45;
}

.player-edit-form {
  display: grid;
  gap: 10px;
}

.player-edit-form label {
  display: grid;
  gap: 6px;
}

.player-edit-form textarea {
  resize: vertical;
}

.danger-confirm-box {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.match-seat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.match-seat-grid--snake-4p {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.match-seat-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111820;
}

.match-seat-card.is-dead {
  opacity: 0.62;
}

.match-seat-card.is-winner {
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.18);
}

.match-seat-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-seat-card__head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-seat-card__seat {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.match-seat-card__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.match-player-card__badge--winner {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  color: var(--warning-text);
  font-size: 0.72rem;
  font-weight: 600;
}

.loadout-player-head {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  flex-wrap: wrap;
}

.loadout-player-head .match-player-card__main {
  flex: 1 1 120px;
  min-width: 0;
}

.game-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--neutral-a025);
}

.game-panel-head,
.dealer-row,
.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.game-panel-head {
  justify-content: space-between;
}

.dealer-row {
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #12171d;
}

.js-bomberman-panel {
  gap: 12px;
}

.js-pong-panel {
  display: grid;
  gap: 12px;
}

.js-pong-panel .pong-side {
  min-width: 0;
}

.js-texas-holdem-panel {
  gap: 14px;
}

.holdem-broadcast-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 14px;
  align-items: stretch;
}

.holdem-table-stage {
  min-width: 0;
}

.holdem-table-felt {
  position: relative;
  display: grid;
  min-height: 520px;
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 44%, rgba(34, 197, 94, 0.28), rgba(15, 118, 110, 0.2) 35%, rgba(15, 23, 42, 0.96) 72%),
    linear-gradient(135deg, rgba(22, 101, 52, 0.45), rgba(15, 23, 42, 0.92));
  box-shadow: inset 0 0 0 10px rgba(15, 23, 42, 0.45), inset 0 0 42px rgba(0, 0, 0, 0.42);
}

.holdem-table-regions {
  display: grid;
  grid-template-areas:
    "top top top"
    "left board right"
    "bottom bottom bottom";
  grid-template-columns: minmax(138px, 0.72fr) minmax(210px, 0.9fr) minmax(138px, 0.72fr);
  grid-template-rows: minmax(112px, auto) minmax(170px, 1fr) minmax(112px, auto);
  gap: 10px;
  width: 100%;
  min-height: inherit;
  padding: 22px;
}

.holdem-table-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.holdem-table-meta span,
.holdem-pot-chip {
  padding: 5px 9px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
}

.holdem-board-zone {
  grid-area: board;
  align-self: center;
  justify-self: center;
  z-index: 1;
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.28);
}

.holdem-pot-chip {
  color: var(--warning-text);
  border-color: rgba(250, 204, 21, 0.42);
  background: rgba(120, 53, 15, 0.48);
  font-weight: 800;
}

.holdem-community-cards {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.holdem-settlement-cue {
  display: grid;
  gap: 3px;
  max-width: min(320px, 100%);
  padding: 9px 12px;
  border: 1px solid rgba(250, 204, 21, 0.46);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.92);
  color: #f8fafc;
  text-align: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
}

.holdem-settlement-cue strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.holdem-settlement-cue span {
  color: var(--warning-text);
  font-size: 0.78rem;
}

.holdem-card,
.holdem-hole-card-backs span {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 56px;
  border: 1px solid rgba(226, 232, 240, 0.74);
  border-radius: 9px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.holdem-card--empty,
.holdem-hole-card-backs span {
  border-color: rgba(148, 163, 184, 0.35);
  background: repeating-linear-gradient(45deg, #1e293b, #1e293b 4px, #334155 4px, #334155 8px);
  color: rgba(226, 232, 240, 0.64);
}

.holdem-seat-ring {
  pointer-events: auto;
}

.holdem-seat-region {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.holdem-seat-region--top {
  grid-area: top;
  align-items: start;
}

.holdem-seat-region--left {
  grid-area: left;
  justify-content: start;
}

.holdem-seat-region--right {
  grid-area: right;
  justify-content: end;
}

.holdem-seat-region--bottom {
  grid-area: bottom;
  align-items: end;
}

.holdem-seat-badge {
  box-sizing: border-box;
  z-index: 2;
  display: grid;
  width: min(100%, 218px);
  max-width: 100%;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.holdem-seat--acting {
  border-color: rgba(34, 197, 94, 0.72);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15), 0 20px 40px rgba(0, 0, 0, 0.34);
}

.holdem-seat--folded {
  opacity: 0.58;
  filter: grayscale(0.45);
}

.holdem-seat-head,
.holdem-seat-stats,
.holdem-decision-panel header,
.holdem-action-options {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.holdem-seat-pill {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
  font-size: 0.78rem;
  font-weight: 800;
}

.holdem-seat-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holdem-hole-card-backs {
  display: flex;
  gap: 4px;
}

.holdem-hole-card-backs span {
  width: 28px;
  height: 38px;
  border-radius: 6px;
}

.holdem-seat-stats {
  justify-content: space-between;
}

.holdem-seat-stats div {
  display: grid;
  gap: 1px;
}

.holdem-seat-stats dt {
  color: var(--muted);
  font-size: 0.68rem;
}

.holdem-seat-stats dd {
  margin: 0;
  color: var(--soft);
  font-weight: 800;
}

.holdem-seat-line,
.holdem-player-insights p {
  margin: 0;
}

.holdem-seat-line {
  color: #cbd5e1;
  font-size: 0.78rem;
  line-height: 1.35;
}

.holdem-decision-panel,
.holdem-player-insights,
.holdem-public-feed > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.6);
}

.holdem-decision-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.holdem-decision-timer {
  color: var(--warning-text);
  font-size: 0.86rem;
}

.holdem-action-options span {
  color: var(--muted);
}

.holdem-player-insights {
  display: grid;
  gap: 10px;
}

.holdem-insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.holdem-insight-grid article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: var(--neutral-a03);
}

.holdem-insight-grid article.is-current {
  border-color: rgba(34, 197, 94, 0.42);
}

.holdem-insight-grid span {
  color: var(--muted);
  font-size: 0.78rem;
}

.holdem-insight-grid p {
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.holdem-public-feed {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 12px;
}

.holdem-street-feed {
  display: grid;
  gap: 10px;
}

.holdem-timeline-scroll,
.holdem-hand-history-scroll {
  max-height: min(420px, 46vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.holdem-street-section {
  display: grid;
  gap: 6px;
}

.holdem-street-section h5 {
  margin: 0;
  color: #bfdbfe;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.holdem-street-action {
  padding: 7px 8px;
  border-radius: 10px;
  background: var(--neutral-a028);
}

.holdem-reactions {
  display: grid;
  gap: 8px;
}

.holdem-reaction-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: var(--neutral-a028);
}

.holdem-reaction-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.holdem-reaction-card header strong {
  color: var(--soft);
}

.holdem-reaction-card header em {
  padding: 2px 7px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 999px;
  color: #bfdbfe;
  font-style: normal;
  background: rgba(59, 130, 246, 0.12);
}

.holdem-reaction-lines {
  display: grid;
  gap: 6px;
}

.holdem-reaction-lines p {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  margin: 0;
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.holdem-reaction-type {
  align-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--warning-text);
  background: rgba(120, 53, 15, 0.35);
  white-space: nowrap;
}

.loadout-brief-card.not_ready {
  border-color: rgba(251, 113, 133, 0.45);
}

.pong-broadcast-head,
.pong-meta-row,
.pong-event-row,
.pong-player-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pong-broadcast-head {
  justify-content: space-between;
}

.pong-score-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  line-height: 1;
}

.pong-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.pong-player-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-left: 4px solid var(--pong-player-color, #7dd3fc);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.72);
}

.pong-player-main {
  justify-content: space-between;
}

.pong-side {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.pong-score {
  color: var(--pong-player-color, #7dd3fc);
  font-size: 1.35rem;
}

.pong-canvas-wrap {
  width: min(100%, 980px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #06111f;
}

.pong-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pong-meta-row,
.pong-event-row {
  color: var(--muted);
  font-size: 0.86rem;
}

.pong-event {
  padding: 4px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
}

.pong-debug {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(2, 6, 23, 0.35);
}

.pong-debug-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.loadout-brief-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(14, 32, 48, 0.92), rgba(10, 18, 28, 0.95));
  min-width: 0;
  overflow: hidden;
}

.loadout-brief-panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.loadout-brief-panel-title .muted {
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.loadout-brief-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  min-width: 0;
}

.loadout-brief-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(8, 14, 22, 0.72);
  min-width: 0;
  overflow: hidden;
}

.loadout-brief-card.loading,
.loadout-brief-card.pending {
  border-color: rgba(125, 211, 252, 0.28);
  animation: loadout-pulse 1.6s ease-in-out infinite;
}

.loadout-brief-card.fallback {
  border-color: rgba(251, 191, 36, 0.35);
}

@keyframes loadout-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}

.loadout-brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.loadout-brief-chip {
  flex: 0 1 auto;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.16);
  color: #bae6fd;
  font-size: 0.68rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.loadout-brief-headline {
  margin: 0;
  color: #f8fafc;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.loadout-brief-section {
  min-width: 0;
}

.loadout-brief-section h4 {
  margin: 0 0 4px;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.loadout-brief-list {
  margin: 0;
  padding-left: 1.1em;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.5;
  min-width: 0;
}

.loadout-brief-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.prepare-rounds-summary {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.loadout-brief-skills {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.loadout-brief-skills li {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--neutral-a04);
}

.loadout-brief-skills strong {
  color: var(--warning-text);
  font-size: 0.78rem;
}

.loadout-brief-skills span {
  color: #cbd5e1;
  font-size: 0.74rem;
  line-height: 1.45;
}

.js-snake-panel .snake-score-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a03);
}

.snake-score-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text);
}

.snake-score-legend-item.dead {
  opacity: 0.5;
}

.snake-score-legend-item.food {
  color: var(--muted);
}

.snake-player-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.snake-player-swatch.snake-food-swatch {
  background: radial-gradient(circle at 42% 38%, #f0abfc 0%, #d946ef 42%, #a21caf 100%);
}

.snake-score-card strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.js-snake-panel .snake-score-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 12px;
}

.snake-score-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: var(--neutral-a03);
}

.snake-score-card.dead {
  opacity: 0.55;
}

.snake-board-wrap {
  display: grid;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  padding-bottom: 0;
}

.snake-board-canvas {
  display: block;
  width: min(100%, 520px);
  height: auto;
  max-height: min(70vh, 640px);
  aspect-ratio: var(--snake-board-aspect, 1 / 1);
  border: 1px solid var(--neutral-a08);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(0, 0, 0, 0.35);
}

.snake-debug-panel {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.snake-debug-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.bomberman-match-banner {
  display: flex;
  min-width: 0;
  min-height: 48px;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111820;
}

.bomberman-match-banner strong {
  font-size: 0.98rem;
}

.bomberman-match-banner span {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.bomberman-match-banner.live {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.1);
}

.bomberman-match-banner.winner {
  border-color: rgba(250, 204, 21, 0.48);
  background: rgba(250, 204, 21, 0.12);
}

.bomberman-match-banner.draw {
  border-color: rgba(148, 163, 184, 0.48);
  background: rgba(148, 163, 184, 0.12);
}

.bomberman-score-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.bomberman-score-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111820;
}

.bomberman-score-card.dead {
  opacity: 0.62;
}

.bomberman-score-card strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bomberman-score-card span,
.bomberman-score-card small {
  color: var(--muted);
  font-size: 0.82rem;
}

.js-bomberman-layout {
  display: grid;
  grid-template-columns: minmax(360px, 900px) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.js-bomberman-layout--board-only {
  grid-template-columns: minmax(0, 900px);
}

.js-bomberman-board {
  --bm-cell-min: 30px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--bm-cols), minmax(var(--bm-cell-min), 1fr));
  grid-template-rows: repeat(var(--bm-rows), minmax(var(--bm-cell-min), 1fr));
  width: min(100%, 900px);
  aspect-ratio: var(--bm-cols) / var(--bm-rows);
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #080c11;
}

.bm-cell-layer {
  display: contents;
}

.bm-entity-layer {
  position: absolute;
  inset: 10px;
  z-index: 6;
  pointer-events: none;
}

.bm-entity {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: calc(100% / var(--bm-cols));
  height: calc(100% / var(--bm-rows));
  place-items: center;
  transition-property: transform;
  transition-timing-function: linear;
  transform: translate(0%, 0%);
}

.bm-entity.no-transition {
  transition-duration: 0ms !important;
}

.bm-entity-player {
  z-index: 4;
}

.bm-entity-bomb {
  z-index: 3;
}

.bm-entity-flame {
  z-index: 2;
}

.bm-entity-powerup {
  z-index: 1;
}

.bm-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: visible;
  border: 1px solid var(--neutral-a025);
  background: #142018;
}

.bm-cell.solid {
  background: #263241;
  box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.1);
}

.bm-cell.brick {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 48%, transparent 48% 52%, rgba(0, 0, 0, 0.18) 52%),
    #8a5a32;
}

.bm-cell.danger {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.58);
}

.bm-cell.flame:not(.flame-sprite) {
  background: #f97316;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.65);
}

.bm-cell.flame.flame-sprite {
  background: rgba(249, 115, 22, 0.18);
  box-shadow: inset 0 0 10px rgba(249, 115, 22, 0.35);
}

.bm-cell.player b {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 80%;
  height: 80%;
  place-items: center;
  border-radius: 50%;
  color: #061017;
  font-size: clamp(0.58rem, 1vw, 0.82rem);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.bm-player-sprite {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  display: block;
  width: auto;
  height: 88%;
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  pointer-events: none;
  --bm-sprite-shadow: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
  filter: var(--bm-sprite-shadow);
}

.bm-player-sprite.is-p2 {
  --bm-sprite-tint: hue-rotate(158deg) saturate(1.4) brightness(1.03);
  filter: var(--bm-sprite-shadow) var(--bm-sprite-tint);
}

.bm-player-sprite.is-dead {
  opacity: 0.72;
}

.bm-player-sprite.is-p2.is-dead {
  --bm-sprite-tint: hue-rotate(158deg) saturate(1.2) brightness(0.92);
}

.bm-effect {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-origin: center center;
}

.bm-effect img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.bm-bomb-sprite {
  z-index: 3;
}

.bm-bomb-fuse {
  position: absolute;
  top: -2px;
  right: -2px;
  z-index: 4;
  min-width: 1.1em;
  padding: 0 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.bm-flame-sprite {
  z-index: 1;
}

.bm-powerup-sprite {
  z-index: 2;
}

.bm-powerup-sprite img {
  object-fit: contain;
}

.bm-powerup-tag {
  position: absolute;
  right: 1px;
  bottom: 0;
  z-index: 5;
  color: #fff9c4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.45rem, 1.1vw, 0.58rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  pointer-events: none;
  text-shadow:
    0 0 2px #1a0a00,
    1px 0 0 #1a0a00,
    -1px 0 0 #1a0a00,
    0 1px 0 #1a0a00,
    0 -1px 0 #1a0a00;
}

.bm-cell.powerup:not(.powerup-sprite) {
  background: rgba(253, 230, 138, 0.12);
}

.bm-cell.bomb .bm-bomb-sprite {
  z-index: 3;
}

.bm-bomb,
.bm-power {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 78%;
  height: 78%;
  place-items: center;
  border-radius: 999px;
  font-size: clamp(0.62rem, 1.6vw, 0.78rem);
  font-weight: 900;
}

.bm-bomb {
  background: #0f172a;
  color: #f8fafc;
  border: 2px solid #64748b;
}

.bm-power {
  background: var(--warning-text);
  color: #422006;
}

.bomberman-side {
  display: grid;
  gap: 10px;
}

@media (min-width: 1120px) {
  .player-match-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  }

  .game-loadout-layout {
    grid-template-columns: minmax(0, 900px) minmax(300px, 420px);
  }

  .game-loadout-layout > .loadout-brief-panel {
    align-self: stretch;
    min-width: 0;
  }

  .game-loadout-layout .loadout-brief-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .detail-head {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.9fr);
  }

  .player-match-layout {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.9fr);
  }

  .my-player-summary,
  .player-editor-grid,
  .player-editor-agent-layout,
  .match-seat-grid,
  .match-seat-grid--snake-4p {
    grid-template-columns: 1fr;
  }

  .player-editor-agent-side {
    max-height: none;
  }

  .agent-thread-shell {
    min-height: 0;
  }

  .agent-thread-viewport {
    height: clamp(300px, 48vh, 540px);
  }

  .agent-composer__input {
    max-height: 180px;
  }

  .agent-composer-actions {
    flex-wrap: wrap;
  }

  .agent-artifact-panel {
    width: 100%;
  }

  .player-editor-header {
    display: grid;
  }

  .player-editor-panel .status-row {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .player-editor-panel .status-row .small-button {
    width: 100%;
    justify-content: center;
  }

  .player-editor-composer,
  .player-editor-diff__row {
    grid-template-columns: 1fr;
  }

  .player-editor-composer .small-button {
    width: 100%;
    justify-content: center;
  }

  .my-player-panel__status,
  .my-player-panel__action {
    justify-content: flex-start;
  }

  .my-player-panel__status {
    min-width: 0;
  }

  .my-player-summary-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .strategy-release-panel__actions {
    justify-content: flex-start;
  }

  .js-bomberman-layout {
    grid-template-columns: 1fr;
  }

  .js-bomberman-board {
    --bm-cell-min: 24px;
    width: min(100%, 100%);
  }
}

@media (max-width: 720px) {
  .my-player-summary-header > .status-row {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .my-player-summary-header > .status-row > .small-button,
  .my-player-more-actions > summary {
    box-sizing: border-box;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .my-player-more-actions {
    max-width: 100%;
    min-width: 0;
  }

  .player-journey-status-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .player-journey-status-panel .my-player-panel__action {
    width: 100%;
  }

  .player-journey-status-panel .my-player-panel__action :where(button, a) {
    width: 100%;
    justify-content: center;
  }

  .room-hud {
    grid-template-columns: 1fr;
  }

  .room-hud__state {
    justify-self: start;
    white-space: normal;
  }

  .room-intelligence {
    grid-template-columns: 1fr;
  }

  .room-event-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .room-event-row span:last-child {
    grid-column: 1 / -1;
  }
}

.danger-button {
  border-color: color-mix(in srgb, var(--rose) 42%, transparent);
  background: color-mix(in srgb, var(--rose) 12%, transparent);
  color: var(--danger-text);
}

.debug-panel {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  min-width: 0;
}

.debug-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #10151b;
  min-width: 0;
}

.debug-card-title {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.debug-lines {
  display: grid;
  gap: 6px;
}

.debug-line {
  margin: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 0.8rem;
}

.debug-line strong {
  color: var(--muted);
  font-weight: 700;
}

.debug-line span {
  color: var(--soft);
  overflow-wrap: anywhere;
}

.debug-details {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.debug-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
}

.debug-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  margin: 6px 0 0;
  font-size: 0.78rem;
}

.debug-card dt {
  color: var(--muted);
}

.debug-card dd {
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.debug-card-wide {
  grid-column: 1 / -1;
}

.prepare-trace-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.prepare-trace-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.prepare-round {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #0b0f14;
}

.prepare-round summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  list-style: none;
}

.prepare-round-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.prepare-io-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.prepare-io-block h5 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.prepare-io-label {
  margin: 4px 0 2px;
  font-size: 0.72rem;
}

.prepare-io-pre {
  max-height: min(320px, 42vh);
}

.raw-response {
  max-height: min(280px, 38vh);
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  scrollbar-gutter: stable both-edges;
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #0b0f14;
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  tab-size: 2;
  user-select: text;
  -webkit-user-select: text;
}

.copyable-pre {
  max-height: min(320px, 42vh);
}

.error-text {
  margin: 0;
  color: #fecaca;
  font-size: 0.82rem;
}

.event-list {
  display: grid;
  gap: 6px;
}

.event-list-full {
  max-height: min(420px, 50vh);
  overflow-y: auto;
  padding-right: 4px;
}

.event-log-head {
  margin-top: 12px;
}

.event-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.event-row strong {
  color: var(--soft);
}

.debug-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  font-size: 0.78rem;
}

.debug-kv span {
  color: var(--muted);
}

.debug-kv b {
  overflow-wrap: anywhere;
  color: var(--soft);
  font-weight: 650;
}

.debug-text,
.debug-error {
  margin: 0;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.debug-error {
  color: #fecaca;
}

.debug-raw {
  max-height: min(280px, 38vh);
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  scrollbar-gutter: stable both-edges;
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #0b0f14;
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  tab-size: 2;
  user-select: text;
  -webkit-user-select: text;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.model-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.model-settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.1fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--neutral-a08);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--neutral-a025), rgba(255, 255, 255, 0.01)), var(--surface-1);
  box-shadow: none;
}

.model-settings-row .model-edit,
.model-settings-row > p {
  grid-column: 1 / -1;
}

.model-title-row {
  align-items: start;
}

.model-settings-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.model-settings-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.model-settings-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.model-settings-editor {
  border-top: 1px solid var(--neutral-a08);
  padding-top: 10px;
}

.model-settings-editor__body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a025);
}

.model-settings-editor__form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin-top: 0;
}

.model-settings-group {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a02);
}

.model-settings-advanced {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--neutral-a07);
  border-radius: 6px;
  background: var(--neutral-a02);
}

.model-settings-group legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.model-settings-advanced > summary {
  color: var(--soft);
  font-weight: 600;
  cursor: pointer;
}

.model-settings-advanced__body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.proxy-status {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.model-edit {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.model-edit summary,
.config-details summary {
  cursor: pointer;
  color: var(--soft);
}

.model-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.model-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.model-edit-form .primary-button {
  grid-column: 1 / -1;
}

.full-span {
  grid-column: 1 / -1;
}

.config-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.config-output {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1116;
  color: #dbeafe;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
  width: min(180px, 100%);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--neutral-a045), var(--neutral-a02));
}

.metric-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 1.55rem;
}

.ops-columns {
  grid-template-columns: 1fr 1fr;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

td {
  color: var(--soft);
  font-size: 0.88rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0f1419;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .user-panel {
    justify-content: flex-start;
  }

  .arena-grid,
  .two-column,
  .ops-columns {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 1200px) {
  .holdem-broadcast-layout {
    grid-template-columns: 1fr;
  }

  .holdem-decision-panel {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .game-leaderboard__row {
    grid-template-columns: 34px minmax(0, 1fr) repeat(3, minmax(44px, auto));
  }

  .game-leaderboard__result {
    grid-column: 2 / -1;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .room-switcher {
    width: 100%;
  }

  .room-switcher-actions {
    justify-content: space-between;
  }

  .room-switcher-menu {
    left: 0;
    right: auto;
    width: min(360px, calc(100vw - 44px));
    min-width: 0;
  }
}

.external-preview-dialog {
  box-sizing: border-box;
  width: min(900px, calc(100vw - 32px));
  max-width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.external-workspace {
  display: grid;
  width: min(980px, 100%);
  min-width: 0;
  margin: 0 auto;
  gap: 20px;
}

.external-workspace__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.external-workspace__header h2 {
  margin: 10px 0 0;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.external-workspace__identity {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.external-workspace__identity strong {
  color: var(--text);
}

.external-workspace__main {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.external-workspace__hero {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: clamp(44px, 8vw, 86px) clamp(20px, 6vw, 72px);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--teal) 11%, transparent), transparent 54%),
    var(--surface-1);
}

.external-workspace__hero :where(h3, p) {
  max-width: 650px;
  margin: 0;
}

.external-workspace__hero h3 {
  margin-top: 10px;
  font-size: clamp(1.65rem, 4vw, 2.65rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.external-workspace__hero > p:not(.external-workspace__eyebrow, .external-workspace__trust) {
  margin-top: 18px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.external-workspace__eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.external-workspace__hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.external-workspace__hero-actions .primary-button,
.external-workspace__hero-actions .small-button {
  min-height: 44px;
  padding-inline: 20px;
}

.external-workspace__trust {
  margin-top: 14px !important;
  color: var(--muted);
  font-size: 0.8rem;
}

.external-workspace__connection {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-1);
}

.external-workspace__connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.external-workspace__connection[data-external-connection-state="online"] .external-workspace__connection-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent);
}

.external-workspace__connection :where(strong, p) {
  margin: 0;
}

.external-workspace__connection p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.external-workspace__progress {
  margin: -2px 0 0;
  color: var(--muted);
  text-align: center;
}

.external-workspace__technical {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-1);
}

.external-workspace__technical > summary {
  padding: 16px 18px;
  font-weight: 650;
  cursor: pointer;
}

.external-workspace__details {
  display: grid;
  min-width: 0;
  padding: 0 18px 18px;
  gap: 20px;
}

.external-workspace__detail-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.external-workspace__detail-status > div,
.external-workspace__compatibility,
.external-workspace__management {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.external-workspace__details :where(h4, p) {
  margin-top: 0;
}

.external-workspace__detail-status p,
.external-workspace__compatibility > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.external-workspace__compatibility .agent-config-tabs {
  margin: 14px 0 12px;
}

@media (max-width: 720px) {
  .external-workspace__header {
    align-items: stretch;
    flex-direction: column;
  }

  .external-workspace__identity {
    justify-content: flex-start;
  }

  .external-workspace__hero {
    padding: 44px 18px;
    border-radius: 14px;
  }

  .external-workspace__hero-actions {
    width: 100%;
  }

  .external-workspace__hero-actions :where(.primary-button, .small-button) {
    width: 100%;
  }

  .external-workspace__detail-status {
    grid-template-columns: minmax(0, 1fr);
  }

  .external-workspace .agent-config-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .external-workspace .agent-config-tabs .small-button {
    width: 100%;
    min-width: 0;
  }
}

.external-preview-dialog[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.external-preview-dialog::backdrop {
  background: rgba(2, 6, 12, 0.78);
  backdrop-filter: blur(4px);
}

.external-preview-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.external-preview-dialog__header h2,
.external-preview-dialog > p {
  margin: 0;
}

.external-preview-dialog pre {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-height: min(65vh, 640px);
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  font: 0.82rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre;
  user-select: text;
}

.arena-players-mount {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.player-create-page {
  display: grid;
  gap: 20px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 4px 0 24px;
}

.player-create-page__heading {
  display: grid;
  gap: 6px;
}

.player-create-page__heading :where(h2, p) {
  margin: 0;
}

.player-list-shell {
  display: grid;
  gap: 12px;
}

.player-list-intro {
  margin: 0;
  color: var(--muted);
}

.player-list-table {
  width: 100%;
  table-layout: fixed;
}

.player-list-table th,
.player-list-table td {
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.player-list-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.player-list-table td {
  border-top: 1px solid var(--line);
}

.player-list-table a {
  color: var(--teal);
  text-decoration-color: color-mix(in srgb, var(--teal) 46%, transparent);
  text-underline-offset: 3px;
}

.player-list__player,
.player-list__actions,
.player-list__secondary-actions {
  display: flex;
  min-width: 0;
}

.player-list__player {
  flex-direction: column;
  gap: 4px;
}

.player-list__asset,
.player-list__model,
.player-list__empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.player-list__model {
  color: var(--soft);
}

.player-list__status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: var(--neutral-a035);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.player-list__status.status-ready {
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
  color: var(--teal);
  background: color-mix(in srgb, var(--teal) 10%, transparent);
}

.player-list__status.status-queued,
.player-list__status.status-playing {
  border-color: color-mix(in srgb, var(--cyan) 42%, var(--line));
  color: var(--cyan);
}

.player-list__actions,
.player-list__secondary-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.player-list__more {
  position: relative;
}

.player-list__more > summary {
  min-height: 42px;
  padding: 0 8px;
  color: var(--muted);
  cursor: pointer;
  line-height: 42px;
  list-style: none;
  white-space: nowrap;
}

.player-list__more > summary::-webkit-details-marker {
  display: none;
}

.player-list__more > summary::after {
  content: ' ▾';
}

.player-list__more[open] > summary::after {
  content: ' ▴';
}

.player-list__more-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  display: grid;
  width: max-content;
  min-width: 128px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36);
}

.player-list__more-menu .small-button {
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
}

.player-list__actions button {
  min-height: 44px;
}

@media (max-width: 720px) {
  .player-list-table,
  .player-list-table :where(thead, tbody, tr, td) {
    display: block;
  }

  .player-list-table {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .player-list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .player-list-table tr {
    min-width: 0;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-1);
  }

  .player-list-table td {
    display: grid;
    grid-template-columns: minmax(76px, auto) minmax(0, 1fr);
    min-width: 0;
    padding: 7px 0;
    border-top: 0;
    gap: 12px;
    overflow-wrap: anywhere;
  }

  .player-list-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.82rem;
    font-weight: 600;
  }

  .player-list-table td[data-label] {
    display: block;
    padding-top: 12px;
  }

  .player-list-table td[data-label]::before {
    content: none;
  }

  .player-list__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .player-list__primary-action {
    width: 100%;
  }

  .player-list__secondary-actions {
    justify-content: flex-start;
  }

  .player-list__more-menu {
    right: auto;
    left: 0;
  }
}

.player-profile-drawer {
  box-sizing: border-box;
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  background: var(--surface-1);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.44);
}

.player-profile-drawer[open] {
  display: block;
}

.player-profile-drawer::backdrop {
  background: rgba(2, 6, 12, 0.7);
  backdrop-filter: blur(3px);
}

.player-profile-drawer > [data-player-profile-content] {
  height: 100%;
  min-width: 0;
}

.player-profile-form {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
}

.player-profile-form__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.player-profile-form__header h2,
.player-profile-form__header p,
.player-profile-assets h3,
.player-profile-assets dl,
.player-profile-assets dd {
  margin: 0;
}

.player-profile-form__header p {
  margin-top: 4px;
  color: var(--muted);
}

.player-profile-form__body {
  display: grid;
  min-height: 0;
  padding: 20px;
  overflow: auto;
  gap: 18px;
  flex: 1;
  align-content: start;
}

.player-profile-field {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.player-profile-field > span,
.player-profile-form legend {
  color: var(--soft);
  font-weight: 600;
}

.player-profile-form :where(input, select, textarea, button) {
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
}

.player-profile-form textarea {
  width: 100%;
  resize: vertical;
}

.player-profile-runtime-description {
  margin: -8px 0 0;
  color: var(--muted);
}

.player-profile-runtime-impact {
  margin: -8px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  color: var(--soft);
  background: color-mix(in srgb, var(--teal) 7%, transparent);
  line-height: 1.5;
}

.player-runtime-confirmation-dialog {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 32px));
  max-width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
}

.player-runtime-confirmation-dialog::backdrop {
  background: rgba(2, 6, 12, 0.76);
  backdrop-filter: blur(4px);
}

.player-runtime-confirmation {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.player-runtime-confirmation :where(h2, h3, p, ul) {
  margin: 0;
}

.player-runtime-confirmation header,
.player-runtime-confirmation__assets {
  display: grid;
  gap: 8px;
}

.player-runtime-confirmation header p,
.player-runtime-confirmation__assets {
  color: var(--muted);
}

.player-runtime-confirmation__assets h3 {
  color: var(--soft);
  font-size: 0.9rem;
}

.player-runtime-confirmation__assets ul {
  padding-left: 20px;
}

.player-runtime-confirmation__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.player-profile-assets {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--neutral-a025);
}

.player-profile-assets h3 {
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.player-profile-assets dl {
  display: grid;
  gap: 8px;
}

.player-profile-assets dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.player-profile-assets dt {
  color: var(--muted);
}

.player-profile-assets dd {
  text-align: right;
}

.player-profile-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}

@media (max-width: 720px) {
  .player-profile-drawer {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-top: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .player-profile-form {
    min-height: 100%;
    max-height: 100dvh;
  }

  .player-profile-form__header,
  .player-profile-form__body {
    padding-right: 16px;
    padding-left: 16px;
  }

  .player-profile-form__actions {
    padding-right: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: 16px;
  }
}

@media (max-width: 680px) {
  main,
  .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar {
    min-height: 56px;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  main {
    padding-top: 14px;
  }

  .arena-home {
    gap: 12px;
  }

  .home-chip-row {
    margin-inline: -4px;
  }

  .nav-tabs,
  .user-panel,
  .login-form,
  .profile-form,
  .contestant-row,
  .room-title-row,
  .model-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .player-editor-agent-layout,
  .player-editor-grid {
    grid-template-columns: 1fr;
  }

  .arena-grid--detail-only .room-detail-panel {
    padding: 10px;
  }

  .player-editor-route__context {
    align-items: stretch;
    flex-direction: column;
  }

  .room-detail.player-editor-route {
    padding: 8px;
  }

  #player-editor-react-root,
  .player-editor-react-shell,
  .player-editor-chat-column,
  .player-editor-side-column,
  .agent-artifact-panel,
  .agent-resource-card {
    width: 100%;
    min-width: 0;
  }

  .player-editor-route__crumb {
    flex-wrap: wrap;
  }

  .player-editor-route__room-cta {
    width: 100%;
    justify-content: center;
  }

  .agent-thread-session-history__menu {
    position: fixed;
    top: 112px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: min(360px, calc(100vh - 136px));
  }

  .player-editor-mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--neutral-a08);
    border-radius: calc(var(--radius) - 2px);
    background: rgba(8, 14, 22, 0.92);
    backdrop-filter: blur(14px);
  }

  .player-editor-mobile-tabs a {
    min-width: 0;
    padding: 7px 6px;
    border: 1px solid var(--neutral-a08);
    border-radius: 6px;
    color: var(--soft);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    background: var(--neutral-a035);
  }

  .player-editor-agent-side {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .agent-thread-shell {
    min-height: auto;
  }

  .agent-thread-viewport {
    height: auto;
    max-height: min(70vh, 560px);
  }

  .user-panel {
    align-items: center;
    flex-direction: row;
  }

  .auth-surface {
    align-items: end;
    padding: 12px;
  }

  .auth-surface__panel {
    width: 100%;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  .arena-home__head {
    align-items: stretch;
    flex-direction: column;
  }

  .home-room-grid {
    grid-template-columns: 1fr;
  }

  .match-players-panel .room-title-row {
    flex-direction: row;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .bet-controls,
  .inline-form,
  .model-edit-form,
  .contestant-prompt-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bet-controls input,
  .inline-form input,
  .inline-form select {
    width: 100%;
  }

  .js-bomberman-board {
    --bm-cell-min: 18px;
  }

  .bomberman-match-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .bomberman-match-banner span {
    text-align: left;
  }

  .holdem-broadcast-layout,
  .holdem-public-feed {
    grid-template-columns: 1fr;
  }

  .holdem-table-felt {
    min-height: 760px;
    border-radius: 24px;
  }

  .holdem-table-regions {
    grid-template-areas:
      "top"
      "left"
      "board"
      "right"
      "bottom";
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, auto);
    padding: 18px;
  }

  .holdem-seat-region,
  .holdem-seat-region--left,
  .holdem-seat-region--right {
    justify-content: center;
  }

  .holdem-seat-badge {
    width: min(100%, 320px);
  }

  .holdem-insight-grid {
    grid-template-columns: 1fr;
  }

  .external-preview-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .external-workspace__resource .status-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .external-workspace__resource .status-row > button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 390px) {
  .external-workspace__resource .status-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-felt {
    height: 100%;
    min-height: 0;
  }

  .home-room-card__stage .js-texas-holdem-panel--preview .holdem-table-regions {
    grid-template-areas:
      "top top top"
      "left board right"
      "bottom bottom bottom";
    grid-template-columns: minmax(72px, 0.7fr) minmax(108px, 0.95fr) minmax(72px, 0.7fr);
    grid-template-rows: minmax(70px, 0.75fr) minmax(104px, 1fr) minmax(70px, 0.75fr);
    padding: 10px;
  }

  .home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-region--left {
    justify-content: start;
  }

  .home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-region--right {
    justify-content: end;
  }

  .home-room-card__stage .js-texas-holdem-panel--preview .holdem-seat-badge {
    width: min(100%, 136px);
  }
}

/* Theme boundaries ------------------------------------------------------- */

:root[data-theme="light"] .home-room-card {
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  box-shadow: 0 8px 26px rgba(23, 33, 43, 0.06);
}

:root[data-theme="light"] .home-room-card:hover {
  border-color: color-mix(in srgb, var(--teal) 30%, var(--line));
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(23, 33, 43, 0.1);
}

:root[data-theme="light"] :is(
  .agent-thread-viewport,
  .editor-panel,
  .release-history-item,
  .home-room-card__meta,
  .my-player-summary div,
  .external-agent-panel,
  .player-editor-header,
  .agent-resource-card,
  .player-editor-strategy-panel__dynamic,
  .agent-thread-session-history__button,
  .agent-thread-session-button,
  .agent-thread-session-history__menu,
  .agent-thread-session-history__transcript,
  .player-editor-message,
  .agent-message,
  .agent-side-card,
  .player-manual-section,
  .player-editor-artifact,
  .strategy-release-compare,
  .agent-config-tabs
) {
  background: var(--surface-inset);
}

:root[data-theme="light"] :is(
  .agent-thread-session-history__menu,
  .agent-thread-jump-button
) {
  background: var(--surface-floating);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] :is(
  .auth-surface__panel,
  .room-switcher-menu,
  .external-preview-dialog,
  .player-profile-drawer,
  .player-runtime-confirmation-dialog
) {
  color: var(--text);
}

:root[data-theme="light"] .toast {
  background: #ffffff;
}

:root[data-theme="light"] .player-editor-mobile-tabs {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.08);
}

:root[data-theme="light"] :is(
  .agent-artifact-panel__result,
  .small-button.on,
  .ok-chip
) {
  color: var(--positive-text);
}

:root[data-theme="light"] :is(
  .agent-artifact-panel__result.is-error,
  .home-room-card__status--danger,
  .danger-button,
  .small-button.danger,
  .small-button.off,
  .warn-chip,
  .error-text,
  .debug-error
) {
  color: var(--danger-text);
}

:root[data-theme="light"] :is(
  .home-room-card__status--waiting,
  .game-leaderboard__live-note
) {
  color: var(--warning-text);
}

/* Game chrome remains a focused dark domain; individual stages provide day materials. */
:root[data-theme="light"] :is(.game-panel, .home-room-card__stage) {
  color-scheme: dark;
  --bg: #101114;
  --surface-1: #191b20;
  --surface-2: #20242b;
  --surface-3: #262b33;
  --panel: var(--surface-1);
  --panel-2: var(--surface-2);
  --line: #303640;
  --line-strong: #44505d;
  --text: #f4f7fb;
  --muted: #aab4c0;
  --soft: #d7dde5;
  --teal: #14b8a6;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --rose: #fb7185;
  --green: #22c55e;
  --accent-contrast: #031311;
  --positive-text: #bbf7d0;
  --danger-text: #fecdd3;
  --warning-text: #fde68a;
  --accent-soft-text: #99f6e4;
  --neutral-a015: rgba(255, 255, 255, 0.015);
  --neutral-a02: rgba(255, 255, 255, 0.02);
  --neutral-a022: rgba(255, 255, 255, 0.022);
  --neutral-a025: rgba(255, 255, 255, 0.025);
  --neutral-a028: rgba(255, 255, 255, 0.028);
  --neutral-a03: rgba(255, 255, 255, 0.03);
  --neutral-a035: rgba(255, 255, 255, 0.035);
  --neutral-a04: rgba(255, 255, 255, 0.04);
  --neutral-a045: rgba(255, 255, 255, 0.045);
  --neutral-a05: rgba(255, 255, 255, 0.05);
  --neutral-a055: rgba(255, 255, 255, 0.055);
  --neutral-a06: rgba(255, 255, 255, 0.06);
  --neutral-a07: rgba(255, 255, 255, 0.07);
  --neutral-a08: rgba(255, 255, 255, 0.08);
  --neutral-a09: rgba(255, 255, 255, 0.09);
  --neutral-a1: rgba(255, 255, 255, 0.1);
  --neutral-a12: rgba(255, 255, 255, 0.12);
  --neutral-a14: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

:root[data-theme="light"] .game-panel {
  background: #15181e;
}

:root[data-theme="light"] .home-room-card__stage {
  background: #e6ecef;
}

:root[data-theme="light"] .home-room-card__stage .game-panel--preview {
  background: linear-gradient(145deg, #f2f5f6, #dde6ea);
}

:root[data-theme="light"] :is(
  .js-bomberman-panel,
  .js-snake-panel,
  .js-texas-holdem-panel
) {
  color-scheme: light;
  --line: #d6dfe5;
  --line-strong: #aebbc5;
  --text: #17212b;
  --muted: #5f6d7a;
  --soft: #344250;
  --teal: #087f73;
  --cyan: #147aa8;
  --warning-text: #8a5200;
  --neutral-a025: rgba(15, 23, 42, 0.025);
  --neutral-a028: rgba(15, 23, 42, 0.028);
  --neutral-a03: rgba(15, 23, 42, 0.03);
  --neutral-a08: rgba(15, 23, 42, 0.08);
  color: var(--text);
  border-color: #d0dbe1;
  background: linear-gradient(145deg, #f7f9f9, #edf2f3);
}

/* Bomberman: a daylight stone arena. Gameplay sprites and effects stay unchanged. */
:root[data-theme="light"] .js-bomberman-board {
  border-color: #9eacb8;
  background: #d4dde2;
  box-shadow: 0 14px 30px rgba(45, 61, 72, 0.14);
}

:root[data-theme="light"] .bm-cell {
  border-color: rgba(58, 76, 66, 0.11);
  background: #dfe8dd;
}

:root[data-theme="light"] .bm-cell.solid {
  background: linear-gradient(145deg, #8f9eab, #758696);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

:root[data-theme="light"] .bm-cell.brick {
  background:
    linear-gradient(90deg, rgba(89, 52, 27, 0.2) 48%, transparent 48% 52%, rgba(89, 52, 27, 0.2) 52%),
    linear-gradient(180deg, #bd8554, #aa6f3e);
}

:root[data-theme="light"] .bm-player-sprite {
  --bm-sprite-shadow: drop-shadow(0 2px 2px rgba(21, 34, 42, 0.58));
}

/* Snake: a light blueprint board with stronger entity edges for bright player colors. */
:root[data-theme="light"] .snake-board-canvas {
  border-color: #9fb0bd;
  background: #e9eff3;
  box-shadow: 0 14px 30px rgba(45, 61, 72, 0.12);
}

:root[data-theme="light"] .js-snake-panel .snake-score-legend {
  border-color: #c5d0d8;
  background: rgba(246, 249, 250, 0.94);
}

:root[data-theme="light"] .js-snake-panel .snake-score-legend-item {
  color: #263744;
}

:root[data-theme="light"] .js-snake-panel .snake-score-legend-item.food {
  color: #5e6f7c;
}

:root[data-theme="light"] .js-snake-panel .bomberman-match-banner {
  border-color: #cad5dc;
  background: rgba(255, 255, 255, 0.84);
}

:root[data-theme="light"] .js-snake-panel .bomberman-match-banner.live {
  border-color: rgba(24, 120, 58, 0.34);
  background: rgba(24, 120, 58, 0.08);
}

:root[data-theme="light"] .match-seat-card {
  border-color: #d3dde3;
  background: #f8fafb;
  color: #17212b;
}

:root[data-theme="light"] .match-seat-card.is-winner {
  border-color: rgba(173, 95, 0, 0.42);
  box-shadow: inset 0 0 0 1px rgba(173, 95, 0, 0.1);
}

:root[data-theme="light"] .snake-player-swatch {
  box-shadow: inset 0 0 0 1px rgba(19, 41, 57, 0.38);
}

/* Texas Hold'em: keep recognizable green felt, but move the room into daylight. */
:root[data-theme="light"] .holdem-table-felt {
  border-color: #b5a179;
  background:
    radial-gradient(circle at 50% 44%, rgba(67, 170, 129, 0.76), rgba(29, 118, 92, 0.76) 38%, rgba(15, 78, 68, 0.96) 76%),
    linear-gradient(135deg, #2b8a68, #0f554c);
  box-shadow:
    inset 0 0 0 10px rgba(225, 209, 176, 0.72),
    inset 0 0 42px rgba(7, 45, 40, 0.32),
    0 16px 34px rgba(45, 61, 72, 0.16);
}

:root[data-theme="light"] .holdem-table-meta span,
:root[data-theme="light"] .holdem-pot-chip {
  border-color: rgba(30, 66, 60, 0.28);
  background: rgba(248, 245, 235, 0.88);
  color: #30433f;
}

:root[data-theme="light"] .holdem-pot-chip {
  border-color: rgba(154, 99, 16, 0.42);
  background: rgba(255, 244, 204, 0.94);
  color: #79500b;
}

:root[data-theme="light"] .holdem-board-zone {
  border-color: rgba(241, 231, 205, 0.4);
  background: rgba(8, 73, 61, 0.28);
}

:root[data-theme="light"] .holdem-seat-badge {
  border-color: rgba(59, 78, 88, 0.24);
  background: rgba(250, 249, 244, 0.94);
  color: #1d2d36;
  box-shadow: 0 14px 28px rgba(21, 42, 47, 0.2);
}

:root[data-theme="light"] .holdem-seat-pill {
  background: rgba(22, 119, 102, 0.13);
  color: #176f62;
}

:root[data-theme="light"] .holdem-seat-stats dt {
  color: #64747d;
}

:root[data-theme="light"] .holdem-seat-stats dd {
  color: #283942;
}

:root[data-theme="light"] .holdem-seat-line {
  color: #42545e;
}

:root[data-theme="light"] .holdem-seat--acting {
  border-color: rgba(19, 124, 89, 0.78);
  box-shadow: 0 0 0 2px rgba(19, 124, 89, 0.16), 0 16px 32px rgba(21, 42, 47, 0.22);
}

:root[data-theme="light"] .holdem-seat--folded {
  opacity: 0.68;
}

:root[data-theme="light"] :is(
  .holdem-decision-panel,
  .holdem-player-insights,
  .holdem-public-feed > section
) {
  border-color: #d3dde3;
  background: rgba(255, 255, 255, 0.82);
}

:root[data-theme="light"] .holdem-street-section h5 {
  color: #176f62;
}

:root[data-theme="light"] .holdem-reaction-card {
  border-color: rgba(55, 78, 91, 0.16);
  background: rgba(15, 23, 42, 0.025);
}

:root[data-theme="light"] .holdem-reaction-card header em {
  border-color: rgba(20, 122, 168, 0.24);
  color: #126f98;
  background: rgba(20, 122, 168, 0.08);
}

:root[data-theme="light"] .holdem-reaction-type {
  color: #8a5200;
  background: rgba(173, 95, 0, 0.1);
}

/* Raw technical content stays dark for scanning and preserves syntax colors. */
:root[data-theme="light"] :is(
  .debug-card,
  .prepare-round,
  .raw-response,
  .debug-raw,
  .config-output,
  .copyable-pre,
  .agent-markdown pre,
  .agent-decision-code pre,
  .external-preview-dialog pre
) {
  color-scheme: dark;
  --text: #f4f7fb;
  --muted: #aab4c0;
  --soft: #d7dde5;
  --line: #303640;
  --line-strong: #44505d;
  border-color: #303640;
  background: #0b0f14;
  color: #d7dde5;
}

@media (max-width: 680px) {
  .app-footer {
    justify-content: center;
    padding: 14px 10px calc(16px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .app-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .app-footer .language-control,
  .app-footer .footer-theme-group {
    display: flex;
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
  }

  .app-footer .theme-control {
    display: flex;
    min-width: 0;
    min-height: 44px;
    flex: 1;
    justify-content: space-between;
  }

  .app-footer .footer-github-link {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .app-footer .language-control select,
  .app-footer .theme-control__options button {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:has([data-theme-value]) *,
  html:has([data-theme-value]) *::before,
  html:has([data-theme-value]) *::after {
    scroll-behavior: auto !important;
  }
}
