/* ==========================================================================
   Arena Lab · 机器人厨房专属视觉与观战布局系统
   专注于画面占比最大化、触控易用性、自由视角与沉浸式观战体验。
   ========================================================================== */

/* ---------------- 1. 记分板 (Scoreboard) 紧凑精细化 ---------------- */
body[data-game="robot_kitchen"] .race-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin: 0 6px 4px;
  padding: 3px 14px;
  background: linear-gradient(100deg, #182d33, #15222b 48%, #30262b);
  border: 1px solid #334e57;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

body[data-game="robot_kitchen"] .race-team-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

body[data-game="robot_kitchen"] .race-team-score > span {
  font-size: 11px;
  font-weight: 600;
  color: #8be5d7;
  letter-spacing: 0.04em;
}

body[data-game="robot_kitchen"] .race-team-score strong {
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: #effbf8;
  font-variant-numeric: tabular-nums;
}

body[data-game="robot_kitchen"] .race-team-score > small {
  font-size: 10px;
  color: #9cb8be;
  white-space: nowrap;
}

body[data-game="robot_kitchen"] .race-team-score[data-team="1"] {
  justify-content: flex-end;
}

body[data-game="robot_kitchen"] .race-team-score[data-team="1"] > span {
  color: #fcaea1;
}

body[data-game="robot_kitchen"] .race-match-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 12px;
  border-radius: 6px;
  background: rgba(10, 18, 24, 0.45);
  border: 1px solid rgba(80, 120, 130, 0.2);
}

body[data-game="robot_kitchen"] .race-match-clock strong {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  color: #ddf5f0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* ---------------- 2. 状态说明条 (Scenario Info) 精简单行 ---------------- */
body[data-game="robot_kitchen"] .arena-stage-top {
  display: none;
}

body[data-game="robot_kitchen"] .scenario-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 6px 4px;
  padding: 2px 10px;
  border: 1px solid #283e47;
  border-radius: 6px;
  background: #111d24;
  color: #8faeb6;
  font-size: 10px;
  line-height: 1.2;
}

body[data-game="robot_kitchen"] .scenario-info strong {
  color: #aeeae0;
  font-weight: 550;
}

/* ---------------- 3. 双厨房容器与画面占比最大化 ---------------- */
body[data-game="robot_kitchen"] .canvas-wrap.is-kitchen-race {
  display: flex;
  flex-direction: column;
  margin: 0 6px;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #111b22;
}

body[data-game="robot_kitchen"] .kitchen-race-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
}

body[data-game="robot_kitchen"] .race-kitchen {
  display: grid;
  grid-template-rows: 22px max-content max-content minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #2b4851;
  border-radius: 8px;
  background: #14232c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body[data-game="robot_kitchen"] .race-kitchen[data-team="1"] {
  border-color: #573e43;
  background: #231920;
}

/* 厨房 Header (单行，整合队伍与运营数据) */
body[data-game="robot_kitchen"] .race-kitchen > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 1px 9px;
  background: #1b333c;
  color: #b2ede3;
  font-size: 11px;
  line-height: 1.2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

body[data-game="robot_kitchen"] .race-kitchen[data-team="1"] > header {
  background: #39242a;
  color: #ffd0c4;
}

body[data-game="robot_kitchen"] .race-kitchen > header strong {
  font-weight: 600;
  letter-spacing: 0.02em;
}

body[data-game="robot_kitchen"] .race-kitchen > header span {
  font-size: 10px;
  color: #9cb5bc;
  font-variant-numeric: tabular-nums;
}

body[data-game="robot_kitchen"] .race-kitchen[data-team="1"] > header span {
  color: #caa099;
}

/* ---------------- 4. 订单卡片 (Orders) 紧凑水平轨道 ---------------- */
body[data-game="robot_kitchen"] .race-orders {
  display: flex;
  align-items: stretch;
  gap: 5px;
  min-height: 38px;
  padding: 3px 6px;
  background: #111e26;
  border-bottom: 1px solid #243b44;
  overflow-x: auto;
  scrollbar-width: thin;
}

body[data-game="robot_kitchen"] .race-kitchen[data-team="1"] .race-orders {
  background: #1b1319;
  border-bottom-color: #402c33;
}

body[data-game="robot_kitchen"] .race-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 15px 12px 3px;
  gap: 1px 6px;
  flex: 1 0 76px;
  min-width: 72px;
  max-width: 130px;
  padding: 2px 6px;
  border: 1px solid #758e8b;
  border-radius: 5px;
  background: #edf5f2;
  color: #263c3d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body[data-game="robot_kitchen"] .race-order strong {
  grid-row: 1;
  grid-column: 1;
  align-self: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
  color: #213d3f;
  line-height: 1.2;
}

body[data-game="robot_kitchen"] .race-order .race-order-food {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

body[data-game="robot_kitchen"] .race-order small {
  grid-column: 1;
  grid-row: 2;
  font-size: 9px;
  color: #557273;
  line-height: 1.2;
  white-space: nowrap;
}

body[data-game="robot_kitchen"] .race-order .progress-track {
  grid-row: 3;
  grid-column: 1 / -1;
  height: 3px;
  background: #cad7d4;
  margin: 0;
  border-radius: 2px;
}

body[data-game="robot_kitchen"] .race-order .progress-track > span {
  background: #399187;
  border-radius: 2px;
}

body[data-game="robot_kitchen"] .race-order.is-next {
  border-color: #3bb39f;
  box-shadow: inset 2px 0 0 #3bb39f, 0 1px 4px rgba(0, 0, 0, 0.15);
}

body[data-game="robot_kitchen"] .race-order.is-urgent {
  background: #fdf0df;
  border-color: #da9351;
}

body[data-game="robot_kitchen"] .race-order.is-urgent small {
  color: #b05e26;
  font-weight: 600;
}

body[data-game="robot_kitchen"] .race-order.is-urgent .progress-track > span {
  background: #d46b2b;
}

/* ---------------- 5. 机器人状态轨 (Robot Task Rail) ---------------- */
.robot-task-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px 6px;
  background: #14242e;
  border-bottom: 1px solid #233a45;
}

.race-kitchen[data-team="1"] .robot-task-rail {
  background: #20161d;
  border-bottom-color: #3f2a32;
}

.robot-task-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  background: #1c313a;
  border: 1px solid #2a4753;
  min-width: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.robot-task-card:hover {
  background: #233e4a;
  border-color: #4b808e;
  transform: translateY(-1px);
}

.race-kitchen[data-team="1"] .robot-task-card {
  background: #2d1e26;
  border-color: #48323c;
}

.race-kitchen[data-team="1"] .robot-task-card:hover {
  background: #392631;
  border-color: #8c5765;
}

.robot-task-avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #2b585e;
  border: 1px solid #4eb5a9;
  color: #a8f5e7;
  font-size: 10px;
  font-weight: 700;
}

.race-kitchen[data-team="1"] .robot-task-avatar {
  background: #5d393d;
  border-color: #b97677;
  color: #ffd8d3;
}

.robot-task-card strong,
.robot-task-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.robot-task-card strong {
  font-size: 10px;
  font-weight: 550;
  color: #ddede9;
  line-height: 1.3;
}

.robot-task-card small {
  font-size: 9px;
  color: #88aeb6;
  line-height: 1.2;
}

.race-kitchen[data-team="1"] .robot-task-card strong {
  color: #fce1dc;
}

.race-kitchen[data-team="1"] .robot-task-card small {
  color: #bfa0a6;
}

.robot-task-card.is-followed {
  background: #254a54;
  border-color: #5fe6cb;
  box-shadow: 0 0 0 1px #5fe6cb;
}

.race-kitchen[data-team="1"] .robot-task-card.is-followed {
  background: #422934;
  border-color: #ff9d93;
  box-shadow: 0 0 0 1px #ff9d93;
}

.robot-task-card.is-waiting {
  opacity: 0.72;
}

/* ---------------- 6. 3D 画布及交互 ---------------- */
.race-kitchen canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  outline: none;
}

/* 单队聚焦布局 */
body[data-game="robot_kitchen"] .kitchen-race-view[data-focus="0"],
body[data-game="robot_kitchen"] .kitchen-race-view[data-focus="1"],
.kitchen-race-view[data-focus="0"],
.kitchen-race-view[data-focus="1"] {
  grid-template-columns: 1fr;
}

.kitchen-race-view[data-focus="0"] .race-kitchen[data-team="1"],
.kitchen-race-view[data-focus="1"] .race-kitchen[data-team="0"] {
  display: none;
}

/* ---------------- 7. 观战控制条增强 (Controls Bar) ---------------- */
body[data-game="robot_kitchen"] .race-camera-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: #14222a;
  border: 1px solid #2f4d57;
  border-radius: 7px;
}

body[data-game="robot_kitchen"] .race-camera-controls .toggle-control {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 5px;
  background: transparent;
  border-color: transparent;
  color: #8faeb6;
  transition: background 0.15s, color 0.15s;
}

body[data-game="robot_kitchen"] .race-camera-controls .toggle-control:hover {
  color: #ddf5f0;
  background: #1d333e;
}

body[data-game="robot_kitchen"] .race-camera-controls .toggle-control.is-active {
  background: #2e6065;
  color: #e3faf5;
  border-color: #4ba69e;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body[data-game="robot_kitchen"] .camera-mode-switch {
  background: #14222a;
  border: 1px solid #2f4d57;
  border-radius: 7px;
}

body[data-game="robot_kitchen"] .camera-mode-switch button {
  min-height: 38px;
  min-width: 72px;
  padding: 6px 11px;
  font-size: 12px;
  color: #8faeb6;
}

body[data-game="robot_kitchen"] .camera-mode-switch button.is-active {
  background: #3c655b;
  color: #e5fcf4;
  border-color: #559f8c;
}

/* ---------------- 8. 移动端专门优化 (Mobile <= 700px) ---------------- */
@media (max-width: 700px) {
  body[data-game="robot_kitchen"] .race-scoreboard {
    min-height: 38px;
    margin: 0 4px 3px;
    padding: 2px 8px;
    gap: 6px;
  }

  body[data-game="robot_kitchen"] .race-team-score {
    gap: 5px;
  }

  body[data-game="robot_kitchen"] .race-team-score strong {
    font-size: 22px;
  }

  body[data-game="robot_kitchen"] .race-team-score > small {
    display: none;
  }

  body[data-game="robot_kitchen"] .race-match-clock {
    padding: 2px 8px;
  }

  body[data-game="robot_kitchen"] .race-match-clock strong {
    font-size: 18px;
  }

  body[data-game="robot_kitchen"] .scenario-info {
    font-size: 9px;
    padding: 2px 7px;
    margin: 0 4px 3px;
  }

  body[data-game="robot_kitchen"] .canvas-wrap.is-kitchen-race {
    margin: 0 4px;
  }

  body[data-game="robot_kitchen"] .kitchen-race-view {
    gap: 4px;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  body[data-game="robot_kitchen"] .kitchen-race-view[data-focus="0"],
  body[data-game="robot_kitchen"] .kitchen-race-view[data-focus="1"] {
    grid-template-rows: 1fr;
  }

  body[data-game="robot_kitchen"] .race-kitchen {
    grid-template-rows: 20px max-content max-content minmax(0, 1fr);
    border-radius: 6px;
  }

  body[data-game="robot_kitchen"] .race-kitchen > header {
    padding: 1px 6px;
    font-size: 10px;
  }

  body[data-game="robot_kitchen"] .race-kitchen > header span {
    font-size: 9px;
  }

  body[data-game="robot_kitchen"] .race-orders {
    min-height: 34px;
    padding: 2px 4px;
    gap: 4px;
  }

  body[data-game="robot_kitchen"] .race-order {
    flex-basis: 68px;
    min-width: 65px;
    grid-template-rows: 13px 10px 2px;
    padding: 2px 4px;
    gap: 1px 3px;
  }

  body[data-game="robot_kitchen"] .race-order strong {
    font-size: 9px;
  }

  body[data-game="robot_kitchen"] .race-order small {
    font-size: 8px;
  }

  body[data-game="robot_kitchen"] .race-order .race-order-food {
    font-size: 13px;
  }

  .robot-task-rail {
    padding: 2px 4px;
    gap: 3px;
  }

  .robot-task-card {
    padding: 2px 4px;
    gap: 4px;
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .robot-task-avatar {
    width: 20px;
    height: 20px;
    font-size: 9px;
  }

  .robot-task-card strong {
    font-size: 9px;
  }

  .robot-task-card small {
    font-size: 8px;
  }

  /* 移动端控制按钮增大触摸面积 (>= 44px) 且双行工整排布 */
  body[data-game="robot_kitchen"] .spectator-controls {
    padding: 3px 6px 6px;
  }

  body[data-game="robot_kitchen"] .timeline-row {
    height: 22px;
  }

  body[data-game="robot_kitchen"] .transport-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 5px;
    align-items: center;
  }

  body[data-game="robot_kitchen"] .transport-row:after {
    display: none;
  }

  body[data-game="robot_kitchen"] .transport-main {
    grid-column: 1;
    grid-row: 1;
  }

  body[data-game="robot_kitchen"] .transport-options {
    grid-column: 2;
    grid-row: 1;
  }

  body[data-game="robot_kitchen"] .mobile-fullscreen-control {
    grid-column: 3;
    grid-row: 1;
    display: inline-flex;
    min-height: 44px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
  }

  body[data-game="robot_kitchen"] .spectator-more {
    grid-column: 4;
    grid-row: 1;
    margin-left: 0;
  }

  body[data-game="robot_kitchen"] .race-camera-controls {
    grid-column: 1 / 3;
    grid-row: 2;
    height: 44px;
    display: flex;
    padding: 2px;
  }

  body[data-game="robot_kitchen"] .race-camera-controls .toggle-control {
    min-height: 40px;
    flex: 1;
    padding: 0 4px;
    font-size: 11px;
  }

  body[data-game="robot_kitchen"] .camera-mode-switch {
    grid-column: 3 / 5;
    grid-row: 2;
    height: 44px;
    display: flex;
    padding: 2px;
  }

  body[data-game="robot_kitchen"] .camera-mode-switch button {
    min-height: 40px;
    min-width: 58px;
    flex: 1;
    padding: 0 8px;
    font-size: 11px;
  }
}

/* ---------------- 9. 训练遥测卡片与指标展示 ---------------- */
.robot-learning {
  margin-bottom: 16px;
  border-color: #365661;
  background: linear-gradient(120deg, #1c303a, #1c2933);
}

.robot-learning > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
}

.robot-learning h3 {
  font-size: 18px;
  font-weight: 550;
  color: #e0eeea;
}

.robot-learning header p {
  font-size: 12px;
  color: #93b4bb;
  margin-top: 7px;
}

.robot-evaluation-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-block: 1px solid #36515c;
}

.robot-team-evaluation {
  padding: 15px 18px;
}

.robot-team-evaluation + div {
  border-left: 1px solid #36515c;
}

.robot-team-evaluation > span {
  font-size: 11px;
  color: #99c7c2;
}

.robot-team-evaluation[data-team="1"] > span {
  color: #d7afa0;
}

.robot-team-evaluation > strong {
  display: block;
  font-size: 27px;
  font-weight: 500;
  margin-top: 6px;
  color: #dfefe9;
}

.robot-team-evaluation p {
  font-size: 11px;
  line-height: 1.8;
  color: #96adb1;
  margin-top: 6px;
}

.robot-learning-note {
  padding: 13px 18px;
  font-size: 11px;
  color: #99b2b9;
  line-height: 1.9;
}

.robot-learning > details {
  padding: 12px 18px;
  border-top: 1px solid #36515c;
}

.robot-learning summary {
  font-size: 12px;
  color: #a7c5c8;
}

.robot-learning th,
.robot-learning td {
  padding: 10px 12px;
  font-size: 11px;
}

.robot-learning .table-scroll {
  overflow: auto;
}

@media (max-width: 700px) {
  .robot-learning > header {
    padding: 15px 13px;
  }
  .robot-learning h3 {
    font-size: 16px;
  }
  .robot-learning header p {
    font-size: 11px;
  }
  .robot-team-evaluation {
    padding: 12px;
  }
  .robot-team-evaluation > strong {
    font-size: 24px;
  }
  .robot-learning-note {
    padding: 12px;
    font-size: 11px;
  }
  .robot-learning > details {
    padding-inline: 12px;
  }
}
