/* X-energy Icon & Illustration Generator
   Palette: orange #FB5D00 · teal #00D5CF · amber #FFBE0D · navy #112750 · dark #080E19
   Type: Druk Wide Medium (display headlines, always caps) · PP Neue Montreal (body)
   · Akkurat Mono (captions and labels). Served locally from static/fonts/ — these are
   licensed foundry faces, so check the EULAs in brand-assets/Fonts/ before exposing
   this app outside the company. */

/* ---------- brand faces ---------- */

@font-face {
  font-family: "Druk Wide";
  src: url("/fonts/DrukWide-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Neue Montreal";
  src: url("/fonts/PPNeueMontreal-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Neue Montreal";
  src: url("/fonts/PPNeueMontreal-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Neue Montreal";
  src: url("/fonts/PPNeueMontreal-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Neue Montreal";
  src: url("/fonts/PPNeueMontreal-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Neue Montreal";
  src: url("/fonts/PPNeueMontreal-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Akkurat Mono";
  src: url("/fonts/AkkuratMonoLL-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Druk Wide", "Helvetica Neue", Arial, sans-serif;
  --font-body: "PP Neue Montreal", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Akkurat Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --orange: #FB5D00;
  --teal: #00D5CF;
  --amber: #FFBE0D;
  --navy: #112750;
  --dark: #080E19;
  --offwhite: #F7F6FF;

  --bg: var(--dark);
  --panel: #0e1626;
  --panel-2: #131e33;
  --line: #23324f;
  --text: #E8ECF5;
  --muted: #8C9BB8;

  --radius: 14px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }

/* Elements below set display (grid/inline-block), which otherwise beats [hidden]. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

/* Druk Wide is reserved for h1 — everything below runs in PP Neue Montreal. */
h2, h3, h4, h5, h6 { font-family: var(--font-body); }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(251, 93, 0, .16), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(0, 213, 207, .13), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ---------- masthead ---------- */

.masthead {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 14, 25, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Same column as <main>: 1080px, same side gutters. */
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 40px);
}

/* The real brand wordmark (brand-assets/logos/x-energy_wordmark_white.svg).
   Width is derived from the SVG's 12:1 ratio — set height only. */
.wordmark {
  display: block;
  height: 12px;
  width: auto;
  flex: 0 0 auto;
}

.masthead-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.masthead-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(255, 190, 13, .35);
  background: rgba(255, 190, 13, .08);
  padding: 5px 11px;
  border-radius: 999px;
}

/* ---------- layout ---------- */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 68px) clamp(20px, 5vw, 40px) 80px;
}

/* Display headline. Druk Wide is a very wide face and only ships Medium, so it runs
   smaller and with positive tracking than the grotesk it replaced. Always caps. */
.composer h1 {
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 24px;
  line-height: 1.14;
  letter-spacing: .005em;
  margin: 0 0 16px;
}

.lede {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 30px;
  font-size: 14px;
  line-height: 23px;
}
.lede strong { color: var(--teal); }

/* ---------- input ---------- */

.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

#prompt {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 15px 20px;
  transition: border-color .3s, box-shadow .3s;
}
#prompt::placeholder { color: #5d6d8c; }
#prompt:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

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

/* Layout only — the look comes from .shiny-cta (end of file). */
#submit-btn {
  position: relative;
  flex: 0 0 auto;
  font-size: 17px; /* matches #prompt */
}
#submit-btn:disabled { cursor: progress; }

/* ---------- composer bar: kind radios + text links ---------- */

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.kind-picker {
  display: flex;
  align-items: center;
  gap: 28px;
}

.kind-opt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.kind-opt input { position: absolute; opacity: 0; pointer-events: none; }

.kind-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background .16s, border-color .16s;
}
.kind-check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--dark);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .16s, transform .16s;
}
.kind-opt:hover .kind-check { border-color: #35496e; }
.kind-opt.is-active .kind-check { background: var(--teal); border-color: var(--teal); }
.kind-opt.is-active .kind-check svg { opacity: 1; transform: scale(1); }
/* Keyboard users still get a focus ring, since the real radio is visually hidden. */
.kind-opt:focus-within .kind-check { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 213, 207, .15); }

.kind-name { font-weight: 700; font-size: 14px; }

.composer-links {
  display: flex;
  align-items: center;
  gap: 34px;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: color .16s;
}
.text-link:hover { color: var(--text); }
.text-link.is-open { color: var(--teal); }

/* ---------- options ---------- */

.options-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 20px 18px 22px;
}
.opt-wide { grid-column: 1 / -1; }

.opt label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 7px;
  color: var(--text);
}
.opt-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 5px;
}

.opt select,
.opt input[type="text"] {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}
.opt select:focus,
.opt input[type="text"]:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.45;
}

/* ---------- error ---------- */

.error {
  margin-top: 18px;
  padding: 14px 17px;
  border: 1px solid rgba(251, 93, 0, .45);
  border-left: 3px solid var(--orange);
  border-radius: 10px;
  background: rgba(251, 93, 0, .09);
  font-size: 14px;
}

/* ---------- result ---------- */

.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 44px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

/* Checkerboard, so a transparent cut-out reads as transparent rather than as
   whatever colour happens to sit behind it. */
.checkerboard,
.result-art.is-transparent,
.hist-card img.is-transparent {
  background:
    linear-gradient(45deg, #16202f 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, #16202f 25%, transparent 25%) 0 11px/22px 22px,
    linear-gradient(45deg, transparent 75%, #16202f 75%) 11px -11px/22px 22px,
    linear-gradient(-45deg, transparent 75%, #16202f 75%) -11px 0/22px 22px,
    #101826;
}

.result-art {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #101826;
  box-shadow: var(--shadow);
  min-height: 220px;
}
.result-art img { display: block; width: 100%; height: auto; }

/* Placeholder shown from the moment Generate is pressed until the PNG lands. */
.result-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  padding: 20px;
}

.ph-spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  border: 2px solid rgba(0, 213, 207, .22);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

.ph-text { font-size: 15px; font-weight: 500; color: var(--text); }

.ph-elapsed {
  font-family: var(--font-mono);
  font-size: 21px;
  color: var(--teal);
  letter-spacing: .02em;
}

.ph-hint { font-size: 12px; color: var(--muted); }

/* While loading, the meta column shows only the subject — nothing to download yet. */
.result.is-loading #downloads,
.result.is-loading .result-tip,
.result.is-loading #regen-btn { display: none; }
.result.is-loading #result-img { visibility: hidden; }

.result-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(0, 213, 207, .12) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.result-kind {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
}

.result-meta h2 {
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: -.01em;
  margin: 0 0 14px;
}

.result-specs {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 26px;
}

.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

.dl {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .16s, background .16s;
}
.dl:hover { border-color: var(--teal); background: #17253d; }
.dl.primary { background: var(--teal); border-color: var(--teal); color: var(--dark); font-weight: 700; }
.dl.primary:hover { background: #2ce4de; }

.result-tip {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 46ch;
}

.ghost {
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.ghost:hover { color: var(--text); border-color: #35496e; }

/* ---------- history ---------- */

.history { margin-top: 60px; padding-top: 36px; border-top: 1px solid var(--line); }

.history-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.hist-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: border-color .16s, transform .12s;
}
.hist-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.hist-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #101826; }

.hist-label {
  display: block;
  padding: 9px 11px 11px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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


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

@media (max-width: 760px) {
  .field-row { flex-direction: column; }
  #submit-btn { width: 100%; }
  .result { grid-template-columns: 1fr; gap: 24px; }
  .masthead-title { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Style-rules editor (/style-editor.html)
   ============================================================ */

.masthead-home { display: block; line-height: 0; }

.masthead-nav { margin-left: auto; }
.masthead-nav a,
.masthead-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  transition: color .16s, border-color .16s;
}
.masthead-nav a:hover,
.masthead-link:hover { color: var(--teal); border-color: var(--teal); }


.notice {
  margin-top: 18px;
  padding: 14px 17px;
  border: 1px solid rgba(0, 213, 207, .4);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  background: rgba(0, 213, 207, .08);
  font-size: 14px;
}

.editor-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  margin-top: 38px;
}

.editor-index {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 6px;
}

.side-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 12px;
}
.side-title-spaced { margin-top: 30px; }

.index-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-link:hover { color: var(--teal); background: var(--panel); }

.side-add { width: 100%; margin-top: 14px; font-size: 13px; }

.history-list { display: flex; flex-direction: column; gap: 6px; }

.history-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .16s;
}
.history-entry:hover { border-color: var(--teal); }
.hist-when { font-size: 12.5px; }
.hist-file {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px 22px 18px;
  margin-bottom: 18px;
  scroll-margin-top: 92px;
}

.block-head { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }

.block-id {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--teal);
  margin: 0;
}

.block-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

.block-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; max-width: 78ch; }

.block-text,
.add-block textarea {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
}
.block-text:focus,
.add-block textarea:focus,
.add-block input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.block-actions { display: flex; align-items: center; gap: 10px; margin-top: 13px; }
.block-actions .dl { border: none; cursor: pointer; font-family: inherit; }
.block-actions .dl:disabled,
.block-actions .ghost:disabled { opacity: .4; cursor: default; }
.block-actions .dl.primary:disabled:hover { background: var(--teal); }

.block-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
}

.add-block {
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 22px;
  margin-bottom: 22px;
}
.add-block h3 { margin: 0 0 16px; font-size: 17px; }
.add-block label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 14px 0 6px;
}
.add-block input {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}
.add-actions { display: flex; gap: 10px; margin-top: 18px; }
.add-actions .dl { border: none; cursor: pointer; font-family: inherit; }

/* ---------- snapshot modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(4, 7, 12, .78);
  backdrop-filter: blur(3px);
}

.modal-panel {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: 86vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal);
}

.snapshot-body {
  margin: 0;
  padding: 20px;
  overflow: auto;
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.modal-actions .dl { border: none; cursor: pointer; font-family: inherit; }
.modal-actions .hint { margin: 0; }

@media (max-width: 880px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-index { position: static; max-height: none; }
}

/* ============================================================
   Single / bulk composer
   ============================================================ */

.bulk-row { margin-bottom: 18px; }

#bulk-prompts {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
  padding: 16px 20px;
  transition: border-color .3s, box-shadow .3s;
  resize: vertical;
  transition: border-color .16s, box-shadow .16s;
}
#bulk-prompts::placeholder { color: #5d6d8c; }
#bulk-prompts:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.bulk-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.bulk-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--teal);
  white-space: nowrap;
}
.bulk-count.is-over { color: var(--orange); }
.bulk-hint { margin: 0; flex: 1; }

/* Layout only — the look comes from .shiny-cta (end of file). */
.bulk-btn { flex: 0 0 auto; }
.bulk-btn:disabled { cursor: progress; }

/* ---------- batch progress ---------- */

.batch { margin-top: 44px; padding-top: 36px; border-top: 1px solid var(--line); }

.batch-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

.batch-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--muted);
  font-weight: 400;
  margin: 0;
}

.batch-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--teal);
  flex: 1;
}

.batch-list { display: flex; flex-direction: column; gap: 8px; }

.batch-item {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  padding: 9px 14px 9px 9px;
  transition: border-color .16s;
}
.batch-item.is-done { cursor: pointer; }
.batch-item.is-done:hover,
.batch-item.is-done:focus-visible { border-color: var(--teal); }
.batch-item.is-error { border-color: rgba(251, 93, 0, .45); }
.batch-item.is-cancelled { opacity: .55; }

.batch-art {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: #101826;
  display: grid;
  place-items: center;
}
.batch-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.batch-spinner { width: 20px; height: 20px; margin-bottom: 0; }

.batch-copy { min-width: 0; flex: 1; }
.batch-prompt {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.batch-item.is-running .batch-status { color: var(--teal); }
.batch-item.is-error .batch-status { color: var(--orange); }

.batch-retry { flex: 0 0 auto; padding: 7px 14px; font-size: 13px; }

/* ---------- tags on the result panel ---------- */

.asset-tags { margin-bottom: 18px; }

.tags-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
}

.tag-x {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
  cursor: pointer;
}
.tag-x:hover { color: var(--orange); }

.tag-input {
  background: none;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 11px;
  width: 15ch;
}
.tag-input::placeholder { color: #5d6d8c; }
.tag-input:focus { outline: none; border-color: var(--teal); border-style: solid; }

/* ---------- result actions ---------- */

.asset-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 13px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s;
}
.action-link svg { width: 15px; height: 15px; flex: 0 0 auto; }
.action-link:hover { color: var(--text); }
.action-link.danger:hover { color: var(--orange); }

.ghost.danger:hover { color: var(--orange); border-color: rgba(251, 93, 0, .55); }

.dl.danger {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.dl.danger:hover { background: #ff7526; }

.result.is-loading .asset-tags,
.result.is-loading .asset-actions { display: none; }

/* ---------- history toolbar + cards ---------- */

/* One row: title + count left, search + filter pills right. */
.history-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hist-count { font-family: var(--font-mono); font-size: 12px; color: var(--teal); }

.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.hist-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s, border-color .3s;
}
.hist-search-toggle.has-term { padding: 0 14px 0 12px; }
.hist-search-toggle svg { width: 15px; height: 15px; flex: 0 0 auto; }
.hist-search-toggle:hover { color: var(--text); border-color: #35496e; }

.hist-search-term {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Styled exactly like the filter pills, with matched height and font, so
   expanding it never shifts the row vertically. */
#hist-search,
#lib-search {
  width: 230px;
  height: 34px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 14px;
  transition: width .3s, padding .3s, border-color .3s, box-shadow .3s;
}
/* Starting/ending frame of the expand animation — same circle as the icon. */
#hist-search.is-collapsed,
#lib-search.is-collapsed { width: 34px; padding: 0; }
#hist-search::placeholder,
#lib-search::placeholder { color: #5d6d8c; }
#hist-search:focus,
#lib-search:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.hist-kinds { display: flex; gap: 6px; }

.kind-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.kind-btn:hover { color: var(--text); border-color: #35496e; }
.kind-btn.is-active {
  color: var(--teal);
  border-color: var(--teal);
  background: rgba(0, 213, 207, .08);
}

.hist-tagbar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }

.tag-filter { cursor: pointer; transition: color .16s, border-color .16s, background .16s; }
.tag-filter:hover { border-color: #35496e; }
.tag-filter.is-active { color: var(--teal); border-color: var(--teal); background: rgba(0, 213, 207, .08); }

.hist-art { position: relative; }
.hist-art > img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #101826; }

.hist-actions {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .14s;
}
.hist-card:hover .hist-actions,
.hist-card:focus-within .hist-actions { opacity: 1; }

.hist-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 25, .85);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .16s, color .16s;
}
.hist-action:hover { border-color: var(--orange); color: var(--orange); }

.hist-flag {
  position: absolute;
  left: 7px;
  bottom: 7px;
  font-size: 12px;
  background: rgba(8, 14, 25, .85);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 6px;
}

.hist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 11px 11px;
}
.hist-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.hist-empty { margin-top: 6px; }

/* ---------- modals: dislike / replace / confirm ---------- */

.modal-narrow { width: min(560px, 100%); }

.modal-body { padding: 20px; overflow-y: auto; }

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 16px 0 7px;
}

.modal-body input[type="text"],
.modal-body textarea {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  resize: vertical;
}
.modal-body input[type="text"]:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.modal-actions-inline { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions-inline .dl { border: none; cursor: pointer; font-family: inherit; }

.reason-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.reason-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.reason-chip:hover { border-color: #35496e; }
.reason-chip:has(input:checked) {
  border-color: var(--teal);
  background: rgba(0, 213, 207, .09);
}
.reason-chip input { accent-color: var(--teal); margin: 0; flex: 0 0 auto; }

.next-lede { margin: 0 0 14px; font-size: 15px; font-weight: 500; }
.next-actions { display: flex; flex-direction: column; align-items: stretch; gap: 9px; margin-bottom: 14px; }
.next-actions .dl,
.next-actions .ghost { text-align: center; border: none; cursor: pointer; font-family: inherit; }
.next-actions .dl:not(.primary) { border: 1px solid var(--line); }
.next-actions .ghost { border: 1px solid var(--line); }

.confirm-body { margin: 0; font-size: 14px; line-height: 1.55; }

/* ============================================================
   Global style change ("change something everywhere")
   ============================================================ */

/* A collapsible rounded panel, matching the options box on the index page. */
.global-change {
  position: relative; /* anchors the close button */
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.gc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s, border-color .3s;
}
.gc-close svg { width: 14px; height: 14px; }
.gc-close:hover { color: var(--text); border-color: #35496e; }

/* The "Edit rules" panel heading — direct child only, so the smaller
   .gc-heading h3s deeper inside keep their own style. */
.global-change > h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .01em;
  margin: 0 0 12px;
}

.gc-row { display: flex; gap: 12px; }

#gc-input {
  flex: 1;
  min-width: 0;
  background: var(--dark); /* sits inside the panel box */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 14px 18px;
  transition: border-color .16s, box-shadow .16s;
}
#gc-input::placeholder { color: #5d6d8c; }
#gc-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}

.gc-row .dl { border: none; cursor: pointer; font-family: inherit; white-space: nowrap; }

.gc-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}
.gc-loading .ph-spinner { width: 18px; height: 18px; margin: 0; }

.gc-review { margin-top: 26px; }

.gc-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin: 26px 0 12px;
}

.gc-summary {
  border: 1px solid rgba(0, 213, 207, .4);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  background: rgba(0, 213, 207, .07);
  padding: 16px 18px;
}
.gc-summary .gc-heading { margin: 0 0 8px; color: var(--teal); }
.gc-summary p { margin: 0; font-size: 15px; line-height: 1.6; }

.gc-warning { margin-top: 12px; }

.gc-change { margin-bottom: 14px; }

.diff-body {
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-add {
  background: rgba(0, 213, 207, .18);
  color: #b8fffc;
  border-radius: 3px;
  padding: 1px 2px;
}

.diff-del {
  background: rgba(251, 93, 0, .16);
  color: #ffb28a;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  border-radius: 3px;
  padding: 1px 2px;
}

.gc-master {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  margin-top: 20px;
}
.gc-master summary {
  cursor: pointer;
  padding: 13px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}
.gc-master summary::marker { color: var(--orange); }
.gc-master[open] summary { border-bottom: 1px solid var(--line); color: var(--text); }
.gc-master > .hint { margin: 14px 18px 0; }

.master-entry { padding: 14px 18px 18px; }
.master-label {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--teal);
}
.master-body { font-size: 14px; line-height: 23px; }

.master-viewer { margin-bottom: 22px; }

.gc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}
.gc-actions .dl { border: none; cursor: pointer; font-family: inherit; }
.gc-actions .dl:disabled { opacity: .4; cursor: default; }
.gc-actions .hint { margin: 0; }

@media (max-width: 760px) {
  .gc-row { flex-direction: column; }
  .reason-grid { grid-template-columns: 1fr; }
  .bulk-foot { flex-wrap: wrap; }
  .history-toolbar { align-items: stretch; }
}


/* ---------- sign-in ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.login-main {
  width: min(464px, 100%);
  display: flex;
  flex-direction: column;
}

.login-wordmark {
  width: min(200px, 60%);
  height: auto;
  margin: 2px auto 24px;
  display: block;
}

/* The same card the sign-in overlay used, now the centrepiece of its own page. */
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px;
}

.login-subhead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 16px;
}

.auth-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 6px;
}

.login-panel input {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 11px 12px;
  transition: border-color .3s, box-shadow .3s;
}
.login-panel input::placeholder { color: #5d6d8c; }
.login-panel input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 213, 207, .15);
}
.login-panel input:disabled { opacity: .45; }

#auth-code {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: .35em;
  text-align: center;
}

.auth-btn {
  width: 100%;
  margin-top: 14px;
}
.auth-btn:disabled { opacity: .55; cursor: default; }

.auth-links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.auth-links .ghost { flex: 1; padding: 9px 10px; font-size: 13px; }
.auth-links .ghost:disabled { opacity: .45; cursor: default; }

.auth-error {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid rgba(251, 93, 0, .5);
  background: rgba(251, 93, 0, .09);
  color: #ffb490;
  font-size: 14px;
  line-height: 1.45;
}
.auth-error.is-info {
  border-color: rgba(0, 213, 207, .4);
  background: rgba(0, 213, 207, .08);
  color: var(--teal);
}

/* Icon nav: gear (settings) + power (log out). */
.masthead-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.masthead-nav .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.masthead-nav .icon-btn svg {
  width: 17px;
  height: 17px;
}
.masthead-nav .icon-btn:hover { color: var(--teal); border-color: var(--teal); }
.masthead-nav .icon-btn.is-current { color: var(--text); border-color: #35496e; }

/* ---------- shiny CTA ----------
   The one treatment for every primary action, from the pen "XE CTA"
   (codepen.io/Rich-Tong/pen/ZYzeKrK, after ryanmulligan.dev/blog/css-property-new-style/).
   The <span> label wrapper is optional: buttons whose labels are rewritten by
   JS keep a bare text node and simply skip the gradient-text and breathe-glow
   extras. The .spinner span inside the generate button is excluded. */

@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --gradient-angle-offset {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --gradient-percent {
  syntax: "<percentage>";
  initial-value: 5%;
  inherits: false;
}

@property --gradient-shine {
  syntax: "<color>";
  initial-value: white;
  inherits: false;
}

.shiny-cta {
  --shiny-cta-bg: var(--dark);
  --shiny-cta-bg-subtle: var(--teal);
  --shiny-cta-fg: #ffffff;
  --shiny-cta-highlight: var(--teal);
  --shiny-cta-highlight-subtle: var(--teal);
  --animation: gradient-angle linear infinite;
  --duration: 4s;
  --shadow-size: 2px;
  isolation: isolate;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  outline-offset: 4px;
  padding: 0.85rem 2rem;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  min-width: 200px;
  border: 1px solid transparent;
  border-radius: 60px;
  color: var(--shiny-cta-fg);
  background: linear-gradient(var(--shiny-cta-bg), var(--shiny-cta-bg))
      padding-box,
    conic-gradient(
        from calc(var(--gradient-angle) - var(--gradient-angle-offset)),
        transparent,
        var(--shiny-cta-highlight) var(--gradient-percent),
        var(--gradient-shine) calc(var(--gradient-percent) * 2),
        var(--shiny-cta-highlight) calc(var(--gradient-percent) * 3),
        transparent calc(var(--gradient-percent) * 4)
      )
      border-box;
  box-shadow: inset 0 0 0 1px var(--shiny-cta-bg-subtle);
  /* Anchors used as CTAs (downloads) line up like the buttons. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;

  &::before,
  &::after,
  span:not(.spinner)::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset-inline-start: 50%;
    inset-block-start: 50%;
    translate: -50% -50%;
    z-index: -1;
  }

  &:active {
    translate: 0 1px;
  }
}

/* Dots pattern */
.shiny-cta::before {
  --size: calc(100% - var(--shadow-size) * 3);
  --position: 2px;
  --space: calc(var(--position) * 2);
  width: var(--size);
  height: var(--size);
  background: radial-gradient(
      circle at var(--position) var(--position),
      white calc(var(--position) / 4),
      transparent 0
    )
    padding-box;
  background-size: var(--space) var(--space);
  background-repeat: space;
  mask-image: conic-gradient(
    from calc(var(--gradient-angle) + 45deg),
    black,
    transparent 10% 90%,
    black
  );
  border-radius: inherit;
  opacity: 0.4;
  z-index: -1;
}

/* Inner shimmer */
.shiny-cta::after {
  --animation: cta-shimmer linear infinite;
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(
    -50deg,
    transparent,
    var(--shiny-cta-highlight),
    transparent
  );
  mask-image: radial-gradient(circle at bottom, transparent 40%, black);
  opacity: 0.6;
}

.shiny-cta span:not(.spinner) {
  z-index: 1;
  background: -webkit-linear-gradient(45deg, #ffffff, #eeeeee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  &::before {
    --size: calc(100% + 1rem);
    width: var(--size);
    height: var(--size);
    box-shadow: inset 0 -1ex 2rem 4px var(--shiny-cta-highlight);
    opacity: 0;
  }
}

/* Animate */
.shiny-cta {
  --transition: 800ms cubic-bezier(0.25, 1, 0.5, 1);
  transition:
    --gradient-angle-offset var(--transition),
    --gradient-percent var(--transition),
    --gradient-shine var(--transition),
    opacity 0.3s,
    box-shadow 0.3s;

  &,
  &::before,
  &::after {
    animation: var(--animation) var(--duration),
      var(--animation) calc(var(--duration) / 0.4) reverse paused;
    animation-composition: add;
  }

  span:not(.spinner)::before {
    transition: opacity var(--transition);
    animation: calc(var(--duration) * 1.5) breathe linear infinite;
  }
}

.shiny-cta:is(:hover, :focus-visible) {
  --gradient-percent: 20%;
  --gradient-angle-offset: 95deg;
  --gradient-shine: var(--shiny-cta-highlight-subtle);

  &,
  &::before,
  &::after {
    animation-play-state: running;
  }

  span:not(.spinner)::before {
    opacity: 1;
  }
}

/* Inactive: a plain dimmed pill — no rotating highlight, no dots, no shimmer. */
.shiny-cta:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
  --gradient-percent: 0%; /* collapses the conic border highlight */
  animation: none;
  box-shadow: inset 0 0 0 1px var(--line); /* blue-grey ring instead of teal */
}
.shiny-cta:disabled::before,
.shiny-cta:disabled::after {
  display: none;
}

@keyframes gradient-angle {
  to {
    --gradient-angle: 360deg;
  }
}

@keyframes cta-shimmer {
  to {
    rotate: 360deg;
  }
}

@keyframes breathe {
  from,
  to {
    scale: 1;
  }
  50% {
    scale: 1.1;
  }
}

/* ---------- settings tabs ---------- */

.settings-tabs {
  display: flex;
  gap: 6px;
  margin: 32px 0 34px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color .3s, border-color .3s;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }

/* Universal Prompts tab */

.master-head {
  display: flex;
  /* Top-aligned so this h2 sits at exactly the same y as the other tabs' h2s —
     centering against the taller CTA button would push it down. */
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.master-head h2,
.versions-title,
.tab-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(16px, 2.2vw, 22px);
  letter-spacing: .01em;
  margin: 0;
}
.tab-title { margin-bottom: 18px; }
.master-hint {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 23px;
}

.master-panel { margin-top: 10px; }
.master-panel:empty { display: none; }
.master-panel .master-entry { padding-left: 0; padding-right: 0; }


/* Version Control tab */

.versions-title { margin-bottom: 10px; }
.versions-list { max-width: 560px; margin-top: 18px; }

/* ---------- outline CTA ----------
   The standard action button: quiet teal outline. The animated shiny
   treatment is reserved for the special CTAs only — the login and 6-digit
   code Continue buttons and the Generate buttons. */

.outline-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: none;
  border: 1px solid var(--teal);
  border-radius: 999px;
  color: var(--teal);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: color .3s, border-color .3s, background .3s, opacity .3s;
}
.outline-cta:hover { background: rgba(0, 213, 207, .08); }
.outline-cta:active { translate: 0 1px; }
.outline-cta:disabled {
  opacity: .5;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  pointer-events: none;
}

/* ---------- library: category dropdown + pager ---------- */

.lib-cat { position: relative; }

.lib-cat-btn { gap: 7px; }
.lib-cat-btn svg { width: 12px; height: 12px; flex: 0 0 auto; }
.lib-cat-btn.is-active { color: var(--teal); border-color: var(--teal); background: rgba(0, 213, 207, .08); }

.lib-cat-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lib-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.lib-cat-item:hover { background: var(--panel-2); }
.lib-cat-item input { accent-color: var(--teal); margin: 0; flex: 0 0 auto; }

/* Keep the section head clear of the sticky masthead when scrolled to. */
#library-section { scroll-margin-top: 88px; }

/* Text link, but in the pills' typography. */
#lib-reset {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lib-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 22px;
}
.lib-pager .kind-btn:disabled { opacity: .4; cursor: default; }
.lib-page-info {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Library detail panel sits inside the section, between toolbar and grid —
   with the same divider-line separation the generated pop-out gets above
   its grid. */
.lib-result {
  margin: 28px 0 40px;
  padding-top: 0;
  border-top: 0;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}



/* ---------- stacked takes ---------- */

.hist-stack { position: relative; }
/* One card edge peeking out behind the top card — the "stack". */
.hist-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2); /* solid fill, a step lighter so it reads as a card */
  z-index: 0;
}
.hist-stack::before { transform: translate(3px, 3px); }
.hist-stack .hist-card { position: relative; z-index: 1; }

.stack-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(8, 14, 25, .82);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s, border-color .3s;
  z-index: 2;
}
.stack-arrow.prev { left: 8px; }
.stack-arrow.next { right: 8px; }
.hist-stack:hover .stack-arrow { opacity: 1; }
.stack-arrow:hover { border-color: var(--teal); }

.stack-pos {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--muted);
  background: rgba(8, 14, 25, .82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  z-index: 2;
}

/* Pop-out deck framing — on a wrapper, since .result-art clips overflow. */
.result-art-wrap { position: relative; }
.result-art-wrap.is-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  z-index: 0;
}
.result-art-wrap.is-stack::before { transform: translate(3px, 3px); }
.result-art-wrap .result-art { position: relative; z-index: 1; }
.result-art:hover .stack-arrow { opacity: 1; }

/* Stack label row: truncating term left, position indicator right. */
.hist-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 9px 11px;
}
.hist-label-row .hist-label {
  padding: 0;
  flex: 1;
  min-width: 0; /* lets the term truncate so the indicator always fits */
}
.stack-pos-inline {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--muted);
  background: rgba(8, 14, 25, .82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}

/* ---------- billing tab ---------- */

.billing-stats {
  display: flex;
  gap: 48px;
  margin: 20px 0 24px;
}
.billing-stat { display: flex; flex-direction: column; gap: 6px; }
.billing-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.billing-value { font-size: 30px; font-weight: 700; line-height: 1.1; }

/* ---------- public share page ---------- */

.share-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.share-main {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.share-wordmark { width: min(190px, 60%); height: auto; margin-bottom: 34px; }
.share-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.share-card img { display: block; width: 100%; height: auto; }
.share-title { font-family: var(--font-body); font-weight: 700; font-size: 22px; margin: 24px 0 4px; }
.share-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
