@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --surface: #ffffff;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --error: #dc2626;
  --border-light: #e4e7ec;
  --text-dark: #101828;
  --muted-light: #667085;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #0c0e12;
  --panel: #161922;
  --panel-elevated: #1c2029;
  --border: #2a303c;
  --text: #f0f2f5;
  --muted: #949bab;
  --editor-bg: #0a0c10;
  --editor-text: #e4e7ec;
  --link: #fb923c;
  --error: #f87171;
  --error-bg: #450a0a;
  --preview-canvas: #111318;
  --paper-shadow: 0 4px 24px rgb(0 0 0 / 35%), 0 0 0 1px rgb(255 255 255 / 4%);
  --backdrop: rgb(0 0 0 / 65%);
  --panel-shadow: 0 24px 48px rgb(0 0 0 / 40%);
  --landing-gallery-bg: #0a0c10;
  --nav-bg: rgb(22 25 34 / 88%);
  --hero-glow: transparent;
}

:root,
[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-elevated: #ffffff;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --editor-bg: #ffffff;
  --editor-text: #344054;
  --link: #ea580c;
  --error: #dc2626;
  --error-bg: #fef3f2;
  --preview-canvas: #eaecf0;
  --paper-shadow: 0 4px 20px rgb(16 24 40 / 8%), 0 0 0 1px rgb(16 24 40 / 6%);
  --backdrop: rgb(16 24 40 / 45%);
  --panel-shadow: 0 20px 40px rgb(16 24 40 / 10%);
  --landing-gallery-bg: #eef0f3;
  --nav-bg: rgb(255 255 255 / 88%);
  --hero-glow: transparent;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.7rem 1.5rem;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-nav__brand {
  display: flex;
  flex-direction: column;
  margin-right: auto;
  min-width: 0;
}

.site-nav__brand-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-nav__logo {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: block;
}

.site-nav__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-nav__brand-link:hover .site-nav__title {
  color: var(--link);
}

.site-nav__title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-nav__tagline {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.site-nav__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}

.site-nav__pages a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__pages a:hover {
  color: var(--link);
}

.site-nav__pages a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.site-nav__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.site-nav__github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav__github:hover {
  color: var(--text);
}

.site-nav__github-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.site-nav label {
  font-size: 0.75rem;
  color: var(--muted);
}

.site-nav select,
.site-nav button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.site-nav button:not(.secondary) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.site-nav button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.site-nav button.secondary:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
  opacity: 1;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 5.5rem;
  justify-content: center;
}

.theme-toggle__icon {
  font-size: 0.95rem;
  line-height: 1;
}

.site-nav button:not(.secondary):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.site-error {
  display: none;
  margin: 0;
  padding: 0.5rem 1.25rem;
  background: var(--error-bg);
  color: var(--error);
  font-size: 0.85rem;
}

.site-error.visible { display: block; }

.generator-hero {
  padding: 2.5rem 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.generator-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: 48rem;
  margin: 0 auto;
}

.generator-hero__title {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text);
}

.generator-hero__lead {
  max-width: 46rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-format-name {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.hero-format-name:hover {
  text-decoration: underline;
}

.hero-format-name strong {
  font-weight: 600;
}

.hero-benefits {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hero-benefits::-webkit-scrollbar {
  display: none;
}

.hero-benefits__pill {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.hero-benefits__pill::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.1em;
}

.landing-intro {
  display: flex;
  flex-direction: column;
}

.landing-zone {
  width: 100%;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.landing-zone__inner {
  width: 100%;
  max-width: min(72rem, 100%);
  margin: 0 auto;
}

.landing-zone--hero {
  background:
    radial-gradient(ellipse 90% 70% at 50% -30%, var(--hero-glow), transparent 65%),
    var(--panel);
  padding-top: 4rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
}

.landing-zone--gallery {
  background: var(--landing-gallery-bg, var(--bg));
  padding-top: 4rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
}

.landing-zone--hero .generator-hero__inner {
  align-items: center;
  text-align: center;
  max-width: min(62rem, 100%);
  margin: 0 auto;
}

.landing-zone--hero .hero-benefits {
  justify-content: center;
}

.landing-zone--hero .landing-hero__actions {
  justify-content: center;
  width: 100%;
  margin-top: 1.25rem;
}

.template-gallery {
  width: 100%;
}

.template-gallery__header {
  margin-bottom: 0.75rem;
}

.template-gallery__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.3;
}

.template-gallery__subtitle {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.template-gallery__viewport {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}

.template-gallery__nav-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.template-gallery__nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.template-gallery__nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  border-color: var(--border);
  color: var(--muted);
}

.template-gallery__track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  touch-action: pan-x;
  padding: 0.15rem 0 0.5rem;
}

.template-gallery__track::-webkit-scrollbar {
  display: none;
}

.template-gallery__card {
  flex: 0 0 min(200px, 72vw);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.template-gallery__card:hover .template-gallery__frame,
.template-gallery__card:focus-visible .template-gallery__frame {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 12px 32px rgb(16 24 40 / 12%);
  transform: translateY(-2px);
}

.template-gallery__card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}

.template-gallery__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--paper-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.template-gallery__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}

.template-gallery__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 0.15rem;
}

.template-gallery__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.landing-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.landing-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.72rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button.landing-cta-btn {
  appearance: none;
}

.landing-cta-btn:hover {
  transform: translateY(-1px);
}

.landing-cta-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgb(16 24 40 / 8%), 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent);
}

.landing-cta-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 4px rgb(16 24 40 / 10%), 0 8px 20px color-mix(in srgb, var(--accent) 32%, transparent);
}

.landing-cta-btn--secondary {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

.landing-cta-btn--secondary:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

body[data-page="generator"] {
  height: auto;
  min-height: 100vh;
}

.generator-app {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body[data-page="generator"]:not(.app-focus) .generator-app {
  flex: none;
  min-height: 100dvh;
  height: 100dvh;
  scroll-margin-top: 3rem;
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 40px rgb(16 24 40 / 6%);
}

body.app-focus {
  height: 100dvh;
  overflow: hidden;
}

body.app-focus #intro,
body.app-focus #site-footer {
  display: none;
}

body.app-focus .generator-app {
  flex: 1;
  min-height: 0;
  height: auto;
}

.app-focus-toggle {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

body:not(.app-focus) .app-focus-toggle {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

body.app-focus .app-focus-toggle {
  font-weight: 500;
}

.app-focus-toggle:hover {
  opacity: 0.92;
}

.generator-main {
  flex: 1;
  display: grid;
  grid-template-columns: var(--editor-pane-width, 38%) 6px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.pane-splitter {
  grid-column: 2;
  grid-row: 1;
  width: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: var(--border);
  cursor: col-resize;
  touch-action: none;
  position: relative;
  z-index: 2;
}

.pane-splitter::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  right: -5px;
}

.pane-splitter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

body.is-resizing-panes {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-panes--stacked {
  cursor: row-resize;
}

body.is-resizing-panes iframe {
  pointer-events: none;
}

.pane-header__start {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-pane,
.preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.editor-pane {
  grid-column: 1;
  grid-row: 1;
}

.preview-pane {
  grid-column: 3;
  grid-row: 1;
}

.editor-pane {
  border-right: none;
}

.pane-header {
  display: flex;
  align-items: center;
  height: 2.875rem;
  min-height: 2.875rem;
  padding: 0 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--panel-elevated);
  box-sizing: border-box;
}

.pane-header--editor {
  justify-content: space-between;
  overflow: visible;
}

.pane-header--editor .pane-header__actions {
  flex-shrink: 0;
}

.pane-header--preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  overflow: hidden;
}

@media (min-width: 901px) {
  .pane-header--preview {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 0.75rem;
  }

  .pane-header__preview-start {
    display: contents;
  }

  .pane-header__preview-start #preview-label {
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pane-header__preview-start .app-focus-toggle {
    grid-column: 2;
    justify-self: center;
    position: static;
    transform: none;
    flex-shrink: 0;
  }

  .pane-header--preview .pane-header__actions {
    grid-column: 3;
    flex-shrink: 0;
  }
}

@media (max-width: 900px) {
  .pane-header__preview-start {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 0;
    min-height: 100%;
    flex-shrink: 1;
    overflow: hidden;
  }

  .pane-header__preview-start .app-focus-toggle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

.preview-pane--compact #preview-label {
  display: none;
}

.preview-pane--compact #label-template {
  display: none;
}

.preview-pane--compact .pane-menu__trigger {
  display: inline-flex;
}

.preview-pane--compact .pane-menu__panel[hidden] {
  display: none !important;
}

.editor-pane--compact #editor-label {
  display: none;
}

.pane-header--preview .pane-header__actions {
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.pane-header__actions label {
  font-size: 0.75rem;
  color: var(--muted);
}

.pane-select {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.pane-header a {
  color: var(--link);
  text-decoration: none;
}

.pane-header a:hover {
  text-decoration: underline;
}

.pane-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.pane-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.pane-menu__trigger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.pane-menu__icon {
  display: block;
  width: 0.875rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.pane-menu__panel {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pane-menu__item {
  white-space: nowrap;
}

.pane-menu__submenu {
  position: relative;
  display: flex;
  align-items: center;
}

.pane-menu__submenu.is-open {
  z-index: 50;
}

.pane-menu__submenu-trigger::after {
  content: '';
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.65;
}

.pane-menu__submenu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  min-width: 10.5rem;
  padding: 0.35rem;
  padding-top: 0.45rem;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--panel-shadow);
}

.pane-menu__submenu-panel::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0.45rem;
}

.pane-menu__submenu-panel[hidden] {
  display: none !important;
}

.pane-menu__submenu.is-open .pane-menu__submenu-panel {
  display: flex !important;
}

@media (min-width: 901px) {
  .pane-menu__submenu:focus-within {
    z-index: 50;
  }

  .pane-menu__submenu:focus-within .pane-menu__submenu-panel {
    display: flex !important;
  }
}

.pane-menu__submenu-panel .pane-menu__item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.pane-btn {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.pane-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

.pane-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pane-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

.editor-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: color-mix(in srgb, var(--editor-bg) 90%, transparent);
}

.editor-loading[hidden] {
  display: none;
}

.editor-loading--preview {
  background: color-mix(in srgb, var(--preview-canvas) 92%, transparent);
}

.editor-loading__spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: editor-loading-spin 0.7s linear infinite;
}

.editor-loading__label {
  font-size: 0.75rem;
  color: var(--muted);
}

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

.json-editor {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.json-editor[hidden] {
  display: none;
}

.json-editor__toolbar {
  position: absolute;
  top: 0.45rem;
  right: 1.15rem;
  z-index: 1;
  display: flex;
  gap: 0.35rem;
}

.json-editor__toolbar-btn {
  background: var(--panel);
  box-shadow: 0 1px 4px rgb(15 23 42 / 12%);
}

.json-editor__body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.json-editor__gutter {
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  padding: 0.75rem 0 0.75rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--editor-bg);
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.json-editor__gutter-block {
  box-sizing: border-box;
  padding-right: 0.45rem;
  line-height: 1.5;
  text-align: right;
  overflow: hidden;
}

#json-input {
  flex: 1;
  resize: none;
  border: none;
  background: var(--editor-bg);
  color: var(--editor-text);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  padding: 0.75rem;
  padding-right: 9rem;
  min-height: 0;
  overflow: auto;
}

#json-input:focus { outline: none; }

.preview-pane {
  background: var(--preview-canvas);
}

.preview-scroll {
  position: relative;
  z-index: 0;
  flex: 1;
  overflow: auto;
  background: var(--preview-canvas);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.25rem;
  min-height: 0;
}

.preview-paper {
  width: min(210mm, 100%);
  flex-shrink: 0;
  background: #ffffff;
  box-shadow: var(--paper-shadow);
  border: 1px solid var(--border-light);
}

#preview-frame {
  display: block;
  width: 100%;
  border: none;
  background: #ffffff;
  overflow: hidden;
}

.site-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer p {
  max-width: 36rem;
  line-height: 1.5;
}

.site-footer__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 36rem;
}

.site-footer__meta p {
  max-width: none;
}

.site-footer__tip {
  font-size: 0.8125rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.site-footer a {
  color: var(--link);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

.site-footer a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.file-warning {
  padding: 1rem 1.25rem;
  background: #450a0a;
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.5;
  border-bottom: 1px solid #7f1d1d;
}

.file-warning code {
  background: var(--panel);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.file-warning a { color: var(--link); }

@media (min-width: 720px) {
  .hero-benefits {
    justify-content: center;
    overflow-x: visible;
  }
}

@media (min-width: 901px) {
  .pane-menu__panel[hidden] {
    display: flex !important;
  }
}

@media (max-width: 900px) {
  .landing-zone {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .landing-zone--hero {
    padding-top: 2.75rem;
    padding-bottom: 3rem;
  }

  .landing-zone--gallery {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .generator-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--editor-pane-height, 40%) 6px minmax(0, 1fr);
  }
  .editor-pane {
    grid-column: 1;
    grid-row: 1;
    border-bottom: none;
  }
  .pane-splitter {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    height: 6px;
    cursor: row-resize;
  }
  .pane-splitter::after {
    top: -5px;
    bottom: -5px;
    left: 0;
    right: 0;
  }
  .preview-pane {
    grid-column: 1;
    grid-row: 3;
  }

  .pane-header--preview {
    position: relative;
    z-index: 10;
    overflow: visible;
  }

  .pane-header--editor {
    position: relative;
    z-index: 10;
    overflow: visible;
  }

  .pane-menu.is-open {
    z-index: 20;
  }

  .pane-menu__trigger {
    display: inline-flex;
  }

  .pane-menu__panel {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 100;
    flex-direction: column;
    align-items: stretch;
    min-width: 11rem;
    padding: 0.35rem;
    gap: 0.25rem;
    background: var(--panel-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--panel-shadow);
    transform: translateZ(0);
  }

  .pane-menu__panel[hidden] {
    display: none !important;
  }

  .pane-menu__panel--overlay {
    z-index: 1100 !important;
    transform: none;
  }

  .pane-menu.is-open .pane-menu__panel {
    display: flex;
  }

  .pane-header--editor {
    justify-content: flex-end;
  }

  .pane-header--editor .pane-header__start {
    display: none;
  }

  .pane-header--preview .pane-header__preview-start #preview-label {
    display: none;
  }

  .pane-menu__panel .pane-menu__item {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .pane-menu__submenu {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .pane-menu__submenu-panel {
    position: static;
    min-width: 0;
    margin-top: 0.15rem;
    padding: 0 0 0.15rem 0.65rem;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
    box-shadow: none;
  }

  .pane-menu__submenu-panel:not([hidden]) {
    display: flex !important;
  }

  .pane-header__actions--preview #label-template {
    display: none;
  }

  .pane-header__actions--preview {
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
  }

  .pane-header__actions--preview .pane-select {
    max-width: min(12rem, 45vw);
  }
}

@media (max-width: 900px) {
  .site-nav__pages { order: 3; width: 100%; }
}

@media (max-width: 640px) {
  .site-nav__tagline { display: none; }
  .site-nav__pages { gap: 0.5rem 0.65rem; }
  .site-nav__pages a { font-size: 0.8rem; }
}

body.confirm-dialog-open {
  overflow: hidden;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.confirm-dialog[hidden] {
  display: none;
}

.confirm-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(2px);
}

.confirm-dialog__panel {
  position: relative;
  width: min(100%, 26rem);
  padding: 1.25rem 1.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
}

.confirm-dialog__message {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 1.15rem;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.confirm-dialog__btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.confirm-dialog__btn--secondary {
  background: transparent;
  color: var(--text);
}

.confirm-dialog__btn--secondary:hover {
  border-color: var(--muted);
}

.confirm-dialog__ok {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.confirm-dialog__ok:hover {
  opacity: 0.92;
}

.ui-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--bg);
  background: var(--text);
  border-radius: 6px;
  max-width: min(16rem, calc(100vw - 1rem));
  box-shadow: var(--paper-shadow);
  white-space: normal;
}
