/* demo4.5 on demo5.0's page design (界面 一): the pieces the 4.x model adds to it.
   - 开发者模式 only: 定档, 读参 and 存参 of the control line, manual perturbation and the scenario groups.
   - Every clickable control of the toolbars bordered as 存档 and 读档; 选择区域 just left of 应用 and 重置.
   - 规则 panes: the 4.x global rules, a city's 城市参数 and a route's 商路参数 moved into the shown tab's 规则 (app.js
     placeRulePanes); the city and route panes show only their parameter section there (their readings are the 详情 pages).
   - The jobs table of the 城市 详情 page has six columns (the 4.x jobs keep their own worktime and cash).
   - The 本地引擎 label on the control line. */

:root:not([data-ui-mode="explorer"]) .game-shell :is(.explorer-only, #manual-perturbation, #manual-perturbation-status, #scenario-change),
:root:not([data-ui-mode="explorer"]) .game-shell .city-configuration > :not(.section-title, .technology-list, .technology-formula-note, .city-population-control) {
  display: none !important;
}

/* the rule panes in 规则: only the parameter section of the old city and route pages */
.rule-pane-city > :not([data-city-detail-panel="technology"]),
.rule-pane-route > :not([data-route-detail-panel="configuration"], .route-configuration) {
  display: none !important;
}
.rule-pane-city > [data-city-detail-panel="technology"],
.rule-pane-route > [data-route-detail-panel="configuration"] {
  display: block !important;
}
.rule-pane-city > [data-city-detail-panel="technology"] > .inspector-section:first-child,
.rule-pane-route > [data-route-detail-panel="configuration"] > .inspector-section:first-child {
  margin-top: 0;
}
#scope-rules-note { margin: 12px 0 0; }
#region-rules > .rule-pane, #route-rules > .rule-pane { padding-top: 6px; }

/* the 城市 jobs table: 职业 | 人数 | 占比% | 工时 | 净利 | 人均现金, six equal columns, labels and values left-aligned */
.class-row.class-row-split.class-row-wide {
  grid-template-columns: minmax(0, 1.4fr) repeat(5, minmax(0, 1fr));
  column-gap: 6px;
}
.class-row-wide .head-hours { grid-column: 4; }
.class-row-wide .head-income { grid-column: 5; }
.class-row-wide .head-deposit { grid-column: 6; grid-row: 1; }
.class-row-wide .hours-cell,
.class-row-wide .deposit-cell {
  grid-row: 2;
  font-family: ui-monospace, Consolas, "Cascadia Mono", monospace;
  font-size: var(--font-medium);
  font-weight: 400;
  white-space: nowrap;
}
.class-row-wide .hours-cell { grid-column: 4; }
.class-row-wide .income-cell { grid-column: 5; }
.class-row-wide .deposit-cell { grid-column: 6; }
.class-row-wide .class-head { font-size: var(--font-small); letter-spacing: 0; }

/* 本地, the local engine's button (src/UI/engine-client.js; human 2026-11-07: "local engine should be a button "本地", use
   the same module as other buttons, with green on white off"; 2026-11-08: "No special module"): it has no rules of its own, it is
   in styles.css's rules of 存档 and 读档 (white, bordered) and of the chosen speed (green when aria-pressed) */
.engine-host-indicator[hidden] { display: none; }

/* 编辑 (the map editor's button) right of 商路 on the side tabs' line (human 2026-11-04: "make 编辑地图 button into 编辑, right
   to the 商路 button on the top right"): four equal columns, 编辑 with a border as 存档 and 读档 */
.controlbar .inspector-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.controlbar .inspector-tabs > #map-editor-toggle {
  min-width: 0;
  padding-inline: 6px;
  white-space: nowrap;
  border-color: #b9c4bd;
  background: #fffdf6;
  color: var(--ink);
}
.controlbar .inspector-tabs > #map-editor-toggle:hover:not(:disabled) { border-color: var(--teal); }
.controlbar .inspector-tabs > #map-editor-toggle.active { border-color: var(--teal); background: var(--teal); color: white; }
.controlbar .inspector-tabs > #map-editor-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* Every clickable control of the toolbars is a bordered button as 存档 and 读档 (human 2026-11-06: "the ui rules are wrong,
   button that may click should have boundary just as 存档/读档"; their rule is styles.css
   `.controlbar :is(#save-button, #load-button, #advance-button)`). */

/* 读档 存档 定档 读参 存参 (human 2026-11-06: "the first 5 buttons from 存档 to 设为默认 in explorer rearrange as 读档 存档 定档 读参
   存参"): 定档, 读参 and 存参 (开发者模式 only) bordered as 存档 and 读档, 4px apart as the line's buttons */
.controlbar :is(#parameter-load-button, #parameter-save-button, #parameter-default-button) {
  border-color: #b9c4bd;
  background: #fffdf6;
  color: var(--ink);
}
.controlbar :is(#parameter-load-button, #parameter-save-button, #parameter-default-button):hover {
  border-color: var(--teal);
}

/* The tabs: the side tabs 总览 · 区域 · 商路, the scenario tabs of 总览 (开发者 groups and the 展示 row), the chart tabs and the
   载荷 route tabs (.chart-tabs). The chosen one by border, background and colour, as 规则 | 详情 (not weight). */
.inspector-tabs > button[data-inspector],
.overview-scenarios .scenario-tabs button,
.chart-tabs > button {
  border-color: #b9c4bd;
  background: #fffdf6;
  color: var(--ink);
}
.inspector-tabs > button[data-inspector]:hover:not(:disabled, .active),
.overview-scenarios .scenario-tabs button:hover:not(:disabled, .active),
.chart-tabs > button:hover:not(:disabled, .active) {
  border-color: var(--teal);
}
.inspector-tabs > button[data-inspector].active,
.overview-scenarios .scenario-tabs button.active,
.chart-tabs > button.active {
  border-color: #244943;
  background: #eef1eb;
  color: #244943;
}
.chart-tabs > button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* 选择区域 just left of 应用 and 重置 (human 2026-11-06: "“编辑” should remain its place, 选择区域 should left to 应用 重置"): the
   line's free space before it, 8px between it and 应用 (the line's 24px gap undone in part) */
.controlbar > #region-select-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: -16px;
  white-space: nowrap;
}
.controlbar > #region-select-toggle + .configuration-toolbar {
  margin-left: 0;
}
/* 重置's right edge is the map's right edge at every width and display zoom (human 2026-11-07: "reset should right align to
   the map's right edges"): when the line is too narrow, the left group (读档 … 本地) wraps onto a second row instead of
   pushing 圈选, 应用, 重置 and the side tabs past the line's end */
.controlbar > .time-controls {
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 4px;
}
/* Stacked line (the side panel under the map, the map as wide as the line): the left group, then 圈选 应用 重置 at the
   right end of their row (重置 at the line's, i.e. the map's, right edge), then the side tabs */
@media (max-width: 820px) {
  .controlbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .controlbar > .time-controls,
  .controlbar .inspector-tabs {
    flex: 1 0 100%;
  }
  .controlbar > #region-select-toggle {
    margin: 0 0 0 auto;
  }
  .controlbar > #region-select-toggle + .configuration-toolbar {
    margin-right: -12px;
  }
}
