/* Shared surfaces are derived from the selected registry palette. Add palettes in themes.js. */
:root {
  --surface-hover: color-mix(in srgb, var(--panel2) 82%, var(--line));
  --surface-tint: color-mix(in srgb, var(--accent) 7%, var(--panel));
  --surface-selected: color-mix(in srgb, var(--accent) 12%, var(--panel));
  --accent-border: color-mix(in srgb, var(--accent) 48%, var(--line));
  --accent-soft: color-mix(in srgb, var(--accent) 63%, var(--panel));
  --accent-faint: color-mix(in srgb, var(--accent) 30%, var(--panel));
  --accent-glow: color-mix(in srgb, var(--accent) 17%, transparent);
  --accent-guide: color-mix(in srgb, var(--accent) 13%, transparent);
  --accent-watermark: color-mix(in srgb, var(--accent) 4%, transparent);
  --panel-overlay: color-mix(in srgb, var(--panel) 95%, transparent);
  --sidebar-overlay: color-mix(in srgb, var(--sidebar) 96%, transparent);
  --warning-bg: color-mix(in srgb, var(--orange) 10%, var(--panel));
  --warning-line: color-mix(in srgb, var(--orange) 45%, var(--line));
  --error-bg: color-mix(in srgb, var(--red) 10%, var(--panel));
  --error-line: color-mix(in srgb, var(--red) 50%, var(--line));
  --backdrop: color-mix(in srgb, var(--bg) 74%, transparent);
  --selection: color-mix(in srgb, var(--accent) 28%, var(--bg));
}

::selection { background: var(--selection); color: var(--text); }
.btn.primary, .btn.primary:hover { color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.skip-link { color: var(--on-accent); }
.appearance-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text); white-space: nowrap; }
.appearance-trigger:hover { border-color: var(--accent-border); background: var(--surface-tint); }
.appearance-trigger .icon { width: 19px; height: 19px; color: var(--accent); }
.appearance-trigger span { font-size: 12px; }
.appearance-dialog { width: min(700px, 96vw); display: flex; flex-direction: column; }
.appearance-dialog .modal-body { min-height: 0; overflow-y: auto; }
.appearance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-choice { position: relative; display: flex; flex-direction: column; min-width: 0; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.theme-choice:hover { border-color: var(--accent-border); }
.theme-choice.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
.theme-choice.selected .theme-sample { margin: -1px -1px 0; }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.theme-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-sample { display: flex; height: 85px; padding: 12px; gap: 8px; background: var(--sample-bg); border-bottom: 1px solid var(--sample-line); color: var(--sample-text); pointer-events: none; }
.theme-sample-side { width: 18px; display: flex; flex-direction: column; gap: 5px; }
.theme-sample-side i { height: 5px; border-radius: 2px; background: var(--sample-panel); }
.theme-sample-side i:first-child { height: 12px; background: var(--sample-accent); }
.theme-sample-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.theme-sample-line { height: 6px; width: 68%; border-radius: 2px; background: var(--sample-text); opacity: .65; }
.theme-sample-card { display: flex; gap: 6px; flex: 1; border-radius: 4px; padding: 7px; background: var(--sample-panel); align-items: flex-end; }
.theme-sample-card i { height: 5px; width: 42%; border-radius: 2px; background: var(--sample-accent); }
.theme-sample-card i:last-child { width: 25%; background: var(--sample-text); opacity: .35; }
.theme-choice-body { padding: 12px; }
.theme-choice-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-choice-heading strong { font-size: 14px; font-weight: 600; }
.theme-choice-status { display: inline-flex; gap: 3px; align-items: center; color: var(--accent); font-size: 12px; }
.theme-choice-status .icon { width: 14px; height: 14px; }
.theme-choice-status[hidden] { display: none; }
.theme-choice-body p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 7px 0 0; }
.appearance-status { display: flex; gap: 8px; align-items: flex-start; padding: 12px; margin: 18px 0 0; border-radius: 8px; background: var(--surface-tint); color: var(--muted); font-size: 13px; }
.appearance-status .icon { color: var(--accent); margin-top: 1px; flex: none; }
.appearance-status span { min-width: 0; }

@media (max-width: 1100px) {
  .appearance-trigger { width: 44px; min-width: 44px; padding: 0; }
  .appearance-trigger span { display: none; }
}
@media (max-width: 600px) {
  .appearance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .appearance-dialog { width: 100%; max-height: 94dvh; }
  .appearance-dialog .modal-head { flex: none; }
  .appearance-dialog .modal-body { padding: 4px 15px 16px; }
  .appearance-dialog .modal-footer { flex: none; }
  .theme-sample { height: 65px; padding: 9px; }
  .theme-choice-body { padding: 10px; }
  .theme-choice-heading { flex-wrap: wrap; }
  .theme-choice-body p { min-height: 36px; }
  .appearance-status { font-size: 12px; margin-top: 12px; }
}
