/* Scoped adaptation of baohe-screen/screen.css inside the unified workbench. */
.baohe-presentation {
  --sc-bg: #050b18;
  --sc-bg-2: #071226;
  --sc-panel: rgba(11, 25, 48, 0.78);
  --sc-panel-solid: #0b1930;
  --sc-line: rgba(96, 140, 200, 0.18);
  --sc-line-strong: rgba(120, 168, 230, 0.34);
  --sc-text: #dbe7f5;
  --sc-text-strong: #f2f7ff;
  --sc-muted: #7d93b4;
  --sc-faint: #8298b9;
  --sc-accent: #0a70de;
  --sc-accent-bright: #4da3ff;
  --sc-ok: #35b37e;
  --sc-warn: #d9a441;
  --sc-bad: #ed7a64;
  --sc-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --sc-mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
  color: var(--sc-text);
  font-family: var(--sc-font);
  line-height: 1.5;
  background: #02060f;
}

@scope (.baohe-presentation) {
  button, select { font: inherit; }

  :where(a, button, select):focus-visible {
    outline: 2px solid var(--sc-accent-bright);
    outline-offset: 3px;
  }

  :scope {
    background:
      radial-gradient(1200px 600px at 50% -10%, rgba(10, 112, 222, 0.12), transparent 60%),
      #02060f;
  }

  .stage {
    position: relative;
    max-width: 1920px;
    min-height: 100svh;
    margin-inline: auto;
    background:
      radial-gradient(1400px 700px at 50% -12%, rgba(10, 112, 222, 0.14), transparent 62%),
      linear-gradient(180deg, #06101f 0%, var(--sc-bg) 34%, #040912 100%);
    display: flex;
    flex-direction: column;
  }

  .stage::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
      linear-gradient(rgba(96, 140, 200, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(96, 140, 200, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(1200px 700px at 50% 40%, rgba(0,0,0,0.9), transparent 78%);
  }

  /* ---------------- 顶部标题栏 ---------------- */

  .sc-head {
    position: relative;
    z-index: 5;
    min-height: 84px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--sc-line);
    background: linear-gradient(180deg, rgba(10, 112, 222, 0.10), rgba(10, 112, 222, 0.02));
  }

  .sc-head::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(77, 163, 255, 0.55) 30%, rgba(77, 163, 255, 0.55) 70%, transparent);
  }

  .sc-title { min-width: 0; }
  .sc-title-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.5em; }
  .sc-title-line > span,
  .sc-title h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.875rem);
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--sc-text-strong);
  }
  .sc-title h1 { color: var(--sc-accent-bright); }
  .sc-title p {
    margin: 4px 0 0;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: var(--sc-muted);
  }

  .sc-controls {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
  }

  .seg {
    display: flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    background: rgba(5, 13, 28, 0.6);
  }
  .seg button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--sc-muted);
    font-family: inherit;
    font-size: 14px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
    white-space: nowrap;
  }
  .seg button:hover { color: var(--sc-text); }
  .seg button[aria-pressed="true"] {
    background: rgba(10, 112, 222, 0.28);
    color: #cfe6ff;
    box-shadow: inset 0 0 0 1px rgba(77, 163, 255, 0.45);
  }
  .sc-head-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
  }

  .sc-clock { text-align: right; }
  .sc-clock span {
    display: block;
    font-size: 12px;
    color: var(--sc-muted);
    letter-spacing: 1px;
  }

  .demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--sc-warn);
    border: 1px solid rgba(217, 164, 65, 0.4);
    background: rgba(217, 164, 65, 0.08);
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
  }
  /* ---------------- 主体三栏 ---------------- */

  .sc-body {
    position: relative;
    z-index: 4;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 0.28fr) minmax(0, 0.55fr) minmax(0, 0.28fr);
    grid-template-areas: "left map right";
    gap: 14px;
    padding: 16px 20px;
  }

  .sc-left { grid-area: left; }
  .sc-right { grid-area: right; }

  .sc-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
  }

  /* ---------------- 面板 ---------------- */

  .sc-panel {
    position: relative;
    border: 1px solid var(--sc-line);
    border-radius: 10px;
    background: var(--sc-panel);
    backdrop-filter: blur(6px);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
  }
  .sc-left .sc-panel:last-child, .sc-right .sc-panel:last-child { flex-grow: 1; }
  .sc-panel::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 14px;
    width: 56px;
    height: 2px;
    background: linear-gradient(90deg, var(--sc-accent-bright), transparent);
  }

  .sc-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }
  .sc-panel-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--sc-text-strong);
  }
  .sc-panel-tag {
    font-size: 12px;
    color: var(--sc-faint);
    letter-spacing: 1px;
  }

  .sc-panel-note {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--sc-faint);
    letter-spacing: 0.5px;
  }

  .sc-panel-body { flex: 1; min-height: 0; overflow-wrap: anywhere; }

  /* ---------------- 大数字与统计块 ---------------- */

  .stat-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
  }
  .stat {
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    background: rgba(5, 13, 28, 0.5);
    min-width: 0;
    padding: 8px 10px;
  }
  .stat .stat-label {
    font-size: 12px;
    color: var(--sc-muted);
    letter-spacing: 1px;
  }
  .stat .stat-value {
    margin-top: 4px;
    font-family: var(--sc-mono);
    font-size: clamp(1.125rem, 1.55vw, 1.5rem);
    font-weight: 600;
    color: var(--sc-text-strong);
    font-variant-numeric: tabular-nums;
  }
  .stat .stat-sub {
    margin-top: 3px;
    font-size: 12px;
    color: var(--sc-faint);
  }

  /* ---------------- 中央地图区 ---------------- */

  .sc-map {
    grid-area: map;
    position: relative;
    border: 1px solid var(--sc-line);
    border-radius: 12px;
    background: rgba(4, 10, 22, 0.55);
    overflow: hidden;
    min-height: 630px;
  }

  #map3d {
    position: absolute;
    inset: 0;
  }
  #map3d canvas { display: block; width: 100%; height: 100%; }

  .map-overlay-title {
    position: absolute;
    top: 14px;
    left: 18px;
    z-index: 3;
    pointer-events: none;
  }
  .map-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .map-overlay-title h2 {
    display: block;
    margin: 0;
    font-size: 1rem;
    letter-spacing: 2px;
    color: var(--sc-text-strong);
  }
  .map-reset {
    appearance: none;
    pointer-events: auto;
    border: 1px solid rgba(77, 163, 255, 0.45);
    background: rgba(10, 112, 222, 0.14);
    color: var(--sc-accent-bright);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
  }
  .map-reset:hover { background: rgba(10, 112, 222, 0.28); }
  .map-reset:focus-visible {
    outline: 2px solid var(--sc-accent-bright);
    outline-offset: 2px;
  }
  .map-overlay-title span {
    display: block;
    font-size: 12px;
    color: var(--sc-faint);
    letter-spacing: 1px;
  }
  .map-hint {
    margin-top: 2px;
    color: var(--sc-muted) !important;
  }

  .map-legend {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--sc-muted);
    background: rgba(5, 13, 28, 0.7);
    border: 1px solid var(--sc-line);
    border-radius: 8px;
    padding: 7px 12px;
  }
  .map-chips {
    position: absolute;
    left: 18px;
    bottom: 16px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .map-chips button {
    appearance: none;
    text-align: left;
    border: 1px solid var(--sc-line);
    background: rgba(5, 13, 28, 0.72);
    color: var(--sc-text);
    font-family: inherit;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease;
    white-space: nowrap;
  }
  .map-chips button:hover { border-color: var(--sc-line-strong); }
  .map-chips button[aria-pressed="true"] {
    border-color: rgba(77, 163, 255, 0.6);
    color: var(--sc-accent-bright);
    background: rgba(10, 112, 222, 0.16);
  }

  .map-compass {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 3;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--sc-line);
    background: rgba(5, 13, 28, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sc-muted);
    font-size: 12px;
  }

  /* 聚焦园区卡片 */
  .focus-card {
    position: absolute;
    top: auto;
    bottom: 16px;
    right: 16px;
    z-index: 4;
    width: min(19rem, calc(100% - 12rem));
    border: 1px solid rgba(77, 163, 255, 0.4);
    border-radius: 10px;
    background: rgba(6, 15, 30, 0.92);
    padding: 12px 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
  .focus-card[hidden] { display: none; }
  .focus-card h3 {
    margin: 0 26px 2px 0;
    font-size: 16px;
    color: var(--sc-text-strong);
  }
  .focus-card .focus-industry {
    font-size: 12px;
    color: var(--sc-muted);
    margin-bottom: 10px;
  }
  .focus-card .focus-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--sc-accent-bright);
    text-decoration: none;
  }
  .focus-card .focus-link:hover { text-decoration: underline; }
  /* ---------------- 底部异常 ---------------- */

  .sc-ticker {
    position: relative;
    z-index: 5;
    flex: none;
    min-height: 52px;
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--sc-line);
    background: rgba(5, 13, 28, 0.85);
  }
  .ticker-label {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--sc-bad);
    border-right: 1px solid var(--sc-line);
    background: rgba(208, 82, 58, 0.08);
    white-space: nowrap;
  }
  .ticker-label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sc-bad);
  }
  .ticker-track {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 24px;
    margin: 0;
    padding: 0 14px;
  }
  .ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--sc-text);
  }
  .ticker-item .t-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: none;
  }
  .ticker-item .t-dot.high { background: var(--sc-bad); }
  .ticker-item .t-dot.mid { background: var(--sc-warn); }
  .ticker-item .t-dot.low { background: var(--sc-accent-bright); }
  .ticker-item .t-meta { color: var(--sc-faint); }

  .screen-status {
    max-width: 38rem;
    margin: 12vh auto 0;
    padding: 20px;
  }
  .screen-status h1 { margin-block: 0 12px; }

  .screen-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sc-text-strong);
    border: 1px solid var(--sc-line-strong);
    background: var(--sc-panel-solid);
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    cursor: pointer;
  }

  :where(.screen-action, .map-reset, .map-chips button, .focus-link, .screen-jump) {
    min-height: 44px;
    min-width: 44px;
  }
  .screen-action:hover, .screen-action:focus-visible { border-color: var(--sc-accent-bright); }

  .screen-data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--sc-line);
    font-size: 0.875rem;
  }
  .screen-data-row dt { color: var(--sc-muted); }
  .screen-data-row dd { margin: 0; text-align: end; }
  .screen-data { margin: 0; }
  .device-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .device-kinds .screen-data-row { font-size: 0.8125rem; }
  .screen-jump {
    display: inline-flex;
    align-items: center;
    color: var(--sc-accent-bright);
    text-underline-offset: 2px;
  }
  .screen-empty {
    margin: 4px 0 8px;
    color: var(--sc-muted);
    line-height: 1.6;
  }
  .screen-note { margin-block: 8px 2px; color: var(--sc-muted); font-size: 0.8125rem; line-height: 1.55; }

  .map2d {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse at 62% 42%, rgba(22, 72, 130, 0.24), transparent 68%),
      linear-gradient(rgba(77, 163, 255, 0.08) 1px, transparent 1px),
      linear-gradient(90deg, rgba(77, 163, 255, 0.08) 1px, transparent 1px),
      var(--sc-bg);
    background-size: auto, 32px 32px, 32px 32px, auto;
  }
  .map-board {
    position: absolute;
    inset: 8.5rem 3.25rem 14rem 3.25rem;
  }
  .map-pin {
    position: absolute;
    left: var(--pin-x);
    top: var(--pin-y);
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
  }
  .map-pin::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid var(--pin-color);
    border-radius: 50%;
    background: var(--sc-bg-2);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--pin-color) 20%, transparent);
  }
  .map-pin[aria-pressed="true"]::before { background: var(--pin-color); }
  .map-pin span {
    position: absolute;
    top: calc(100% - 2px);
    font-size: 0.8125rem;
    line-height: 1.25;
    white-space: nowrap;
    color: var(--sc-text-strong);
    padding: 4px 7px;
    border: 1px solid var(--sc-line);
    border-radius: 6px;
    background: var(--sc-panel-solid);
  }
  .map-pin span small { display: block; margin-top: 2px; color: var(--sc-muted); }
  .map-pin[data-project="103104"] span { top: auto; bottom: calc(100% - 2px); }
  .map-pin[data-project="103101"] span { left: 8px; }
  .map-pin[data-project="103102"] span { right: 9px; top: auto; bottom: calc(100% - 2px); }
  .map-pin[data-project="103106"] span { left: 8px; }
  .map-selectors { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
  .map-selectors label { display: grid; gap: 4px; min-width: 0; font-size: 0.8125rem; }
  .map-selectors select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--sc-line-strong);
    border-radius: 6px;
    background: var(--sc-panel-solid);
    color: var(--sc-text-strong);
    padding-inline: 6px;
  }
  .focus-actions { display: flex; flex-wrap: wrap; gap: 0 10px; }

  @media (max-width: 1199px) {
    .sc-head { flex-wrap: wrap; justify-content: space-between; }
    .sc-controls { order: 3; flex: 1 1 100%; justify-content: flex-start; }
    .sc-body {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-areas: "map map" "left right";
    }
    .sc-map { min-height: 620px; }
  }

  @media (max-width: 650px) {
    .sc-head, .sc-body { padding-inline: 12px; }
    .sc-head { gap: 10px; }
    .sc-head-right { justify-content: space-between; flex: 1 1 100%; }
    .sc-clock { text-align: start; }
    .sc-controls { gap: 6px; flex-wrap: wrap; }
    .seg button { padding-inline: 8px; }
    .sc-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "left" "right"; }
    .sc-map { display: flex; flex-direction: column; min-height: 0; gap: 8px; padding: 12px; }
    .map-overlay-title, .map-legend, .map-chips, .focus-card { position: static; }
    .map-overlay-title { order: -4; }
    .map-chips { order: -3; flex-flow: row wrap; }
    .map-chips button { white-space: normal; }
    .map-legend { order: -2; align-self: start; }
    #map3d, .map2d { position: relative; min-height: 270px; border-radius: 8px; }
    .map-board { inset: 32px 32px 30px; }
    .map-pin span { display: none; }
    .map-compass { display: none; }
    .focus-card { width: auto; }
    .sc-ticker { flex-direction: column; }
    .ticker-label { min-height: 32px; }
    .ticker-track { display: block; }
    .ticker-item { display: block; }
  }

  @media (prefers-reduced-motion: reduce) {
    :scope *, :scope *::before, :scope *::after { transition: none; }
  }


  @media (min-width: 1200px) {
    .sc-body { grid-template-areas: "left map right"; }
  }

  @media (max-width: 650px) {
    .map-chips button { min-height: 48px; }
    .map-selectors select { min-height: 48px; }
    .seg button { min-height: 48px; }
  }

  .sc-clock { display: grid; justify-items: end; }
  .sc-period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .sc-period input { color: var(--sc-text); background: var(--sc-panel-solid); border: 1px solid var(--sc-line-strong);
    border-radius: 6px; padding-inline: 5px; min-height: 44px; max-inline-size: 100%; }
  .sc-period button { font-size: 0.8125rem; }
  .sc-panel-head h2 { line-height: 1.3; }
}
