:root {
  --bg: #e8eef5;
  --bg-soft: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.08);
  --text: #101828;
  --muted: #526070;
  --accent: #1f5d8f;
  --accent-dark: #123b5d;
  --accent-soft: rgba(31, 93, 143, 0.12);
  --success: #2f6f55;
  --success-soft: rgba(47, 111, 85, 0.14);
  --warning: #8a5a23;
  --warning-soft: rgba(138, 90, 35, 0.16);
  --danger: #a03d3d;
  --danger-soft: rgba(160, 61, 61, 0.15);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --body-bg: linear-gradient(180deg, #eef3f8 0%, #e7edf4 36%, #dde5ee 100%);
  --body-glow-left: rgba(31, 93, 143, 0.1);
  --body-glow-right: rgba(148, 163, 184, 0.16);
  --button-secondary-bg: #f8fafc;
  --button-ghost-bg: rgba(255, 255, 255, 0.78);
  --button-ghost-border: rgba(15, 23, 42, 0.08);
  --button-tool-bg: rgba(248, 250, 252, 0.92);
  --button-tool-border: rgba(15, 23, 42, 0.08);
  --tool-button-text: #182230;
  --card-soft-bg: rgba(248, 250, 252, 0.86);
  --input-bg: rgba(255, 255, 255, 0.94);
  --canvas-bg: linear-gradient(180deg, rgba(250, 252, 255, 0.97) 0%, rgba(235, 241, 247, 0.98) 100%);
  --canvas-overlay: radial-gradient(circle at top left, rgba(31, 93, 143, 0.08) 0%, rgba(31, 93, 143, 0) 56%);
  --chip-bg: rgba(248, 250, 252, 0.82);
  --surface-soft: rgba(248, 250, 252, 0.78);
  --surface-elevated: rgba(255, 255, 255, 0.94);
  --status-info-bg: rgba(248, 250, 252, 0.94);
  --status-info-border: rgba(148, 163, 184, 0.28);
  --media-card-bg: #f5f7fa;
  --top-nav-bg: rgba(255, 255, 255, 0.82);
  --toggle-track-bg: rgba(82, 96, 112, 0.18);
  --toggle-knob-bg: #ffffff;
  --toggle-chip-bg: rgba(255, 255, 255, 0.92);
  --toggle-chip-border: rgba(15, 23, 42, 0.08);
  --tutorial-bg: rgba(255, 255, 255, 0.97);
  --primary-end: #174a72;
  --primary-shadow: 0 14px 30px rgba(18, 59, 93, 0.18);
  --nav-active-end: #174a72;
  --nav-active-shadow: 0 12px 26px rgba(18, 59, 93, 0.22);
  --tool-active-text: #f8fbff;
  --tool-active-bg: linear-gradient(135deg, var(--accent) 0%, #174a72 100%);
  --tool-active-border: rgba(31, 93, 143, 0.4);
  --tool-active-shadow: 0 12px 22px rgba(18, 59, 93, 0.18);
  --hero-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 248, 252, 0.88) 100%);
  --hero-grid-color: rgba(82, 96, 112, 0.08);
  --hero-orb: rgba(31, 93, 143, 0.14);
  --subpanel-bg: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(244, 247, 250, 0.88) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(31, 93, 143, 0.08) 0%, rgba(255, 255, 255, 0.5) 100%);
  --theme-menu-bg: rgba(255, 255, 255, 0.96);
  --theme-menu-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-heading: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, var(--body-glow-left), transparent 30%),
    radial-gradient(circle at top right, var(--body-glow-right), transparent 28%),
    var(--body-bg);
}


body[data-theme="dark"] {
  --bg: #08111d;
  --bg-soft: #111b28;
  --surface: rgba(9, 17, 28, 0.92);
  --surface-strong: #111b28;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e8eef5;
  --muted: #9aa8b7;
  --accent: #64a2d8;
  --accent-dark: #d8e8f8;
  --accent-soft: rgba(100, 162, 216, 0.2);
  --success: #7bc29e;
  --success-soft: rgba(70, 120, 95, 0.34);
  --warning: #d0a062;
  --warning-soft: rgba(130, 95, 49, 0.38);
  --danger: #eb8a8a;
  --danger-soft: rgba(120, 55, 55, 0.38);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.44);
  --body-bg: linear-gradient(180deg, #07111c 0%, #0b1624 38%, #111f30 100%);
  --body-glow-left: rgba(50, 110, 165, 0.18);
  --body-glow-right: rgba(15, 23, 42, 0.22);
  --button-secondary-bg: #172535;
  --button-ghost-bg: rgba(20, 31, 45, 0.84);
  --button-ghost-border: rgba(148, 163, 184, 0.18);
  --button-tool-bg: rgba(17, 27, 40, 0.88);
  --button-tool-border: rgba(148, 163, 184, 0.16);
  --tool-button-text: #e8eef5;
  --card-soft-bg: rgba(17, 27, 40, 0.84);
  --input-bg: rgba(11, 22, 34, 0.92);
  --canvas-bg: linear-gradient(180deg, rgba(17, 27, 40, 0.98) 0%, rgba(10, 18, 29, 0.98) 100%);
  --canvas-overlay: radial-gradient(circle at top left, rgba(100, 162, 216, 0.12) 0%, rgba(100, 162, 216, 0) 56%);
  --chip-bg: rgba(17, 27, 40, 0.82);
  --surface-soft: rgba(17, 27, 40, 0.82);
  --surface-elevated: rgba(21, 32, 46, 0.94);
  --status-info-bg: rgba(17, 27, 40, 0.94);
  --status-info-border: rgba(148, 163, 184, 0.2);
  --media-card-bg: #142131;
  --top-nav-bg: rgba(17, 27, 40, 0.86);
  --toggle-track-bg: rgba(148, 163, 184, 0.26);
  --toggle-knob-bg: #eff4f9;
  --toggle-chip-bg: rgba(17, 27, 40, 0.94);
  --toggle-chip-border: rgba(148, 163, 184, 0.18);
  --tutorial-bg: rgba(17, 27, 40, 0.97);
  --primary-end: #2f6e9d;
  --primary-shadow: 0 14px 30px rgba(10, 35, 58, 0.26);
  --nav-active-end: #174a72;
  --nav-active-shadow: 0 12px 26px rgba(10, 35, 58, 0.32);
  --tool-active-text: #f4f9ff;
  --tool-active-bg: linear-gradient(135deg, #64a2d8 0%, #2f6e9d 100%);
  --tool-active-border: rgba(149, 198, 240, 0.42);
  --tool-active-shadow: 0 12px 22px rgba(10, 35, 58, 0.34);
  --hero-bg: linear-gradient(145deg, rgba(17, 27, 40, 0.96) 0%, rgba(10, 18, 29, 0.94) 100%);
  --hero-grid-color: rgba(120, 146, 176, 0.08);
  --hero-orb: rgba(100, 162, 216, 0.18);
  --subpanel-bg: linear-gradient(180deg, rgba(21, 32, 46, 0.96) 0%, rgba(17, 27, 40, 0.88) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(100, 162, 216, 0.1) 0%, rgba(17, 27, 40, 0.62) 100%);
  --theme-menu-bg: rgba(17, 27, 40, 0.96);
  --theme-menu-shadow: 0 28px 54px rgba(0, 0, 0, 0.34);
}

body[data-theme-style="pottery"] {
  --line: rgba(124, 80, 54, 0.12);
  --text: #3d2a1f;
  --muted: #7b5a48;
  --accent: #b45b36;
  --accent-dark: #6b3721;
  --accent-soft: rgba(180, 91, 54, 0.14);
  --success: #5b7d61;
  --success-soft: rgba(91, 125, 97, 0.16);
  --warning: #9b6c1b;
  --warning-soft: rgba(155, 108, 27, 0.18);
  --danger: #9c4a3d;
  --danger-soft: rgba(156, 74, 61, 0.16);
  --shadow: 0 24px 52px rgba(92, 59, 37, 0.14);
  --body-bg: linear-gradient(180deg, #f7eee6 0%, #ead9ca 42%, #d7bda9 100%);
  --body-glow-left: rgba(180, 91, 54, 0.18);
  --body-glow-right: rgba(127, 86, 53, 0.14);
  --surface: rgba(255, 248, 241, 0.88);
  --surface-strong: #fff8f2;
  --button-secondary-bg: #fff5ec;
  --button-ghost-bg: rgba(255, 249, 242, 0.82);
  --button-ghost-border: rgba(124, 80, 54, 0.12);
  --button-tool-bg: rgba(255, 247, 239, 0.92);
  --button-tool-border: rgba(124, 80, 54, 0.12);
  --tool-button-text: #4a2f22;
  --card-soft-bg: rgba(255, 245, 236, 0.86);
  --input-bg: rgba(255, 251, 247, 0.96);
  --surface-soft: rgba(255, 244, 234, 0.78);
  --surface-elevated: rgba(255, 249, 244, 0.95);
  --status-info-bg: rgba(255, 248, 241, 0.94);
  --status-info-border: rgba(156, 112, 82, 0.24);
  --media-card-bg: #f7ebe1;
  --top-nav-bg: rgba(255, 248, 241, 0.86);
  --toggle-track-bg: rgba(124, 80, 54, 0.16);
  --toggle-chip-bg: rgba(255, 249, 244, 0.94);
  --toggle-chip-border: rgba(124, 80, 54, 0.12);
  --tutorial-bg: rgba(255, 248, 241, 0.97);
  --primary-end: #8d4828;
  --nav-active-end: #7c4427;
  --tool-active-bg: linear-gradient(135deg, #b45b36 0%, #8d4828 100%);
  --tool-active-border: rgba(141, 72, 40, 0.34);
  --tool-active-shadow: 0 12px 24px rgba(121, 68, 39, 0.18);
  --hero-bg: linear-gradient(145deg, rgba(255, 250, 244, 0.96) 0%, rgba(244, 228, 212, 0.88) 100%);
  --hero-grid-color: rgba(123, 90, 72, 0.08);
  --hero-orb: rgba(180, 91, 54, 0.18);
  --subpanel-bg: linear-gradient(180deg, rgba(255, 248, 241, 0.96) 0%, rgba(249, 238, 229, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(180, 91, 54, 0.1) 0%, rgba(255, 250, 245, 0.74) 100%);
}

body[data-theme-style="pottery"][data-theme="dark"] {
  --line: rgba(214, 165, 132, 0.16);
  --text: #f3e6da;
  --muted: #d0b19b;
  --accent: #d88a59;
  --accent-dark: #ffe4d1;
  --accent-soft: rgba(216, 138, 89, 0.18);
  --success: #91b487;
  --success-soft: rgba(91, 125, 97, 0.3);
  --warning: #e2b06a;
  --warning-soft: rgba(150, 109, 53, 0.34);
  --danger: #ef9a85;
  --danger-soft: rgba(140, 67, 51, 0.36);
  --body-bg: linear-gradient(180deg, #1f130e 0%, #2a1812 40%, #3a241b 100%);
  --body-glow-left: rgba(216, 138, 89, 0.2);
  --body-glow-right: rgba(81, 49, 34, 0.22);
  --surface: rgba(41, 24, 18, 0.92);
  --surface-strong: #311d16;
  --button-secondary-bg: #3b241b;
  --button-ghost-bg: rgba(54, 31, 23, 0.84);
  --button-ghost-border: rgba(216, 165, 132, 0.14);
  --button-tool-bg: rgba(49, 29, 22, 0.88);
  --button-tool-border: rgba(216, 165, 132, 0.14);
  --tool-button-text: #f7eade;
  --card-soft-bg: rgba(53, 31, 23, 0.84);
  --input-bg: rgba(35, 20, 15, 0.92);
  --surface-soft: rgba(50, 29, 22, 0.82);
  --surface-elevated: rgba(55, 33, 25, 0.94);
  --status-info-bg: rgba(49, 29, 22, 0.94);
  --status-info-border: rgba(216, 165, 132, 0.18);
  --media-card-bg: #3c241b;
  --top-nav-bg: rgba(45, 27, 20, 0.88);
  --toggle-track-bg: rgba(216, 165, 132, 0.24);
  --toggle-knob-bg: #fff1e4;
  --toggle-chip-bg: rgba(49, 29, 22, 0.94);
  --toggle-chip-border: rgba(216, 165, 132, 0.16);
  --tutorial-bg: rgba(49, 29, 22, 0.97);
  --primary-end: #8d4828;
  --nav-active-end: #9d5a36;
  --tool-active-bg: linear-gradient(135deg, #d88a59 0%, #9d5a36 100%);
  --tool-active-border: rgba(255, 213, 183, 0.3);
  --tool-active-shadow: 0 14px 28px rgba(53, 24, 16, 0.34);
  --hero-bg: linear-gradient(145deg, rgba(59, 34, 23, 0.96) 0%, rgba(40, 24, 18, 0.94) 100%);
  --hero-grid-color: rgba(214, 165, 132, 0.08);
  --hero-orb: rgba(216, 138, 89, 0.2);
  --subpanel-bg: linear-gradient(180deg, rgba(58, 35, 25, 0.96) 0%, rgba(45, 27, 20, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(216, 138, 89, 0.12) 0%, rgba(45, 27, 20, 0.66) 100%);
}

body[data-theme-style="neon"] {
  --line: rgba(0, 128, 160, 0.14);
  --text: #102046;
  --muted: #49617a;
  --accent: #00c6d4;
  --accent-dark: #082c45;
  --accent-soft: rgba(0, 198, 212, 0.16);
  --success: #44b86d;
  --success-soft: rgba(68, 184, 109, 0.16);
  --warning: #d48817;
  --warning-soft: rgba(212, 136, 23, 0.18);
  --danger: #e4469d;
  --danger-soft: rgba(228, 70, 157, 0.18);
  --shadow: 0 26px 54px rgba(21, 47, 82, 0.14);
  --body-bg: linear-gradient(180deg, #f4fcff 0%, #edf4ff 44%, #e7f0ff 100%);
  --body-glow-left: rgba(0, 198, 212, 0.16);
  --body-glow-right: rgba(255, 28, 247, 0.12);
  --surface: rgba(249, 252, 255, 0.88);
  --surface-strong: #ffffff;
  --button-secondary-bg: #f7fbff;
  --button-ghost-bg: rgba(250, 252, 255, 0.82);
  --button-ghost-border: rgba(0, 128, 160, 0.12);
  --button-tool-bg: rgba(248, 252, 255, 0.92);
  --button-tool-border: rgba(0, 128, 160, 0.12);
  --tool-button-text: #132742;
  --card-soft-bg: rgba(245, 251, 255, 0.86);
  --input-bg: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(240, 248, 255, 0.8);
  --surface-elevated: rgba(251, 253, 255, 0.95);
  --status-info-bg: rgba(248, 252, 255, 0.94);
  --status-info-border: rgba(0, 198, 212, 0.2);
  --top-nav-bg: rgba(248, 252, 255, 0.88);
  --toggle-track-bg: rgba(0, 198, 212, 0.18);
  --toggle-chip-bg: rgba(252, 254, 255, 0.94);
  --toggle-chip-border: rgba(0, 128, 160, 0.12);
  --primary-end: #ff1cf7;
  --nav-active-end: #ff1cf7;
  --primary-shadow: 0 14px 30px rgba(255, 28, 247, 0.18);
  --nav-active-shadow: 0 12px 26px rgba(255, 28, 247, 0.18);
  --tool-active-bg: linear-gradient(135deg, #00c6d4 0%, #ff1cf7 100%);
  --tool-active-border: rgba(255, 28, 247, 0.28);
  --tool-active-shadow: 0 12px 24px rgba(200, 25, 190, 0.18);
  --hero-bg: linear-gradient(145deg, rgba(252, 254, 255, 0.96) 0%, rgba(233, 247, 255, 0.9) 100%);
  --hero-grid-color: rgba(0, 140, 165, 0.08);
  --hero-orb: rgba(255, 28, 247, 0.16);
  --subpanel-bg: linear-gradient(180deg, rgba(250, 253, 255, 0.96) 0%, rgba(241, 249, 255, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(255, 28, 247, 0.08) 0%, rgba(255, 255, 255, 0.68) 100%);
}

body[data-theme-style="neon"][data-theme="dark"] {
  --line: rgba(116, 214, 255, 0.16);
  --text: #edf9ff;
  --muted: #9ed2f2;
  --accent: #00f5ff;
  --accent-dark: #effcff;
  --accent-soft: rgba(0, 245, 255, 0.18);
  --success: #8cff9c;
  --success-soft: rgba(68, 184, 109, 0.28);
  --warning: #ffd166;
  --warning-soft: rgba(139, 101, 32, 0.34);
  --danger: #ff7de6;
  --danger-soft: rgba(142, 42, 120, 0.34);
  --body-bg: linear-gradient(180deg, #04060f 0%, #0a0f22 42%, #141336 100%);
  --body-glow-left: rgba(0, 245, 255, 0.2);
  --body-glow-right: rgba(255, 28, 247, 0.16);
  --surface: rgba(9, 12, 24, 0.92);
  --surface-strong: #10142a;
  --button-secondary-bg: #161a31;
  --button-ghost-bg: rgba(14, 17, 31, 0.84);
  --button-ghost-border: rgba(116, 214, 255, 0.14);
  --button-tool-bg: rgba(15, 18, 33, 0.88);
  --button-tool-border: rgba(116, 214, 255, 0.14);
  --tool-button-text: #eefcff;
  --card-soft-bg: rgba(17, 20, 37, 0.84);
  --input-bg: rgba(9, 11, 24, 0.92);
  --surface-soft: rgba(16, 19, 34, 0.82);
  --surface-elevated: rgba(20, 23, 40, 0.94);
  --status-info-bg: rgba(16, 19, 34, 0.94);
  --status-info-border: rgba(116, 214, 255, 0.18);
  --top-nav-bg: rgba(15, 18, 33, 0.88);
  --toggle-track-bg: rgba(116, 214, 255, 0.26);
  --toggle-chip-bg: rgba(17, 20, 37, 0.94);
  --toggle-chip-border: rgba(116, 214, 255, 0.16);
  --primary-end: #ff1cf7;
  --nav-active-end: #ff1cf7;
  --primary-shadow: 0 14px 30px rgba(191, 31, 187, 0.26);
  --nav-active-shadow: 0 12px 26px rgba(191, 31, 187, 0.28);
  --tool-active-bg: linear-gradient(135deg, #00f5ff 0%, #ff1cf7 100%);
  --tool-active-border: rgba(255, 191, 252, 0.28);
  --tool-active-shadow: 0 14px 28px rgba(13, 10, 46, 0.36);
  --hero-bg: linear-gradient(145deg, rgba(13, 16, 31, 0.96) 0%, rgba(8, 10, 22, 0.94) 100%);
  --hero-grid-color: rgba(116, 214, 255, 0.08);
  --hero-orb: rgba(255, 28, 247, 0.22);
  --subpanel-bg: linear-gradient(180deg, rgba(19, 22, 39, 0.96) 0%, rgba(14, 17, 31, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(255, 28, 247, 0.12) 0%, rgba(10, 12, 25, 0.64) 100%);
}

body[data-theme-style="rainbow"] {
  --line: rgba(128, 114, 181, 0.14);
  --text: #3b3159;
  --muted: #6e6689;
  --accent: #ff6b6b;
  --accent-dark: #7c3d5d;
  --accent-soft: rgba(255, 107, 107, 0.14);
  --success: #30aa7e;
  --success-soft: rgba(48, 170, 126, 0.16);
  --warning: #d48e18;
  --warning-soft: rgba(212, 142, 24, 0.18);
  --danger: #d44874;
  --danger-soft: rgba(212, 72, 116, 0.18);
  --shadow: 0 26px 56px rgba(95, 80, 141, 0.14);
  --body-bg: linear-gradient(180deg, #fff8f2 0%, #fff5fb 40%, #eef7ff 100%);
  --body-glow-left: rgba(255, 107, 107, 0.14);
  --body-glow-right: rgba(96, 165, 250, 0.14);
  --surface: rgba(255, 250, 247, 0.88);
  --surface-strong: #fffdfb;
  --button-secondary-bg: #fff9f4;
  --button-ghost-bg: rgba(255, 251, 247, 0.82);
  --button-ghost-border: rgba(128, 114, 181, 0.12);
  --button-tool-bg: rgba(255, 250, 247, 0.92);
  --button-tool-border: rgba(128, 114, 181, 0.12);
  --tool-button-text: #463b68;
  --card-soft-bg: rgba(255, 248, 244, 0.86);
  --input-bg: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(255, 245, 251, 0.8);
  --surface-elevated: rgba(255, 252, 249, 0.95);
  --status-info-bg: rgba(255, 251, 247, 0.94);
  --status-info-border: rgba(192, 132, 252, 0.2);
  --top-nav-bg: rgba(255, 251, 247, 0.88);
  --toggle-track-bg: rgba(192, 132, 252, 0.18);
  --toggle-chip-bg: rgba(255, 253, 250, 0.94);
  --toggle-chip-border: rgba(128, 114, 181, 0.12);
  --primary-end: #c084fc;
  --nav-active-end: #60a5fa;
  --primary-shadow: 0 14px 30px rgba(163, 119, 230, 0.18);
  --nav-active-shadow: 0 12px 26px rgba(96, 165, 250, 0.18);
  --tool-active-bg: linear-gradient(135deg, #ff6b6b 0%, #c084fc 100%);
  --tool-active-border: rgba(192, 132, 252, 0.3);
  --tool-active-shadow: 0 12px 24px rgba(162, 110, 205, 0.18);
  --hero-bg: linear-gradient(145deg, rgba(255, 252, 248, 0.96) 0%, rgba(248, 241, 255, 0.9) 100%);
  --hero-grid-color: rgba(127, 118, 188, 0.08);
  --hero-orb: rgba(255, 209, 102, 0.16);
  --subpanel-bg: linear-gradient(180deg, rgba(255, 252, 248, 0.96) 0%, rgba(250, 244, 255, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(192, 132, 252, 0.08) 0%, rgba(255, 255, 255, 0.7) 100%);
}

body[data-theme-style="rainbow"][data-theme="dark"] {
  --line: rgba(168, 160, 235, 0.16);
  --text: #f8f3ff;
  --muted: #c7c0ea;
  --accent: #ff9f67;
  --accent-dark: #fff3d9;
  --accent-soft: rgba(255, 159, 103, 0.18);
  --success: #8fdfb9;
  --success-soft: rgba(48, 170, 126, 0.28);
  --warning: #ffe08a;
  --warning-soft: rgba(139, 101, 32, 0.34);
  --danger: #ff9bc3;
  --danger-soft: rgba(145, 52, 89, 0.34);
  --body-bg: linear-gradient(180deg, #18122d 0%, #231a3f 42%, #1b2b4d 100%);
  --body-glow-left: rgba(255, 107, 107, 0.18);
  --body-glow-right: rgba(96, 165, 250, 0.16);
  --surface: rgba(28, 21, 50, 0.92);
  --surface-strong: #20183b;
  --button-secondary-bg: #2a2048;
  --button-ghost-bg: rgba(31, 24, 55, 0.84);
  --button-ghost-border: rgba(168, 160, 235, 0.14);
  --button-tool-bg: rgba(31, 24, 55, 0.88);
  --button-tool-border: rgba(168, 160, 235, 0.14);
  --tool-button-text: #f9f5ff;
  --card-soft-bg: rgba(33, 26, 58, 0.84);
  --input-bg: rgba(22, 17, 40, 0.92);
  --surface-soft: rgba(30, 23, 53, 0.82);
  --surface-elevated: rgba(35, 28, 61, 0.94);
  --status-info-bg: rgba(30, 23, 53, 0.94);
  --status-info-border: rgba(168, 160, 235, 0.18);
  --top-nav-bg: rgba(30, 23, 53, 0.88);
  --toggle-track-bg: rgba(168, 160, 235, 0.24);
  --toggle-chip-bg: rgba(33, 26, 58, 0.94);
  --toggle-chip-border: rgba(168, 160, 235, 0.16);
  --primary-end: #c084fc;
  --nav-active-end: #60a5fa;
  --primary-shadow: 0 14px 30px rgba(128, 95, 193, 0.26);
  --nav-active-shadow: 0 12px 26px rgba(50, 101, 188, 0.26);
  --tool-active-bg: linear-gradient(135deg, #ff9f67 0%, #c084fc 100%);
  --tool-active-border: rgba(255, 230, 178, 0.28);
  --tool-active-shadow: 0 14px 28px rgba(24, 16, 50, 0.34);
  --hero-bg: linear-gradient(145deg, rgba(38, 25, 68, 0.96) 0%, rgba(24, 18, 45, 0.94) 100%);
  --hero-grid-color: rgba(168, 160, 235, 0.08);
  --hero-orb: rgba(255, 209, 102, 0.22);
  --subpanel-bg: linear-gradient(180deg, rgba(39, 28, 67, 0.96) 0%, rgba(30, 23, 53, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(192, 132, 252, 0.12) 0%, rgba(28, 21, 50, 0.64) 100%);
}

body[data-theme-style="vaporwave"] {
  --line: rgba(139, 124, 210, 0.14);
  --text: #442f67;
  --muted: #78639e;
  --accent: #ff71ce;
  --accent-dark: #5d2f66;
  --accent-soft: rgba(255, 113, 206, 0.14);
  --success: #40beaa;
  --success-soft: rgba(64, 190, 170, 0.16);
  --warning: #d2a11b;
  --warning-soft: rgba(210, 161, 27, 0.18);
  --danger: #de5a8b;
  --danger-soft: rgba(222, 90, 139, 0.18);
  --shadow: 0 26px 56px rgba(101, 70, 160, 0.16);
  --body-bg: linear-gradient(180deg, #fff5ff 0%, #f9f0ff 40%, #ebf8ff 100%);
  --body-glow-left: rgba(255, 113, 206, 0.16);
  --body-glow-right: rgba(1, 205, 254, 0.14);
  --surface: rgba(255, 249, 255, 0.88);
  --surface-strong: #fffaff;
  --button-secondary-bg: #fff7ff;
  --button-ghost-bg: rgba(255, 250, 255, 0.82);
  --button-ghost-border: rgba(139, 124, 210, 0.12);
  --button-tool-bg: rgba(255, 249, 255, 0.92);
  --button-tool-border: rgba(139, 124, 210, 0.12);
  --tool-button-text: #4f3b78;
  --card-soft-bg: rgba(255, 247, 255, 0.86);
  --input-bg: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(252, 244, 255, 0.8);
  --surface-elevated: rgba(255, 251, 255, 0.95);
  --status-info-bg: rgba(255, 250, 255, 0.94);
  --status-info-border: rgba(255, 113, 206, 0.2);
  --top-nav-bg: rgba(255, 250, 255, 0.88);
  --toggle-track-bg: rgba(255, 113, 206, 0.18);
  --toggle-chip-bg: rgba(255, 252, 255, 0.94);
  --toggle-chip-border: rgba(139, 124, 210, 0.12);
  --primary-end: #01cdfe;
  --nav-active-end: #01cdfe;
  --primary-shadow: 0 14px 30px rgba(1, 205, 254, 0.18);
  --nav-active-shadow: 0 12px 26px rgba(1, 205, 254, 0.18);
  --tool-active-bg: linear-gradient(135deg, #ff71ce 0%, #01cdfe 100%);
  --tool-active-border: rgba(1, 205, 254, 0.3);
  --tool-active-shadow: 0 12px 24px rgba(108, 70, 182, 0.18);
  --hero-bg: linear-gradient(145deg, rgba(255, 251, 255, 0.96) 0%, rgba(244, 236, 255, 0.9) 100%);
  --hero-grid-color: rgba(129, 119, 194, 0.08);
  --hero-orb: rgba(255, 113, 206, 0.18);
  --subpanel-bg: linear-gradient(180deg, rgba(255, 251, 255, 0.96) 0%, rgba(247, 241, 255, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(255, 113, 206, 0.08) 0%, rgba(255, 255, 255, 0.68) 100%);
}

body[data-theme-style="vaporwave"][data-theme="dark"] {
  --line: rgba(164, 145, 242, 0.16);
  --text: #f8f1ff;
  --muted: #cebdf1;
  --accent: #ff71ce;
  --accent-dark: #fff3ff;
  --accent-soft: rgba(255, 113, 206, 0.18);
  --success: #8df0dc;
  --success-soft: rgba(64, 190, 170, 0.28);
  --warning: #f9f871;
  --warning-soft: rgba(160, 141, 42, 0.34);
  --danger: #ff9ed1;
  --danger-soft: rgba(152, 58, 118, 0.34);
  --body-bg: linear-gradient(180deg, #130b27 0%, #1e1238 40%, #0d2240 100%);
  --body-glow-left: rgba(255, 113, 206, 0.2);
  --body-glow-right: rgba(1, 205, 254, 0.18);
  --surface: rgba(28, 18, 54, 0.92);
  --surface-strong: #1c1236;
  --button-secondary-bg: #27184b;
  --button-ghost-bg: rgba(31, 20, 58, 0.84);
  --button-ghost-border: rgba(164, 145, 242, 0.14);
  --button-tool-bg: rgba(31, 20, 58, 0.88);
  --button-tool-border: rgba(164, 145, 242, 0.14);
  --tool-button-text: #f9f3ff;
  --card-soft-bg: rgba(33, 22, 61, 0.84);
  --input-bg: rgba(20, 13, 40, 0.92);
  --surface-soft: rgba(30, 20, 56, 0.82);
  --surface-elevated: rgba(35, 24, 66, 0.94);
  --status-info-bg: rgba(30, 20, 56, 0.94);
  --status-info-border: rgba(164, 145, 242, 0.18);
  --top-nav-bg: rgba(30, 20, 56, 0.88);
  --toggle-track-bg: rgba(164, 145, 242, 0.24);
  --toggle-chip-bg: rgba(33, 22, 61, 0.94);
  --toggle-chip-border: rgba(164, 145, 242, 0.16);
  --primary-end: #01cdfe;
  --nav-active-end: #01cdfe;
  --primary-shadow: 0 14px 30px rgba(1, 205, 254, 0.24);
  --nav-active-shadow: 0 12px 26px rgba(1, 205, 254, 0.26);
  --tool-active-bg: linear-gradient(135deg, #ff71ce 0%, #01cdfe 100%);
  --tool-active-border: rgba(204, 242, 255, 0.28);
  --tool-active-shadow: 0 14px 28px rgba(18, 9, 45, 0.36);
  --hero-bg: linear-gradient(145deg, rgba(34, 18, 61, 0.96) 0%, rgba(18, 10, 38, 0.94) 100%);
  --hero-grid-color: rgba(164, 145, 242, 0.08);
  --hero-orb: rgba(255, 113, 206, 0.22);
  --subpanel-bg: linear-gradient(180deg, rgba(37, 24, 67, 0.96) 0%, rgba(30, 20, 56, 0.9) 100%);
  --soft-box-bg: linear-gradient(180deg, rgba(255, 113, 206, 0.12) 0%, rgba(28, 18, 54, 0.64) 100%);
}

button,
input,
select,
output {
  font: inherit;
}

button,
input,
select {
  border-radius: 12px;
}

button {
  border: 1px solid transparent;
  padding: 0.8rem 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  color: #fff8f3;
  background: linear-gradient(135deg, var(--accent) 0%, #b35634 100%);
  box-shadow: 0 12px 24px rgba(167, 88, 53, 0.24);
}

.secondary {
  color: var(--accent-dark);
  background: var(--button-secondary-bg);
  border-color: rgba(200, 107, 66, 0.22);
}

.ghost {
  color: var(--text);
  background: var(--button-ghost-bg);
  border-color: var(--button-ghost-border);
}

.danger {
  color: var(--danger);
}

.danger-btn {
  color: #fff8f3;
  background: linear-gradient(135deg, #a54545 0%, #7f2b2b 100%);
  border-color: rgba(138, 65, 65, 0.42);
  box-shadow: 0 12px 24px rgba(128, 43, 43, 0.24);
}

.danger-panel {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(138, 65, 65, 0.2);
  background: color-mix(in srgb, var(--danger-soft) 82%, white 18%);
}

.danger-panel-title {
  margin: 0;
  font-weight: 700;
  color: var(--danger);
}

.small {
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
}

.compact-action-btn {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.icon-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 18px auto 40px;
  display: grid;
  gap: 18px;
}


.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}


.auth-nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-gate {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.checkout-popup {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: min(420px, 92vw);
  border-radius: 14px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  box-shadow: 0 12px 24px rgba(37, 22, 16, 0.25);
  background: var(--surface-strong);
  padding: 12px 14px;
}

.checkout-popup[data-tone="success"] {
  border-color: rgba(64, 105, 76, 0.4);
  background: color-mix(in srgb, var(--success-soft) 82%, white 18%);
}

.checkout-popup[data-tone="error"] {
  border-color: rgba(138, 65, 65, 0.35);
  background: color-mix(in srgb, var(--danger-soft) 82%, white 18%);
}

.checkout-popup strong,
.checkout-popup p {
  margin: 0;
}

.checkout-popup p {
  margin-top: 6px;
}


.top-nav-btn {
  border: 1px solid rgba(124, 89, 67, 0.18);
  background: var(--top-nav-bg);
  color: var(--accent-dark);
  font-weight: 700;
  padding: 0.7rem 0.95rem;
}

.top-nav-btn.is-active {
  color: #fff8f3;
  background: linear-gradient(135deg, var(--accent) 0%, #a95433 100%);
  box-shadow: 0 10px 20px rgba(167, 88, 53, 0.22);
}


.hero,
.panel {
  border: 1px solid rgba(124, 89, 67, 0.12);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.75fr minmax(240px, 0.85fr);
  gap: 18px;
  padding: 24px 28px;
  border-radius: 34px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -30% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 107, 66, 0.22) 0%, rgba(200, 107, 66, 0) 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-dark);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-heading);
  line-height: 1.05;
}

.hero h1 {
  max-width: 22ch;
  font-size: clamp(2rem, 2.7vw, 3.2rem);
}

.hero-text {
  max-width: 62ch;
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions {
  align-self: center;
  display: grid;
  gap: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(480px, 1fr) minmax(320px, 360px);
  gap: 18px;
  margin-top: 4px;
  align-items: start;
}

.panel {
  padding: 20px;
  border-radius: var(--radius-xl);
}

.toolbar-panel,
.control-panel {
  display: grid;
  gap: 16px;
}

.control-panel {
  gap: 10px;
}

.control-panel {
  align-self: start;
}

.sketch-panel {
  display: grid;
  gap: 14px;
}

.canvas-support-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.canvas-support-panel {
  gap: 8px;
  padding: 12px;
  align-content: start;
}

.canvas-support-panel .subpanel-header {
  align-items: flex-start;
}

.canvas-support-panel .subpanel-header h3 {
  font-size: 0.95rem;
}

.canvas-support-panel label {
  gap: 6px;
  font-size: 0.9rem;
}

.canvas-support-panel .switch-row {
  gap: 8px;
}

.canvas-support-panel .small-note {
  font-size: 0.82rem;
  line-height: 1.35;
}

.canvas-support-panel .card-actions {
  gap: 6px;
}

.canvas-support-panel .card-actions .small {
  padding: 0.42rem 0.6rem;
}

.panel-title-row,
.subpanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-title-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(200, 107, 66, 0.13);
}

#activeToolLabel {
  white-space: nowrap;
}

.pill.soft {
  color: var(--muted);
  background: rgba(109, 88, 77, 0.09);
}

.unit-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0.25rem 0.3rem;
  border-radius: 999px;
  background: rgba(109, 88, 77, 0.09);
}

.unit-switch-label {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.unit-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.unit-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.unit-toggle-track {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--toggle-track-bg);
  transition: background 0.2s ease;
}

.unit-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--toggle-knob-bg);
  box-shadow: 0 3px 10px rgba(61, 40, 28, 0.18);
  transition: transform 0.2s ease;
}

.unit-toggle input:checked + .unit-toggle-track {
  background: rgba(200, 107, 66, 0.4);
}

.unit-toggle input:checked + .unit-toggle-track::after {
  transform: translateX(22px);
}

.unit-toggle input:focus-visible + .unit-toggle-track {
  outline: 2px solid rgba(200, 107, 66, 0.7);
  outline-offset: 2px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tool-btn {
  color: var(--tool-button-text);
  background: var(--button-tool-bg);
  border-color: var(--button-tool-border);
}

.tool-btn.is-active {
  color: #fff8f3;
  background: linear-gradient(135deg, #4a3932 0%, #5b4438 100%);
  border-color: rgba(124, 89, 67, 0.5);
}


#polygonBtn {
  color: var(--tool-button-text) !important;
}

#polygonBtn.is-active {
  color: #fff8f3 !important;
}

.erase-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sketch-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sketch-action-row > * {
  width: 100%;
}

.action-row.compact {
  margin-bottom: 0.2rem;
}

#edgeSelectionRow {
  align-items: center;
}

.subpanel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--card-soft-bg);
  border: 1px solid rgba(124, 89, 67, 0.1);
}

.small-note {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
  font-size: 0.95rem;
}

.plain-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.55;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.switch-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.grid-controls-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: center;
}

.grid-spacing-control {
  grid-column: 1 / -1;
  min-width: 0;
}

.grid-spacing-control select {
  min-height: 38px;
  padding: 0.5rem 0.7rem;
}


.shrinkage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.shrinkage-table th,
.shrinkage-table td {
  text-align: left;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid rgba(124, 89, 67, 0.15);
}

.shrinkage-table th {
  color: var(--muted);
  font-weight: 700;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(105, 76, 58, 0.14);
  background: var(--input-bg);
  padding: 0.75rem 0.9rem;
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

input[type="color"] {
  width: 100%;
  min-height: 52px;
  padding: 0.3rem;
  border: 1px solid rgba(105, 76, 58, 0.14);
  background: var(--input-bg);
}

.range-row {
  display: grid;
  grid-template-columns: 1fr minmax(78px, 92px) auto;
  gap: 10px;
  align-items: center;
}

.auth-password-row {
  grid-template-columns: 1fr auto;
}

.auth-password-row button {
  min-width: 48px;
}

.auth-meta-row {
  display: flex;
  justify-content: flex-start;
  margin-top: -6px;
}

.account-security-box button {
  justify-self: start;
}

.unit-tag,
output {
  min-width: 42px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

.soft-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(232, 215, 199, 0.5) 0%, var(--surface-soft) 100%);
  border: 1px solid rgba(124, 89, 67, 0.1);
}

.soft-box-title {
  margin: 0;
  font-weight: 800;
}

.status-strip {
  display: grid;
  gap: 6px;
  padding: 15px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
}

.status-strip strong {
  font-size: 1rem;
  color: var(--text);
}

.status-strip p {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}

.status-info {
  background: var(--status-info-bg);
  border-color: var(--status-info-border);
}

.status-success {
  background: var(--success-soft);
  border-color: rgba(64, 105, 76, 0.16);
}

.status-warning {
  background: var(--warning-soft);
  border-color: rgba(142, 96, 32, 0.16);
}

.status-error {
  background: var(--danger-soft);
  border-color: rgba(138, 65, 65, 0.16);
}

.canvas-frame,
.preview-frame {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(124, 89, 67, 0.12);
  background:
    var(--canvas-bg),
    var(--canvas-overlay);
}

.canvas-frame {
  position: relative;
}

.preview-panel {
  position: relative;
  z-index: 1;
  min-height: 0;
}


.preview-panel {
  gap: 6px;
  padding: 10px;
}

.preview-panel label {
  gap: 4px;
}

.preview-color-control {
  display: grid;
  gap: 4px;
  font-weight: 600;
}

.preview-panel .small-note {
  line-height: 1.35;
}

.preview-panel .subpanel-header {
  margin-bottom: 2px;
}

.preview-panel .action-row {
  gap: 4px;
}

.preview-frame {
  min-height: 0;
  width: 100%;
  padding: 0;
}

.preview-actions {
  margin-top: 0;
  margin-bottom: 0;
  display: grid;
  gap: 8px;
  align-self: start;
  align-content: start;
}

.preview-actions button {
  width: 100%;
  padding: 0.32rem 0.85rem;
}

#sketchCanvas,
#previewCanvas {
  display: block;
  width: 100%;
  height: auto;
}


.sketch-mode-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 12px;
  border: 1px solid var(--toggle-chip-border);
  background: var(--toggle-chip-bg);
  font-size: 0.78rem;
  color: var(--muted);
}


.bubble-visibility-toggle {
  position: absolute;
  top: 52px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 12px;
  border: 1px solid var(--toggle-chip-border);
  background: var(--toggle-chip-bg);
  font-size: 0.78rem;
  color: var(--muted);
}

.center-sketch-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  border-color: rgba(31, 93, 143, 0.18);
  background: var(--surface-elevated);
}

.precision-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.precision-field {
  position: absolute;
  height: 24px;
  z-index: 1;
}

.precision-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.precision-leaders line {
  stroke: rgba(94, 82, 73, 0.55);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.precision-input {
  width: 100%;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(31, 93, 143, 0.24);
  background: rgba(18, 59, 93, 0.82);
  color: #f8fbff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  pointer-events: auto;
  padding: 0 20px 0 6px;
}

.precision-input.precision-has-prefix {
  padding-left: 22px;
}

.precision-prefix {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(248, 251, 255, 0.9);
  pointer-events: none;
}

.precision-unit {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(248, 251, 255, 0.86);
  pointer-events: none;
}

.precision-input.precision-defined {
  border-color: rgba(125, 184, 232, 0.92);
  box-shadow: 0 0 0 1px rgba(125, 184, 232, 0.28);
  background: rgba(43, 78, 109, 0.94);
}

.precision-input:disabled {
  opacity: 1;
  color: #f8fbff;
  -webkit-text-fill-color: #f8fbff;
}

.precision-input.precision-defined:disabled {
  border-color: rgba(125, 184, 232, 0.92);
  box-shadow: 0 0 0 1px rgba(125, 184, 232, 0.28);
  background: rgba(43, 78, 109, 0.94);
}


.metrics-row,
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.stat-chip {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 18px;
  background: var(--chip-bg);
  border: 1px solid rgba(124, 89, 67, 0.1);
}

.metric-card span,
.stat-chip span {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-card strong,
.stat-chip strong {
  font-size: 1.18rem;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.owner-live-banner {
  grid-column: 1 / -1;
  padding: 18px 20px;
  border: 1px solid rgba(46, 139, 87, 0.2);
  background:
    radial-gradient(circle at left center, rgba(46, 139, 87, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(247, 255, 251, 0.96), rgba(238, 249, 244, 0.9));
}

.owner-live-banner-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.owner-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(46, 139, 87, 0.16);
}

.owner-live-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #216341;
}

.owner-live-pulse {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #2e8b57;
  box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.45);
  animation: owner-live-pulse 1.8s ease-out infinite;
}

.owner-live-copy {
  display: grid;
  gap: 4px;
}

.owner-live-copy strong {
  font-size: 1.05rem;
  color: var(--text);
}

.owner-live-copy .small-note {
  margin: 0;
}

@keyframes owner-live-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.45);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(46, 139, 87, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 139, 87, 0);
  }
}

.dashboard-card {
  display: grid;
  align-content: start;
  gap: 14px;
}


.dashboard-card.is-reorderable {
  position: relative;
}

.dashboard-reorder-handle {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--muted);
  background: var(--card-soft-bg);
  border: 1px solid rgba(124, 89, 67, 0.18);
  border-radius: 10px;
  padding: 3px 6px;
  cursor: grab;
}

.dashboard-reorder-handle:active {
  cursor: grabbing;
}

.dashboard-card.is-reorderable.is-dragging {
  opacity: 0.5;
}

.order-export-btn {
  margin-right: 44px;
}


.card-list {
  display: grid;
  gap: 12px;
}

.card-list.is-scroll-capped {
  overflow-y: auto;
  padding-right: 6px;
  align-content: start;
}

#savedDesignsList {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.list-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--chip-bg);
  border: 1px solid rgba(124, 89, 67, 0.1);
}

.list-card h3 {
  font-size: 1.08rem;
}

.list-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edge-dialog {
  width: min(620px, calc(100vw - 24px));
  border: none;
  border-radius: 26px;
  padding: 0;
  background: transparent;
}

.edge-dialog::backdrop {
  background: rgba(39, 27, 19, 0.3);
  backdrop-filter: blur(4px);
}

.edge-dialog-form {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 26px;
  background: var(--surface-strong);
  border: 1px solid rgba(124, 89, 67, 0.12);
  box-shadow: var(--shadow);
}

.edge-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.edge-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(245, 238, 230, 0.72);
  border: 1px solid rgba(124, 89, 67, 0.08);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  padding: 16px;
  border-radius: 18px;
  color: var(--muted);
  background: var(--card-soft-bg);
  border: 1px dashed rgba(124, 89, 67, 0.2);
}

@media (max-width: 1100px) {
  .canvas-support-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero,
  .dashboard,
  .workspace,
  .metrics-row,
  .stats-row,
  .control-panel,
  .canvas-support-row {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100vw - 18px, 960px);
    margin-top: 10px;
  }

  .hero {
    padding: 22px;
  }

  .hero h1 {
    max-width: none;
  }

  .range-row {
    grid-template-columns: 1fr;
  }

  .control-panel {
    align-self: stretch;
  }
}

@media (max-width: 720px) {
  .panel,
  .hero {
    border-radius: 22px;
  }

  .page-shell {
    width: calc(100vw - 12px);
  }

  .top-nav {
    gap: 8px;
  }

  .top-nav > *,
  .auth-nav-actions > * {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .top-nav-btn {
    width: 100%;
  }

  .theme-controls,
  #backendStatusBadge {
    flex-basis: 100%;
  }

  .theme-controls {
    justify-content: center;
  }

  .theme-picker {
    width: 100%;
  }

  .theme-picker-btn {
    width: 100%;
    justify-content: space-between;
  }

  .theme-menu {
    left: 0;
    right: auto;
    width: min(100%, 360px);
  }

  #backendStatusBadge {
    margin-left: 0;
    text-align: center;
  }

  .panel {
    padding: 16px;
  }

  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }

  .action-row,
  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .grid-controls-row {
    grid-template-columns: 1fr;
  }

  .order-previews-grid,
  .order-modal-previews {
    grid-template-columns: 1fr;
  }

  .action-row > *,
  .card-actions > * {
    width: 100%;
  }
}



body[data-theme="dark"] .tool-btn {
  color: #dce7f2;
  background: linear-gradient(180deg, rgba(22, 35, 50, 0.96) 0%, rgba(15, 25, 38, 0.94) 100%);
  border-color: rgba(100, 162, 216, 0.18);
}

body[data-theme="dark"] .tool-btn.is-active {
  color: #f4f9ff;
  background: linear-gradient(135deg, #64a2d8 0%, #2f6e9d 100%);
  border-color: rgba(149, 198, 240, 0.42);
  box-shadow: 0 12px 22px rgba(10, 35, 58, 0.34);
}

body[data-theme="dark"] .secondary {
  border-color: rgba(100, 162, 216, 0.2);
}

body[data-theme="dark"] #polygonBtn {
  color: var(--tool-button-text);
}

body[data-theme="dark"] .center-sketch-btn,
body[data-theme="dark"] .sketch-mode-toggle,
body[data-theme="dark"] .bubble-visibility-toggle {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}


.theme-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.theme-slider {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.theme-slider-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

body[data-theme="dark"] .theme-slider {
  border-color: rgba(248, 224, 204, 0.24);
}

.theme-picker {
  position: relative;
}

.theme-picker-btn {
  position: relative;
  min-height: 44px;
  padding-right: 2.8rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.theme-picker-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-62%) rotate(45deg);
  transition: transform 140ms ease;
}

.theme-picker-btn.is-open::after {
  transform: translateY(-34%) rotate(-135deg);
}

.theme-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--theme-menu-bg);
  box-shadow: var(--theme-menu-shadow);
  backdrop-filter: blur(14px);
}

.theme-menu-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: var(--card-soft-bg);
  border: 1px solid var(--line);
  box-shadow: none;
}

.theme-menu-option:hover:not(:disabled) {
  transform: translateY(-1px);
}

.theme-menu-option.is-active {
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--surface-elevated) 38%);
}

.theme-menu-swatch {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: var(--theme-swatch);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.theme-menu-copy {
  display: grid;
  gap: 3px;
}

.theme-menu-title {
  font-weight: 800;
  color: var(--text);
}

.theme-menu-note {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.theme-menu-status {
  min-width: 44px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: transparent;
}

.theme-menu-option.is-active .theme-menu-status {
  color: var(--accent-dark);
}

.stacked-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}


.market-dimension-search {
  display: grid;
  gap: 8px;
}

.market-dimension-search .small-note {
  margin: 0;
}

.market-dimension-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.market-dimension-row label {
  color: var(--muted);
  font-size: 0.9rem;
}

.market-filter-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.market-filter-row select {
  width: 100%;
  min-width: 0;
}

.app-version-badge {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid rgba(124, 89, 67, 0.2);
  box-shadow: var(--shadow);
}

.segmented-row {
  display: flex;
  gap: 8px;
}

.segmented-row .is-active {
  background: rgba(200, 107, 66, 0.14);
  border-color: rgba(200, 107, 66, 0.34);
}

.order-row-list {
  gap: 8px;
}


.market-detail-preview {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.market-detail-image {
  width: min(320px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--media-card-bg);
  padding: 6px;
}

.market-detail-label {
  margin: 0;
}

.market-rating {
  display: inline-flex;
  gap: 2px;
  margin: 4px 0 0;
}

.star-btn {
  border: none;
  background: transparent;
  color: #a39a8e;
  padding: 0 2px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.star-btn.is-selected {
  color: #f0b429;
}

.star-btn:hover {
  color: #f0b429;
}

.order-row-grid {
  display: grid;
  justify-items: start;
  gap: 10px;
}


#ordersList.orders-grid-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#ordersList.orders-grid-mode .order-row-grid {
  padding: 6px;
  gap: 6px;
  justify-items: stretch;
}

#ordersList.orders-grid-mode .order-grid-thumb-btn {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 3px;
}

#ordersList.orders-grid-mode .order-grid-expanded-image {
  width: 100%;
}
.order-grid-thumb-btn {
  border: 1px solid rgba(124, 89, 67, 0.22);
  background: var(--media-card-bg);
  border-radius: 10px;
  padding: 4px;
  width: 86px;
  height: 86px;
  cursor: pointer;
}

.order-grid-thumb-btn:hover {
  border-color: rgba(200, 107, 66, 0.5);
}

.order-grid-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.order-grid-expanded {
  margin-top: 4px;
  display: grid;
  gap: 8px;
}

.order-grid-expanded-image {
  width: min(320px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--media-card-bg);
  padding: 6px;
}

.order-grid-expanded-name {
  font-weight: 600;
  color: var(--ink-strong);
  margin: 0;
}
.order-previews-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.order-modal-previews {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(37, 22, 16, 0.45);
  backdrop-filter: blur(4px);
  z-index: 30;
  padding: 18px;
}

.modal-card {
  width: min(560px, 96vw);
  border-radius: 20px;
  border: 1px solid rgba(124, 89, 67, 0.18);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 12px;
}

.modal-card h2 {
  margin-bottom: 0.35rem;
}

.print-order-modal-card {
  width: min(760px, 96vw);
  max-height: min(90vh, 960px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.market-listing-modal-card {
  width: min(760px, 96vw);
  max-height: min(90vh, 920px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.market-listing-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.market-listing-preview-panel {
  display: grid;
  gap: 10px;
}

.market-listing-preview-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--media-card-bg);
  padding: 10px;
}

.market-listing-fields {
  display: grid;
  gap: 12px;
}

.market-listing-fields textarea {
  min-height: 120px;
  resize: vertical;
}

.market-seller-note {
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  .market-listing-layout {
    grid-template-columns: 1fr;
  }
}

body.checkout-modal-open {
  overflow: hidden;
}


.order-image-modal-card {
  width: min(520px, 92vw);
}

.order-image-modal-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--media-card-bg);
  padding: 8px;
}


#backendStatusBadge {
  margin-left: auto;
}

.top-nav {
  width: 100%;
}


.tutorial-overlay {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
}

.tutorial-card {
  width: min(360px, 92vw);
  border-radius: 16px;
  border: 1px solid rgba(124, 89, 67, 0.2);
  background: var(--tutorial-bg);
  box-shadow: 0 16px 30px rgba(52, 31, 20, 0.2);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.tutorial-focus {
  position: relative;
  z-index: 41;
  outline: 3px solid rgba(200, 107, 66, 0.45);
  outline-offset: 3px;
  border-radius: 10px;
}


.order-preview-thumb-wrap {
  margin-top: 8px;
}

.order-preview-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(124, 89, 67, 0.18);
  background: var(--media-card-bg);
  display: block;
}



.preview-color-palette {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.preview-color-palette .color-swatch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid rgba(124, 89, 67, 0.35);
  background: var(--swatch-color, #808080);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.preview-color-palette .color-swatch:hover {
  transform: translateY(-1px);
  border-color: rgba(111, 67, 50, 0.65);
}

.preview-color-palette .color-swatch.is-selected {
  border-color: rgba(111, 67, 50, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 248, 243, 0.85);
}
.print-color-palette {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.print-color-palette button.is-selected {
  border-color: rgba(111, 67, 50, 0.7);
  background: rgba(200, 107, 66, 0.2);
}

#printOrderModal textarea {
  width: 100%;
  resize: vertical;
}

.app-version-badge {
  position: relative;
  display: block;
  width: 100%;
  margin: 24px 0 10px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.38;
  color: var(--ink-soft);
  pointer-events: none;
  user-select: none;
}

.print-cart-items-list {
  display: grid;
  gap: 10px;
}

.print-cart-item-card .range-row {
  align-items: end;
  gap: 12px;
}

.print-cart-item-card input,
.print-cart-item-card select {
  width: 100%;
}


.print-cart-item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 14px;
  align-items: center;
}

.print-cart-item-main {
  min-width: 0;
}

.print-cart-item-preview {
  width: 130px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(124, 89, 67, 0.22);
  background: #f8f3ee;
  padding: 6px;
}

.print-order-details-card summary {
  cursor: pointer;
  font-weight: 600;
}

.print-order-details-card[open] summary {
  margin-bottom: 8px;
}

.print-line-items {
  margin: 0 0 10px;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

body {
  letter-spacing: 0.004em;
}

button {
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.primary {
  color: #f8fbff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-end) 100%);
  border-color: rgba(18, 59, 93, 0.18);
  box-shadow: var(--primary-shadow);
}

.secondary {
  color: var(--accent-dark);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.ghost {
  border-color: var(--line);
}

.top-nav {
  gap: 12px;
  align-items: center;
}

.top-nav-btn {
  min-height: 44px;
  border-color: var(--line);
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

body[data-theme="dark"] .top-nav-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.top-nav-btn.is-active {
  color: #f8fbff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--nav-active-end) 100%);
  box-shadow: var(--nav-active-shadow);
}

.hero,
.panel {
  border-color: var(--line);
  backdrop-filter: blur(10px);
}

.hero {
  grid-template-columns: 1.9fr minmax(220px, 0.75fr);
  min-height: 220px;
  padding: 28px 30px;
  border-radius: 26px;
  background: var(--hero-bg);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--hero-grid-color) 1px, transparent 1px),
    linear-gradient(var(--hero-grid-color) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.hero::after {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--hero-orb) 0%, rgba(255, 255, 255, 0) 72%);
}

.eyebrow,
.pill,
.unit-tag,
output,
.theme-slider-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow {
  font-size: 0.78rem;
  color: var(--accent);
}

.hero h1 {
  max-width: 20ch;
  font-size: clamp(2.2rem, 2.9vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
}

.hero-text {
  max-width: 58ch;
  margin-top: 0.9rem;
  font-size: 1.02rem;
}

.hero-actions {
  align-self: end;
}

.panel {
  padding: 18px;
}

.subpanel,
.metric-card,
.stat-chip,
.list-card,
.checkout-popup,
.modal-card,
.theme-slider {
  border-color: var(--line);
}

body[data-theme="dark"] .theme-slider {
  border-color: var(--line);
}

.subpanel {
  background: var(--subpanel-bg);
}

.soft-box {
  background: var(--soft-box-bg);
  border-color: var(--line);
}

.pill {
  border: 1px solid rgba(31, 93, 143, 0.14);
  background: rgba(31, 93, 143, 0.08);
}

.pill.soft,
.unit-switch {
  background: rgba(82, 96, 112, 0.08);
}

.unit-toggle-track::after {
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.unit-toggle input:checked + .unit-toggle-track {
  background: rgba(31, 93, 143, 0.42);
}

.tool-btn.is-active {
  color: var(--tool-active-text);
  background: var(--tool-active-bg);
  border-color: var(--tool-active-border);
  box-shadow: var(--tool-active-shadow);
}

.canvas-frame,
.preview-frame {
  border-radius: 18px;
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.status-strip {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(243, 247, 251, 0.88) 100%);
}

body[data-theme="dark"] .status-strip {
  background: linear-gradient(180deg, rgba(21, 32, 46, 0.92) 0%, rgba(17, 27, 40, 0.9) 100%);
}

.metric-card strong,
.stat-chip strong {
  font-family: var(--font-heading);
  font-size: 1.28rem;
  letter-spacing: 0.02em;
}

label,
.switch-row {
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select,
input[type="color"] {
  border-radius: 10px;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.04);
}

.preview-color-palette .color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border-color: rgba(82, 96, 112, 0.32);
}

.preview-color-palette .color-swatch:hover {
  border-color: rgba(31, 93, 143, 0.62);
}

.preview-color-palette .color-swatch.is-selected {
  border-color: rgba(31, 93, 143, 0.92);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88), 0 0 0 4px rgba(31, 93, 143, 0.16);
}

.dashboard-reorder-handle {
  border-color: var(--line);
}

#backendStatusBadge {
  font-size: 0.77rem;
}

.app-version-badge {
  width: calc(100% - 32px);
  margin: 24px 16px 10px;
}

.page-shell {
  width: min(1620px, calc(100vw - 24px));
  gap: 14px;
}

.top-nav {
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

body[data-theme="dark"] .top-nav {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

.hero {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  min-height: 0;
  align-items: stretch;
  padding: 22px 24px;
}

.hero-copy,
.hero-summary {
  display: grid;
  align-content: start;
  gap: 12px;
}

.hero-copy {
  padding-right: 8px;
}

.hero-header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-start;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 93, 143, 0.16);
  background: rgba(31, 93, 143, 0.08);
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-theme="dark"] .hero-status {
  color: var(--accent-dark);
  background: rgba(100, 162, 216, 0.12);
}

.hero h1 {
  max-width: 16ch;
  margin-right: auto;
}

.hero-text {
  max-width: 58ch;
  margin-top: 0;
}

.hero-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-capabilities span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  font-size: 0.88rem;
}

body[data-theme="dark"] .hero-capabilities span {
  background: rgba(17, 27, 40, 0.6);
}

.hero-summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(247, 250, 253, 0.94) 0%, rgba(241, 246, 250, 0.9) 100%);
}

body[data-theme="dark"] .hero-summary {
  background: linear-gradient(180deg, rgba(20, 31, 45, 0.96) 0%, rgba(13, 23, 36, 0.92) 100%);
}

.hero-summary-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-summary-grid {
  display: grid;
  gap: 10px;
}

.hero-summary-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
}

body[data-theme="dark"] .hero-summary-card {
  background: rgba(17, 27, 40, 0.58);
}

.hero-summary-card span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-summary-card strong {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.hero-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.hero-actions > * {
  width: 100%;
}

.workspace {
  margin-top: 0;
}

.panel-title-row h2,
.subpanel-header h3,
.preview-panel h2 {
  font-size: 0.94rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-title-row,
.subpanel-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.subpanel-header {
  margin-bottom: 2px;
}

.small-note {
  font-size: 0.9rem;
}

.metric-card,
.stat-chip {
  padding: 12px;
}

.preview-frame {
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.84) 0%, rgba(255, 255, 255, 0) 34%),
    var(--canvas-bg),
    var(--canvas-overlay);
}

body[data-theme="dark"] .preview-frame {
  background:
    radial-gradient(circle at top center, rgba(116, 156, 208, 0.12) 0%, rgba(116, 156, 208, 0) 38%),
    linear-gradient(180deg, rgba(10, 17, 26, 0.98) 0%, rgba(7, 13, 20, 1) 100%),
    var(--canvas-bg),
    var(--canvas-overlay);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 0 0 1px rgba(100, 162, 216, 0.04);
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .top-nav {
    top: 8px;
    padding: 10px;
  }

  .hero {
    padding: 18px;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

}

.toolbar-panel,
.control-panel {
  gap: 12px;
}

.toolbar-panel .subpanel,
.control-panel .subpanel {
  gap: 10px;
  padding: 12px;
}

.tool-grid,
.action-row,
.preview-actions {
  gap: 8px;
}

.toolbar-panel button,
.control-panel button {
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}

.preview-actions button {
  min-height: 38px;
  padding: 0.3rem 0.78rem;
}

.range-row {
  gap: 8px;
}

.small-note {
  font-size: 0.86rem;
  line-height: 1.42;
}

.precision-leaders line {
  stroke: rgba(93, 122, 152, 0.52);
}

.precision-input {
  border-color: rgba(118, 138, 158, 0.26);
  background: rgba(18, 27, 40, 0.88);
}

.precision-input.precision-defined {
  border-color: rgba(125, 184, 232, 0.92);
  box-shadow: 0 0 0 1px rgba(125, 184, 232, 0.28);
  background: rgba(43, 78, 109, 0.94);
}

body[data-theme="dark"] .secondary,
body[data-theme="dark"] .ghost,
body[data-theme="dark"] .tool-btn,
body[data-theme="dark"] .preview-actions button:not(.primary) {
  color: #dce7f2;
  background: linear-gradient(180deg, rgba(22, 35, 50, 0.96) 0%, rgba(15, 25, 38, 0.94) 100%);
  border-color: rgba(100, 162, 216, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .secondary:hover:not(:disabled),
body[data-theme="dark"] .ghost:hover:not(:disabled),
body[data-theme="dark"] .tool-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(27, 42, 60, 0.98) 0%, rgba(19, 31, 47, 0.96) 100%);
}

body[data-theme="dark"] .tool-btn:disabled,
body[data-theme="dark"] .tool-btn.is-disabled {
  color: rgba(220, 231, 242, 0.48);
  background: linear-gradient(180deg, rgba(13, 21, 31, 0.96) 0%, rgba(11, 18, 27, 0.94) 100%);
  border-color: rgba(100, 162, 216, 0.1);
  box-shadow: none;
  opacity: 1;
}

body[data-theme="dark"] .tool-btn.is-active,
body[data-theme="dark"] .tool-btn.is-active:hover:not(:disabled) {
  color: #f4f9ff;
  background: linear-gradient(135deg, #64a2d8 0%, #2f6e9d 100%);
  border-color: rgba(149, 198, 240, 0.42);
  box-shadow: 0 12px 22px rgba(10, 35, 58, 0.34);
}

body[data-theme="dark"] .sketch-mode-toggle,
body[data-theme="dark"] .bubble-visibility-toggle,
body[data-theme="dark"] .center-sketch-btn {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(17, 27, 40, 0.92);
}

.hero {
  grid-template-columns: 1fr;
  padding: 20px 24px;
}

.hero-main {
  display: grid;
  gap: 16px;
}

.hero-header-row {
  justify-content: space-between;
  align-items: start;
  gap: 16px 20px;
}

.hero-heading-block {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.hero-toolbar {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 12px;
  min-width: 280px;
}

.hero h1 {
  max-width: 12ch;
}

.hero-text {
  max-width: 62ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 0;
}

.hero-actions > * {
  width: auto;
  min-width: 170px;
}

.hero-flow {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hero-flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 18px;
}

.hero-flow-step {
  position: relative;
  display: grid;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: help;
  outline: none;
  transition: color 160ms ease;
}

.hero-flow-step-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hero-flow-step-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 14px);
  z-index: 4;
  width: min(260px, calc(100vw - 80px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-elevated);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.hero-flow-step::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: calc(100% + 8px);
  z-index: 4;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-elevated);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) rotate(45deg);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.hero-flow-step:hover,
.hero-flow-step:focus-visible {
  color: var(--text);
}

.hero-flow-step:hover .hero-flow-step-tip,
.hero-flow-step:focus-visible .hero-flow-step-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hero-flow-step:hover::after,
.hero-flow-step:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) rotate(45deg);
}

.hero-flow-step:nth-child(4) .hero-flow-step-tip {
  left: auto;
  right: 0;
}

.hero-flow-step:nth-child(4)::after {
  left: auto;
  right: 18px;
}

body[data-theme="dark"] .hero-flow-step-tip {
  background: rgba(15, 24, 36, 0.98);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .hero-flow-step::after {
  background: rgba(15, 24, 36, 0.98);
}

.hero-flow-step strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

@media (max-width: 1100px) {
  .hero-header-row {
    flex-direction: column;
  }

  .hero-toolbar {
    min-width: 0;
    width: 100%;
    justify-items: start;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-flow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-flow-step-tip {
    width: min(250px, calc(50vw - 56px));
  }

  .hero-flow-step:nth-child(2n) .hero-flow-step-tip {
    left: auto;
    right: 0;
  }

  .hero-flow-step:nth-child(2n)::after {
    left: auto;
    right: 18px;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 18px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .hero-actions > * {
    width: 100%;
  }

  .hero-flow-steps {
    grid-template-columns: 1fr;
  }

  .hero-flow-step-tip {
    width: min(280px, calc(100vw - 48px));
  }

  .hero-flow-step .hero-flow-step-tip {
    left: 0;
    right: auto;
  }

  .hero-flow-step::after {
    left: 18px;
    right: auto;
  }
}
