@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  color-scheme: dark;
  --accent: #b0c944;
  --bg: #0c0f0e;
  --panel: rgba(10, 10, 10, 0.56);
  --panel-soft: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(176, 201, 68, 0.18);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

html, body { height: 100%; min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  font-family: 'Inter', sans-serif;
  background:
    linear-gradient(rgba(13, 14, 15, 0.82), rgba(13, 14, 15, 0.90)),
    url("https://ghidpolitie.fplayt.ro/politie/assets-ghidpd/bg.png") no-repeat center center fixed;
  background-size: cover;
  color: var(--text);
}

.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.accent-glow { box-shadow: 0 0 0 1px rgba(176, 201, 68, 0.12), 0 0 28px rgba(176, 201, 68, 0.05); }
.field-box {
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color .22s ease, box-shadow .22s ease, background-color .22s ease, transform .22s ease;
}
.field-box:hover { border-color: rgba(176, 201, 68, 0.36); box-shadow: 0 0 14px rgba(176, 201, 68, 0.10); }
.copy-panel, .template-list-card, button { cursor: pointer; }
.copy-panel.copied { border-color: var(--accent) !important; background: rgba(176, 201, 68, 0.10) !important; box-shadow: 0 0 14px rgba(176, 201, 68, 0.22); }

input, textarea, select, button { font: inherit; transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease; }
input, textarea, select { color: white; }
input::placeholder, textarea::placeholder { color: #6b7280 !important; }

.fplayt-header { flex: 0 0 auto; }
.page-shell { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 14px; }
.flow-app { position: relative; height: 100%; min-height: 0; overflow: hidden; }
.flow-stage {
  position: absolute;
  inset: 0;
  min-height: 0;
  transition: opacity .34s ease, transform .42s cubic-bezier(.2,.8,.2,1), visibility .34s ease;
  will-change: opacity, transform;
}
.flow-stage.is-active { opacity: 1; visibility: visible; transform: translateX(0) scale(1); pointer-events: auto; }
.flow-stage.is-hidden { opacity: 0; visibility: hidden; transform: translateX(40px) scale(.985); pointer-events: none; }

.library-screen, .editor-shell { height: 100%; min-height: 0; }
.library-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}
.library-hero-card {
  padding: 24px;
  border-radius: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 24px;
  align-items: end;
}
.library-hero-copy { min-width: 0; }
.flow-headline {
  margin: 8px 0 0;
  font-size: clamp(2rem, 1.2rem + 1.4vw, 3rem);
  line-height: 1;
  letter-spacing: -.05em;
  font-weight: 900;
  color: white;
}
.flow-subcopy {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.85;
  max-width: 60ch;
  color: var(--muted);
}
.library-toolbar {
  display: grid;
  gap: 14px;
  align-items: end;
}
.library-search-shell {
  display: block;
  padding: 16px;
  border-radius: 22px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.07);
}
.library-search-shell input {
  width: 100%;
  margin-top: 10px;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.08);
  outline: 0;
}
.library-search-shell input:focus, .editor-shell textarea:focus, .editor-shell input:focus, .editor-shell select:focus {
  border-color: rgba(176, 201, 68, 0.48);
  box-shadow: 0 0 0 3px rgba(176, 201, 68, 0.10);
}
.library-quick-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}
.library-quick-meta.stacked-actions { align-items: flex-end; }
.library-count-pill, .pill-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(176, 201, 68, 0.10);
  border: 1px solid rgba(176, 201, 68, 0.18);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .18em;
}
.library-link-chip, .button-subtle, .button-solid, .back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 18px;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .18em;
}
.library-link-chip, .button-subtle, .back-button {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  color: white;
}
.button-solid {
  background: var(--accent);
  border: 1px solid rgba(176,201,68,.3);
  color: #0a0a0a;
  box-shadow: 0 12px 30px rgba(176, 201, 68, 0.18);
}
.section-kicker, .section-muted {
  margin: 0;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .28em;
}
.section-kicker { color: var(--accent); }
.section-muted { color: #8f979f; }

.flow-empty-card {
  display: grid;
  place-items: center;
  min-height: 280px;
}
.template-gallery {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding-right: 4px;
}
.template-list-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.template-list-card.is-active {
  border-color: rgba(176,201,68,.32);
  box-shadow: 0 0 0 1px rgba(176,201,68,.14), 0 14px 32px rgba(176,201,68,.08);
}
.template-list-card .template-list-index { color: #6b7280; }
.template-list-card h3 { margin: 0; }
.template-list-card p { margin: 0; }

.editor-shell {
  height: 100%;
  border-radius: 30px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.editor-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.10);
}
.editor-topbar-copy { min-width: 0; }
.editor-topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.editor-content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 360px;
  gap: 18px;
  padding: 18px;
}
.studio-editor-grid { grid-template-columns: minmax(0, 1.45fr) 420px; }
.editor-form-column, .editor-output-column, .modern-scroll, .modal-scroll, [data-scroll-lock] {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.editor-form-column, .editor-output-column { padding-right: 6px; }
.editor-section { box-shadow: var(--shadow); }
.section-headline { display: grid; gap: 6px; }
.section-headline-inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.section-headline h3 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -.04em;
  color: white;
  font-weight: 900;
}
.section-headline p:not(.section-kicker):not(.section-muted) {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

#mainFields > *,
#identityFields > *,
#studioMainFields > *,
#defaultAccusationsList > *,
#studioSituations > *,
#selectedSituations > * {
  border-radius: 22px !important;
}

textarea, select, input[type="text"], input[type="search"], input[type="password"] {
  width: 100%;
  border-radius: 16px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.08);
}

#toast {
  background: var(--accent);
  color: black;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }

@media (max-width: 1280px) {
  .library-hero-card { grid-template-columns: 1fr; }
  .library-quick-meta { justify-content: flex-start; }
  .editor-topbar { grid-template-columns: 1fr; }
  .editor-topbar-actions { justify-content: flex-start; }
  .editor-content-grid, .studio-editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .page-shell { padding: 10px; }
  .library-hero-card, .editor-topbar, .editor-content-grid { padding: 16px; }
  .template-gallery { grid-template-columns: 1fr; }
  .flow-headline { font-size: 1.8rem; }
  .library-link-chip, .button-subtle, .button-solid, .back-button, .library-count-pill { width: 100%; justify-content: center; }
  .library-quick-meta.stacked-actions .inline-flex { width: 100%; }
}

/* v24 refinements: persistence-aware flow, cleaner library, smoother transitions */
.flow-app {
  isolation: isolate;
}

.flow-stage {
  transition:
    opacity .44s cubic-bezier(.22,.9,.22,1),
    transform .52s cubic-bezier(.2,.85,.2,1),
    filter .44s ease,
    visibility .44s ease;
  filter: blur(0);
}

.flow-stage.is-hidden {
  filter: blur(10px);
}

.generator-flow-app[data-view="editor"] #generatorLibraryStage.is-hidden,
.studio-flow-app[data-view="editor"] #studioLibraryStage.is-hidden {
  transform: translateX(-54px) scale(.984);
}

.generator-flow-app[data-view="library"] #generatorEditorStage.is-hidden,
.studio-flow-app[data-view="library"] #studioEditorStage.is-hidden {
  transform: translateX(54px) scale(.984);
}

.generator-flow-app[data-view="editor"] #generatorEditorStage.is-active,
.studio-flow-app[data-view="editor"] #studioEditorStage.is-active {
  animation: flowStageSlideIn .52s cubic-bezier(.2,.82,.2,1);
}

.generator-flow-app[data-view="library"] #generatorLibraryStage.is-active,
.studio-flow-app[data-view="library"] #studioLibraryStage.is-active {
  animation: flowStageSlideBack .48s cubic-bezier(.2,.82,.2,1);
}

@keyframes flowStageSlideIn {
  from { opacity: 0; transform: translateX(36px) scale(.988); filter: blur(12px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

@keyframes flowStageSlideBack {
  from { opacity: 0; transform: translateX(-28px) scale(.988); filter: blur(12px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

.library-screen {
  gap: 14px;
}

.library-hero-card {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  padding: 16px 18px;
  border-radius: 26px;
  position: relative;
  overflow: hidden;
}

.library-hero-card::after {
  content: '';
  position: absolute;
  inset: auto -10% -88px 52%;
  height: 132px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(176, 201, 68, 0.10), rgba(176, 201, 68, 0));
  pointer-events: none;
}

.library-hero-copy,
.library-toolbar {
  position: relative;
  z-index: 1;
}

.flow-headline {
  max-width: 10ch;
  font-size: clamp(1.55rem, 1rem + 1.15vw, 2.55rem);
  line-height: .98;
}

.flow-subcopy {
  max-width: 42ch;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.editor-topbar-copy .flow-headline {
  max-width: none;
  font-size: clamp(2rem, 1.15rem + 1.1vw, 2.8rem);
}

.library-toolbar {
  align-self: stretch;
  gap: 10px;
}

.library-search-shell {
  border-radius: 20px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.16));
}

.library-search-shell input {
  height: 50px;
  border-radius: 16px;
}

.library-quick-meta {
  justify-content: flex-end;
  gap: 10px;
}

.library-actions-only {
  justify-content: flex-end;
}

.template-gallery {
  align-content: start;
  justify-content: start;
  grid-template-columns: repeat(auto-fit, minmax(250px, 280px));
  gap: 14px;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(0,0,0,.16));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02), 0 18px 48px rgba(0,0,0,.16);
}

.template-list-card {
  position: relative;
  overflow: hidden;
  min-height: 236px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.022), rgba(0,0,0,.18));
}

.template-list-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(176,201,68,.08), rgba(176,201,68,0) 40%);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}

.template-list-card:hover::before,
.template-list-card.is-active::before {
  opacity: 1;
}

.template-list-card .template-card-body {
  display: grid;
  align-content: start;
  gap: 0;
}

.template-list-card h3 {
  margin: 0;
  letter-spacing: -.05em;
}

.template-list-card p {
  margin: 0;
  color: #98a4af;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.template-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.template-card-footer-single {
  justify-content: flex-end;
}

.template-card-category {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: #d1d5db;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .2em;
}

.template-card-action {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .18em;
}

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

  .library-hero-card .flow-headline,
  .editor-topbar-copy .flow-headline {
    max-width: none;
  }
}

.library-empty-card,
.flow-empty-card {
  min-height: 220px;
  grid-column: 1 / -1;
  border-radius: 28px;
}

.editor-shell {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.018));
}

.editor-topbar {
  gap: 22px;
  padding: 20px 22px;
}

.editor-content-grid {
  gap: 16px;
  padding: 16px;
}

.back-button {
  min-width: 190px;
}

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

  .library-quick-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .template-gallery {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .template-list-card {
    min-height: 250px;
  }
}


/* v26 library + studio polish */
.library-hero-card {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  padding: 12px 16px;
  gap: 14px;
  align-items: center;
}

.library-hero-card::after { display: none; }

.flow-headline {
  max-width: none;
  font-size: clamp(1.15rem, .92rem + .55vw, 1.7rem);
  line-height: 1.02;
  letter-spacing: -.04em;
}

.flow-subcopy {
  max-width: 48ch;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.55;
  color: #8c98a3;
}

.library-screen {
  gap: 12px;
}

.library-toolbar {
  gap: 8px;
}

.library-search-shell {
  padding: 10px;
}

.library-search-shell input {
  height: 46px;
  margin-top: 8px;
}

.generator-flow-app .library-hero-card {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.generator-flow-app .library-hero-copy {
  display: grid;
  gap: 2px;
}

.generator-flow-app .flow-subcopy {
  max-width: 30ch;
}

.template-gallery {
  grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
}

.template-list-card {
  min-height: 214px;
  padding: 16px;
}

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

.template-list-card p {
  -webkit-line-clamp: 2;
  line-height: 1.65;
}

.editor-form-column, .editor-output-column {
  padding-right: 6px;
  padding-bottom: 120px;
  scroll-padding-bottom: 120px;
}

#studioSituations {
  padding-bottom: 18px;
}

.just-added-card {
  border-color: rgba(176, 201, 68, 0.34) !important;
  box-shadow: 0 0 0 1px rgba(176, 201, 68, 0.16), 0 0 0 14px rgba(176, 201, 68, 0.06);
}

@media (max-width: 1100px) {
  .library-hero-card,
  .generator-flow-app .library-hero-card {
    grid-template-columns: 1fr;
  }
}


/* v27 cleanup: no green fade, better modal scroll, single-row studio actions */
.library-hero-card::after,
.generator-flow-app .library-hero-card::after,
.studio-flow-app .library-hero-card::after {
  display: none !important;
  background: none !important;
}

.situation-modal-shell {
  max-height: min(860px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.situation-modal-body {
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.situation-modal-sidebar,
.situation-modal-catalog {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.situation-modal-sidebar {
  padding-right: 4px;
}

.situation-modal-catalog {
  align-content: start;
  padding-right: 6px;
  padding-bottom: 18px;
}

.studio-hero-actions,
.studio-topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.studio-hero-actions > *,
.studio-topbar-actions > * {
  flex: 0 0 auto;
}

.studio-topbar-actions {
  justify-content: flex-end;
}

@media (max-width: 1280px) {
  .studio-topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1024px) {
  .situation-modal-body {
    grid-template-columns: 1fr;
  }

  .situation-modal-sidebar {
    max-height: 220px;
  }
}

/* v28 fplayt classic ui pass: keep layout, restyle controls/panels to match old script */
:root {
  --panel: rgba(255, 255, 255, 0.03);
  --panel-strong: rgba(0, 0, 0, 0.28);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(176, 201, 68, 0.24);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
}

body {
  background:
    linear-gradient(rgba(13, 14, 15, 0.78), rgba(13, 14, 15, 0.88)),
    url("https://ghidpolitie.fplayt.ro/politie/assets-ghidpd/bg.png") no-repeat center center fixed;
  background-size: cover;
}

.page-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.flow-stage {
  transition:
    opacity .34s ease,
    transform .40s cubic-bezier(.2,.82,.2,1),
    visibility .34s ease,
    filter .34s ease;
}

.flow-stage.is-hidden {
  filter: blur(8px);
}

.glass,
.library-hero-card,
.template-gallery,
.editor-shell,
.situation-modal-shell,
.library-empty-card,
.flow-empty-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.accent-glow,
.editor-shell,
.situation-modal-shell {
  box-shadow: 0 0 0 1px rgba(176, 201, 68, 0.13), 0 0 24px rgba(176, 201, 68, 0.06), var(--shadow);
}

.field-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.field-box:hover {
  border-color: rgba(176, 201, 68, 0.45);
  box-shadow: 0 0 12px rgba(176, 201, 68, 0.15);
}

.template-gallery {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  gap: 16px;
}

.template-list-card {
  min-height: 238px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.template-list-card::before {
  background: linear-gradient(180deg, rgba(176, 201, 68, 0.08), rgba(176, 201, 68, 0) 45%);
}

.template-list-card .template-list-index,
.template-list-card .template-list-active,
.section-muted,
.copy-panel .section-muted,
#descriptionOutput .section-muted,
#previewDescription + .section-muted {
  letter-spacing: .22em;
}

.template-list-card h3,
.flow-headline,
.editor-topbar-copy .flow-headline {
  letter-spacing: -.045em;
  font-weight: 900;
}

.template-list-card h3 {
  font-size: 2rem;
  line-height: 1.02;
}

.template-list-card p {
  color: #b6bec8;
  font-size: 14px;
  line-height: 1.8;
}

.template-card-action {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .18em;
}

.library-hero-card,
.editor-shell {
  border-radius: 28px;
}

.library-hero-card {
  padding: 18px 20px;
  align-items: center;
}

.flow-headline {
  font-size: clamp(1.35rem, 1rem + .95vw, 2.25rem);
  line-height: 1.02;
}

.flow-subcopy {
  margin-top: 8px;
  max-width: 42ch;
  color: #a9b1bb;
  font-size: 13px;
  line-height: 1.7;
}

.editor-topbar-copy .flow-headline {
  font-size: clamp(1.75rem, 1.1rem + 1.15vw, 2.7rem);
}

.section-kicker,
.section-muted,
.template-list-index,
.template-list-active,
.library-count-pill,
.pill-accent,
.template-card-action,
.button-subtle,
.button-solid,
.back-button,
.library-link-chip {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .25em;
}

.section-kicker {
  color: var(--accent);
}

.library-search-shell,
.editor-section,
.copy-panel,
.flow-empty-card,
.library-empty-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

.library-search-shell {
  padding: 14px;
  border-radius: 22px;
}

.library-search-shell input,
textarea,
select,
input[type="text"],
input[type="search"],
input[type="password"] {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(176, 201, 68, 0.38);
}

input:focus,
textarea:focus,
select:focus,
.library-search-shell input:focus,
.editor-shell textarea:focus,
.editor-shell input:focus,
.editor-shell select:focus {
  border-color: rgba(176, 201, 68, 0.5);
  box-shadow: 0 0 0 2px rgba(176, 201, 68, 0.16);
}

.button-subtle,
.back-button,
.library-link-chip {
  background: rgba(176, 201, 68, 0.10);
  border: 1px solid rgba(176, 201, 68, 0.20);
  color: var(--accent);
}

.button-subtle:hover,
.back-button:hover,
.library-link-chip:hover {
  background: rgba(176, 201, 68, 0.16);
  color: #eaf7ab;
  border-color: rgba(176, 201, 68, 0.34);
}

.button-solid {
  background: var(--accent);
  color: #090909;
  border: 1px solid rgba(176, 201, 68, 0.26);
  box-shadow: none;
}

.button-solid:hover {
  background: #f3f4f6;
  color: #111827;
}

.library-count-pill,
.pill-accent {
  background: rgba(176, 201, 68, 0.10);
  border: 1px solid rgba(176, 201, 68, 0.22);
  color: #d9ef7a;
}

.editor-topbar {
  padding: 20px 22px;
  background: rgba(0, 0, 0, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-content-grid {
  padding: 18px;
}

.editor-section {
  border-radius: 24px;
}

.section-headline {
  gap: 4px;
}

.section-headline h3 {
  font-size: 1.2rem;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.section-headline p:not(.section-kicker):not(.section-muted) {
  color: #98a2ad;
  font-size: 13px;
  line-height: 1.7;
}

.copy-panel {
  border-radius: 18px;
}

.copy-panel .copy-value {
  line-height: 1.85;
}

#toast {
  background: var(--accent);
  color: #0a0a0a;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.situation-modal-shell {
  background: rgba(8, 8, 8, 0.96);
  border: 1px solid rgba(176, 201, 68, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.situation-modal-body .field-box,
#situationCatalog .field-box,
#selectedSituations .field-box,
#studioSituations .field-box,
#defaultAccusationsList .field-box,
#studioMainFields .field-box,
#mainFields .field-box,
#identityFields .field-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#situationCatalog .field-box:hover,
#selectedSituations .field-box:hover,
#studioSituations .field-box:hover,
#defaultAccusationsList .field-box:hover,
#studioMainFields .field-box:hover,
#mainFields .field-box:hover,
#identityFields .field-box:hover {
  border-color: rgba(176, 201, 68, 0.45);
  box-shadow: 0 0 12px rgba(176, 201, 68, 0.15);
}

#situationCatalog .field-box,
#studioSituations .field-box article,
#selectedSituations .field-box article {
  border-radius: 22px;
}

#studioSituations textarea,
#studioSituations input,
#studioSituations select,
#studioMainFields input,
#studioMainFields select,
#identityFields input,
#identityFields textarea,
#defaultAccusationsList input,
#defaultAccusationsList select {
  background: rgba(0, 0, 0, 0.30) !important;
  border-color: rgba(255,255,255,.08) !important;
}

.studio-hero-actions,
.studio-topbar-actions {
  gap: 12px;
}

.studio-hero-actions .button-solid,
.studio-hero-actions .button-subtle,
.studio-topbar-actions .button-solid,
.studio-topbar-actions .button-subtle {
  min-height: 46px;
}

input[type="checkbox"] + span,
button[data-checkbox-key],
button[data-field-required],
button[data-situation-repeatable],
button[data-situation-field-required] {
  box-shadow: none;
}

@media (max-width: 1280px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 14px;
  }
}

@media (max-width: 768px) {
  .page-shell {
    width: min(100%, calc(100% - 12px));
  }

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

/* v29 polish: unify old-script interactions while preserving current layout */
:root {
  --ui-fast: .18s;
  --ui-ease: cubic-bezier(.2,.82,.2,1);
  --hover-line: rgba(176, 201, 68, 0.42);
  --hover-bg: rgba(176, 201, 68, 0.08);
  --hover-shadow: 0 0 12px rgba(176, 201, 68, 0.14);
}

button,
.button-subtle,
.button-solid,
.back-button,
.library-link-chip,
.library-count-pill,
.copy-panel,
.template-list-card,
.field-box,
.library-search-shell,
input,
textarea,
select,
#closeSituationModal,
#situationCategories button,
.situation-catalog-card,
.situation-catalog-card__action {
  transition:
    border-color var(--ui-fast) var(--ui-ease),
    background-color var(--ui-fast) var(--ui-ease),
    color var(--ui-fast) var(--ui-ease),
    box-shadow var(--ui-fast) var(--ui-ease),
    opacity var(--ui-fast) var(--ui-ease) !important;
}

.library-hero-card,
.library-search-shell,
.template-list-card,
.editor-section,
.copy-panel,
.flow-empty-card,
.library-empty-card,
.situation-modal-shell,
#studioSituations > article,
#selectedSituations > article,
#defaultAccusationsList > article,
#studioMainFields > label,
#mainFields > label,
#identityFields > label {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.library-hero-card,
.library-search-shell,
.editor-section,
.copy-panel,
.flow-empty-card,
.library-empty-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.template-list-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.template-list-card:hover,
.template-list-card.is-active,
.copy-panel:hover,
.library-search-shell:hover,
.editor-section:hover,
.field-box:hover {
  border-color: var(--hover-line);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.template-list-card::before {
  background: linear-gradient(180deg, rgba(176, 201, 68, 0.05), rgba(176, 201, 68, 0) 42%);
}

.template-list-card p,
.flow-subcopy,
.section-headline p:not(.section-kicker):not(.section-muted) {
  color: #a6b0ba;
}

.library-search-shell input,
textarea,
select,
input[type="text"],
input[type="search"],
input[type="password"] {
  background: rgba(0, 0, 0, 0.30);
}

.button-subtle,
.back-button,
.library-link-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #f3f4f6;
}

.button-subtle:hover,
.back-button:hover,
.library-link-chip:hover,
#closeSituationModal:hover,
#situationCategories button:hover {
  background: rgba(176, 201, 68, 0.10);
  border-color: rgba(176, 201, 68, 0.30);
  color: #eef7bc;
}

.button-solid {
  background: var(--accent);
  border: 1px solid rgba(176, 201, 68, 0.28);
  color: #090909;
}

.button-solid:hover {
  background: #d7ed79;
  color: #090909;
}

.copy-panel.copied {
  border-color: var(--accent) !important;
  background: rgba(176, 201, 68, 0.10) !important;
  box-shadow: 0 0 14px rgba(176, 201, 68, 0.22), 0 18px 36px rgba(0, 0, 0, 0.22) !important;
}

.flow-stage {
  transition:
    opacity .30s var(--ui-ease),
    transform .30s var(--ui-ease),
    visibility .30s var(--ui-ease),
    filter .30s var(--ui-ease);
}

.flow-stage.is-hidden {
  filter: blur(5px);
}

.generator-flow-app[data-view="editor"] #generatorLibraryStage.is-hidden,
.studio-flow-app[data-view="editor"] #studioLibraryStage.is-hidden {
  transform: translateX(-26px) scale(.992);
}

.generator-flow-app[data-view="library"] #generatorEditorStage.is-hidden,
.studio-flow-app[data-view="library"] #studioEditorStage.is-hidden {
  transform: translateX(26px) scale(.992);
}

@keyframes flowStageSlideIn {
  from { opacity: 0; transform: translateX(22px) scale(.994); filter: blur(6px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

@keyframes flowStageSlideBack {
  from { opacity: 0; transform: translateX(-18px) scale(.994); filter: blur(6px); }
  to { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}

.situation-modal-shell {
  border-radius: 28px;
}

.situation-modal-body {
  gap: 18px;
}

.situation-modal-sidebar {
  padding-right: 6px;
}

.situation-modal-catalog {
  grid-auto-rows: minmax(390px, auto);
  align-items: stretch;
  gap: 16px;
  padding-right: 8px;
  padding-bottom: 24px;
}

.situation-catalog-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 390px;
  height: 100%;
  padding: 18px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.situation-catalog-card:hover {
  border-color: var(--hover-line);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.situation-catalog-card__body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding-bottom: 14px;
}

.situation-catalog-card__title,
.situation-catalog-card__body h4 {
  margin: 0;
  line-height: 1.14;
  letter-spacing: -.03em;
}

.situation-catalog-card__body p {
  margin: 0;
  word-break: break-word;
}

.situation-catalog-card__description {
  color: #9aa6b2;
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.situation-catalog-card__meta-block {
  display: grid;
  gap: 5px;
}

.situation-catalog-card__eyebrow {
  color: #6f7b87;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .22em;
}

.situation-catalog-card__meta {
  color: #c3ccd6;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.situation-catalog-card__meta--accent {
  color: #e4f3a0;
}

.situation-catalog-card__action {
  margin-top: 0 !important;
  align-self: end;
  min-height: 48px;
  border-radius: 18px;
}

.situation-catalog-card__action:not([disabled]) {
  background: var(--accent) !important;
  border-color: rgba(176, 201, 68, 0.28) !important;
  color: #090909 !important;
  box-shadow: none !important;
}

.situation-catalog-card__action:not([disabled]):hover {
  background: #cfe86b !important;
}

#situationCategories button {
  min-height: 46px;
  border-radius: 18px;
}

#situationCategories button[data-situation-category="all"] {
  font-weight: 800;
}

.studio-topbar-actions .button-subtle,
.studio-topbar-actions .button-solid,
.studio-hero-actions .button-subtle,
.studio-hero-actions .button-solid {
  min-height: 46px;
  border-radius: 18px;
}

#previewTitle,
#previewDescription,
#titleOutput,
#descriptionOutput {
  transition:
    border-color var(--ui-fast) var(--ui-ease),
    background-color var(--ui-fast) var(--ui-ease),
    box-shadow var(--ui-fast) var(--ui-ease);
}

#titleOutput:hover,
#descriptionOutput:hover,
#previewTitle:hover,
#previewDescription:hover {
  border-color: var(--hover-line);
}

@media (max-width: 1024px) {
  .situation-catalog-card {
    min-height: 360px;
  }
}

@media (max-width: 768px) {
  .template-list-card h3 {
    font-size: 1.55rem;
  }

  .situation-catalog-card {
    min-height: 0;
  }

  .situation-modal-catalog {
    grid-auto-rows: auto;
  }
}

/* v31 library grid fit */
.template-gallery {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}

@media (max-width: 1279px) {
  .template-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 979px) {
  .template-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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


/* final library card stabilization */
.template-gallery {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}

.template-list-card {
  position: relative;
  min-height: 236px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  align-items: stretch;
  padding: 18px 18px 16px;
}

.template-list-card .template-list-top,
.template-list-card .template-card-body,
.template-list-card .template-card-footer,
.template-list-card .template-card-footer-single {
  position: relative;
  z-index: 1;
}

.template-list-card .template-list-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}

.template-list-card .template-list-index {
  padding-top: 3px;
  line-height: 1;
}

.template-list-card .template-list-active {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-start;
  white-space: nowrap;
}

.template-list-card .template-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 96px;
  padding-top: 6px;
}

.template-list-card h3 {
  margin: 0;
  min-height: 3.45rem;
  font-size: 1.68rem;
  line-height: 1.02;
  letter-spacing: -0.05em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-wrap: balance;
}

.template-list-card p {
  margin: 0;
  min-height: 2.95em;
  font-size: 12px;
  line-height: 1.48;
  color: #9aa7b5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.template-list-card .template-card-footer,
.template-list-card .template-card-footer-single {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  min-height: 44px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.template-list-card .template-card-action {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.18em;
}

@media (max-width: 1279px) {
  .template-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 979px) {
  .template-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .template-list-card {
    min-height: 228px;
  }
}

/* final library cards real fix */
.template-list-card {
  position: relative;
  min-height: 244px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  padding: 18px 18px 16px !important;
}

.template-list-card .template-list-top {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-height: 28px !important;
  margin-bottom: 16px !important;
}

.template-list-card .template-list-index {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1 !important;
  padding-top: 3px !important;
}

.template-list-card .template-list-active {
  flex: 0 0 auto;
  margin-left: 12px;
  align-self: flex-start !important;
  white-space: nowrap;
}

.template-list-card .template-card-body {
  display: block !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  padding: 0 !important;
}

.template-list-card h3 {
  margin: 0 0 10px !important;
  min-height: 0 !important;
  font-size: clamp(1.48rem, 1.18rem + 0.45vw, 1.72rem) !important;
  line-height: 1.02 !important;
  letter-spacing: -0.05em !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-wrap: balance;
}

.template-list-card p {
  margin: 0 !important;
  min-height: calc(1.52em * 2) !important;
  font-size: 12px !important;
  line-height: 1.52 !important;
  color: #9aa7b5 !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.template-list-card .template-card-footer,
.template-list-card .template-card-footer-single {
  margin-top: auto !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  padding-top: 14px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.template-list-card .template-card-action {
  font-size: 11px !important;
  line-height: 1 !important;
  letter-spacing: 0.18em !important;
}

@media (max-width: 639px) {
  .template-list-card {
    min-height: 232px !important;
  }
}


.tutorial-trigger {
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(176, 201, 68, 0.08);
}

.tutorial-trigger::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(176, 201, 68, 0.16), rgba(176, 201, 68, 0));
  opacity: 0;
  transition: opacity var(--ui-fast) var(--ui-ease);
  pointer-events: none;
}

.tutorial-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(176, 201, 68, 0.18), 0 10px 24px rgba(176, 201, 68, 0.10);
}

.tutorial-trigger:hover::after {
  opacity: 1;
}
