/* COZONE Web — Edition R1 (极简深灰 · Apple TV / Infuse) Design Tokens */

:root {
  color-scheme: dark;

  /* Core Palette (Locked R1) */
  --bg: #141416;
  --bg-elevated: #19191D;
  --surface: #1E1E22;
  --surface-hover: #26262B;
  --border: #242429;
  --border-strong: #323238;
  --text: #F4F4F6;
  --text-secondary: #8E8E93;
  --text-muted: #636368;
  --cta-bg: #FFFFFF;
  --cta-fg: #141416;
  --status-ok: #22C55E;

  /* Semantic Quiet Source Health Tokens */
  --health-ok: #30D158;
  --health-warn: #FFD60A;
  --health-bad: #FF453A;
  --health-idle: #636366;

  /* Quiet Extended Neutrals */
  --topbar-bg-glass: rgba(25, 25, 29, 0.86);
  --topbar-border: #202024;
  --search-border: #2C2C32;
  --search-placeholder: #787880;
  --nav-active: #FFFFFF;
  --mobile-audio-bg: #1D1D21;
  --mobile-audio-border-top: #28282E;
  --mobile-audio-border-bottom: #232328;
  --mobile-tab-bg: #18181B;
  --mobile-tab-inactive: #787880;
  --frame-bg: #1B1B1F;
  --frame-hairline: rgba(255, 255, 255, 0.065);
  --btn-secondary-bg: rgba(255, 255, 255, 0.10);
  --btn-secondary-hover: rgba(255, 255, 255, 0.16);
  --btn-secondary-border: rgba(255, 255, 255, 0.08);
  --progress-track: rgba(255, 255, 255, 0.18);
  --progress-fill: #FFFFFF;
  --overlay-backdrop: rgba(10, 10, 12, 0.72);
  --focus-ring: rgba(255, 255, 255, 0.28);
  --status-danger: #EF4444;
  --status-warn: #EAB308;
  --scrollbar-thumb: rgba(255, 255, 255, 0.14);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.24);
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.52);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* Layout Dimensions */
  --topbar-h: 56px;
  --audiobar-h: 52px;
  --mobile-tab-h: 54px;
  --mobile-audio-h: 48px;
  --stage-max-w: 1380px;

  /* Typography */
  --font-sans: "PingFang SC", "Microsoft YaHei UI", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Consolas", monospace;
}

/* Optional restrained light mode (toggled exclusively inside Settings modal) */
[data-theme="light"] {
  color-scheme: light;

  --bg: #F5F5F7;
  --bg-elevated: #FFFFFF;
  --surface: #EAEAEE;
  --surface-hover: #DFDFE5;
  --border: #DCDCE2;
  --border-strong: #C5C5CD;
  --text: #141416;
  --text-secondary: #5E5E64;
  --text-muted: #86868D;
  --cta-bg: #141416;
  --cta-fg: #FFFFFF;
  --status-ok: #16A34A;

  /* Light-theme High-Contrast Health Tokens */
  --health-ok: #248A3D;
  --health-warn: #B25000;
  --health-bad: #D70015;
  --health-idle: #8E8E93;

  --topbar-bg-glass: rgba(245, 245, 247, 0.86);
  --topbar-border: #E2E2E7;
  --search-border: #D5D5DC;
  --search-placeholder: #75757D;
  --nav-active: #141416;
  --mobile-audio-bg: #FAFAFC;
  --mobile-audio-border-top: #E0E0E6;
  --mobile-audio-border-bottom: #E8E8ED;
  --mobile-tab-bg: #FFFFFF;
  --mobile-tab-inactive: #75757D;
  --frame-bg: #E4E4E9;
  --frame-hairline: rgba(0, 0, 0, 0.08);
  --btn-secondary-bg: rgba(20, 20, 22, 0.06);
  --btn-secondary-hover: rgba(20, 20, 22, 0.11);
  --btn-secondary-border: rgba(20, 20, 22, 0.09);
  --progress-track: rgba(20, 20, 22, 0.14);
  --progress-fill: #141416;
  --overlay-backdrop: rgba(20, 20, 22, 0.36);
  --focus-ring: rgba(20, 20, 22, 0.28);
  --status-danger: #DC2626;
  --status-warn: #CA8A04;
  --scrollbar-thumb: rgba(20, 20, 22, 0.16);
  --scrollbar-thumb-hover: rgba(20, 20, 22, 0.28);
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.18);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
}

[hidden] {
  display: none !important;
}

/* Restrained keyboard focus indicator */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Subtle hairlined media surface */
.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--frame-bg);
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--frame-hairline);
  pointer-events: none;
}

/* Flat monochrome buttons shared across shell & modals */
.btn-primary {
  height: 35px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: var(--cta-bg);
  color: var(--cta-fg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity 0.14s ease;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  height: 35px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Thin monochrome scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}
