/* ==========================================================================
   RangSutra — design system
   ========================================================================== */

:root {
  --bg: #0e0313;
  --bg-2: #13051a;
  --surface: #1a0a22;
  --surface-2: #221029;
  --surface-3: #2d1636;
  --surface-4: #3a1d45;
  --line: rgba(255, 228, 248, 0.08);
  --line-2: rgba(255, 228, 248, 0.15);
  --text: #fbf1f6;
  --text-2: #d3bfd6;
  --text-3: #a28ba8;
  --gold: #f5b91b;
  --gold-2: #ffd66e;
  --gold-3: #e0900b;
  --gold-ink: #2a1206;
  --pink: #ed1678;
  --teal: #08bdb2;
  --saffron: #ff7a1a;
  --ivory: #fff4e8;
  --ok: #3ccf91;
  --warn: #ffb547;
  --danger: #ff5c7c;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
  --glow-gold: 0 10px 30px -10px rgba(245, 185, 27, 0.55);
  --font-display: 'Playfair Display', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --container: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, canvas, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(245, 185, 27, 0.35); color: #fff; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 0.95em; height: 0.95em; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--gold-ink);
  border-radius: var(--r-sm);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }
.noscript { margin: 0; padding: 12px var(--gutter); background: var(--gold); color: var(--gold-ink); font-weight: 600; text-align: center; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font: 600 11.5px/1 var(--font-ui);
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 18px;
  border-radius: 999px;
  font: 600 14.5px/1 var(--font-ui);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s, border-color 0.18s, color 0.18s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; }
.btn-sm { --btn-h: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { --btn-h: 52px; padding: 0 24px; font-size: 15.5px; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 45%, var(--gold-3));
  color: var(--gold-ink);
  border-color: rgba(255, 220, 120, 0.7);
  box-shadow: var(--glow-gold), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-gold:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px -10px rgba(245, 185, 27, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-2);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: rgba(245, 185, 27, 0.6); color: var(--gold-2); background: rgba(245, 185, 27, 0.06); }

.btn-ghost { color: var(--text-2); padding-inline: 12px; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-ghost-danger:hover:not(:disabled) { color: var(--danger); background: rgba(255, 92, 124, 0.1); }

.btn-danger {
  background: linear-gradient(135deg, #ff7a93, var(--danger));
  color: #2a0510;
  border-color: rgba(255, 140, 160, 0.6);
}
.btn-danger:hover { box-shadow: 0 12px 30px -10px rgba(255, 92, 124, 0.6); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 17px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn-danger:hover:not(:disabled) { color: var(--danger); background: rgba(255, 92, 124, 0.12); }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: rgba(20, 6, 26, 0.65);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.chip-btn:hover { border-color: rgba(245, 185, 27, 0.6); color: var(--gold-2); transform: translateY(-1px); }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
}
.link-btn .icon { transition: transform 0.2s var(--ease); }
.link-btn:hover .icon { transform: translateX(3px); }

/* tooltips */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translate(-50%, 4px);
    padding: 6px 9px;
    font: 500 12px/1.2 var(--font-ui);
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--text);
    background: #08020b;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 30;
  }
  [data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 0.45s; }
}

/* ---------------------------------------------------------------- typography helpers */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.eyebrow-mark { color: var(--pink); }
.eyebrow-num {
  display: inline-grid;
  place-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 185, 27, 0.4);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.1em;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 em, h2 em {
  font-style: italic;
  background: linear-gradient(100deg, var(--gold-2), var(--gold) 40%, #ff8d3a 75%, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.06em;
}
h2 { font-size: clamp(32px, 4.2vw, 50px); line-height: 1.08; margin-top: 14px; }

.lead {
  margin-top: 14px;
  max-width: 60ch;
  font-size: 17px;
  color: var(--text-2);
  text-wrap: pretty;
}

.muted-note { font-size: 13px; color: var(--text-3); }
.storage-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-2);
  background: rgba(245, 185, 27, 0.07);
  border: 1px solid rgba(245, 185, 27, 0.22);
}
.storage-note .icon { color: var(--gold); }

.section { padding-block: clamp(56px, 7.5vw, 104px); position: relative; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background 0.25s, border-color 0.25s, backdrop-filter 0.25s;
}
.site-header.is-scrolled,
.site-header.nav-open {
  background: rgba(14, 3, 19, 0.94);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(245, 185, 27, 0.35), 0 8px 20px -8px rgba(237, 22, 120, 0.6);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font: 700 22px/1 var(--font-display); letter-spacing: 0.01em; }
.brand-name em { font-style: normal; color: var(--gold); }
.brand-tag {
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline: auto;
}
.site-nav a,
.nav-shortcuts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.site-nav a:hover,
.nav-shortcuts:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current] { color: var(--gold-2); background: rgba(245, 185, 27, 0.08); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; font-size: 20px; }
.nav-toggle .icon-close { display: none; }
.nav-open .nav-toggle .icon-open { display: none; }
.nav-open .nav-toggle .icon-close { display: block; }

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding-top: clamp(24px, 5vw, 64px);
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: calc(var(--header-h) * -1) 0 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 50% 60% at 78% 42%, rgba(237, 22, 120, 0.22), transparent 70%),
    radial-gradient(ellipse 40% 50% at 85% 70%, rgba(8, 189, 178, 0.12), transparent 70%),
    radial-gradient(ellipse 60% 70% at 10% 10%, rgba(142, 68, 214, 0.18), transparent 70%),
    radial-gradient(rgba(255, 228, 248, 0.09) 1.2px, transparent 1.3px) 0 0 / 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-bottom: clamp(48px, 6vw, 80px);
}
.hero h1 {
  margin-top: 22px;
  font-size: clamp(44px, 6.4vw, 84px);
  line-height: 1.02;
}
.hero h1 em { display: inline-block; }
.hero-lead {
  margin-top: 24px;
  max-width: 34em;
  font-size: clamp(16px, 1.4vw, 18.5px);
  color: var(--text-2);
  text-wrap: pretty;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-stats {
  display: flex;
  gap: clamp(24px, 4vw, 48px);
  margin: 44px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hero-stats div { display: flex; flex-direction: column-reverse; gap: 4px; }
.hero-stats dt { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.hero-stats dd { margin: 0; font: 600 34px/1 var(--font-display); color: var(--gold); }
.hero-stats dd span { font-size: 18px; color: var(--gold-2); }

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 560px);
  justify-self: center;
}
.hero-halo {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 185, 27, 0.18), rgba(237, 22, 120, 0.12) 45%, transparent 70%);
  filter: blur(20px);
}
.hero-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(245, 185, 27, 0.28);
  animation: spin 90s linear infinite reverse;
}
.hero-orbit::before,
.hero-orbit::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px var(--gold);
}
.hero-orbit::before { top: -5px; left: calc(50% - 5px); }
.hero-orbit::after { bottom: 14%; right: 4%; background: var(--teal); box-shadow: 0 0 16px var(--teal); }
.hero-canvas {
  position: relative;
  width: 90%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  animation: spin 160s linear infinite;
  transition: opacity 0.26s, transform 0.26s;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.5));
}
.hero-canvas.is-swapping { opacity: 0; }
.hero.is-paused .hero-canvas,
.hero.is-paused .hero-orbit,
.hero.is-paused .marquee-track { animation-play-state: paused; }
.hero-visual-actions {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

@keyframes spin { to { transform: rotate(360deg); } }

.marquee {
  border-block: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  gap: 28px;
  width: max-content;
  padding: 18px 0;
  animation: marquee 50s linear infinite;
}
.marquee span { font: italic 500 22px/1 var(--font-display); color: var(--text-2); }
.marquee i { font-style: normal; color: var(--gold); font-size: 14px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------------------------------------------------------------- features */

.features { padding-block: clamp(48px, 6vw, 80px) 0; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.feature {
  padding: 26px 24px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.feature:hover { border-color: rgba(245, 185, 27, 0.3); transform: translateY(-2px); }
.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  color: var(--gold);
  background: rgba(245, 185, 27, 0.1);
  border: 1px solid rgba(245, 185, 27, 0.22);
}
.feature:nth-child(2) .feature-icon { color: #ff6fa5; background: rgba(237, 22, 120, 0.1); border-color: rgba(237, 22, 120, 0.25); }
.feature:nth-child(3) .feature-icon { color: #3fd9cf; background: rgba(8, 189, 178, 0.1); border-color: rgba(8, 189, 178, 0.25); }
.feature:nth-child(4) .feature-icon { color: #c79bff; background: rgba(142, 68, 214, 0.12); border-color: rgba(142, 68, 214, 0.3); }
.feature h3 { margin-top: 18px; font-size: 17px; font-weight: 700; }
.feature p { margin-top: 8px; font-size: 14.5px; color: var(--text-2); }

/* ---------------------------------------------------------------- studio / editor */

.editor {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 304px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.panel { background: var(--surface); min-width: 0; }
.panel-tools { border-right: 1px solid var(--line); border-top-left-radius: var(--r-xl); }
.panel-side { border-left: 1px solid var(--line); border-top-right-radius: var(--r-xl); display: flex; flex-direction: column; }

.panel-section { padding: 20px 18px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); }
.panel-title {
  margin-bottom: 14px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 2px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 19px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tool span { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.tool:hover { background: var(--surface-2); color: var(--text); }
.tool.is-active {
  color: var(--gold-2);
  background: linear-gradient(180deg, rgba(245, 185, 27, 0.16), rgba(245, 185, 27, 0.06));
  border-color: rgba(245, 185, 27, 0.45);
}
.tool-hint { margin-top: 12px; min-height: 2.9em; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }

.field { margin-top: 16px; }
.field:first-of-type { margin-top: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field-row label,
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.field > .field-label { margin-bottom: 8px; }
.field-row output { font-size: 12.5px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

input[type='range'] {
  --p: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold) var(--p), var(--surface-4) var(--p));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ivory);
  border: 3px solid var(--gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s;
}
input[type='range']:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type='range']::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-4); }
input[type='range']::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ivory);
  border: 3px solid var(--gold);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented [aria-checked='true'],
.segmented [aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--gold-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 6px rgba(0, 0, 0, 0.3);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-4);
  transition: background 0.2s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.2s var(--ease), background 0.2s;
}
.switch input:checked + .switch-track { background: var(--gold); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: var(--gold-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; }
.switch kbd { min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 4px; }

.chip-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.chip {
  height: 34px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-checked='true'] { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); }

/* workspace */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(237, 22, 120, 0.06), transparent 65%),
    var(--bg-2);
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.doc-title {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  height: 36px;
  padding: 0 10px;
  margin-left: -10px;
  font: 600 18px/1 var(--font-display);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-overflow: ellipsis;
  transition: border-color 0.15s, background 0.15s;
}
.doc-title:hover { border-color: var(--line); }
.doc-title:focus { outline: none; border-color: rgba(245, 185, 27, 0.6); background: var(--surface); }
.toolbar-group { display: flex; align-items: center; gap: 2px; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line-2); }
.zoom-label {
  min-width: 56px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.zoom-label:hover { background: var(--surface-3); color: var(--text); }

.stage-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2.4vw, 28px);
}
.stage {
  position: relative;
  width: min(100%, 700px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 14px;
  background: #0a0210;
  box-shadow: 0 0 0 1px var(--line-2), 0 30px 60px -24px rgba(0, 0, 0, 0.9);
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.stage[data-tool='hand'],
.stage.is-pan-ready { cursor: grab; }
.stage.is-grabbing { cursor: grabbing; }
.stage[data-tool='picker'] { cursor: copy; }
.board {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
}
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { pointer-events: none; }
.stage.is-zoomed { box-shadow: 0 0 0 1px rgba(245, 185, 27, 0.35), 0 30px 60px -24px rgba(0, 0, 0, 0.9); }

.welcome {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 16px;
}
.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 24px 26px;
  max-width: 340px;
  border-radius: var(--r-lg);
  background: rgba(14, 3, 19, 0.6);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: rise 0.5s var(--ease) both;
}
.welcome-card img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 8px; }
.welcome-card strong { font: 600 22px/1.2 var(--font-display); }
.welcome-card > span { font-size: 14px; color: var(--text-2); }
.welcome-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; pointer-events: auto; }

.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.statusbar > span { display: inline-flex; align-items: center; gap: 6px; }
.statusbar b { color: var(--text-2); font-weight: 600; }
.statusbar .icon { font-size: 14px; }
.st-pos { font-variant-numeric: tabular-nums; min-width: 72px; }
.st-draft { margin-left: auto; }
.st-draft::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.st-draft.is-ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* side panel */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin: 12px 12px 0;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.tabs [role='tab'] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.tabs [role='tab']:hover { color: var(--text); }
.tabs [aria-selected='true'] { background: var(--surface-3); color: var(--gold-2); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.tabpanel { padding: 18px; }

.color-current { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.swatch-lg {
  --c: #f5b91b;
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset, 0 10px 24px -8px var(--c);
  cursor: pointer;
  transition: transform 0.15s;
}
.swatch-lg:hover { transform: scale(1.04); }
.swatch-lg.is-rainbow { background: conic-gradient(#ff3d7f, #ffd23f, #3bceac, #4cc9f0, #7b2cbf, #ff3d7f); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset; }
.swatch-lg.is-pulse { animation: pulse 0.45s var(--ease); }
.swatch-lg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.swatch-lg:focus-within { outline: 2px solid var(--gold); outline-offset: 3px; }
.color-meta { flex: 1; min-width: 0; }
.color-meta .field-label { margin-bottom: 6px; }
.hex-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  font: 600 14px/1 ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hex-input:focus { outline: none; border-color: var(--gold); }

.select-wrap { position: relative; }
.select-wrap select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 36px 0 12px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.select-wrap select:focus { outline: none; border-color: var(--gold); }
.select-wrap .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-3); }
.select-wrap option { background: var(--surface-2); }

.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ivory); }
.swatches .muted-note { grid-column: 1 / -1; }

.surfaces { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-top: 2px; }
.surface {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
}
.surface[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }

/* layers */
.layers-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.layers-head .field-label { margin: 0; }
.layer-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.layer-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.layer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.layer:hover { background: var(--surface-2); }
.layer.is-active { background: rgba(245, 185, 27, 0.08); border-color: rgba(245, 185, 27, 0.4); }
.layer.is-hidden .layer-thumb,
.layer.is-hidden .layer-text { opacity: 0.45; }
.layer-eye {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-3);
}
.layer-eye:hover { color: var(--text); background: var(--surface-3); }
.layer-select {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 2px 2px;
  border-radius: 8px;
  text-align: left;
}
.layer-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background:
    conic-gradient(#2c1834 25%, #20102a 0 50%, #2c1834 0 75%, #20102a 0) 0 0 / 10px 10px;
  box-shadow: 0 0 0 1px var(--line-2) inset;
}
.layer-thumb canvas { width: 100%; height: 100%; }
.layer-text { min-width: 0; display: flex; flex-direction: column; }
.layer-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-meta { font-size: 12px; color: var(--text-3); }
.layer-rename {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--gold);
  font-size: 14px;
}
.layer-rename:focus { outline: none; }
.layer-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.layer-actions + .muted-note { margin-top: 10px; }

/* designs */
.generator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(237, 22, 120, 0.25), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(8, 189, 178, 0.18), transparent 60%),
    var(--surface-2);
  border: 1px solid rgba(245, 185, 27, 0.25);
}
.generator strong { display: block; font: 600 17px/1.2 var(--font-display); }
.generator > div > span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s var(--ease), background 0.15s;
}
.preset:hover { border-color: rgba(245, 185, 27, 0.5); transform: translateY(-2px); background: var(--surface-3); }
.preset-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-3);
}
.preset-art canvas { width: 100%; height: 100%; transition: transform 0.6s var(--ease); }
.preset:hover .preset-art canvas { transform: scale(1.06) rotate(8deg); }
.preset-name { margin: 8px 4px 0; font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.preset-tag { margin: 2px 4px 0; font-size: 11.5px; color: var(--text-3); }

/* save bar */
.savebar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
}
.save-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.save-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.save-state[data-tone='ok']::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.save-state[data-tone='warn']::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.save-hint { font-size: 13px; color: var(--text-3); }
.save-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.menu { position: relative; }
.menu-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  min-width: 250px;
  padding: 6px;
  border-radius: 14px;
  background: #170820;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  animation: rise 0.18s var(--ease);
}
.menu-list button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  text-align: left;
}
.menu-list button:hover,
.menu-list button:focus-visible { background: var(--surface-3); outline: none; }
.menu-list strong { font-size: 14px; }
.menu-list span { font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- traditions */

.traditions {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(142, 68, 214, 0.12), transparent 70%),
    var(--bg-2);
  border-block: 1px solid var(--line);
}
.tradition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tradition {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.tradition:hover { border-color: rgba(245, 185, 27, 0.35); transform: translateY(-4px); box-shadow: var(--shadow); }
.tradition-art { aspect-ratio: 16 / 11; overflow: hidden; background: var(--surface-2); }
.tradition-art canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
  transition: transform 1.2s var(--ease);
}
.tradition:hover .tradition-art canvas { transform: scale(1.2) rotate(10deg); }
.tradition-body { display: flex; flex-direction: column; gap: 8px; padding: 22px 22px 24px; flex: 1; }
.tradition-region {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3fd9cf;
}
.tradition h3 { font: 600 26px/1.15 var(--font-display); }
.tradition-body > p:not(.tradition-region) { font-size: 15px; color: var(--text-2); flex: 1; }
.tradition .link-btn { margin-top: 8px; align-self: flex-start; }

/* ---------------------------------------------------------------- gallery */

.gallery-count { font-size: 14px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.gallery-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.search {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
}
.search .icon { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  font-size: 15px;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { outline: none; border-color: var(--gold); }
.segmented-inline { grid-auto-columns: auto; border-radius: 999px; height: 44px; align-items: center; }
.segmented-inline button { height: 36px; border-radius: 999px; padding: 0 16px; }
.select-inline select { height: 44px; border-radius: 999px; padding-left: 16px; min-width: 180px; background: var(--surface); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.gcard {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.gcard:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.gcard.is-new { animation: glow-in 1.6s var(--ease); }
.gcard-media { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); }
.gcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.gcard:hover .gcard-media img { transform: scale(1.04); }
.gcard-fav {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 17px;
  color: var(--text);
  background: rgba(14, 3, 19, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 0.15s, color 0.15s;
}
.gcard-fav:hover { transform: scale(1.08); }
.gcard-fav[aria-pressed='true'],
.fav-toggle[aria-pressed='true'] { color: var(--pink); }
.gcard-fav[aria-pressed='true'] .icon,
.fav-toggle[aria-pressed='true'] .icon { fill: currentColor; }
.gcard-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 14px 16px; }
.gcard-text { min-width: 0; }
.gcard-title { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-meta { margin-top: 2px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-actions { display: flex; flex: none; }
.gcard-actions .icon-btn { width: 34px; height: 34px; font-size: 16px; }

.gcard.is-skeleton .gcard-media,
.gcard.is-skeleton .gcard-body span {
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.gcard.is-skeleton .gcard-body { flex-direction: column; align-items: flex-start; gap: 8px; }
.gcard.is-skeleton .gcard-body span { display: block; height: 12px; width: 70%; border-radius: 6px; }
.gcard.is-skeleton .gcard-body span + span { width: 40%; }

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(48px, 8vw, 80px) 24px;
  text-align: center;
  border-radius: var(--r-xl);
  border: 1px dashed var(--line-2);
  background: radial-gradient(ellipse at 50% 0%, rgba(245, 185, 27, 0.06), transparent 70%);
}
.empty-icon { width: 44px; height: 44px; color: var(--gold); margin-bottom: 8px; stroke-width: 1.4; }
.empty-state h3 { font: 600 26px/1.2 var(--font-display); }
.empty-state p { color: var(--text-2); max-width: 40ch; }
.empty-state .btn { margin-top: 14px; }

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); position: relative; overflow: hidden; }
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  padding-block: 56px 32px;
  align-items: start;
}
.footer-brand p { margin-top: 16px; max-width: 36ch; color: var(--text-2); font-size: 15px; }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.footer-links > div { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.footer-links h4 { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.footer-links a,
.footer-links .link-btn { color: var(--text-2); font-size: 15px; font-weight: 500; text-decoration: none; }
.footer-links a:hover,
.footer-links .link-btn:hover { color: var(--gold); }
.footer-emblem {
  justify-self: end;
  width: 100%;
  max-width: 320px;
  border-radius: var(--r-lg);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 45%, transparent 75%);
  opacity: 0.9;
}
.footer-base {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px 28px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-3);
}
.footer-base span:last-child span { color: var(--gold); }

/* ---------------------------------------------------------------- dialogs */

.dialog {
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background: #160720;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
}
.dialog[open] { animation: pop 0.22s var(--ease); }
.dialog::backdrop { background: rgba(6, 1, 9, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-body { padding: 26px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog h3 { font: 600 24px/1.2 var(--font-display); }
.dialog-sm { width: 420px; }
.dialog-sm p { margin-top: 10px; color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.shortcuts { width: 760px; }
.shortcut-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; align-items: center; }
.shortcut-list dt { font-size: 14px; color: var(--text-2); }
.shortcut-list dt:first-child { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.shortcut-list dd:nth-child(2) { display: none; }
.shortcut-list dd { margin: 0; display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 13px; color: var(--text-3); white-space: nowrap; }

.lightbox { width: min(1100px, calc(100vw - 32px)); }
.lightbox-inner { display: grid; grid-template-columns: minmax(0, 1fr) 320px; max-height: calc(100dvh - 34px); }
.lightbox-media { position: relative; display: grid; place-items: center; background: #08020b; min-height: 0; }
.lightbox-media img { width: 100%; height: 100%; max-height: calc(100dvh - 34px); object-fit: contain; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text);
  background: rgba(14, 3, 19, 0.65);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
.lightbox-side { display: flex; flex-direction: column; padding: 20px 22px 24px; overflow-y: auto; }
.lightbox-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.lightbox-counter { font-size: 13px; color: var(--text-3); font-weight: 600; }
.lightbox-side > .field-label { margin-bottom: 6px; }
.lightbox-title {
  width: 100%;
  padding: 8px 10px;
  margin-left: -10px;
  font: 600 26px/1.2 var(--font-display);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
}
.lightbox-title:hover { border-color: var(--line); }
.lightbox-title:focus { outline: none; border-color: var(--gold); background: var(--bg-2); }
.lightbox-meta { margin-top: 4px; font-size: 14px; color: var(--text-3); }
.lightbox-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 24px; }
.lightbox-actions .btn { width: 100%; }
.lightbox-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 8px 10px 14px;
  border-radius: 14px;
  background: #1d0b27;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.is-shown { opacity: 1; transform: none; }
.toast > .icon { font-size: 18px; }
.toast-success > .icon { color: var(--ok); }
.toast-error > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--gold); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-action {
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--gold);
  white-space: nowrap;
}
.toast-action:hover { background: rgba(245, 185, 27, 0.12); }
.toast-close { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--text-3); }
.toast-close:hover { color: var(--text); background: var(--surface-3); }

/* ---------------------------------------------------------------- focus mode */

.editor:fullscreen,
.editor.is-focus {
  border-radius: 0;
  border: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}
.editor.is-focus { position: fixed; inset: 0; z-index: 120; }
.editor:fullscreen .panel,
.editor.is-focus .panel { overflow-y: auto; border-radius: 0; }
.editor:fullscreen .savebar,
.editor.is-focus .savebar { border-radius: 0; padding-block: 10px; }
.editor:fullscreen .save-hint,
.editor.is-focus .save-hint { display: none; }
.editor:fullscreen .stage,
.editor.is-focus .stage { width: min(100%, calc(100vh - 220px)); width: min(100%, calc(100dvh - 220px)); }
.editor:fullscreen::backdrop { background: var(--bg); }
/* keep notifications clear of the Save / Export bar */
.editor:fullscreen .toasts,
.editor.is-focus .toasts { bottom: 84px; }
html.editor-focus body { overflow: hidden; }

/* ---------------------------------------------------------------- motion */

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.feature-grid .reveal:nth-child(2), .tradition-grid .reveal:nth-child(3n + 2) { transition-delay: 0.08s; }
.feature-grid .reveal:nth-child(3), .tradition-grid .reveal:nth-child(3n) { transition-delay: 0.16s; }
.feature-grid .reveal:nth-child(4) { transition-delay: 0.24s; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes glow-in {
  0% { box-shadow: 0 0 0 0 rgba(245, 185, 27, 0.8); border-color: var(--gold); }
  100% { box-shadow: 0 0 0 18px rgba(245, 185, 27, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .hero-canvas, .hero-orbit, .marquee-track { animation: none !important; }
}

/* ---------------------------------------------------------------- responsive */

/* Keyboard shortcuts are irrelevant on touch-only devices. */
@media (hover: none) and (pointer: coarse) {
  [data-open-shortcuts], .switch kbd { display: none !important; }
}

@media (max-width: 1180px) {
  .editor { grid-template-columns: 240px minmax(0, 1fr); }
  .panel-side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .tabs { max-width: 480px; }
  #tab-colour { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; align-items: start; }
  #tab-colour[hidden] { display: none; }
  #tab-colour .field:first-of-type { margin-top: 0; }
  .preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tradition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor:fullscreen .panel-side, .editor.is-focus .panel-side { display: none; }
}

@media (max-width: 900px) {
  :root { --header-h: 64px; }
  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px var(--gutter) 20px;
    background: rgba(14, 3, 19, 0.97);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }
  .nav-open .site-nav { opacity: 1; transform: none; visibility: visible; }
  .site-nav a, .nav-shortcuts { height: 48px; font-size: 16px; border-radius: 12px; }
  .nav-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; width: min(100%, 440px); }
  .hero-copy { text-align: left; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-emblem { display: none; }
  .lightbox-inner { grid-template-columns: 1fr; overflow-y: auto; }
  .lightbox-media img { max-height: 60dvh; }
  .shortcuts { width: 560px; }
  .shortcut-cols { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 760px) {
  .editor { display: flex; flex-direction: column; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .panel-tools { display: contents; }
  .panel-section-tools { order: 1; padding: 12px 12px 8px; border-bottom: 1px solid var(--line); }
  .panel-section-tools .panel-title { display: none; }
  .tool-grid {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    scrollbar-width: none;
    margin-inline: -4px;
    padding-inline: 4px 28px;
    -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
    mask-image: linear-gradient(90deg, #000 82%, transparent);
  }
  .welcome-card { padding: 16px 18px; gap: 4px; }
  .welcome-card img, .welcome-card > span { display: none; }
  .welcome-card strong { font-size: 18px; }
  .welcome-actions { margin-top: 10px; }
  .tool-grid::-webkit-scrollbar { display: none; }
  .tool { flex: 0 0 62px; }
  .tool-hint { min-height: 0; margin-top: 8px; }
  .workspace { order: 2; }
  .panel-section-brush { order: 3; border-top: 1px solid var(--line); }
  .panel-section-sym { order: 4; }
  .panel-side { order: 5; }
  .savebar { order: 6; }
  .tabs { margin: 12px; max-width: none; }
  #tab-colour { display: block; }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { flex-wrap: wrap; padding: 8px 10px; }
  .doc-title { max-width: none; flex-basis: 100%; margin-left: 0; font-size: 17px; }
  .toolbar-group { width: 100%; justify-content: space-between; }
  .stage-wrap { padding: 10px; }
  .statusbar { gap: 12px; font-size: 12px; }
  .statusbar .st-pos { display: none; }
  .savebar { flex-direction: column; align-items: stretch; border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .save-actions { justify-content: stretch; }
  .save-actions > * { flex: 1; }
  .save-actions .btn { width: 100%; }
  .menu-list { left: 0; right: auto; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .tradition-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .gcard-body { flex-direction: column; align-items: stretch; padding: 10px 10px 8px; }
  .gcard-actions { justify-content: space-between; margin-top: 4px; }
  .select-inline { flex: 1; }
  .select-inline select { min-width: 0; }
  .editor.is-focus .panel-section-brush, .editor.is-focus .panel-section-sym, .editor.is-focus .save-info { display: none; }
  .editor.is-focus { display: flex; }
  .editor.is-focus .workspace { flex: 1; min-height: 0; }
  .editor.is-focus .savebar { flex-direction: row; padding: 8px 10px; }
  .editor.is-focus .save-actions { flex-wrap: nowrap; }
  .editor.is-focus .save-actions .btn { --btn-h: 40px; padding: 0 10px; font-size: 13.5px; }
  .editor.is-focus .stage { width: min(100%, calc(100vh - 330px)); width: min(100%, calc(100dvh - 330px)); }
}

@media (max-width: 560px) {
  .brand-tag { display: none; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 38px; height: 38px; }
  .header-cta { display: none; }
  .hero h1 { font-size: clamp(40px, 12vw, 52px); }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-stats { gap: 20px; justify-content: space-between; }
  .hero-stats dd { font-size: 28px; }
  .hero-stats dt { font-size: 10.5px; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-base { flex-direction: column; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { max-width: none; }
  .surfaces, .swatches { gap: 6px; }
  .lightbox-row { grid-template-columns: 1fr 1fr; }
}
