/**
 * Base Styles
 * Root variables, resets, and foundational styles
 *
 * All colors/shadows/radii live as semantic tokens here. Light is the default;
 * `html[data-theme="dark"]` overrides the palette. Components consume tokens,
 * never hardcoded hex values.
 */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg-page: #f5f5f7;
  --bg-page-1: #fcfcfd;
  --bg-page-2: #f0f2f7;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-blur: 20px;
  --bg-workspace: #f7f8fb;
  --surface-elevated: #ffffff;
  --input-bg: #ffffff;
  --surface-inverse: #1d1d1f;
  --surface-inverse-fg: #ffffff;

  /* Text */
  --text-primary: #1d1d1f;
  --text-secondary: rgba(29, 29, 31, 0.66);
  --text-faint: rgba(29, 29, 31, 0.48);

  /* Accent — the single primary hue for the whole page */
  --accent: #2d6df6;
  --accent-strong: #1f5fd8;
  --accent-soft: rgba(45, 109, 246, 0.08);
  --accent-soft-strong: rgba(45, 109, 246, 0.16);
  --accent-ring: rgba(45, 109, 246, 0.2);
  --accent-fg: #ffffff;
  --accent-gradient: linear-gradient(90deg, #2d6df6 0%, #4e8cff 100%);

  /* Danger — recording / destructive states only */
  --danger: #e0392d;
  --danger-strong: #c52a1f;
  --danger-soft: rgba(224, 57, 45, 0.08);
  --danger-fg: #ffffff;

  /* Status */
  --success: #1e9e5a;

  /* Borders & tracks */
  --border: rgba(15, 15, 15, 0.08);
  --border-strong: rgba(0, 0, 0, 0.18);
  --track: rgba(0, 0, 0, 0.08);

  /* Radius scale — controls 8 / cards 12 / modal 16 / stage 24 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Layout */
  --aside-width: 320px;

  /* Shadows */
  --shadow-card: 0 28px 70px rgba(15, 15, 15, 0.06);
  --shadow-raise: 0 12px 24px rgba(45, 109, 246, 0.25);
  --shadow-raise-hover: 0 16px 30px rgba(45, 109, 246, 0.32);
  --shadow-danger: 0 8px 18px rgba(224, 57, 45, 0.25);
  --shadow-danger-hover: 0 12px 24px rgba(224, 57, 45, 0.32);
  --shadow-overlay: 0 24px 60px rgba(0, 0, 0, 0.28);
  --shadow-inverse: 0 8px 18px rgba(0, 0, 0, 0.25);

  --scrim: rgba(15, 15, 16, 0.42);

  /* Select chevron tinted for the active theme */
  --select-chevron: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.59 0.585999L6 5.172L1.41 0.585999L0 2L6 8L12 2L10.59 0.585999Z' fill='%231D1D1F'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-page: #0b0d11;
  --bg-page-1: #10131a;
  --bg-page-2: #090b0f;
  --glass-bg: rgba(20, 23, 30, 0.72);
  --glass-blur: 24px;
  --bg-workspace: #13161d;
  --surface-elevated: #1b1f27;
  --input-bg: #1b1f27;
  --surface-inverse: #3a3a3c;
  --surface-inverse-fg: #f5f5f7;

  --text-primary: #f5f5f7;
  --text-secondary: rgba(245, 245, 247, 0.66);
  --text-faint: rgba(245, 245, 247, 0.46);

  --accent: #4e8cff;
  --accent-strong: #3a78f0;
  --accent-soft: rgba(78, 140, 255, 0.14);
  --accent-soft-strong: rgba(78, 140, 255, 0.24);
  --accent-ring: rgba(78, 140, 255, 0.32);
  --accent-fg: #ffffff;
  --accent-gradient: linear-gradient(90deg, #4e8cff 0%, #6fa5ff 100%);

  --danger: #f25c4f;
  --danger-strong: #e0392d;
  --danger-soft: rgba(242, 92, 79, 0.14);
  --danger-fg: #ffffff;

  --success: #34c26b;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.24);
  --track: rgba(255, 255, 255, 0.12);

  --shadow-card: 0 28px 70px rgba(0, 0, 0, 0.5);
  --shadow-raise: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-raise-hover: 0 16px 30px rgba(0, 0, 0, 0.55);
  --shadow-danger: 0 8px 18px rgba(0, 0, 0, 0.4);
  --shadow-danger-hover: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-overlay: 0 24px 60px rgba(0, 0, 0, 0.6);
  --shadow-inverse: 0 8px 18px rgba(0, 0, 0, 0.5);

  --scrim: rgba(0, 0, 0, 0.6);

  --select-chevron: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.59 0.585999L6 5.172L1.41 0.585999L0 2L6 8L12 2L10.59 0.585999Z' fill='%23F5F5F7'/%3E%3C/svg%3E");
}

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

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: linear-gradient(180deg, var(--bg-page-1) 0%, var(--bg-page-2) 100%);
}

a {
  text-decoration: none;
  color: var(--accent);
}

::selection {
  background: var(--accent-soft-strong);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}