:root {
  --xh-space-1: 4px;
  --xh-space-2: 8px;
  --xh-space-3: 12px;
  --xh-space-4: 16px;
  --xh-space-5: 24px;
  --xh-space-6: 32px;
  --xh-gap-local: var(--xh-space-2);
  --xh-gap-group: var(--xh-space-4);
  --xh-gap-section: var(--xh-space-6);
  --xh-pad-control: var(--xh-space-2) var(--xh-space-3);
  --xh-pad-container: var(--xh-space-4);
  --xh-pad-page: var(--xh-space-4);

  --xh-text-caption: 12px;
  --xh-text-small: 13px;
  --xh-text-body: 14px;
  --xh-text-large: 16px;
  --xh-text-title: 18px;
  --xh-text-heading: 22px;
  --xh-text-display: 28px;
  --xh-text-hero: 36px;
  --xh-text-input: 16px;
  --xh-leading-tight: 1.25;
  --xh-leading-body: 1.5;
  --xh-weight-regular: 400;
  --xh-weight-medium: 500;
  --xh-weight-bold: 700;
  --xh-font-sans: var(--ui-sans);
  --xh-font-mono: var(--ui-mono);

  --xh-radius-inner: 2px;
  --xh-radius-control: 4px;
  --xh-radius-container: 8px;
  --xh-radius-card: 16px;
  --xh-radius-full: 999px;

  --xh-surface-page: var(--tone-page);
  --xh-surface-panel: var(--tone-panel);
  --xh-surface-raised: var(--tone-raised);
  --xh-surface-hover: var(--tone-hover);
  --xh-text: var(--tone-ink);
  --xh-text-secondary: var(--tone-secondary);
  --xh-text-muted: var(--tone-muted);
  --xh-text-on-dark: var(--tone-ink);
  --xh-border: color-mix(in srgb, var(--tone-ink) 38%, transparent);
  --xh-border-strong: color-mix(in srgb, var(--tone-ink) 48%, transparent);
  --xh-accent: var(--tone-mint);
  --xh-accent-hover: var(--tone-mint-hover);
  --xh-accent-active: var(--tone-mint-active);
  --xh-on-accent: var(--tone-page);
  --xh-status-success: var(--tone-mint);
  --xh-status-warning: #E0A43A;
  --xh-status-danger: #E06A4F;
  --xh-status-info: #6FA8DC;
  --xh-focus-ring: 0 0 0 2px var(--tone-page), 0 0 0 4px var(--tone-mint);

  --xh-shadow-floating: 0 8px 24px color-mix(in srgb, #000 28%, transparent);
  --xh-shadow-overlay: 0 16px 48px color-mix(in srgb, #000 40%, transparent);

  --xh-bp-tablet: 640px;
  --xh-bp-desktop: 960px;

  --xh-duration-fast: 120ms;
  --xh-duration-base: 200ms;
  --xh-duration-slow: 320ms;
  --xh-ease-standard: cubic-bezier(0.2, 0, 0, 1);
}

html[data-surface="social"][data-theme="light"] {
  --tone-page: #f7f9f6;
  --tone-panel: #ffffff;
  --tone-raised: #e6f3eb;
  --tone-ink: #202321;
  --tone-muted: #505b55;
  --tone-mint: #14513f;
  --ui-sans: system-ui, -apple-system, "PingFang TC", sans-serif;
}

html[data-theme="light"] {
  --xh-text-on-dark: var(--tone-page);
  --xh-border: color-mix(in srgb, var(--tone-ink) 50%, transparent);
  --xh-border-strong: color-mix(in srgb, var(--tone-ink) 60%, transparent);
  --xh-status-warning: #B26A00;
  --xh-status-danger: #B3361C;
  --xh-status-info: #2F6FA8;
  --xh-shadow-floating: 0 8px 24px color-mix(in srgb, #000 10%, transparent);
  --xh-shadow-overlay: 0 16px 48px color-mix(in srgb, #000 16%, transparent);
}

.style-icon-btn,
.side-palette-btn.style-choice-btn {
  --xh-style-chip: var(--xh-surface-raised);
  --xh-style-chip-active: var(--xh-surface-hover);
  --xh-style-icon: var(--xh-text);
  --xh-style-icon-active: var(--xh-text);
}

@supports (color: color-mix(in srgb, white, black)) and (color: color(from white xyz-d65 calc(sign(y)) y z)) {
  .style-icon-btn,
  .side-palette-btn.style-choice-btn {
    --xh-style-chip: color-mix(in srgb, var(--style-hue, var(--xh-accent)) 72%, var(--xh-surface-raised));
    --xh-style-chip-active: color-mix(in srgb, var(--style-hue, var(--xh-accent)) 88%, var(--xh-surface-raised));
    --xh-style-icon: color(from var(--xh-style-chip) xyz-d65 calc((1 - clamp(0, 1, sign(y - 0.17913))) * 0.9505) calc(1 - clamp(0, 1, sign(y - 0.17913))) calc((1 - clamp(0, 1, sign(y - 0.17913))) * 1.089));
    --xh-style-icon-active: color(from var(--xh-style-chip-active) xyz-d65 calc((1 - clamp(0, 1, sign(y - 0.17913))) * 0.9505) calc(1 - clamp(0, 1, sign(y - 0.17913))) calc((1 - clamp(0, 1, sign(y - 0.17913))) * 1.089));
  }
}

@supports (color: contrast-color(white)) and (color: color-mix(in srgb, white, black)) {
  .style-icon-btn,
  .side-palette-btn.style-choice-btn {
    --xh-style-chip: color-mix(in srgb, var(--style-hue, var(--xh-accent)) 72%, var(--xh-surface-raised));
    --xh-style-chip-active: color-mix(in srgb, var(--style-hue, var(--xh-accent)) 88%, var(--xh-surface-raised));
    --xh-style-icon: contrast-color(var(--xh-style-chip));
    --xh-style-icon-active: contrast-color(var(--xh-style-chip-active));
  }
}
