@font-face {
  font-family: "Space Grotesk";
  src: url("./space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #10171f;
  --surface: #151f29;
  --layer: #1b2834;
  --well: #111b25;
  --line: #2b3b49;
  --text: #edf4f6;
  --muted: #a3b3bf;
  --dim: #8699a7;
  --lime: #dcfa72;
  --cyan: #8fd3e7;
  --danger: #ffafa8;
  --robot-hp: #79e6ad;
  --robot-battery: #ffd079;
  --robot-meter-track: #304451;
  --mono: "Cascadia Mono", Consolas, monospace;
  font: 15px/1.45 "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
a.button { text-decoration: none; }
.active-design-content { display: grid; gap: 12px; padding: 13px; }
#active-design { font-size: 1.4rem; overflow-wrap: anywhere; }
.active-design-panel .panel-head { border-bottom: 1px solid var(--line); }
.active-stats { display: grid; gap: 4px; margin: 0; }
.active-stats div { display: flex; gap: 5px; justify-content: space-between; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.active-stats dt { color: var(--muted); }
.active-stats dd { margin: 0; }
.roster-counts { display: grid; gap: 5px; padding: 8px; background: var(--well); border: 1px solid var(--line); border-radius: 6px; }
.roster-counts label { display: grid; grid-template-columns: minmax(0, 1fr) 64px; align-items: center; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .47; }
input, select {
  min-width: 0;
  min-height: 39px;
  padding: 6px 10px;
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 6px;
}
select { padding-right: 6px; }
input::placeholder { color: var(--dim); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.075rem; line-height: 1.25; font-weight: 700; }
h3 { font-size: .94rem; line-height: 1.3; }

.header {
  background: #131d26;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 61px;
  width: min(1320px, 100% - 64px);
  margin: 0 auto;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  text-decoration: none;
  font-size: 1.43rem;
  font-weight: 700;
  letter-spacing: -.045em;
}
.logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 7px;
  background: var(--lime);
}
.logo i { width: 3px; border-radius: 1px; background: #172214; transform: skewX(-24deg); }
.logo i:nth-child(1) { height: 9px; margin-top: 5px; }
.logo i:nth-child(2) { height: 16px; }
.logo i:nth-child(3) { height: 9px; margin-bottom: 5px; }
nav { display: flex; gap: 28px; align-items: center; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 60px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.current { color: var(--text); }
.nav-link.current::after { position: absolute; inset: auto 0 0; content: ""; height: 2px; background: var(--lime); }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #3b4d5b;
  border-radius: 7px;
  background: #202e3a;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.2;
  white-space: nowrap;
}
.button:not(:disabled):hover { border-color: #697f8e; background: #2b3e4c; }
.button.primary {
  color: #1b2312;
  background: var(--lime);
  border-color: var(--lime);
  font-weight: 700;
}
.button.primary:not(:disabled):hover { background: #ecffae; border-color: #ecffae; }
.button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button.danger { color: var(--danger); background: transparent; border-color: #6c4447; }
.room-button { justify-self: end; }
.room-icon {
  width: 17px;
  height: 13px;
  background:
    radial-gradient(circle at 5px 3px, currentColor 2px, transparent 2.5px),
    radial-gradient(circle at 12px 3px, currentColor 2px, transparent 2.5px),
    radial-gradient(ellipse at 5px 12px, currentColor 3px, transparent 3.6px),
    radial-gradient(ellipse at 12px 12px, currentColor 3px, transparent 3.6px);
  color: var(--lime);
}

.page { width: min(1320px, 100% - 64px); margin: 0 auto; padding: 22px 0 36px; }
.page-top { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
h1 { font-size: clamp(2.2rem, 3.55vw, 3.2rem); font-weight: 700; line-height: 1.01; letter-spacing: -.059em; }
.page-top p { margin-top: 6px; color: var(--muted); font-size: 1rem; }
.match-options { display: flex; align-items: stretch; gap: 9px; }
.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--well);
}
.segmented button {
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  padding: 5px 11px;
  font-size: .87rem;
  font-weight: 700;
  white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: #293744; border-color: #41535f; color: var(--text); }
.segmented button:not(:disabled):hover { color: var(--text); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(332px, 376px); gap: 17px; align-items: start; }
.arena-column { min-width: 0; display: grid; align-content: start; gap: 17px; }
.setup-column { min-width: 0; display: grid; gap: 17px; }
.setup-panel { scroll-margin-top: 14px; }
.setup-panel > header { border-bottom: 1px solid var(--line); }
.practice-fields { display: grid; gap: 9px; min-width: 0; margin: 0; padding: 12px; border: 0; }
.practice-fields label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: .82rem; font-weight: 600; }
.practice-fields select, .practice-fields input { width: 100%; }
.practice-fields > .hint { font-size: .78rem; }
.practice-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.practice-pair > :only-child { grid-column: 1 / -1; }
.royale-lineup, .royale-rows { display: grid; gap: 5px; }
.royale-lineup { padding: 10px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--well); }
.royale-heading { display: flex; gap: 7px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.royale-heading .hint { font: .72rem var(--mono); }
.royale-heading [data-over] { color: var(--danger); }
.royale-columns, .royale-row { display: grid; grid-template-columns: minmax(0, 1fr) 63px 28px; gap: 5px; align-items: center; }
.royale-columns { padding-left: 8px; color: var(--muted); font-size: .73rem; }
.royale-row { border-left: 3px solid var(--team); padding-left: 4px; }
.royale-row :is(select, input, button), .royale-lineup > button { min-height: 34px; }
.royale-row input { padding-inline: 5px; }
.royale-row button { padding: 0; font-size: 1.1rem; }
.royale-lineup > button { justify-self: start; margin-top: 3px; }
@media (max-width: 350px) {
  .match-options, .controls { flex-wrap: wrap; }
}
.practice-options { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; }
.practice-options summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.practice-options > div { margin-top: 8px; }
.practice-fields .roster-counts label { align-items: center; }
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 13px 35px #050a101c;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; min-height: 48px; gap: 10px; padding: 9px 14px; }
.map-head { border-bottom: 1px solid var(--line); }
.map-name { display: flex; align-items: center; min-width: 0; gap: 8px; }
.map-name h2 { white-space: nowrap; }
.map-symbol { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #3a5361; border-radius: 5px; color: var(--cyan); font: 16px var(--mono); }
.map-dimensions { margin-left: 4px; font: .73rem var(--mono); color: var(--muted); white-space: nowrap; }
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  min-width: 0;
  border: 1px solid #3d5342;
  border-radius: 5px;
  background: #233329;
  color: #c6e2a6;
  font: .71rem var(--mono);
  white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-pill[data-state="playing"] { color: var(--lime); border-color: #566838; }
.state-pill[data-state="paused"], .state-pill[data-state="lobby"] { color: #f1d18a; background: #382f23; border-color: #5b4b3b; }
.state-pill[data-state="finished"] { color: #c7e5ff; background: #243647; border-color: #435e75; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; margin: 0 13px; min-height: 67px; }
.score-wing { display: flex; min-width: 0; padding: 8px 0; align-items: stretch; gap: 6px; }
.scoreboard.many-squads { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding-bottom: 7px; }
.scoreboard.many-squads .score-wing { display: contents; }
.scoreboard.many-squads .timer { grid-column: 1 / -1; grid-row: 1; }
.scoreboard.many-squads .score-team { padding: 4px; gap: 5px; }
.scoreboard.many-squads .score-number { font-size: 1.15rem; }
.legend-items { flex-wrap: wrap; }
#robot-seed { width: 100%; resize: vertical; padding: 8px; background: #121b25; color: #edf5ff; border: 1px solid #374555; border-radius: 6px; }
.score-right { flex-direction: row-reverse; }
.score-team {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: center;
  gap: clamp(7px, 1.12vw, 15px);
  padding: 5px 11px;
  border-left: 2px solid var(--team);
  background: linear-gradient(90deg, color-mix(in srgb, var(--team) 8%, var(--surface)), var(--surface));
}
.score-right .score-team {
  flex-direction: row-reverse;
  border-left: 0;
  border-right: 2px solid var(--team);
  background: linear-gradient(270deg, color-mix(in srgb, var(--team) 8%, var(--surface)), var(--surface));
  text-align: right;
}
.score-number { font-size: clamp(1.6rem, 2.3vw, 2.15rem); line-height: 1; color: var(--team); font-weight: 700; font-variant-numeric: tabular-nums; }
.score-meta { min-width: 0; max-width: 17ch; }
.score-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.score-meta small { display: block; color: var(--dim); font: .68rem var(--mono); font-weight: 500; text-transform: uppercase; }
.timer { display: grid; place-content: center; padding: 4px 15px; text-align: center; }
.timer strong { font-size: clamp(1.55rem, 2.5vw, 2.12rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.07em; line-height: 1.05; }
.timer span { margin-top: 4px; color: var(--muted); font: .65rem var(--mono); letter-spacing: .03em; }
.field { position: relative; margin: 0 13px; overflow: hidden; border: 1px solid #334754; border-radius: 7px; background: #0b1520; }
.field canvas { display: block; width: 100%; height: auto; aspect-ratio: 1.76; cursor: crosshair; }
.field canvas.can-pan { cursor: grab; touch-action: none; }
.field canvas.panning { cursor: grabbing; }
.field canvas:focus-visible { outline-offset: -3px; }
.arena-camera { position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 3px; }
.arena-camera .button { min-width: 38px; min-height: 38px; padding: 3px 6px; background: #101b25; font: 700 .9rem var(--mono); }
.result {
  position: absolute;
  inset: auto auto 12px 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  display: grid;
  gap: 2px;
  padding: 10px 20px;
  border: 1px solid #96ae58;
  border-radius: 8px;
  background: #182325f0;
  box-shadow: 0 8px 30px #0009;
  text-align: center;
  pointer-events: none;
}
.result strong { color: var(--lime); font-size: clamp(1.15rem, 2.5vw, 1.7rem); line-height: 1.15; overflow-wrap: anywhere; }
.kicker { color: var(--muted); font: .73rem var(--mono); letter-spacing: .04em; }
.legend { min-height: 40px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 14px; color: var(--muted); font-size: .8rem; }
.legend-items, .legend-items span, .check-label { display: flex; align-items: center; gap: 6px; }
.legend-items { gap: 15px; }
.legend.legend-items { justify-content: flex-start; }
.meter-hp { --meter-fill: var(--robot-hp); }
.meter-battery { --meter-fill: var(--robot-battery); }
.legend-meter { width: 12px; height: 4px; border-radius: 2px; background: var(--meter-fill); }
.legend-dock { width: 12px; height: 12px; border: 1px dashed #6dcebc; background: #245a53; border-radius: 50%; }
.legend-pillar { width: 12px; height: 12px; border: 1px solid #7e8c93; border-radius: 2px; background: #354854; }
.legend-water, .legend-sand { width: 12px; height: 11px; border: 1px solid; border-radius: 2px; }
.legend-water { background: #255a86; border-color: #498ab9; }
.legend-sand { background: #625135; border-color: #aa8b59; }
.legend-zone { width: 12px; height: 12px; border: 1px dashed #ae9ae5; border-radius: 50%; background: #292b47; }
.check-label { cursor: pointer; white-space: nowrap; }
.check-label input { margin: 0; min-height: auto; width: 14px; height: 14px; accent-color: var(--lime); }
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 8px 13px;
  border-top: 1px solid var(--line);
  background: #141e27;
  border-radius: 0 0 12px 12px;
}
.match-buttons { display: flex; gap: 5px; align-items: center; }
.play-icon { font-size: .75rem; }
.speed-label { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: .83rem; }
.speed-label select { min-height: 34px; width: 59px; color: var(--text); padding: 4px 6px; }
.camera-controls .speed-label select { width: 66px; }
.camera-controls button[aria-pressed="true"] { color: var(--lime); border-color: var(--lime); }
.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.insight-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 44px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.insight-head h2 { font-size: .95rem; }
.insight-head select { min-height: 30px; max-width: 52%; padding: 3px 5px; font-size: .77rem; }
.insight-content { min-height: 75px; padding: 10px 12px; font-size: .84rem; }
.insight-content > p { color: var(--muted); }
.insight-content ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.feed-time { margin-right: 7px; color: var(--dim); font: .73rem var(--mono); }
.robot-vitals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 7px 0; }
.robot-vital { padding: 7px 8px; background: var(--well); border: 1px solid var(--line); border-radius: 6px; }
.robot-vital-caption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 5px; color: var(--muted); }
.robot-vital-caption strong { color: var(--meter-fill); font: 700 .8rem var(--mono); white-space: nowrap; }
.robot-vital meter { display: block; width: 100%; height: 5px; margin-top: 5px; appearance: none; }
.robot-vital meter::-webkit-meter-bar { background: var(--robot-meter-track); border: 0; }
.robot-vital meter::-webkit-meter-optimum-value { background: var(--meter-fill); }
.robot-vital meter::-moz-meter-bar { background: var(--meter-fill); }
.telemetry-data { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 4px; color: var(--muted); }

.workshop-head { border-bottom: 1px solid var(--line); }
.text-button { padding: 3px; border: none; background: none; color: var(--cyan); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.robot-picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, .9fr); gap: 9px; padding: 12px 13px; }
.robot-picker label, .dialog-body label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .84rem; font-weight: 600; }
.robot-picker input, .robot-picker select { width: 100%; }
.workshop-tabs { display: flex; padding: 0 13px; gap: 12px; border-bottom: 1px solid var(--line); }
.workshop-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  min-height: 39px;
  padding: 4px 8px 5px;
  font-weight: 700;
  font-size: .9rem;
}
.workshop-tabs button[aria-selected="true"] { border-bottom-color: var(--lime); color: var(--text); }
#spent-chip { background: #2c3d2d; color: #cfe799; font: .7rem var(--mono); padding: 3px 4px; border-radius: 4px; }
.bench { padding: 13px; }
.bench-top { display: flex; align-items: start; justify-content: space-between; gap: 7px; margin-bottom: 9px; }
.bench-top p, .budget p { margin-top: 3px; color: var(--muted); font-size: .81rem; }
.rule-count { color: var(--muted); font: .73rem var(--mono); white-space: nowrap; }
.rule-list {
  display: grid;
  gap: 6px;
  max-height: 412px;
  margin: 0;
  padding: 1px 3px 2px 1px;
  overflow: auto;
  scrollbar-color: #455c6b transparent;
  scrollbar-width: thin;
  list-style: none;
}
.rule-item {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) 21px;
  align-items: center;
  min-height: 50px;
  border: 1px solid #334756;
  border-radius: 7px;
  background: #1c2935;
}
.rule-item:hover { background: #233340; }
.rule-item.drag-over { outline: 1px dashed var(--lime); outline-offset: -1px; }
.rule-order { align-self: stretch; display: grid; place-items: center; color: #9eb1bf; font: .72rem var(--mono); cursor: grab; border-right: 1px solid #2f4250; }
.rule-main { min-width: 0; align-self: stretch; display: grid; align-content: center; gap: 3px; border: none; padding: 5px 6px; background: transparent; color: var(--text); text-align: left; }
.rule-line { display: grid; grid-template-columns: 39px minmax(0, 1fr); gap: 5px; align-items: baseline; font-size: .8rem; line-height: 1.2; }
.syntax { font: 700 .68rem var(--mono); border-radius: 3px; text-align: center; padding: 3px 1px; color: #a5deed; background: #23414d; }
.syntax.then { color: #d8f3a1; background: #35503a; }
.rule-item:is([data-lane="tool"], [data-lane="blade"]) .syntax.then,
.block-action:is([data-lane="tool"], [data-lane="blade"]) .syntax.then { color: #edc5ff; background: #4c3757; }
.rule-item[data-lane="memory"] .syntax.then { color: #f7d290; background: #53452e; }
.rule-move { display: grid; align-content: center; gap: 0; }
.rule-move button { width: 20px; height: 21px; padding: 0; border: none; background: transparent; color: var(--muted); font: .85rem/1 var(--mono); }
.rule-move button:disabled { opacity: .24; }
.rule-move button:not(:disabled):hover { color: var(--lime); }
.empty { padding: 9px 6px; color: var(--muted); font-size: .86rem; }
.add-rule { width: 100%; margin-top: 8px; border-style: dashed; background: #17242d; color: var(--cyan); }
.workshop-footer { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 8px; padding: 8px 13px; border-top: 1px solid var(--line); }
.workshop-footer p { color: var(--muted); font-size: .8rem; }
.save-button { color: var(--lime); border-color: #536646; background: #27382b; }
.budget { padding: 10px; margin-bottom: 8px; border: 1px solid #405246; border-radius: 7px; background: #1c2d28; }
.budget > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.budget strong { color: var(--lime); font: 700 1.1rem var(--mono); }
.budget-cap { color: #c5d8b2; font-size: .7em; }
progress { display: block; width: 100%; height: 7px; margin-top: 7px; border: 0; border-radius: 20px; accent-color: var(--lime); overflow: hidden; }
progress::-webkit-progress-bar { background: #35433b; }
progress::-webkit-progress-value { background: var(--lime); }
progress::-moz-progress-bar { background: var(--lime); }
.upgrade-list { display: grid; gap: 2px; }
.upgrade { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 52px; padding: 6px 1px; border-bottom: 1px solid var(--line); }
.upgrade:last-child { border-bottom: 0; }
.upgrade h4 { margin: 0 0 1px; line-height: 1.15; font-size: .86rem; }
.upgrade p { color: var(--muted); font-size: .73rem; line-height: 1.3; }
.upgrade-stepper { display: flex; align-items: center; gap: 5px; color: var(--text); }
.upgrade-stepper output { min-width: 14px; text-align: center; font: .8rem var(--mono); }
.stepper-button { min-width: 29px; min-height: 29px; padding: 0; font-size: 1.01rem; }

dialog {
  width: min(490px, 100% - 24px);
  max-height: calc(100% - 24px);
  padding: 0;
  border: 1px solid #506574;
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 14px 65px #0009;
}
dialog::backdrop { background: #060b11bb; backdrop-filter: blur(3px); }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 15px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.25rem; }
.icon-button { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #3d5260; border-radius: 6px; color: var(--text); background: var(--layer); font-size: 1.2rem; }
.dialog-body { display: grid; gap: 10px; padding: 14px 15px; }
.dialog-body label input, .dialog-body label select { width: 100%; }
.dialog-actions { border-top: 1px solid var(--line); }
.dialog-actions .primary:last-child { margin-left: auto; }
.form-stack { display: grid; gap: 9px; }
.input-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.push { margin-left: auto; }
.hint { font-size: .86rem; color: var(--muted); }
.page-error, .inline-error { color: #ffd2ce; background: #442a2e; border: 1px solid #77464d; border-radius: 6px; padding: 7px 9px; font-size: .87rem; }
.page-error { margin-bottom: 12px; }
.block-field { display: grid; gap: 7px; padding: 8px; border: 1px solid #36515f; border-radius: 7px; background: #192934; }
.block-fieldhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.block-fieldhead .syntax { padding-inline: 9px; }
.block-fieldhead button { min-height: 24px; padding: 1px 5px; font-size: .76rem; }
.condition-controls { display: flex; align-items: center; gap: 7px; }
.condition-controls .check-label { display: flex; min-height: 24px; align-items: center; }
.condition-controls .check-label input { width: 13px; height: 13px; }
.block-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.block-fields label { flex: 1 1 95px; }
.block-action { border-color: #425849; background: #202d2c; }
.library-list { display: grid; gap: 6px; }
.library-entry { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; padding: 7px; }
.library-entry .library-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.library-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-name small { display: block; color: var(--muted); }
.library-entry button { min-height: 31px; padding: 4px 7px; font-size: .8rem; }
.separator { height: 1px; background: var(--line); margin: 3px 0; }
.room-code-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.room-code-row strong { display: block; color: var(--lime); font: 700 1.45rem var(--mono); letter-spacing: .12em; }
#room-dialog.has-lobby { width: min(970px, 100% - 24px); }
.workspace.in-room { grid-template-columns: minmax(0, 1fr); }
#room-configure { margin-top: 12px; }
.room-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)); gap: 9px; }
.room-lineups { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 10px; align-items: start; }
.room-lineup { min-width: 0; display: grid; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.room-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-members { display: grid; gap: 5px; padding: 0; margin: 2px 0; list-style: none; }
.room-members li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; background: var(--well); border: 1px solid var(--line); border-radius: 6px; }
.room-members p, .room-members small { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.room-members strong { overflow-wrap: anywhere; }
.room-members .room-issue { display: block; color: #ffd2ce; }
.room-pilot { flex: 1 1 120px; min-width: 0; }
.room-pilot .room-pilot-roster { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.room-member-actions select { width: auto; }
.room-member-actions .button, .room-member-actions select, .room-robot .button { min-height: 33px; }
.room-roster { display: grid; gap: 5px; max-height: 325px; overflow-y: auto; }
.room-robot { display: grid; grid-template-columns: minmax(0, 1fr) 54px auto auto; gap: 5px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.room-robot strong { overflow-wrap: anywhere; }
.room-robot small { display: block; }
.room-robot input { padding-inline: 4px; }
.room-robot-identity { min-width: 0; display: flex; align-items: center; gap: 8px; }
.room-robot-summary { grid-column: 1 / -1; overflow-wrap: anywhere; }
.room-tank { flex: 0 0 29px; position: relative; height: 22px; border-block: 4px solid var(--tank-tracks); border-radius: 4px; background: var(--tank-hull); box-shadow: inset 0 0 0 1px #0a141e; }
.room-tank i { position: absolute; left: 5px; top: 5px; width: 3px; height: 4px; background: var(--tank-accent); }
.room-tank b { position: absolute; top: 5px; left: 15px; width: 16px; height: 4px; background: var(--tank-weapon); border-radius: 1px; }
.room-add-design { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
#room-seed-panel label { display: grid; gap: 4px; margin-block: 7px; }
#room-seed { width: 100%; min-height: 55px; resize: vertical; }
.room-actions { position: sticky; bottom: -14px; padding-block: 8px; background: var(--surface); }
.room-editor { width: min(1360px, 100% - 16px); height: calc(100% - 24px); }
.room-editor[open] { display: flex; flex-direction: column; }
.room-editor iframe { display: block; flex: 1; width: 100%; border: 0; }
@media (max-width: 700px) {
  .room-lineups { grid-template-columns: minmax(0, 1fr); }
  .room-actions { position: static; }
}

@media (min-width: 781px) and (max-height: 950px) {
  .rule-list { max-height: clamp(208px, 100svh - 522px, 412px); }
}

@media (max-width: 980px) {
  .header nav { gap: 14px; }
  .header-inner, .page { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); gap: 12px; }
  .arena-column, .insights { gap: 12px; }
  .score-team { padding-inline: 7px; }
  .timer { padding-inline: 9px; }
}

@media (max-width: 860px) {
  .header-inner { grid-template-columns: 1fr auto; gap: 2px 8px; min-height: 0; padding-top: 8px; }
  .header nav { grid-row: 2; grid-column: 1 / -1; flex-wrap: wrap; gap: 0 18px; }
  .nav-link { min-height: 36px; font-size: .85rem; }
  .brand { font-size: 1.2rem; }
  .logo { width: 28px; height: 28px; }
  .room-button { font-size: .8rem; min-height: 32px; }
}

@media (max-width: 780px) {
  .header-inner, .page { width: min(650px, 100% - 26px); }
  .workspace { grid-template-columns: 1fr; }
  .page { padding-top: 22px; }
  .page-top { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .rule-list { max-height: 420px; }
}

@media (max-width: 435px) {
  .header-inner, .page { width: calc(100% - 20px); }
  .header nav { flex-wrap: wrap; gap: 0 12px; }
  .map-dimensions { display: none; }
  .match-options { width: 100%; }
  .match-options a.button { flex: 1; }
  .scoreboard { margin: 0 8px; min-height: 65px; }
  .score-team { padding: 5px 4px; gap: 5px; }
  .score-wing { gap: 3px; }
  .score-meta { font-size: .72rem; }
  .score-meta small { display: none; }
  .score-team[data-yours] .score-meta small { display: block; font-size: .56rem; }
  .scoreboard:not([data-squads="2"]) .score-wing { flex-direction: column; }
  .scoreboard.many-squads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scoreboard:not([data-squads="2"]) .score-meta { max-width: 16ch; }
  .timer { padding: 4px 5px; }
  .timer strong { font-size: 1.4rem; }
  .timer span { font-size: .56rem; }
  .field { margin: 0 8px; }
  .legend { flex-wrap: wrap; gap: 6px; padding-inline: 8px; font-size: .71rem; }
  .legend-items { gap: 7px; }
  .controls { padding-inline: 8px; }
  .speed-label { gap: 4px; }
  .insights { grid-template-columns: 1fr; }
}
