/* 共享平台条：Switch 红 / PS 蓝，固定在页面顶部，两个面板共用。 */

:root {
  --platform-shell-h: 58px;
}

[hidden] {
  display: none !important;
}

.platform-shell {
  position: sticky;
  top: 0;
  z-index: 80;
  background: #0c1320;
  color: #c7d2e0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.platform-shell-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1280px;
  height: var(--platform-shell-h);
  margin: 0 auto;
  padding: 0 32px;
}

.platform-shell-title {
  flex: 0 0 auto;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.platform-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.platform-tab {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #aab7c8;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.platform-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* 高亮只跟随 html[data-platform]，首屏 JS 未执行时也不会闪错。 */
html[data-platform="switch"] .platform-tab[data-platform-choice="switch"] {
  background: #e60012;
  color: #fff;
}

html[data-platform="ps"] .platform-tab[data-platform-choice="ps"] {
  background: #0068e8;
  color: #fff;
}

.platform-shell-note {
  margin-left: auto;
  color: #77879c;
  font-size: 11.5px;
  white-space: nowrap;
}

/* 两个平台面板互斥显示；不改变各自内部 DOM。 */
html[data-platform="ps"] #switch-panel,
html[data-platform="switch"] #ps-host {
  display: none;
}

#switch-panel {
  display: block;
}

#ps-host {
  display: block;
  min-height: calc(100dvh - var(--platform-shell-h));
  background: #f4f6fa;
}

html[data-platform="ps"] {
  color-scheme: light;
}

html[data-platform="ps"] body {
  background: #f4f6fa;
}

/* Switch 的 header / toolbar 需要让出共享条的高度。 */
#switch-panel .topbar {
  top: var(--platform-shell-h);
}

#switch-panel .toolbar {
  top: calc(var(--platform-shell-h) + var(--topbar-h));
}

/* PS 弹窗打开时锁住文档滚动（弹窗本体在 Shadow DOM 内）。 */
html.ps-dialog-open,
html.ps-dialog-open body {
  overflow: hidden;
}

#ps-host > .ps-loading {
  margin: 0;
  padding: 48px 20px;
  color: #5b6779;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 760px) {
  :root {
    --platform-shell-h: 52px;
  }

  .platform-shell-inner {
    gap: 10px;
    padding: 0 16px;
  }

  .platform-shell-title,
  .platform-shell-note {
    display: none;
  }

  .platform-tab {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .platform-tab {
    transition: none;
  }
}
