/* Keep Latin letterforms in San Francisco while CJK text keeps PingFang's
 * glyph metrics. The local() sources deliberately avoid bundling Apple fonts. */
@font-face {
  font-family: 'YAQMC Text';
  font-weight: 100 900;
  font-stretch: 100%;
  src: local('SF Pro Text'), local('San Francisco');
  unicode-range: U+0000-02AF, U+1E00-1EFF, U+2000-214F;
}

@font-face {
  font-family: 'YAQMC Text';
  font-weight: 100 900;
  src: local('PingFang SC');
  unicode-range: U+3000-303F, U+3040-30FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
}

@font-face {
  font-family: 'YAQMC Display';
  font-weight: 100 900;
  font-stretch: 100%;
  src: local('SF Pro Display'), local('San Francisco');
  unicode-range: U+0000-02AF, U+1E00-1EFF, U+2000-214F;
}

@font-face {
  font-family: 'YAQMC Display';
  font-weight: 100 900;
  src: local('PingFang SC');
  unicode-range: U+3000-303F, U+3040-30FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
}

:root {
  color-scheme: dark;
  --ui-font-scale: 1;
  font-stretch: 100%;
  font-variation-settings: 'wdth' 100;
  --font-ui-text:
    'YAQMC Text', 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI Variable', 'Segoe UI',
    system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC',
    'Source Han Sans CN', 'Microsoft YaHei', sans-serif;
  --font-ui-display:
    'YAQMC Display', 'SF Pro Display', 'Segoe UI Variable Display', 'Segoe UI Variable', 'Segoe UI',
    system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC',
    'Source Han Sans CN', 'Microsoft YaHei', sans-serif;
  font-family: var(--font-ui-text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;

  --font-display: var(--font-ui-display);
  --text-2xs: calc(0.6875rem * var(--ui-font-scale));
  --text-xs: calc(0.75rem * var(--ui-font-scale));
  --text-sm: calc(0.8125rem * var(--ui-font-scale));
  --text-base: calc(0.875rem * var(--ui-font-scale));
  --text-md: calc(1rem * var(--ui-font-scale));
  --text-lg: calc(1.25rem * var(--ui-font-scale));
  --text-xl: calc(1.625rem * var(--ui-font-scale));
  --text-2xl: clamp(
    calc(2.15rem * var(--ui-font-scale)),
    calc(4vw * var(--ui-font-scale)),
    calc(3.7rem * var(--ui-font-scale))
  );

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-round: 999px;

  --bg: #11120f;
  --bg-subtle: #141511;
  --sidebar: #0d0e0c;
  --surface: #181a16;
  --surface-raised: #1d1f1a;
  --surface-hover: #242620;
  --surface-pressed: #292c24;
  --player: #141511;
  --border: rgba(244, 247, 236, 0.09);
  --border-strong: rgba(244, 247, 236, 0.15);
  --text: #f0f2e9;
  --text-secondary: #a9ada2;
  --text-tertiary: #74796f;
  --accent: #d5ee8d;
  --accent-hover: #e1f6a6;
  --accent-ink: #171b0d;
  --danger: #e58a84;
  --warning: #e3c07a;
  --focus: #c5e478;
  --selection: rgba(197, 228, 120, 0.25);

  --yaqmc-primary: var(--accent);
  --yaqmc-secondary: var(--text-secondary);
  --yaqmc-radius-card: var(--radius-md);
  --yaqmc-player-height: 88px;
  --yaqmc-surface-alpha: 1;

  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.32);
  --shadow-art: 0 20px 45px rgba(0, 0, 0, 0.28);

  --radius-xl: 24px;
  --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;

  /* Aliases for names older stylesheets reference; they previously resolved to nothing. */
  --border-subtle: var(--border);
  --surface-border: var(--border);
  --surface-primary: var(--surface);
  --surface-elevated: var(--surface-raised);
  --surface-muted: var(--bg-subtle);
  --surface-strong: var(--surface-pressed);
  --surface-code: color-mix(in srgb, var(--bg) 70%, #000);
  --accent-muted: color-mix(in srgb, var(--accent) 16%, transparent);

  --motion-fast: 110ms;
  --motion-base: 180ms;
  --motion-slow: 280ms;
  --ease-out: cubic-bezier(0.22, 0.75, 0.24, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --press-scale: 0.96;
}

/* Android's default palette is true grayscale; surfaces and accents come from
 * generateThemeTokens({ neutral: true }), these remove the remaining tint. */
:root[data-palette='neutral'] {
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f2f2f2;
  --text-secondary: #ababab;
  --text-tertiary: #777777;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f5f1;
  --bg-subtle: #f0f0eb;
  --sidebar: #ebebe6;
  --surface: #ffffff;
  --surface-raised: #fafaf7;
  --surface-hover: #e8e9e2;
  --surface-pressed: #dedfd7;
  --player: #f9f9f5;
  --border: rgba(24, 27, 20, 0.09);
  --border-strong: rgba(24, 27, 20, 0.15);
  --text: #1d201a;
  --text-secondary: #62675d;
  --text-tertiary: #8a8f85;
  --accent: #708f35;
  --accent-hover: #617d2c;
  --accent-ink: #ffffff;
  --danger: #a74741;
  --warning: #9a7423;
  --focus: #6e8e34;
  --selection: rgba(112, 143, 53, 0.2);
  --shadow-sm: 0 8px 24px rgba(31, 35, 25, 0.1);
  --shadow-md: 0 20px 52px rgba(31, 35, 25, 0.16);
  --shadow-art: 0 18px 38px rgba(37, 39, 31, 0.2);
}

:root[data-palette='neutral'][data-theme='light'] {
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #1c1c1c;
  --text-secondary: #636363;
  --text-tertiary: #8b8b8b;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 20px 52px rgba(0, 0, 0, 0.16);
  --shadow-art: 0 18px 38px rgba(0, 0, 0, 0.2);
}
