:root {
  --bg: #0a0f1a;
  --panel: rgba(15, 22, 38, 0.84);
  --line: rgba(136, 178, 255, 0.14);
  --text: #eef3ff;
  --muted: #9bb0d9;
  --accent: #80f3d6;
  --accent-2: #66a8ff;
  --danger: #ff899f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(102, 168, 255, 0.16), transparent 24%),
    linear-gradient(155deg, #08111d, #05070d 42%, #0d1628);
}

.page {
  width: min(1180px, calc(100% - 12px));
  margin: 0 auto;
  padding: 6px 0 10px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero {
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#lab-signin-btn.hidden,
.lab-user-chip.hidden {
  display: none;
}

.lab-user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.lab-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-signout-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lab-signout-btn:hover {
  color: var(--text);
}

.lab-auth-panel.hidden {
  display: none;
}

.lab-auth-panel {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lab-auth-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 14, 0.58);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.lab-auth-card {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 20px 18px;
  width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.lab-auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.lab-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lab-auth-form label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 0.8rem;
  text-align: left;
  color: var(--muted);
}

.lab-auth-form input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.86rem;
  width: 100%;
}

.lab-auth-form input:focus {
  outline: 1px solid var(--accent);
}

.lab-auth-form button[type="submit"] {
  margin-top: 4px;
  width: 100%;
}

.lab-auth-error.hidden {
  display: none;
}

.lab-auth-error {
  font-size: 0.78rem;
  color: var(--danger);
  background: rgba(255, 137, 159, 0.1);
  border-radius: 4px;
  padding: 6px 10px;
}

.eyebrow {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(128, 243, 214, 0.08);
  border: 1px solid rgba(128, 243, 214, 0.16);
  color: var(--accent);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p, pre { margin: 0; }

h1 {
  margin-top: 4px;
  font-size: 1rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 0.86rem;
  line-height: 1.15;
}

.lead,
.hint {
  color: var(--muted);
  line-height: 1.3;
  font-size: 0.74rem;
}

.lead { margin-top: 3px; }
.hint { margin-top: 3px; }

.layout {
  display: grid;
  gap: 8px;
}

.lab-view-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 0 2px;
}

.lab-view-btn {
  padding: 6px 6px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.lab-view-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.lab-view-section {
  display: none;
  gap: 8px;
}

.lab-view-section.active {
  display: grid;
}

.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.panel {
  padding: 10px;
}

.status-panel .status-accordion {
  margin-top: 0;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-top: 6px;
}

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

.fields,
.tabs {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sequence-block {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.action-label-text {
  color: var(--muted);
  font-size: 0.72rem;
}

.sequence-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.channel-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.channel-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
}

.channel-col-header {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.locomotion-header { color: #00b4d8; }
.aim-header        { color: #9bd1ff; }
.vision-header     { color: #d4b800; }
.utility-header    { color: #c77dff; }
.combat-header     { color: #ff4d6d; }
.defense-header    { color: #06d6a0; }

.channel-col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.channel-col-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.action-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.action-section:first-child {
  padding-top: 0;
  border-top: none;
}

.action-type-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.7;
}

.channel-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.80rem;
  padding: 12px 0;
}

.dir-btn:disabled,
button:disabled {
  cursor: default;
  opacity: 0.7;
  transform: none;
}

label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(6, 11, 20, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  outline: none;
}

.credential-value {
  display: block;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(6, 11, 20, 0.92);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  word-break: break-all;
}

.credential-row.hidden {
  display: none;
}

textarea {
  min-height: 58px;
  resize: vertical;
}

.buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  color: var(--text);
  transition: background 160ms ease, color 160ms ease;
}

button:hover {
  background: rgba(255,255,255,0.08);
  color: color-mix(in srgb, currentColor 88%, white 12%);
}

button.pending {
  position: relative;
  z-index: 0;
  animation: btn-pulse 0.85s ease-in-out infinite;
  transform: translateY(-1px);
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  box-shadow:
    0 0 0 1px rgba(128, 243, 214, 0.22),
    0 0 18px rgba(102, 168, 255, 0.18),
    0 0 28px rgba(128, 243, 214, 0.12);
}

.primary.pending {
  background: linear-gradient(135deg, #7fc9ff, #7ff1d3);
  color: #07111f;
  text-shadow: none;
  box-shadow:
    0 0 0 1px rgba(170, 234, 255, 0.3),
    0 0 20px rgba(103, 167, 255, 0.24),
    0 0 34px rgba(128, 243, 214, 0.16);
}

.secondary.pending {
  background: linear-gradient(135deg, rgba(102, 168, 255, 0.3), rgba(128, 243, 214, 0.24));
  border-color: rgba(128, 243, 214, 0.42);
}

.arena-select-btn.pending {
  background: linear-gradient(135deg, rgba(102, 168, 255, 0.35), rgba(128, 243, 214, 0.32));
  border-color: rgba(128, 243, 214, 0.45);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(128, 243, 214, 0.18), 0 0 20px rgba(102, 168, 255, 0.18);
}

.pending-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(120, 135, 166, 0.8);
  box-shadow: 0 0 0 3px rgba(120, 135, 166, 0.12);
  flex: 0 0 auto;
}

.led.pending {
  background: rgba(255, 190, 11, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 190, 11, 0.12);
  animation: led-blink 1s ease-in-out infinite;
}

.led.ok {
  background: rgba(34, 197, 94, 0.95);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

@keyframes btn-pulse {
  0%, 100% {
    filter: brightness(1) saturate(1);
    box-shadow: 0 0 0 0 rgba(128, 243, 214, 0);
  }
  50% {
    filter: brightness(1.28) saturate(1.38);
    box-shadow:
      0 0 0 6px rgba(128, 243, 214, 0.18),
      0 0 22px rgba(128, 243, 214, 0.14),
      0 0 32px rgba(103, 167, 255, 0.16);
  }
}

@keyframes led-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #06111e;
  font-weight: 700;
}

.primary:hover {
  background: linear-gradient(135deg, #8fdcff, #8ef4df);
}

.secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.secondary:hover {
  background: rgba(255,255,255,0.08);
}

.small {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.secondary.small {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.import-export-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.hidden-file-input {
  display: none;
}

.btn-like {
  display: inline-block;
  cursor: pointer;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 160ms ease, color 160ms ease;
}

.btn-like:hover {
  background: rgba(255,255,255,0.08);
  color: color-mix(in srgb, currentColor 88%, white 12%);
}

.import-label {
  display: contents;
}

.player-status,
.join-state,
.identity-state,
.action-preview,
.write-state,
.wait-note,
.error {
  padding: 7px 9px;
  border-radius: 10px;
  line-height: 1.35;
  font-size: 0.74rem;
}

.status-accordion {
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

.status-accordion > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  font-size: 0.75rem;
  color: var(--text);
}

.status-accordion > summary::-webkit-details-marker {
  display: none;
}

.status-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: rgba(102, 168, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(102, 168, 255, 0.12);
}

.status-indicator.ok {
  background: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.status-indicator.warn {
  background: rgba(255, 190, 11, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 190, 11, 0.12);
}

.status-indicator.error {
  background: rgba(255, 137, 159, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 137, 159, 0.14);
}

.status-summary-text {
  min-width: 0;
}

.status-summary-title {
  font-weight: 700;
  line-height: 1.2;
}

.status-summary-detail,
.status-caret {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.2;
}

.status-caret {
  flex: 0 0 auto;
}

.status-body {
  display: grid;
  gap: 6px;
  padding: 0 9px 9px;
}

.timing-line {
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.72rem;
}

.player-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.7rem;
  line-height: 1;
}

.status-pill.ok {
  color: #bcf3cf;
  border-color: rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.1);
}

.status-pill.warn {
  color: #ffe4a6;
  border-color: rgba(255, 190, 11, 0.2);
  background: rgba(255, 190, 11, 0.1);
}

.status-pill.info {
  color: #dceaff;
  border-color: rgba(102, 168, 255, 0.18);
  background: rgba(102, 168, 255, 0.1);
}

.join-state {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
}

.identity-state {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
}


.write-state {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.18);
  color: #bcf3cf;
}

.action-preview {
  margin-top: 6px;
  background: rgba(102, 168, 255, 0.1);
  border: 1px solid rgba(102, 168, 255, 0.18);
  color: #dceaff;
  font-family: "Courier New", monospace;
}

.action-cost-preview {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 190, 11, 0.1);
  border: 1px solid rgba(255, 190, 11, 0.18);
  color: #ffe4a6;
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.stats-panel {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
}

.stats-panel-title {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-bars {
  display: grid;
  gap: 6px;
}

.stats-empty {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.stat-row {
  display: grid;
  gap: 4px;
}

.stat-label-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.stat-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.stat-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.stat-bar-fill.warn {
  background: linear-gradient(90deg, #ffbe0b, #ffd166);
}

.stat-bar-fill.danger {
  background: linear-gradient(90deg, #ef476f, #ff899f);
}

.stat-note {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.identity-state.ready {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.18);
  color: #bcf3cf;
}

.identity-state.missing {
  background: rgba(255, 190, 11, 0.1);
  border-color: rgba(255, 190, 11, 0.2);
  color: #ffe4a6;
}

.identity-state.error,
.join-state.error {
  background: rgba(255, 137, 159, 0.12);
  border: 1px solid rgba(255, 137, 159, 0.18);
  color: #ffd6de;
}

.wait-note {
  display: none;
  background: rgba(255, 190, 11, 0.1);
  border: 1px solid rgba(255, 190, 11, 0.2);
  color: #ffe4a6;
}

.wait-note.visible {
  display: block;
}

.error {
  display: none;
  background: rgba(255, 137, 159, 0.12);
  border: 1px solid rgba(255, 137, 159, 0.18);
  color: #ffd6de;
}

.error.visible {
  display: block;
}

.tab-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tab-btn {
  padding: 5px 8px;
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.72rem;
}

.tab-btn.active {
  background: rgba(102, 168, 255, 0.14);
  color: var(--text);
  border-color: rgba(102, 168, 255, 0.22);
}

.tab-panel {
  display: none;
  margin-top: 6px;
}

.tab-panel.active {
  display: block;
}

details.tech {
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  padding: 6px 8px;
}

details.tech > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.74rem;
  list-style: none;
}

details.tech > summary::-webkit-details-marker {
  display: none;
}

.dump {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  overflow: auto;
  max-height: 44vh;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.32;
}

.obs-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 6px;
}

.obs-row {
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 0.73rem;
  line-height: 1.35;
}

.obs-row strong {
  color: var(--text);
}

details.obs-raw {
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}

details.obs-raw > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
  list-style: none;
}

details.obs-raw > summary::-webkit-details-marker {
  display: none;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(30, 34, 46, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.lab-result-splash {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(5, 8, 14, 0.44), rgba(5, 8, 14, 0.78));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lab-result-splash.hidden {
  display: none;
}

.lab-result-card {
  width: min(620px, calc(100% - 24px));
  display: grid;
  gap: 12px;
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(102, 168, 255, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(128, 243, 214, 0.14), transparent 24%),
    rgba(10, 16, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 26px 68px rgba(0, 0, 0, 0.42);
}

.lab-result-card h2 {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.lab-result-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.lab-result-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.lab-result-highlight {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
}

.lab-result-highlight-label {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lab-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Arena list ────────────────────────────────────────────────────────────── */

.arena-list {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.algo-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.algo-list-placeholder {
  padding: 10px 8px;
  font-size: 0.73rem;
  color: var(--muted);
}

.algo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 0.76rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.algo-row:hover {
  transform: none;
  background: rgba(255,255,255,0.07);
}

.algo-row.active {
  border-color: rgba(128, 243, 214, 0.4);
  background: rgba(128, 243, 214, 0.07);
}

.algo-row.active:hover {
  background: rgba(128, 243, 214, 0.11);
}

.algo-name {
  font-weight: 600;
}

.algo-status {
  font-size: 0.68rem;
  color: var(--muted);
}

.algo-row.active .algo-status {
  color: var(--accent);
}

.arena-card-placeholder {
  padding: 10px 8px;
  font-size: 0.73rem;
  color: var(--muted);
}

.arena-card {
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 0.73rem;
  line-height: 1.3;
  transition: border-color 0.15s;
}

.arena-card.selected {
  border-color: rgba(120,180,255,0.35);
  background: rgba(120,180,255,0.06);
}

.arena-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.arena-name {
  font-weight: 600;
  color: var(--text);
}

.arena-status {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
}

.arena-status.status-waiting  { color: #f5b942; }
.arena-status.status-running  { color: #4fc97e; }
.arena-status.status-finished { color: var(--muted); }

.arena-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 5px;
}

.arena-meta-item {
  color: var(--muted);
  font-size: 0.69rem;
}

.arena-world-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 6px;
}

.arena-world-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1;
}

.arena-world-chip.accent {
  color: #dceaff;
  border-color: rgba(102, 168, 255, 0.18);
  background: rgba(102, 168, 255, 0.1);
}

.arena-players {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
}

.arena-player-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--muted);
}

.player-dot {
  font-size: 0.75rem;
  line-height: 1;
}

.player-dot-joined { color: #4fc97e; }
.player-dot-open   { color: rgba(255,255,255,0.25); }

.arena-select-btn {
  margin-top: 2px;
  padding: 5px 10px;
  font-size: 0.7rem;
}

.arena-open-badge {
  font-size: 0.67rem;
  color: rgba(120, 180, 255, 0.8);
  background: rgba(120, 180, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.arena-open-note {
  font-size: 0.69rem;
  color: rgba(120, 180, 255, 0.7);
  margin-bottom: 6px;
}

.latency-chip {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 200;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(10, 16, 30, 0.9);
  border: 1px solid rgba(128, 180, 255, 0.18);
  color: rgba(180, 210, 255, 0.85);
  font-size: 0.69rem;
  font-family: "Courier New", monospace;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.latency-chip.chip-play {
  animation: chip-show 3.2s ease forwards;
}

@keyframes chip-show {
  0%   { opacity: 0; transform: translateY(-5px); }
  8%   { opacity: 1; transform: translateY(0); }
  78%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-3px); }
}

@media (max-width: 720px) {
  .lab-view-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-grid,
  .row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
