:root {
  color-scheme: dark;
  --bg-0: #050408;
  --bg-1: #120f16;
  --bg-2: #21181a;
  --bg-3: #13202d;
  --panel: rgba(17, 14, 19, 0.78);
  --panel-strong: rgba(13, 11, 17, 0.94);
  --panel-soft: rgba(255, 246, 236, 0.04);
  --panel-elevated: rgba(30, 23, 28, 0.88);
  --line: rgba(255, 243, 230, 0.08);
  --line-strong: rgba(150, 201, 233, 0.18);
  --text: #f7f1eb;
  --muted: #abb3c0;
  --accent: #8cdcff;
  --accent-glow: rgba(140, 220, 255, 0.18);
  --accent-strong: #4db8f0;
  --accent-warm: #ffbe72;
  --accent-warm-glow: rgba(255, 190, 114, 0.2);
  --danger: #f26c67;
  --shadow: 0 36px 80px -24px rgba(0, 0, 0, 0.76);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  
  --font-brand: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  font-family: var(--font-base);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 14%, rgba(140, 220, 255, 0.12), transparent 24%),
    radial-gradient(circle at 82% 8%, rgba(255, 190, 114, 0.12), transparent 20%),
    radial-gradient(circle at 18% 84%, rgba(255, 119, 94, 0.1), transparent 22%),
    radial-gradient(circle at 76% 78%, rgba(77, 184, 240, 0.1), transparent 24%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 42%, #0c1119 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.82), transparent 92%);
  opacity: 0.45;
}

body::after {
  z-index: -1;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 30%);
  mix-blend-mode: screen;
  opacity: 0.5;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: none;
  appearance: none;
  -webkit-appearance: none;
}

canvas {
  display: block;
  width: 100%;
}

.page {
  height: 100vh;
  min-height: 100svh;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  isolation: isolate;
}

.support-strip,
.appbar,
.library-panel,
.stage-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 24%),
    linear-gradient(135deg, rgba(255, 190, 114, 0.06), transparent 34%),
    linear-gradient(220deg, rgba(140, 220, 255, 0.08), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.support-strip {
  position: relative;
  z-index: 180;
  min-height: 48px;
  padding: 8px 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background:
    linear-gradient(90deg, rgba(255, 190, 114, 0.12), transparent 26%),
    linear-gradient(90deg, rgba(13, 11, 17, 0.96), rgba(19, 15, 18, 0.92));
  border: 1px solid var(--line-strong);
  animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

.support-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 22%);
  pointer-events: none;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.support-text {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.support-btn {
  padding: 8px 18px;
  border-radius: 999px;
  color: #18110f;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffd7a8, var(--accent-warm));
  transition: all 0.3s ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.support-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  background: linear-gradient(135deg, #ffe2bf, #ffcb84);
}

.appbar {
  position: relative;
  z-index: 160;
  min-height: 72px;
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  overflow: visible;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 26%),
    linear-gradient(120deg, rgba(255, 190, 114, 0.05), transparent 32%),
    linear-gradient(220deg, rgba(140, 220, 255, 0.08), transparent 36%),
    var(--panel-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  position: relative;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.14), transparent 34%),
    linear-gradient(135deg, #201617, #101720);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 28px rgba(0, 0, 0, 0.34);
}

.brand-ring,
.brand-core,
.brand-beam {
  position: absolute;
  inset: 0;
}

.brand-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(141, 220, 255, 0.72);
  border-radius: 14px;
}

.brand-core::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 16px;
  top: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff4d8, #ffb561);
  box-shadow: 0 0 18px rgba(255, 181, 97, 0.34);
}

.brand-beam::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 3px;
  left: 12px;
  top: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(116,180,255,0.86), rgba(255,255,255,0));
  transform: rotate(-28deg);
}

.brand-copy h1 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(to bottom, #fff, #cbd5e1);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-copy p {
  margin: 2px 0 0;
  color: var(--accent-warm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.menu-bar {
  position: relative;
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu {
  position: relative;
  z-index: 240;
}

.menu.open {
  z-index: 280;
}

.menu-trigger {
  all: unset;
  box-sizing: border-box;
  min-width: 88px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  cursor: pointer;
  color: var(--text);
  background-color: rgba(255, 246, 236, 0.03);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(255, 246, 236, 0.03), rgba(255, 246, 236, 0.03));
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  appearance: none !important;
  -webkit-appearance: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-trigger:hover,
.menu.open .menu-trigger {
  background-color: rgba(140, 220, 255, 0.12);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(140, 220, 255, 0.12), rgba(140, 220, 255, 0.12));
  border-color: var(--accent);
  color: #dff6ff;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 480;
  display: none;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 18%),
    linear-gradient(135deg, rgba(255, 190, 114, 0.07), transparent 28%),
    linear-gradient(225deg, rgba(140, 220, 255, 0.08), transparent 32%),
    rgba(11, 10, 15, 0.98);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.52);
}

.menu.open .menu-panel {
  display: block;
}

.menu.open .file-panel,
.menu.open .color-panel,
.menu.open .language-panel {
  display: grid;
}

.file-panel {
  min-width: 220px;
  gap: 8px;
}

.menu-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 246, 236, 0.04);
  border: 1px solid transparent;
  text-align: left;
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.menu-item:hover {
  background: rgba(140, 220, 255, 0.12);
  border-color: rgba(140, 220, 255, 0.18);
  transform: translateY(-1px);
}

.color-panel {
  width: min(920px, 84vw);
  max-height: min(72vh, 680px);
  overflow: auto;
  scrollbar-width: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.preset-panel {
  width: min(960px, 82vw);
  max-height: min(72vh, 680px);
  overflow: auto;
  scrollbar-width: none;
}

.preset-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.preset-menu-toolbar {
  margin-bottom: 12px;
}

.preset-save-btn {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 190, 114, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 190, 114, 0.16), rgba(140, 220, 255, 0.08));
  color: var(--text);
  font-weight: 700;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.preset-save-btn:hover {
  background:
    linear-gradient(135deg, rgba(255, 190, 114, 0.22), rgba(140, 220, 255, 0.12));
  border-color: rgba(255, 190, 114, 0.42);
  transform: translateY(-1px);
}

.language-panel {
  min-width: 244px;
  gap: 8px;
}

.language-menu-list {
  display: grid;
  gap: 8px;
}

.language-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 246, 236, 0.04);
  border: 1px solid rgba(255, 243, 230, 0.06);
  text-align: left;
  display: grid;
  gap: 4px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.language-item:hover,
.language-item.active {
  background: rgba(140, 220, 255, 0.11);
  border-color: rgba(140, 220, 255, 0.2);
  transform: translateY(-1px);
}

.language-item strong {
  font-size: 13px;
}

.language-item span {
  color: var(--muted);
  font-size: 12px;
}

.language-code {
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.preset-menu-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preset-group {
  padding: 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.025);
  border: 1px solid rgba(255, 243, 230, 0.05);
  display: grid;
  gap: 10px;
}

.preset-head {
  display: grid;
  gap: 4px;
}

.preset-head h3 {
  margin: 0;
  font-size: 15px;
}

.preset-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.preset-list {
  display: grid;
  gap: 8px;
}

.preset-item {
  width: 100%;
  padding: 12px 13px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 246, 236, 0.04);
  border: 1px solid rgba(255, 243, 230, 0.06);
  text-align: left;
  display: grid;
  gap: 5px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.preset-item:hover {
  background: rgba(140, 220, 255, 0.1);
  border-color: rgba(140, 220, 255, 0.2);
  transform: translateY(-1px);
}

.preset-item strong {
  font-size: 13px;
}

.preset-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.preset-item em {
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.submenu-block {
  padding: 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.025);
  border: 1px solid rgba(255, 243, 230, 0.05);
}

.submenu-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.submenu-head span,
.panel-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--accent-warm);
  background: rgba(255, 190, 114, 0.08);
  border: 1px solid rgba(255, 190, 114, 0.14);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.submenu-head strong {
  font-size: 16px;
}

.menu-swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.menu-swatch {
  padding: 8px 7px;
  border-radius: 14px;
  background: rgba(255, 246, 236, 0.04);
  border: 1px solid transparent;
  color: var(--text);
  display: grid;
  gap: 6px;
  text-align: left;
}

.menu-swatch:hover,
.menu-swatch.active {
  border-color: rgba(140, 220, 255, 0.26);
  background: rgba(140, 220, 255, 0.1);
}

.menu-swatch-chip {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.menu-swatch strong {
  font-size: 11px;
  line-height: 1.1;
}

.appbar-status {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.status-pill,
.hint-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
  border: 1px solid rgba(255, 243, 230, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.workspace {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 16px;
}

.library-panel,
.stage-panel {
  position: relative;
  z-index: 1;
  min-height: 0;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  overflow: hidden;
}

.library-panel::before,
.stage-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%),
    linear-gradient(90deg, rgba(255, 190, 114, 0.06), transparent 20%);
  pointer-events: none;
}

.library-panel {
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(17, 14, 19, 0.92), rgba(15, 13, 17, 0.88));
}

.panel-top {
  display: grid;
  gap: 8px;
}

.panel-top-compact {
  gap: 0;
}

.panel-top h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.panel-copy,
.selection-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.search-icon {
  color: var(--accent-warm);
  font-size: 15px;
  line-height: 1;
}

.search-field input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-field input::placeholder {
  color: var(--muted);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.category-tab {
  min-height: 46px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.025);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  transition: all 0.2s ease;
}

.category-tab:hover {
  background: rgba(255, 190, 114, 0.08);
  color: #fff3e5;
}

.category-tab.active {
  color: #fff7ef;
  border-color: rgba(255, 190, 114, 0.36);
  background:
    linear-gradient(135deg, rgba(255, 190, 114, 0.18), rgba(140, 220, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.palette-panel {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding-right: 8px;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.palette-empty {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 246, 236, 0.025);
  border: 1px dashed rgba(255, 243, 230, 0.16);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.palette-panel::-webkit-scrollbar {
  width: 5px;
}

.palette-panel::-webkit-scrollbar-track {
  background: transparent;
}

.palette-panel::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 10px;
}

.palette-group {
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.025);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.palette-group:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.palette-head {
  display: grid;
  gap: 4px;
}

.palette-head h3 {
  margin: 0;
  font-size: 16px;
}

.palette-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.variant-btn {
  min-height: 124px;
  padding: 10px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.02);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 10px;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.variant-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 190, 114, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 190, 114, 0.08), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.04);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
}

.variant-preview {
  height: 60px;
  border-radius: 14px;
  border: 1px solid rgba(255, 243, 230, 0.12);
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(23, 18, 18, 0.96), rgba(12, 16, 26, 0.94));
  background-size: 12px 12px, 12px 12px, auto, auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.variant-btn:hover .variant-preview {
  border-color: rgba(255, 190, 114, 0.28);
}

.variant-svg {
  width: 100%;
  height: 100%;
  display: block;
}

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

.variant-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.variant-copy .variant-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.selection-panel {
  padding: 20px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(255, 190, 114, 0.08), transparent 34%),
    linear-gradient(220deg, rgba(140, 220, 255, 0.08), transparent 36%),
    rgba(16, 14, 19, 0.96);
  border: 1px solid rgba(255, 190, 114, 0.24);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 12px;
}

.selection-panel.empty {
  display: none;
}

.selection-panel.is-hidden {
  display: none;
}

.selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.selection-copy strong {
  display: block;
  font-size: 18px;
}

.selection-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.selection-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.selection-grid input {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 243, 230, 0.08);
  background: rgba(9, 8, 13, 0.72);
  color: var(--text);
}

.selection-power {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 190, 114, 0.08), rgba(140, 220, 255, 0.05));
  border: 1px solid rgba(255, 243, 230, 0.08);
}

.selection-power label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.power-readout {
  justify-self: end;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 190, 114, 0.14);
  border: 1px solid rgba(255, 190, 114, 0.22);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.selection-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-note {
  color: var(--muted);
  font-size: 12px;
}

.selection-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.metric-chip {
  padding: 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
  border: 1px solid rgba(255, 243, 230, 0.08);
  display: grid;
  gap: 3px;
}

.metric-chip strong {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-chip span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.delete-btn {
  padding: 10px 14px;
  border-radius: 999px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(255, 128, 118, 0.98), rgba(209, 72, 91, 0.96));
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.24);
}

.stage-panel {
  padding: 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.stage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stage-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 243, 230, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
}

.stage-view-toggle {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: rgba(247, 241, 235, 0.88);
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.stage-view-toggle.active {
  color: #08111b;
  background: linear-gradient(135deg, #ffd5a3, var(--accent));
  box-shadow: 0 16px 24px -18px rgba(140, 220, 255, 0.9);
}

.stage-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.stage-zoom-tools {
  display: none;
  align-items: center;
  gap: 6px;
}

.stage-zoom-tools.is-active {
  display: flex;
}

.stage-zoom-tool {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 243, 230, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
  color: var(--text);
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.stage-zoom-tool:hover {
  background: rgba(140, 220, 255, 0.12);
  border-color: rgba(140, 220, 255, 0.22);
  transform: translateY(-1px);
}

.stage-zoom-tool:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.stage-zoom-value {
  min-width: 68px;
  color: var(--accent-warm);
}

.stage-tool {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
  border: 1px solid rgba(255, 243, 230, 0.08);
  color: rgba(247, 241, 235, 0.88);
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.stage-tool.active {
  color: #fff4e5;
  background:
    linear-gradient(135deg, rgba(255, 190, 114, 0.18), rgba(140, 220, 255, 0.08));
  border-color: rgba(255, 190, 114, 0.34);
}

.library-toggle {
  display: none;
}

.stage-canvas-wrap {
  min-height: 0;
  position: relative;
  min-height: 560px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(10, 9, 13, 0.98), rgba(5, 6, 10, 1));
  box-shadow: inset 0 0 54px rgba(0, 0, 0, 0.84);
}

.stage-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.06), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(255, 190, 114, 0.08), transparent 34%);
}

.stage-view {
  border-radius: inherit;
}

.stage-view.is-main {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
}

.stage-view.is-secondary {
  position: absolute;
  z-index: 3;
  top: 24px;
  right: 24px;
  width: 320px;
  height: 216px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(255, 190, 114, 0.06), transparent 32%),
    linear-gradient(220deg, rgba(140, 220, 255, 0.08), transparent 34%),
    var(--panel-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.stage-view.is-secondary:hover {
  transform: translateY(-2px);
  border-color: rgba(140, 220, 255, 0.3);
}

.stage-view.is-secondary canvas {
  pointer-events: none;
}

.stage-view canvas {
  width: 100%;
  min-height: 0;
  height: 100%;
  border-radius: calc(var(--radius-lg) - 6px);
}

#planCanvas,
#isoCanvas {
  cursor: default;
  touch-action: none;
}

#planCanvas {
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    radial-gradient(circle at top left, rgba(140, 220, 255, 0.08), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(255, 190, 114, 0.08), transparent 24%),
    rgba(7, 13, 24, 0.4);
  background-size: 36px 36px, 36px 36px, auto, auto, auto, auto;
}

#isoCanvas {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    rgba(8, 13, 21, 0.92);
}

#isoCanvas {
  border-radius: 18px;
  border: 1px solid rgba(255, 243, 230, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(255, 246, 236, 0.03);
}

.stage-view.is-main #isoCanvas {
  height: 100%;
  border-radius: inherit;
}

html[dir="rtl"] body,
html[dir="rtl"] input,
html[dir="rtl"] button {
  direction: rtl;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

html[dir="rtl"] .menu-panel {
  left: auto;
  right: 0;
}

html[dir="rtl"] .menu-trigger,
html[dir="rtl"] .menu-item,
html[dir="rtl"] .language-item,
html[dir="rtl"] .selection-panel,
html[dir="rtl"] .panel-top,
html[dir="rtl"] .stage-topbar,
html[dir="rtl"] .submenu-head,
html[dir="rtl"] .preset-head,
html[dir="rtl"] .palette-head {
  text-align: right;
}

html[dir="rtl"] .selection-grid label {
  text-align: right;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 350px minmax(0, 1fr);
  }

  .stage-view.is-secondary {
    width: 280px;
    height: 194px;
  }

  .preset-menu-list {
    grid-template-columns: 1fr;
  }

  .preset-panel {
    width: min(92vw, 640px);
  }
}

@media (max-width: 1100px) {
  .support-strip {
    padding: 10px 18px;
    border-radius: 24px;
  }

  .menu-bar {
    width: 100%;
  }

  .appbar-status,
  .stage-toolbar {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 1024px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  body {
    overscroll-behavior-y: contain;
  }

  .page {
    height: auto;
    min-height: 100svh;
  }

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

  .stage-panel {
    order: 1;
  }

  .library-panel {
    order: 2;
    min-height: 460px;
  }

  .stage-canvas-wrap {
    min-height: clamp(360px, 58svh, 620px);
  }

  .stage-view.is-secondary {
    top: 14px;
    right: 14px;
    width: min(44vw, 240px);
    height: 168px;
    padding: 10px;
  }
}

@media (min-width: 701px) and (max-width: 1180px) {
  .library-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .workspace.is-library-collapsed {
    grid-template-columns: 1fr;
  }

  .workspace.is-library-collapsed .library-panel {
    display: none;
  }

  .stage-zoom-tools,
  .stage-zoom-tools.is-active {
    display: none !important;
  }

  .appbar {
    padding: 14px 16px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    overflow: visible;
  }

  .brand {
    flex: 0 0 auto;
    min-width: 0;
  }

  .brand-copy p {
    display: none;
  }

  .menu-bar {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: visible;
    justify-content: flex-start;
    padding-bottom: 0;
    gap: 6px;
  }

  .menu-bar::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .menu {
    flex: 0 0 auto;
  }

  .menu-trigger {
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
  }

  .appbar-status {
    display: none;
  }

  .stage-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .stage-toolbar {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  .page {
    height: 100vh;
    min-height: 100svh;
  }

  .workspace {
    grid-template-columns: clamp(272px, 31vw, 332px) minmax(0, 1fr);
  }

  .stage-panel,
  .library-panel {
    order: initial;
  }

  .library-panel {
    min-height: 0;
    padding: 20px;
    gap: 14px;
  }

  .stage-panel {
    padding: 12px;
  }

  .stage-toolbar {
    justify-content: flex-end;
  }

  .stage-canvas-wrap {
    min-height: clamp(420px, 68svh, 760px);
  }

  .stage-view.is-secondary {
    top: 16px;
    right: 16px;
    width: min(30vw, 220px);
    height: 164px;
    padding: 10px;
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .category-tabs {
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  }

  .stage-view.is-secondary {
    width: min(31vw, 196px);
    height: 148px;
  }
}

@media (max-width: 700px) {
  .library-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .workspace.is-library-collapsed .library-panel {
    display: none;
  }

  .stage-zoom-tools,
  .stage-zoom-tools.is-active {
    display: none !important;
  }

  .appbar {
    padding: 12px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow: visible;
  }

  .brand {
    width: auto;
    flex: 0 0 auto;
    gap: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .brand-copy h1 {
    font-size: 18px;
  }

  .brand-copy p {
    display: none;
  }

  .menu-bar {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-start;
    align-self: center;
    gap: 5px;
  }

  .page {
    padding: 10px;
    gap: 8px;
  }

  .support-strip {
    min-height: unset;
    padding: 12px 14px;
    border-radius: 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .support-btn {
    width: 100%;
    text-align: center;
  }

  .appbar,
  .library-panel,
  .stage-panel,
  .stage-view.is-secondary {
    border-radius: 22px;
  }

  .menu-bar {
    flex-wrap: nowrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .menu-bar::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .menu-trigger {
    min-width: 0;
    padding: 7px 9px;
    font-size: 11px;
    flex: 0 0 auto;
  }

  .appbar-status {
    display: none;
  }

  .library-panel,
  .stage-panel {
    padding: 16px;
  }

  .category-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .category-tabs::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .category-tab {
    min-width: 92px;
    flex: 0 0 auto;
  }

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

  .selection-head {
    flex-direction: column;
    align-items: stretch;
  }

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

  .stage-view-switch {
    min-width: 0;
  }

  .stage-view-toggle {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .stage-toolbar {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .stage-tool {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .selection-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .delete-btn {
    width: 100%;
  }

  .stage-view.is-secondary {
    width: min(52vw, 210px);
    height: 144px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 8px;
  }

  .brand-copy h1 {
    font-size: 18px;
  }

  .brand-copy p,
  .panel-copy,
  .selection-note {
    font-size: 12px;
  }

  .variant-grid,
  .selection-metrics {
    grid-template-columns: 1fr;
  }

  .palette-group,
  .selection-panel {
    padding: 14px;
  }

  .stage-canvas-wrap {
    min-height: clamp(320px, 52svh, 520px);
  }

  .stage-view.is-secondary {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: min(44vw, 156px);
    height: 118px;
    padding: 8px;
  }

  .stage-zoom-tool {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
  }

  .stage-zoom-value {
    min-width: 58px;
    font-size: 12px;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  html,
  body {
    height: auto;
    overflow: visible;
    background: white;
  }

  body::before,
  body::after,
  .library-panel::before,
  .stage-panel::before,
  .stage-canvas-wrap::before {
    display: none;
  }

  .page {
    height: auto;
    padding: 0;
    display: block;
  }

  .support-strip,
  .appbar,
  .library-panel,
  .stage-topbar,
  .stage-view.is-secondary {
    display: none !important;
  }

  .workspace {
    display: block;
  }

  .stage-panel {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
  }

  .stage-canvas-wrap {
    border: 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
    overflow: visible;
  }

  #planCanvas {
    background: white;
  }
}






