:root {
  --page-max-width: min(1180px, 92vw);
  --panel-bg: rgba(6, 10, 16, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-shadow: 0 30px 60px -32px rgba(0, 0, 0, 0.65);
  --panel-blur: saturate(140%) blur(18px);
  --muted: var(--site-muted, #93a3b8);
  --accent: var(--site-accent, #24e1d6);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-2: var(--site-accent-2, #ff6fb5);
  --text-strong: #f6fbff;
  --gradient-card: linear-gradient(155deg, rgba(18, 32, 52, 0.52), rgba(18, 13, 26, 0.52));
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-border: rgba(255, 255, 255, 0.16);
  --input-border-focus: color-mix(in srgb, var(--accent), white 35%);
  --control-radius: 14px;
  --section-gap: clamp(18px, 3vw, 32px);
  --transition-snappy: cubic-bezier(0.25, 0.9, 0.35, 1);
  --transition-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --surface-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-strong);
  background: transparent;
  margin: 0;
  min-height: 100vh;
}

a {
  color: inherit;
}

a:hover {
  color: var(--accent);
}

.page-header {
  padding-top: clamp(48px, 12vh, 86px);
  padding-bottom: clamp(28px, 6vh, 48px);
}

.hero-shell {
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
}

.hero-eyebrow {
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent), #ffffff 40%);
}

.page-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  margin: 0;
  font-weight: 700;
}

.page-subtitle {
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.info-strip {
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: grid;
  gap: clamp(18px, 3vw, 32px);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding-bottom: clamp(28px, 6vh, 48px);
}

.info-card {
  position: relative;
  padding: 24px;
  border-radius: 22px;
  background: var(--gradient-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  transition: transform 240ms var(--transition-soft), border-color 240ms var(--transition-soft);
}

.info-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(36, 225, 214, 0.25), transparent 45%);
  opacity: 0;
  transition: opacity 260ms var(--transition-soft);
}

.info-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent), transparent 60%);
}

.info-card:hover::after {
  opacity: 1;
}

.info-card__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 18px;
  color: #051219;
}

.info-card__title {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.info-card__copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.layout-grid {
  max-width: var(--page-max-width);
  margin: 0 auto clamp(56px, 12vh, 88px);
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: 2.2fr 1.2fr;
  align-items: start;
}

.layout-grid > .panel:nth-child(3) {
  grid-column: 1 / -1;
}

.js-ready .panel,
.js-ready .info-card {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 480ms var(--transition-soft), transform 480ms var(--transition-soft), border-color 320ms var(--transition-soft), box-shadow 320ms var(--transition-soft);
}

.js-ready .panel.is-visible,
.js-ready .info-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.panel {
  background: var(--panel-bg);
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: var(--panel-blur);
  padding: clamp(22px, 3vw, 32px);
  position: relative;
  overflow: hidden;
  transition: transform 320ms var(--transition-soft), border-color 320ms var(--transition-soft), box-shadow 320ms var(--transition-soft);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 320ms var(--transition-soft);
}

.panel:hover {
  transform: translateY(-8px);
  border-color: color-mix(in srgb, var(--accent), transparent 70%);
  box-shadow: 0 34px 80px -36px rgba(0, 0, 0, 0.75);
}

.panel:hover::before {
  opacity: 1;
}

.panel-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel-header__meta {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(36, 225, 214, 0.08);
  border: 1px solid rgba(36, 225, 214, 0.18);
  color: color-mix(in srgb, var(--accent), white 30%);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-header__meta.is-success {
  background: rgba(36, 225, 214, 0.18);
  border-color: rgba(36, 225, 214, 0.4);
  color: #0efbf0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--surface-inset);
  margin-bottom: 20px;
}

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

.preset-deck {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted), #fff 20%);
}

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

#preset-chips .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 200ms var(--transition-snappy), box-shadow 200ms var(--transition-snappy), border-color 200ms var(--transition-snappy);
}

#preset-chips .chip::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(36, 225, 214, 0.25), rgba(255, 111, 181, 0.25));
  opacity: 0;
  transition: opacity 220ms var(--transition-snappy);
  z-index: -1;
}

#preset-chips .chip:hover {
  transform: translateY(-4px);
  border-color: rgba(36, 225, 214, 0.45);
}

#preset-chips .chip:hover::after,
#preset-chips .chip.chip-active::after {
  opacity: 1;
}

#preset-chips .chip.chip-active {
  color: #021519;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 18px 32px -18px rgba(36, 225, 214, 0.65);
}

.editor-shell {
  position: relative;
  border-radius: 22px;
  background: rgba(8, 12, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: clamp(16px, 2.4vw, 24px);
  max-height: clamp(420px, 68vh, 720px);
  overflow: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 225, 214, 0.4) rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), inset 0 -12px 26px rgba(0, 0, 0, 0.35);
}

.editor-shell::-webkit-scrollbar {
  width: 10px;
}

.editor-shell::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.editor-shell::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(36, 225, 214, 0.7), rgba(36, 225, 214, 0.3));
  border-radius: 999px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  animation: formRowReveal 420ms var(--transition-soft) forwards;
}

.form-row label {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.control-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.control-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.control-stack > .nested-group {
  flex: 1 1 100%;
  display: grid;
  gap: 12px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.control-stack .form-control,
.control-stack .select-control,
.form-row .form-control {
  min-width: 180px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--control-radius);
  color: inherit;
  padding: 10px 14px;
  font-size: 0.95rem;
  transition: border-color 220ms var(--transition-snappy), box-shadow 220ms var(--transition-snappy), transform 220ms var(--transition-snappy);
}

.control-stack .form-control:focus,
.control-stack .select-control:focus,
.form-row .form-control:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 70%);
}

.select-control {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.65) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.65) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
  padding-right: 36px !important;
}

.field-description {
  grid-column: span 2;
  margin: 6px 0 0 0;
  color: color-mix(in srgb, var(--muted), white 25%);
  font-size: 0.9rem;
  line-height: 1.5;
}

.preview {
  background: rgba(8, 12, 20, 0.82);
  border-radius: 20px;
  padding: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  max-height: clamp(260px, 44vh, 480px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -12px 26px rgba(0, 0, 0, 0.4);
  margin-bottom: 22px;
}

.preview.animate-update {
  animation: previewPulse 540ms var(--transition-soft);
}

.preset-select-group {
  display: grid;
  gap: 10px;
}

.preset-select-label {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted), white 20%);
}

.glossary-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.glossary-card {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.6;
  transition: transform 220ms var(--transition-soft), border-color 220ms var(--transition-soft);
}

.glossary-card:hover {
  transform: translateY(-6px);
  border-color: rgba(36, 225, 214, 0.3);
}

.footer {
  text-align: center;
  padding: 36px 12px 48px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.3);
}

.footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@keyframes previewPulse {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes formRowReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

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

  .panel {
    border-radius: 24px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-header__meta {
    margin-top: 10px;
  }

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

  .field-description {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .page-subtitle {
    font-size: 1rem;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

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

  .toolbar-group {
    width: 100%;
    justify-content: space-between;
  }

  .control-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .control-stack .form-control,
  .control-stack .select-control,
  .form-row .form-control {
    width: 100%;
    min-width: 0;
  }
}