:root {
  color-scheme: light;
  --home-scale: 1;
  --font-ui: "Nunito Sans", "Noto Sans SC", ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Caveat", "Noto Sans SC", cursive;
  --paper: #fff8df;
  --paper-2: #fffdf1;
  --paper-3: #f4edd7;
  --paper-warm: #fbf1cf;
  --ink: #171717;
  --text: #2c2a25;
  --muted: #746f62;
  --faint: #a59d8a;
  --line: #221f1a;
  --line-soft: rgba(23, 23, 23, 0.22);
  --accent: #ff674d;
  --accent-deep: #dd4e38;
  --cyan: #20a6b8;
  --blue: #3d6ee7;
  --mint: #128c77;
  --amber: #f6b83f;
  --red: #c44335;
  --shadow-sm: 5px 6px 0 rgba(23, 23, 23, 0.12);
  --shadow-md: 10px 12px 0 rgba(23, 23, 23, 0.14);
  --ring: 0 0 0 4px rgba(32, 166, 184, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  background: #efe7d2;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 1px 1px, rgba(23, 23, 23, 0.17) 1px, transparent 0) 0 0 / 22px 22px,
    linear-gradient(135deg, rgba(32, 166, 184, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(255, 103, 77, 0.09), transparent 42%),
    #f3ead6;
}

body:not(.has-paper) {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 23, 0.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.92), transparent 96%);
}

button,
input,
select {
  font: inherit;
}

button,
.file-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 8px 7px 9px 6px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 3px 4px 0 rgba(23, 23, 23, 0.16);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:not(:disabled):hover,
.file-button:hover {
  transform: translate(-1px, -1px) rotate(-0.3deg);
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.16);
}

button:focus-visible,
.file-button:focus-within,
input:focus,
select:focus {
  outline: none;
  box-shadow: var(--ring), 3px 4px 0 rgba(23, 23, 23, 0.16);
}

input,
select {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 7px 8px;
  background: #fffdf2;
  color: var(--text);
  outline: none;
  padding: 11px 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.hidden-defaults,
[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100svh;
  min-height: 100svh;
  grid-template-columns: 246px minmax(0, 1fr) 264px;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.landing-nav {
  display: none;
}

body:not(.has-paper) .app-shell {
  display: block;
  height: auto;
  min-height: 100svh;
  padding: 0;
  overflow: visible;
}

body:not(.has-paper) .landing-nav {
  position: fixed;
  z-index: 5;
  top: 14px;
  left: 50%;
  display: flex;
  width: min(1180px, calc(100% - 28px));
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: rgba(255, 253, 242, 0.82);
  box-shadow: 0 18px 48px rgba(23, 23, 23, 0.09), 0 1px 0 rgba(255, 255, 255, 0.82) inset;
  padding: 8px 10px 8px 16px;
  transform: translateX(-50%) scale(var(--home-scale));
  transform-origin: top center;
  backdrop-filter: blur(18px) saturate(1.1);
}

.landing-brand,
.brand,
.tabs,
.top-actions,
.composer-tools,
.stage-toolbar,
.term-head,
.section-row {
  display: flex;
  align-items: center;
}

.landing-brand {
  gap: 11px;
  min-width: 0;
}

.brand-home {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.brand-home:not(:disabled):hover {
  transform: none;
  box-shadow: none;
}

.brand-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 12px;
  box-shadow: none;
}

body:not(.has-paper) .landing-brand .logo-plate {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: #fffdf2;
  box-shadow: none;
}

body:not(.has-paper) .landing-logo {
  width: 31px;
  height: 31px;
}

.logo-plate {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px 7px 11px 8px;
  background: #fffdf2;
  box-shadow: none;
}

.compact-mark {
  width: 42px;
  height: 42px;
}

.landing-logo,
.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand-wordmark {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.landing-brand strong,
.brand strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.landing-brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.prompt-chip {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 999px 820px 900px 760px;
  background: rgba(255, 253, 242, 0.72);
  padding: 8px 13px;
  box-shadow: 3px 4px 0 rgba(23, 23, 23, 0.13);
}

.landing-action,
.landing-console {
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  backdrop-filter: none;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.landing-action {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fffdf2;
  box-shadow: 0 2px 6px rgba(23, 23, 23, 0.18);
}

.landing-console {
  border: 1px solid rgba(23, 23, 23, 0.16);
  background: #fffdf2;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(23, 23, 23, 0.06);
}

.landing-action:not(:disabled):hover {
  background: #000;
  color: #fffdf2;
  box-shadow: 0 4px 12px rgba(23, 23, 23, 0.24);
  transform: translateY(-1px) rotate(0);
}

.landing-console:not(:disabled):hover {
  background: #f3eccf;
  box-shadow: 0 3px 8px rgba(23, 23, 23, 0.12);
  transform: translateY(-1px) rotate(0);
}

.language-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.045);
  padding: 2px;
  box-shadow: none;
  backdrop-filter: none;
}

.language-switch button {
  min-width: 34px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  padding: 0 9px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.language-switch button:not(:disabled):hover {
  background: rgba(255, 253, 242, 0.78);
  box-shadow: none;
  transform: none;
}

.language-switch button.active,
.language-switch button.active:not(:disabled):hover {
  background: #fffdf2;
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(23, 23, 23, 0.08);
}

.compact-locale {
  background: rgba(23, 23, 23, 0.05);
}

body:not(.has-paper) .sidebar,
body:not(.has-paper) .control-panel {
  display: none;
}

.sidebar,
.builder,
.control-panel {
  height: calc(100svh - 24px);
  min-height: calc(100svh - 24px);
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 23, 0.03) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: var(--shadow-sm);
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, 1fr) auto;
  gap: 12px;
  padding: 13px;
  overflow: auto;
  transform: rotate(-0.18deg);
}

.brand {
  gap: 10px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}

.new-button {
  width: 100%;
  min-height: 44px;
  background: var(--ink);
  color: #fffdf2;
  font-family: var(--font-display);
  font-size: 20px;
}

.new-button:not(:disabled):hover {
  background: #000;
}

.side-section {
  display: grid;
  gap: 9px;
}

.side-section {
  min-width: 0;
  padding-top: 12px;
  border-top: 2px dashed rgba(23, 23, 23, 0.22);
}

.section-label,
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-transform: none;
}

.section-row {
  justify-content: space-between;
  gap: 10px;
}

.paper-context h2,
.stage-toolbar h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.05;
}

.paper-context {
  overflow: hidden;
}

.paper-context .muted {
  max-height: 42px;
  overflow: hidden;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-list,
.library-grid,
.prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-picker {
  display: grid;
  width: min(760px, 100%);
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.template-section {
  display: grid;
  width: min(760px, 100%);
  gap: 10px;
}

.template-heading {
  display: grid;
  gap: 5px;
}

.template-heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.template-card {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 8px;
  border: 2px solid rgba(23, 23, 23, 0.78);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  box-shadow: 4px 5px 0 rgba(23, 23, 23, 0.12);
  cursor: pointer;
  overflow: hidden;
  padding: 7px;
  transform: rotate(-0.2deg);
}

.template-card:nth-child(2) {
  transform: rotate(0.5deg);
}

.template-card:nth-child(3) {
  transform: rotate(-0.5deg);
}

.template-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.template-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 2px solid rgba(23, 23, 23, 0.72);
  border-radius: 6px;
  object-fit: cover;
  object-position: top center;
  filter: saturate(0.96) contrast(1.02);
}

.template-card span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.template-card strong,
.template-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.1;
}

.template-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.template-card:has(input:checked) {
  background: #dff7fb;
  box-shadow: var(--ring), 4px 5px 0 rgba(23, 23, 23, 0.14);
}

.template-card:has(input:focus-visible) {
  box-shadow: var(--ring), 4px 5px 0 rgba(23, 23, 23, 0.14);
}

.template-card:has(input:disabled) {
  cursor: wait;
  opacity: 0.72;
}

.chip,
.tiny-pill,
.prompt-chip {
  border: 2px solid rgba(23, 23, 23, 0.75);
  border-radius: 999px 820px 900px 760px;
  background: #fffdf2;
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.chip:nth-child(2n),
.prompt-chip:nth-child(2n) {
  transform: rotate(1deg);
}

.chip:nth-child(2n + 1),
.prompt-chip:nth-child(2n + 1) {
  transform: rotate(-0.8deg);
}

.chip.term {
  border-color: var(--ink);
  background: #fff4bf;
  color: var(--ink);
  cursor: pointer;
}

.sidebar-footer {
  padding-top: 10px;
  border-top: 2px dashed rgba(23, 23, 23, 0.22);
}

.status-pill,
.auth-button {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-shell {
  display: grid;
}

.auth-button {
  min-height: 38px;
  color: var(--ink);
}

.status-pill.ok {
  color: var(--mint);
}

.status-pill.bad {
  color: var(--red);
}

.builder {
  display: grid;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  transform: rotate(0.12deg);
}

body:not(.has-paper) .builder {
  display: block;
  height: auto;
  min-height: 100svh;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  transform: none;
}

body:not(.has-paper) .builder-top {
  display: none;
}

.builder-top {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px dashed var(--line-soft);
  background: rgba(255, 253, 242, 0.66);
  padding: 10px 12px;
}

.builder-title {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.builder-title .eyebrow {
  font-size: 11px;
  line-height: 1;
}

.builder-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.tabs {
  display: none;
}

.top-actions,
.composer-tools {
  gap: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 6px;
  background: var(--ink);
  color: #fffdf2;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 600;
}

.compact {
  min-height: 38px;
  padding: 0 13px;
}

.primary,
#urlButton {
  background: var(--accent);
  color: #fffdf2;
}

.primary:not(:disabled):hover,
#urlButton:not(:disabled):hover {
  background: var(--accent-deep);
}

.primary:disabled,
#urlButton:disabled,
.new-button:disabled {
  background: var(--paper-3);
  color: var(--faint);
  box-shadow: none;
}

.ghost {
  padding: 0 14px;
  background: #fffdf2;
}

.intake-screen {
  display: grid;
  min-height: calc(100svh - 88px);
  grid-template-columns: minmax(0, 760px);
  place-content: center;
  align-items: center;
  gap: 24px;
  padding: 42px;
}

body:not(.has-paper) .intake-screen {
  position: relative;
  display: grid;
  width: min(1180px, 100%);
  min-height: 100svh;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 0 auto;
  padding: 104px 28px 78px;
  overflow: visible;
  transform: none;
  transform-origin: center center;
}

body:not(.has-paper) .intake-card,
body:not(.has-paper) .template-section,
body:not(.has-paper) .gallery-section,
body:not(.has-paper) .seo-faq-section {
  scroll-margin-top: 96px;
}

.intake-card {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 15px;
  animation: rise-in 260ms ease both;
}

body:not(.has-paper) .intake-card {
  width: min(1120px, 100%);
  justify-items: start;
  gap: 16px;
  text-align: left;
}

.intake-row {
  display: grid;
  width: min(1120px, 100%);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.intake-row > .intake-primary,
.intake-row > .template-section {
  width: 100%;
  min-width: 0;
}

.intake-row > .intake-primary {
  align-self: start;
}

.intake-primary {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.intake-row > .template-section {
  align-self: start;
  width: 100%;
}

.intake-row .template-picker {
  width: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.intake-row .template-card {
  min-height: 142px;
  padding: 6px;
  gap: 6px;
}

.intake-row .template-card img {
  aspect-ratio: 4 / 3;
}

.intake-row .template-card strong {
  font-size: 12px;
}

.intake-row .template-card small {
  font-size: 10px;
}

body:not(.has-paper) .intake-row .template-heading h2 {
  font-size: 21px;
  line-height: 1;
}

body:not(.has-paper) .intake-row .template-heading .eyebrow {
  font-size: 10px;
}

.intake-card h1 {
  max-width: 720px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 68px;
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: 0;
}

body:not(.has-paper) .intake-card h1 {
  max-width: 820px;
  color: var(--ink);
  font-size: 82px;
  line-height: 0.86;
  text-shadow: 4px 5px 0 rgba(32, 166, 184, 0.16);
  transform: rotate(-1deg);
}

.lede {
  max-width: 610px;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.48;
}

body:not(.has-paper) .lede {
  max-width: 720px;
  font-size: 19px;
}

.source-composer {
  display: grid;
  width: min(760px, 100%);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 8px 7px;
  background: #fffdf2;
  padding: 8px;
  box-shadow: var(--shadow-md);
  overflow: visible;
}

body:not(.has-paper) .source-composer {
  width: min(860px, 100%);
  min-height: 0;
  text-align: left;
  transform: rotate(0.4deg);
}

body:not(.has-paper) .intake-row > .intake-primary,
body:not(.has-paper) .intake-row > .source-composer {
  width: min(860px, 100%);
}

body:not(.has-paper) .intake-row > .template-section {
  width: min(1120px, 100%);
}

.source-composer.drag-active {
  box-shadow: var(--ring), var(--shadow-md);
}

.auth-gate-note {
  width: min(860px, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

body.is-signed-in .auth-gate-note {
  display: none;
}

.prompt-block {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 860px;
}

.prompt-label {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.source-composer input {
  min-height: 46px;
  border: 0;
  border-radius: 5px;
  background:
    linear-gradient(transparent 0 70%, rgba(32, 166, 184, 0.14) 70% 74%, transparent 74%),
    transparent;
  color: var(--ink);
  padding: 0 12px;
  font-family: var(--font-display);
  font-size: 20px;
  box-shadow: none;
}

body:not(.has-paper) .source-composer input {
  min-height: 48px;
  padding: 0 14px;
  font-size: 21px;
}

.source-composer input::placeholder {
  color: rgba(23, 23, 23, 0.48);
}

.source-composer input:focus {
  box-shadow: none;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
}

.file-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink);
}

.file-button input {
  display: none;
}

body:not(.has-paper) .file-button,
body:not(.has-paper) #urlButton {
  min-height: 44px;
  padding: 0 15px;
}

.workspace {
  display: none;
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  padding: 12px 14px 14px;
}

body.has-paper .intake-screen {
  display: none;
}

body.has-paper .workspace {
  display: grid;
}

/* Standalone share blog page: keep the regular landing-nav, hide the workspace */

body.share-blog-mode {
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(23, 23, 23, 0.10) 1px, transparent 0) 0 0 / 26px 26px,
    linear-gradient(180deg, #fbf3d8 0%, #f5ecd0 100%);
}

body.share-blog-mode::before {
  display: none;
}

/* Collapse the workspace shell so .share-blog can sit at the top of the page.
   The fixed .landing-nav lives inside but is out of flow, so it stays visible. */
body.share-blog-mode .app-shell {
  display: block;
  min-height: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: visible;
}

body.share-blog-mode .sidebar,
body.share-blog-mode .builder,
body.share-blog-mode .control-panel {
  display: none !important;
}

/* The inline blog topbar is no longer rendered; this safety rule keeps it off
   even if older cached markup is around. */
body.share-blog-mode .share-blog-topbar {
  display: none !important;
}

/* Reserve room at the top of the blog so its content clears the fixed nav. */
body.share-blog-mode .share-blog-hero {
  padding-top: clamp(96px, 12vh, 132px);
}

.share-blog[hidden] {
  display: none;
}

.share-blog {
  display: block;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-ui);
  --share-pad-x: clamp(20px, 5vw, 64px);
  --share-content-max: 1180px;
  --share-reader-max: 1180px;
}

/* Soft reset of the global button styles inside the blog. Wrapped in :where()
   so it has zero specificity — that lets every viewer/copy/edge button below
   re-skin itself without fighting against this reset. */
.share-blog :where(button) {
  min-height: 0;
  border-radius: 0;
  background: transparent;
  white-space: normal;
  box-shadow: none;
  font-weight: inherit;
  border: 0;
  padding: 0;
}

.share-blog :where(button):hover:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.share-blog-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px var(--share-pad-x);
  background: rgba(251, 243, 216, 0.86);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
}

.share-blog-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--ink);
}

.share-blog-home:hover .share-blog-home-mark {
  color: var(--accent-deep);
}

.share-blog-home .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 103, 77, 0.18);
}

.share-blog-home-mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: color 120ms ease;
}

.share-blog-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.share-blog-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 2px solid var(--ink);
  border-radius: 8px 7px 9px 6px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 0 16px;
  box-shadow: 3px 3px 0 rgba(23, 23, 23, 0.16);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.share-blog-copy-link:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(23, 23, 23, 0.18);
  background: var(--paper);
}

/* Hero: 2-column on desktop (text + tilted comic cover), stacks below 860px */

.share-blog-hero {
  width: 100%;
  padding: clamp(32px, 5vw, 64px) var(--share-pad-x) clamp(24px, 3.5vw, 40px);
}

.share-blog-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
  max-width: var(--share-content-max);
  margin: 0 auto;
}

@media (max-width: 860px) {
  .share-blog-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

.share-blog-hero-text {
  min-width: 0;
}

.share-blog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  background: rgba(255, 103, 77, 0.14);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.share-blog-eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 103, 77, 0.22);
}

.share-blog-title {
  margin: 0 0 18px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: clamp(28px, 3.6vw, 46px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.018em;
  word-break: break-word;
  text-wrap: balance;
}

.share-blog-lede {
  margin: 0 0 22px;
  color: var(--text);
  font-size: clamp(16px, 1.3vw, 18px);
  font-weight: 500;
  line-height: 1.6;
  max-width: 56ch;
  text-wrap: pretty;
}

.share-blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.share-blog-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.3);
}

.share-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}

.share-blog-tags span {
  border: 1.5px solid rgba(23, 23, 23, 0.16);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 2px 2px 0 rgba(23, 23, 23, 0.06);
}

.share-blog-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* Hero comic cover — tilted, framed, with paper-tape accent */

.share-blog-hero-cover {
  position: relative;
  justify-self: center;
  width: min(360px, 100%);
  aspect-ratio: 3 / 4;
}

.share-blog-hero-cover-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid var(--ink);
  border-radius: 14px 12px 16px 11px;
  background: var(--paper-warm);
  overflow: hidden;
  box-shadow: 10px 12px 0 rgba(23, 23, 23, 0.18);
  transform: rotate(-2.5deg);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.share-blog-hero-cover-frame:hover {
  transform: rotate(-1deg) translate(-2px, -3px);
  box-shadow: 14px 16px 0 rgba(23, 23, 23, 0.2);
}

.share-blog-hero-cover-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.share-blog-hero-cover-tape {
  position: absolute;
  top: -18px;
  right: 24px;
  width: 88px;
  height: 26px;
  background: rgba(246, 184, 63, 0.78);
  border: 1px solid rgba(23, 23, 23, 0.12);
  transform: rotate(8deg);
  box-shadow: 2px 3px 0 rgba(23, 23, 23, 0.1);
}

/* Reader: paragraphs (left) + sticky comic viewer (right) */

.share-blog-section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.share-blog-section-eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent-deep);
}

.share-blog-reader {
  width: 100%;
  padding: clamp(8px, 1.5vw, 16px) var(--share-pad-x) clamp(48px, 6vw, 80px);
}

.share-blog-reader-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 64px);
  align-items: start;
  max-width: var(--share-reader-max);
  margin: 0 auto;
}

@media (max-width: 860px) {
  .share-blog-reader-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

.share-blog-reader-text {
  min-width: 0;
}

.share-blog-paragraphs {
  display: grid;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: blog-paragraph;
}

.share-blog-paragraph {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 4px 0 4px 18px;
  border-left: 2px solid rgba(23, 23, 23, 0.12);
  transition: border-color 160ms ease, transform 160ms ease;
  overflow: hidden;
}

.share-blog-paragraph:hover {
  border-left-color: rgba(23, 23, 23, 0.32);
}

.share-blog-paragraph.is-active {
  border-left-color: var(--accent-deep);
}

.share-blog-paragraph.is-active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-deep);
  border-radius: 4px;
}

.share-blog-paragraph-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid rgba(23, 23, 23, 0.18);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.share-blog-paragraph.is-active .share-blog-paragraph-num {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fffdf2;
}

.share-blog-paragraph-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.share-blog-paragraph-heading {
  display: block;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font-size: clamp(18px, 1.4vw, 22px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.012em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.share-blog-paragraph-text {
  display: block;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: clamp(15px, 1.1vw, 16px);
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.share-blog-reader-comic {
  position: sticky;
  top: 88px;
  align-self: start;
  display: block;
}

@media (max-width: 860px) {
  .share-blog-reader-comic {
    position: static;
  }
}

/* ---------------------------------------------------------------- */
/* SSR-only blog layout                                              */
/* Used by the server-rendered ``/blog/<id>`` page before the SPA    */
/* hydrates into the interactive reader, and by crawlers / users     */
/* without JavaScript. The classes below intentionally render a      */
/* full-width vertical reading flow (text + images stacked) rather   */
/* than the two-column interactive layout, since there is no live    */
/* page navigator to drive a sticky comic frame.                     */
/* ---------------------------------------------------------------- */

.share-blog-ssr-paragraphs {
  display: grid;
  gap: 36px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.share-blog-ssr-section {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-left: 18px;
  border-left: 2px dashed rgba(23, 23, 23, 0.18);
}

.share-blog-ssr-section .share-blog-paragraph-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.share-blog-ssr-section h2.share-blog-paragraph-heading {
  margin: 0;
}

.share-blog-ssr-figure {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  border: 2px solid var(--ink);
  border-radius: 18px 16px 20px 15px;
  background: var(--paper);
  padding: 12px;
  box-shadow: 8px 10px 0 rgba(23, 23, 23, 0.14);
  overflow: hidden;
}

.share-blog-ssr-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.share-blog-source {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text);
  opacity: 0.85;
}

.share-blog-source strong {
  color: var(--ink);
}

.share-blog-source a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.share-blog-source a:hover {
  color: var(--blue);
}

@media (max-width: 720px) {
  .share-blog-ssr-section {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 14px;
  }

  .share-blog-ssr-section .share-blog-paragraph-num {
    justify-self: start;
  }
}

.share-blog-viewer {
  display: grid;
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: 18px 16px 20px 15px;
  background: var(--paper);
  padding: 16px;
  box-shadow: 8px 10px 0 rgba(23, 23, 23, 0.14);
}

.share-blog-viewer-figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper-warm);
  border: 1.5px solid rgba(23, 23, 23, 0.18);
  aspect-ratio: 3 / 4;
  max-height: min(78vh, 720px);
}

.share-blog-viewer-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--paper-warm);
  transition: opacity 140ms ease-out;
}

/* Visually mute the stale pixels while the next page's image streams in,
   so it's obvious that the comic is mid-swap rather than "stuck". */
.share-blog-viewer-figure.is-loading img {
  opacity: 0.25;
}

.share-blog-viewer-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-blog-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.share-blog-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 34px;
  padding: 0 12px;
  border: 1.5px solid rgba(23, 23, 23, 0.2);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.share-blog-viewer-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--paper);
}

.share-blog-viewer-btn:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.5;
}

.share-blog-viewer-counter {
  flex: 1 1 auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.share-blog-viewer-fullscreen {
  margin-left: auto;
}

/* Zoom controls live in the toolbar but are only meaningful while the
   viewer is in fullscreen — outside of it the image is locked to the
   side-by-side reader's contained aspect ratio. */
.share-blog-viewer-zoom {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-zoom {
  display: inline-flex;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-fullscreen {
  margin-left: 0;
}

[data-blog-zoom-reset] {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.share-blog-viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  border: 1.5px dashed rgba(23, 23, 23, 0.22);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-blog-viewer.is-fullscreen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  width: 100vw;
  height: 100vh;
  padding: clamp(16px, 3vw, 32px);
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: #0d0d0d;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-figure {
  aspect-ratio: auto;
  max-height: none;
  background: #0d0d0d;
  border-color: rgba(255, 255, 255, 0.08);
  /* Allow JS-driven pinch / wheel handlers to take over gestures inside
     the figure rather than the browser inferring scroll/zoom. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-figure.is-zoomed {
  cursor: grab;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-figure.is-panning,
.share-blog-viewer.is-fullscreen .share-blog-viewer-figure.is-panning img {
  cursor: grabbing;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-figure img {
  background: #0d0d0d;
  /* All zoom/pan updates come from the JS controller setting ``transform``
     directly every frame, so no CSS transition is needed (and a transition
     would actively hurt drag/wheel responsiveness). */
  will-change: transform;
  /* Stop the browser from kidnapping our mousedown into a native HTML5
     image drag (which fires ``pointercancel`` and kills our pan). */
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-bar {
  color: #fffdf2;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-counter {
  color: rgba(255, 253, 242, 0.7);
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-btn {
  background: rgba(255, 253, 242, 0.12);
  border-color: rgba(255, 253, 242, 0.2);
  color: #fffdf2;
}

.share-blog-viewer.is-fullscreen .share-blog-viewer-btn:hover:not(:disabled) {
  background: rgba(255, 253, 242, 0.22);
  border-color: rgba(255, 253, 242, 0.4);
}

/* Footer CTA */

.share-blog-footer {
  width: 100%;
  padding: clamp(40px, 5vw, 72px) var(--share-pad-x) clamp(36px, 5vw, 56px);
  border-top: 1px solid rgba(23, 23, 23, 0.1);
  background: rgba(255, 253, 242, 0.4);
}

.share-blog-footer-inner {
  display: grid;
  gap: 18px;
  justify-items: center;
  max-width: var(--share-content-max);
  margin: 0 auto;
  text-align: center;
}

.share-blog-footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf2;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.18);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.share-blog-footer-cta:hover {
  background: var(--accent-deep);
  transform: translate(-1px, -1px);
  box-shadow: 7px 8px 0 rgba(23, 23, 23, 0.2);
}

.share-blog-footer small {
  display: block;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .share-blog {
    --share-pad-x: 18px;
  }

  .share-blog-topbar {
    padding: 12px 18px;
  }

  .share-blog-home-mark {
    font-size: 22px;
  }

  .share-blog-hero {
    padding-top: clamp(28px, 9vw, 48px);
  }

  .share-blog-hero-cover {
    width: min(280px, 76%);
  }

  .share-blog-paragraph {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-left: 14px;
  }

  .share-blog-paragraph-num {
    justify-self: start;
  }
}

.comic-stage {
  align-self: stretch;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: clamp(220px, 24%, 320px) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas:
    "toolbar stage"
    "banner  stage"
    "thumbs  stage";
  gap: 12px;
}

.stage-toolbar {
  grid-area: toolbar;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0 2px;
}

.page-counter {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  padding: 6px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transform: rotate(1deg);
  flex: 0 0 auto;
}

.generation-banner {
  grid-area: banner;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #dff7fb;
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.13);
  padding: 11px 13px;
  color: var(--ink);
  transform: rotate(-0.3deg);
  position: relative;
  z-index: 3;
}

.generation-banner[hidden] {
  display: none;
}

.generation-banner strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.generation-banner span {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.generation-banner small {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.page-view {
  container-type: size;
  grid-area: stage;
  display: grid;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 8px 7px;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 23, 0.04) 1px, transparent 1px),
    #f7edd1;
  background-size: 36px 36px, 36px 36px, auto;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(6px, 1svh, 12px);
  scrollbar-gutter: stable both-edges;
}

.generating-state {
  display: grid;
  width: min(100%, 760px);
  min-height: 360px;
  place-items: center;
}

.generating-state-card {
  display: grid;
  width: min(100%, 560px);
  gap: 10px;
  border: 3px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  box-shadow: 9px 10px 0 rgba(23, 23, 23, 0.14);
  padding: 28px;
  text-align: center;
  transform: rotate(-0.4deg);
}

.generating-state-card span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.generating-state-card strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 600;
  line-height: 0.95;
}

.generating-state-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.generating-state-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.generation-meter {
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fbf1cf;
  overflow: hidden;
}

.generation-meter i {
  display: block;
  height: 100%;
  min-width: 8px;
  border-right: 2px solid var(--ink);
  background: var(--cyan);
}

.empty-state {
  display: grid;
  align-self: center;
  justify-self: center;
  min-height: 420px;
  place-items: center;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  animation: rise-in 360ms ease both;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 32px;
}

.empty-state.error strong {
  color: var(--red);
}

.empty-state.error span {
  max-width: 520px;
  line-height: 1.55;
}

.page-card {
  position: relative;
  isolation: isolate;
  display: grid;
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  min-height: 0;
  grid-template-rows: auto 1fr auto;
  border: 3px solid var(--ink);
  border-radius: 8px 7px 10px 6px;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 23, 0.03) 1px, transparent 1px),
    #fff8df;
  background-size: 34px 34px, 34px 34px, auto;
  box-shadow: 10px 12px 0 rgba(23, 23, 23, 0.16);
  overflow: hidden;
  padding: 26px 22px;
  animation: page-rise 420ms ease both;
  transform: rotate(-0.2deg);
}

.page-image-card {
  position: relative;
  isolation: isolate;
  display: block;
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  border: 3px solid var(--ink);
  border-radius: 8px 7px 10px 6px;
  background: #fffdf2;
  box-shadow: 10px 12px 0 rgba(23, 23, 23, 0.16);
  overflow: hidden;
  animation: page-rise 420ms ease both;
  transform: rotate(-0.2deg);
}

.generated-page-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.page-box-surface {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: pan-y;
}

@supports (width: 1cqh) {
  .page-card,
  .page-image-card {
    height: min(calc(100cqh - 6px), calc((100cqw - 6px) * 3 / 2));
    width: auto;
    max-width: 100%;
    max-height: 100%;
  }
}

.box-selection-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.box-selection-rect {
  position: absolute;
  border: 3px solid var(--accent);
  border-radius: 8px 6px 9px 7px;
  background: rgba(255, 103, 77, 0.14);
  box-shadow:
    0 0 0 9999px rgba(23, 23, 23, 0.18),
    4px 5px 0 rgba(23, 23, 23, 0.18);
}

body.selecting-region {
  user-select: none;
}

.page-image-select-layer {
  display: none;
}

.region-preview {
  display: grid;
  gap: 9px;
  border: 2px dashed rgba(23, 23, 23, 0.32);
  border-radius: 8px 6px 9px 7px;
  background: #fbf1cf;
  padding: 9px;
}

.region-preview.empty {
  min-height: 72px;
  place-items: center;
  background: #fffdf2;
  color: var(--muted);
  text-align: center;
}

.region-preview.failed {
  background: #fff0ea;
}

.region-preview img {
  display: block;
  width: 100%;
  max-height: 150px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
}

.region-preview strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.region-preview p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.42;
}

.region-preview small,
.region-preview span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.page-card::before {
  position: absolute;
  right: -18%;
  bottom: -36%;
  z-index: -1;
  width: 68%;
  height: 74%;
  border: 3px solid rgba(23, 23, 23, 0.55);
  border-radius: 42% 12% 0 0;
  content: "";
  background: rgba(32, 166, 184, 0.18);
  transform: rotate(-8deg);
}

.page-card.amber::before {
  background: rgba(255, 103, 77, 0.18);
}

.page-card::after {
  position: absolute;
  right: 26px;
  bottom: 20px;
  width: 150px;
  height: 150px;
  content: "";
  background: url("./assets/readpaper-logo-abstract.png") center / contain no-repeat;
  opacity: 0.045;
}

.page-topline {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.page-chip {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  padding: 7px 10px;
  color: var(--ink);
  transform: rotate(-0.8deg);
}

.page-status-chip {
  border: 2px dashed rgba(23, 23, 23, 0.42);
  border-radius: 999px;
  background: #fffdf2;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.page-status-chip.generating {
  color: var(--cyan);
}

.page-status-chip.failed {
  color: var(--red);
}

.page-failed-card {
  position: relative;
  isolation: isolate;
  display: grid;
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  grid-template-rows: auto 1fr;
  border: 3px solid var(--ink);
  border-radius: 8px 7px 10px 6px;
  background: #fff7ec;
  box-shadow: 10px 12px 0 rgba(23, 23, 23, 0.16);
  overflow: hidden;
  padding: 26px 22px;
  animation: page-rise 420ms ease both;
  transform: rotate(-0.2deg);
}

@supports (width: 1cqh) {
  .page-failed-card {
    height: min(calc(100cqh - 6px), calc((100cqw - 6px) * 3 / 2));
    width: auto;
    max-width: 100%;
    max-height: 100%;
  }
}

.page-failed-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-failed-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 12px;
  text-align: center;
}

.page-failed-body strong {
  color: var(--ink);
  font-size: clamp(18px, 2.6vw, 24px);
  line-height: 1.25;
  max-width: 28ch;
}

.page-failed-detail {
  margin: 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.page-failed-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.page-regenerate-btn {
  min-height: 40px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 8px 7px 9px 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 3px 4px 0 rgba(23, 23, 23, 0.18);
  cursor: pointer;
}

.page-regenerate-btn:not(:disabled):hover {
  background: var(--accent-deep);
  transform: translate(-1px, -1px) rotate(-0.3deg);
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.2);
}

.page-regenerate-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.page-regenerate-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.page-number {
  color: var(--muted);
  font-weight: 600;
}

.page-body {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 0;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
}

.page-copy {
  width: 100%;
  min-width: 0;
}

.page-copy [data-focus-text] {
  cursor: text;
  user-select: text;
}

.page-copy [data-focus-text]:hover,
.page-copy [data-focus-text]:focus-visible {
  border-radius: 6px;
  background: rgba(32, 166, 184, 0.12);
  outline: none;
  box-shadow: 0 0 0 4px rgba(32, 166, 184, 0.12);
}

.page-card h3 {
  width: 100%;
  max-width: none;
  margin: 0 0 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(31px, 7.8cqw, 38px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: pretty;
}

.page-card .subtitle {
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.page-bullets {
  display: grid;
  gap: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  list-style: none;
}

.page-bullets li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border-top: 2px dashed rgba(23, 23, 23, 0.22);
  padding: 9px 0;
}

.page-bullets li.lead {
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 6px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  box-shadow: 4px 5px 0 rgba(23, 23, 23, 0.12);
  padding: 13px 14px;
  transform: rotate(0.4deg);
}

.page-bullets li span {
  display: block;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.page-card.amber .page-bullets li span {
  color: var(--accent);
}

.page-bullets li p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-visual-panel {
  position: relative;
  min-height: 220px;
  color: var(--ink);
  overflow: visible;
  padding: 0;
}

.paper-sheets {
  position: absolute;
  inset: 16px 14px 54px 0;
}

.paper-sheets i {
  position: absolute;
  display: block;
  width: 68%;
  height: 62%;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background:
    linear-gradient(rgba(23, 23, 23, 0.12) 0 0) 24px 34px / 58% 8px no-repeat,
    linear-gradient(rgba(23, 23, 23, 0.09) 0 0) 24px 56px / 46% 8px no-repeat,
    #fffdf2;
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.12);
}

.paper-sheets i:nth-child(1) {
  top: 8px;
  left: 18px;
  transform: rotate(-8deg);
}

.paper-sheets i:nth-child(2) {
  top: 62px;
  right: 12px;
  background-color: #fbf1cf;
  transform: rotate(7deg);
}

.paper-sheets i:nth-child(3) {
  right: 70px;
  bottom: 4px;
  width: 54%;
  height: 48%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.46) 0 0) 24px 32px / 54% 8px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.34) 0 0) 24px 54px / 38% 8px no-repeat,
    var(--cyan);
  transform: rotate(-2deg);
}

.page-card.amber .paper-sheets i:nth-child(3) {
  background:
    linear-gradient(rgba(255, 255, 255, 0.46) 0 0) 24px 32px / 54% 8px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.34) 0 0) 24px 54px / 38% 8px no-repeat,
    var(--accent);
}

.insight-card {
  position: absolute;
  right: 0;
  top: 86px;
  width: min(260px, 92%);
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #191919;
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.14);
  padding: 17px;
  transform: rotate(1.5deg);
}

.insight-card span {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 600;
}

.insight-card strong {
  display: block;
  margin: 18px 0 20px;
  color: #fffdf2;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 0.95;
}

.insight-card em {
  display: block;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.insight-card em:last-child {
  width: 66%;
}

.term-ribbon {
  position: absolute;
  right: 8px;
  bottom: 10px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.term-ribbon span,
.source-row span {
  border: 2px solid rgba(23, 23, 23, 0.7);
  border-radius: 999px;
  background: #fffdf2;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 600;
}

.layout-split .page-copy {
  order: 2;
}

.layout-split .page-visual-panel {
  order: 1;
}

.layout-split .insight-card {
  right: auto;
  left: 0;
  transform: rotate(-2deg);
}

.layout-note .page-body {
  grid-template-columns: 1fr;
}

.layout-note .page-bullets {
  grid-template-columns: 1fr;
  gap: 10px 14px;
}

.layout-note .page-bullets li {
  grid-template-columns: 1fr;
}

.layout-note .page-bullets li.lead {
  grid-column: 1 / -1;
}

.layout-dark {
  background:
    linear-gradient(90deg, rgba(255, 253, 242, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(255, 253, 242, 0.045) 1px, transparent 1px),
    #171717;
  background-size: 34px 34px, 34px 34px, auto;
}

.layout-dark h3,
.layout-dark .subtitle,
.layout-dark .page-bullets,
.layout-dark .page-number {
  color: #fffdf2;
}

.layout-dark .page-chip,
.layout-dark .page-bullets li.lead,
.layout-dark .source-row span,
.layout-dark .term-ribbon span {
  background: #fffdf2;
  color: var(--ink);
}

.layout-dark .page-bullets li {
  border-top-color: rgba(255, 253, 242, 0.24);
}

.layout-dark .paper-sheets i {
  background-color: #fffdf2;
}

.source-row {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-width: 0;
}

.source-row strong {
  display: none;
}

.source-row div {
  display: flex;
  min-width: 0;
  justify-content: flex-start;
  gap: 7px;
  overflow: hidden;
}

.source-row span {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-row {
  display: flex;
  grid-area: thumbs;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 8px 7px;
  background: #fff8df;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
}

.thumb {
  display: grid;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
  background: #fffdf2;
  overflow: hidden;
}

.thumb:nth-child(2n) {
  transform: rotate(0.4deg);
}

.thumb:nth-child(2n + 1) {
  transform: rotate(-0.3deg);
}

.thumb span {
  grid-row: 1 / span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff8df;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.thumb strong {
  display: -webkit-box;
  grid-column: 2;
  grid-row: 1;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thumb small {
  display: block;
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.thumb.image-generated small {
  color: var(--cyan);
}

.thumb.image-failed small {
  color: var(--red);
}

.thumb.active {
  background: #dff7fb;
  color: var(--ink);
  box-shadow: 4px 5px 0 rgba(23, 23, 23, 0.16);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 13px;
  overflow: auto;
  transform: rotate(0.22deg);
}

.term-box {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  box-shadow: 4px 5px 0 rgba(23, 23, 23, 0.12);
  padding: 12px;
  transform: rotate(-0.4deg);
}

.settings-grid {
  display: grid;
  gap: 10px;
}

.term-box.is-disabled {
  opacity: 0.72;
}

.term-head {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

.panel-back-console {
  width: 100%;
  margin-top: auto;
  flex-shrink: 0;
}

.mini {
  min-height: 34px;
  padding: 0 10px;
  background: #fff4bf;
  color: var(--ink);
  font-size: 12px;
}

.library-grid {
  align-content: start;
  overflow: auto;
}

.library-card {
  display: grid;
  flex: 1 1 100%;
  gap: 5px;
  width: 100%;
  border: 2px solid rgba(23, 23, 23, 0.72);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  padding: 10px;
  text-align: left;
}

.library-card:nth-child(2n) {
  transform: rotate(0.5deg);
}

.library-card:nth-child(2n + 1) {
  transform: rotate(-0.45deg);
}

.library-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card small {
  color: var(--muted);
  font-size: 12px;
}

.busy {
  cursor: progress;
}

@keyframes rise-in {
  from {
    opacity: 0.72;
    transform: translateY(8px) rotate(-0.3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(10px) rotate(-0.6deg) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-0.2deg) scale(1);
  }
}

@keyframes soft-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-4px) rotate(0.6deg);
  }
}

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

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .control-panel {
    grid-column: 1 / -1;
    height: auto;
    min-height: auto;
  }

  body:not(.has-paper) .intake-screen {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 980px) {
  body:not(.has-paper) .intake-screen {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding: 98px 20px 44px;
    overflow: visible;
  }

  body:not(.has-paper) .intake-card {
    width: min(640px, 100%);
  }

  .intake-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    padding: 10px;
  }

  .sidebar,
  .builder,
  .control-panel {
    height: auto;
    min-height: auto;
    transform: none;
  }

  .builder {
    order: 1;
  }

  .sidebar {
    order: 2;
    grid-template-rows: auto auto auto auto auto;
  }

  .control-panel {
    order: 3;
  }

  .builder-top,
  .composer-actions,
  .stage-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .composer-tools {
    width: 100%;
  }

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

  .top-actions button,
  .composer-tools button,
  .file-button {
    width: 100%;
  }

  .top-actions .language-switch {
    width: 100%;
  }

  .top-actions .language-switch button {
    width: auto;
    flex: 1 1 0;
  }

  .intake-screen {
    min-height: auto;
    padding: 28px 18px;
  }

  .intake-card h1 {
    font-size: 50px;
  }

  .comic-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toolbar"
      "banner"
      "stage"
      "thumbs";
  }

  .page-view {
    width: 100%;
    height: auto;
    max-width: 100%;
    min-height: 520px;
    padding: 14px;
  }

  .page-card {
    width: 100%;
    height: auto;
    min-height: 560px;
    aspect-ratio: auto;
    padding: 24px 20px;
  }

  .page-image-card {
    width: min(100%, calc(100vw - 58px));
    height: auto;
  }

  .thumb-row {
    flex-direction: row;
    width: 100%;
    height: 104px;
    min-height: 104px;
    max-height: 104px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
  }

  .thumb {
    flex: 0 0 200px;
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 76px;
    height: 100%;
  }

  .page-body,
  .layout-note .page-body,
  .layout-split .page-body,
  .layout-dark .page-body {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 20px;
  }

  .layout-note .page-bullets {
    grid-template-columns: 1fr;
  }

  .page-card h3 {
    font-size: 36px;
  }

  .page-bullets li {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .page-visual-panel {
    min-height: 230px;
  }

  .paper-sheets {
    inset: 8px 18px 38px 0;
  }

  .insight-card {
    top: 54px;
    width: min(250px, 88%);
  }

  .source-row {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .source-row div {
    justify-content: flex-start;
    max-width: 100%;
  }

  body:not(.has-paper) .landing-nav {
    top: 10px;
    width: min(100% - 20px, 520px);
    min-height: 56px;
    gap: 10px;
    padding: 7px 8px 7px 12px;
  }

  body:not(.has-paper) .landing-brand {
    gap: 8px;
  }

  body:not(.has-paper) .landing-brand .logo-plate {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  body:not(.has-paper) .landing-logo {
    width: 27px;
    height: 27px;
  }

  body:not(.has-paper) .landing-actions {
    gap: 6px;
    padding: 0;
    border-color: transparent;
    background: transparent;
  }

  body:not(.has-paper) .landing-auth-wrap {
    gap: 6px;
  }

  body:not(.has-paper) .landing-auth-wrap .signup-bonus {
    display: none;
  }

  body:not(.has-paper) .landing-user-chip {
    display: none;
  }

  .landing-brand strong {
    font-size: 21px;
  }

  .landing-brand small {
    display: none;
  }

  body:not(.has-paper) .language-switch button {
    min-width: 30px;
    min-height: 30px;
    padding: 0 7px;
  }

  body:not(.has-paper) .landing-action,
  body:not(.has-paper) .landing-console {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12px;
  }

  body:not(.has-paper) .intake-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: auto;
    padding: 88px 18px 46px;
  }

  body:not(.has-paper) .intake-card {
    width: calc(100vw - 56px);
    max-width: 360px;
    justify-items: stretch;
    text-align: center;
  }

  body:not(.has-paper) .intake-card h1 {
    width: 100%;
    max-width: 100%;
    font-size: 62px;
  }

  body:not(.has-paper) .eyebrow {
    justify-self: center;
  }

  body:not(.has-paper) .lede {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
  }

  body:not(.has-paper) .source-composer {
    width: 100%;
    max-width: 360px;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  body:not(.has-paper) .template-picker {
    width: 100%;
    max-width: 360px;
    grid-template-columns: 1fr;
  }

  body:not(.has-paper) .template-section {
    width: 100%;
    max-width: 360px;
  }

  body:not(.has-paper) .template-heading {
    justify-items: center;
    text-align: center;
  }

  body:not(.has-paper) .template-heading h2 {
    font-size: 24px;
  }

  body:not(.has-paper) .template-card {
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
  }

  body:not(.has-paper) .template-card img {
    width: 58px;
    height: 48px;
    aspect-ratio: auto;
  }

  body:not(.has-paper) .source-composer input {
    min-height: 46px;
    padding: 0 12px;
    font-size: 20px;
  }

  body:not(.has-paper) .composer-actions {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 0;
  }

  body:not(.has-paper) .composer-tools {
    width: auto;
  }

  body:not(.has-paper) .composer-tools button,
  body:not(.has-paper) .file-button {
    width: auto;
    flex: 1 1 0;
  }

  body:not(.has-paper) .prompt-row {
    justify-content: center;
  }

  body:not(.has-paper) .gallery-section {
    width: min(100%, 360px);
    margin-top: 18px;
    padding: 16px;
  }

  body:not(.has-paper) .seo-faq-section {
    width: min(100%, 360px);
  }

  .seo-faq-section h2 {
    font-size: 32px;
  }

  .faq-list {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.has-paper) .gallery-head {
    align-items: stretch;
    flex-direction: column;
  }

  body.console-view:not(.has-paper) .intake-screen {
    padding-top: 88px;
  }

  .dashboard-head,
  .dashboard-actions,
  .dashboard-card-top,
  .dashboard-card footer {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-head h2 {
    font-size: 40px;
  }

  .dashboard-actions {
    width: 100%;
  }

  .dashboard-actions button {
    width: 100%;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-card {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 154px;
  }

  .gallery-tools,
  .gallery-pagination {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-pagination span {
    min-width: 0;
  }

  .choice-modal-actions {
    flex-direction: column;
  }

  .choice-modal-actions button {
    width: 100%;
  }

  .page-choice-grid {
    grid-template-columns: 1fr;
  }

  .choice-modal {
    align-items: flex-start;
    overflow: auto;
    padding: 18px;
  }

  .choice-modal-card {
    margin: 42px 0 18px;
    padding: 22px;
  }

  .intake-row {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ------------------------------------------------------------------ */
/* Auth + credits + gallery layered on top of existing layout         */
/* ------------------------------------------------------------------ */

.landing-actions {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
}

.landing-user-chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--ink);
}

.landing-user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(23, 23, 23, 0.14);
  border-radius: 999px;
  background: #dff7fb;
  color: var(--ink);
  overflow: hidden;
  font-size: 13px;
  line-height: 1;
}

.landing-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.credits-pill {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 999px;
  background: rgba(255, 253, 242, 0.72);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  box-shadow: none;
  line-height: 1.2;
  white-space: nowrap;
  cursor: help;
  outline: none;
}

.credits-pill strong {
  min-width: 0;
  max-width: 9ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.credits-label {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(23, 23, 23, 0.72);
}

.credits-info {
  align-self: center;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-left: 1px;
  border: 1px solid rgba(23, 23, 23, 0.24);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  background: rgba(255, 253, 242, 0.82);
  font-family: var(--font-ui);
}

.credits-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: min(220px, calc(100vw - 32px));
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink, #171717);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 6px 18px rgba(23, 23, 23, 0.18);
}

.credits-tooltip::before {
  content: "";
  position: absolute;
  top: -4px;
  right: 14px;
  width: 8px;
  height: 8px;
  background: var(--ink, #171717);
  transform: rotate(45deg);
  border-radius: 1px;
}

.credits-pill:hover .credits-tooltip,
.credits-pill:focus-visible .credits-tooltip,
.credits-pill:focus-within .credits-tooltip {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  body:not(.has-paper) .credits-pill {
    display: none;
    flex: 0 0 auto;
    min-width: 58px;
    max-width: clamp(58px, 21vw, 94px);
    align-items: center;
    gap: 4px;
    padding: 0 8px;
  }

  body:not(.has-paper) .credits-pill strong {
    max-width: 5ch;
  }

  body:not(.has-paper) .credits-label {
    display: none;
  }

  body:not(.has-paper) .credits-tooltip {
    right: 50%;
    transform: translate(50%, -4px);
  }

  body:not(.has-paper) .credits-tooltip::before {
    right: calc(50% - 4px);
  }

  body:not(.has-paper) .credits-pill:hover .credits-tooltip,
  body:not(.has-paper) .credits-pill:focus-visible .credits-tooltip,
  body:not(.has-paper) .credits-pill:focus-within .credits-tooltip {
    transform: translate(50%, 0);
  }
}

@media (max-width: 520px) {
  body:not(.has-paper) .landing-user-chip {
    display: none;
  }
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper-2);
}

.user-card img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid var(--ink);
}

.user-card div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-card strong {
  font-size: 14px;
  color: var(--ink);
}

.user-card small {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.auth-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-button.ghost {
  background: transparent;
  border-style: dashed;
  font-size: 13px;
  padding: 6px 10px;
  min-height: 34px;
}

/* Console dashboard */

.dashboard-section {
  display: none;
  width: 100%;
  gap: 20px;
}

body.console-view:not(.has-paper) .intake-card,
body.console-view:not(.has-paper) .gallery-section {
  display: none;
}

body.console-view:not(.has-paper) .dashboard-section {
  display: grid;
}

body.console-view:not(.has-paper) .intake-screen {
  align-items: flex-start;
  padding-top: 112px;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-head h2 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  line-height: 0.9;
}

.dashboard-head p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.dashboard-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-stat {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: #fffdf2;
  box-shadow: 4px 5px 0 rgba(23, 23, 23, 0.12);
  padding: 12px;
}

.dashboard-stat strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 0.9;
}

.dashboard-stat small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.dashboard-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: stretch;
  min-height: 164px;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: var(--paper-2);
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.12);
  padding: 10px;
  text-align: left;
  white-space: normal;
}

.dashboard-card.generating {
  background: #e7faff;
}

.dashboard-card.failed {
  background: #fff0ea;
}

.dashboard-card:hover {
  transform: translate(-1px, -1px);
}

.dashboard-thumb {
  display: grid;
  min-width: 0;
  place-items: center;
  border: 2px solid rgba(23, 23, 23, 0.76);
  border-radius: 7px;
  background: #fbf1cf;
  overflow: hidden;
}

.dashboard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-thumb span {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.dashboard-card-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.dashboard-card-top,
.dashboard-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-card-top small,
.dashboard-card footer span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-card-body > strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-card-body > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-status {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.dashboard-status.generating {
  background: #dff7fb;
  color: #086778;
}

.dashboard-status.completed {
  background: #e6f6df;
  color: var(--mint);
}

.dashboard-status.failed {
  background: #ffe5dd;
  color: var(--red);
}

.dashboard-progress {
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf2;
  overflow: hidden;
}

.dashboard-progress i {
  display: block;
  height: 100%;
  min-width: 4px;
  background: var(--cyan);
}

.dashboard-card.failed .dashboard-progress i {
  background: var(--red);
}

.dashboard-card footer b {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 12px;
}

.dashboard-empty {
  grid-column: 1 / -1;
  margin: 18px 0 0;
  border: 2px dashed rgba(23, 23, 23, 0.38);
  border-radius: 8px 6px 9px 7px;
  background: rgba(255, 253, 242, 0.7);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

/* Gallery on the home screen */

.gallery-section {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 36px;
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: 8px 6px 9px 7px;
  background: var(--paper-2);
  box-shadow: var(--shadow-md);
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.gallery-tools {
  display: flex;
  flex: 0 1 420px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.gallery-tools input {
  min-width: 0;
  min-height: 38px;
  background: #fffdf2;
  padding: 8px 12px;
  font-size: 13px;
}

.gallery-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.gallery-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gallery-meta > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.gallery-views svg {
  flex-shrink: 0;
}

.gallery-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 4px 6px;
}

.gallery-body strong {
  font-size: 14px;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-body small {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 24px 0;
}

.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.gallery-pagination span {
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.gallery-pagination[hidden] {
  display: none;
}

.seo-faq-section {
  display: grid;
  width: min(1120px, 100%);
  gap: 14px;
  margin: 0 auto;
  padding: 8px 0 0;
}

.seo-faq-section h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(31px, 4vw, 54px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
}

.faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.faq-list details {
  min-width: 0;
  border: 2px solid rgba(23, 23, 23, 0.82);
  border-radius: 8px 6px 7px 8px;
  background: #fffdf2;
  box-shadow: 5px 6px 0 rgba(23, 23, 23, 0.1);
  padding: 14px 15px;
}

.faq-list summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
  list-style-position: outside;
}

.faq-list p {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* Sign-in modal */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 11, 0.45);
  backdrop-filter: blur(2px);
}

.auth-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 18px 14px 20px 16px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-md);
}

.auth-modal-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.01em;
}

.auth-modal-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-modal-bonus {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px dashed rgba(46, 125, 50, 0.4);
  border-radius: 999px;
  background: rgba(95, 207, 137, 0.16);
  color: #1f5132;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
}

.signup-bonus {
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(95, 207, 137, 0.18);
  color: #1f5132;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.signup-bonus[hidden] {
  display: none;
}

.landing-auth-wrap {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.landing-auth-wrap .signup-bonus {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(46, 125, 50, 0.32);
  background: rgba(95, 207, 137, 0.22);
  color: #1f5132;
}

.signup-bonus.sidebar-bonus {
  align-self: center;
  margin-top: 6px;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
}

.auth-provider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-button {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  padding: 10px 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.provider-button.google {
  background: linear-gradient(135deg, #ffffff, #f1f5ff);
}

.provider-button.github {
  background: linear-gradient(135deg, #1f1f1f, #2d2d2d);
  color: #fff;
  border-color: #000;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-form input {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px 10px;
  font-size: 14px;
  color: var(--ink);
}

.auth-form input:focus {
  outline: none;
  box-shadow: var(--ring);
}

.auth-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.auth-form-actions .primary,
.auth-form-actions .ghost {
  flex: 1;
}

.auth-error {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(196, 67, 53, 0.12);
  color: var(--red);
  font-size: 12px;
}

body.auth-open {
  overflow: hidden;
}

/* Generation density modal */

.choice-modal {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.choice-modal[hidden] {
  display: none;
}

.choice-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 11, 0.45);
  backdrop-filter: blur(2px);
}

.choice-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(640px, 100%);
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 12px 9px 14px 10px;
  background: var(--paper-2);
  box-shadow: var(--shadow-md);
  padding: 26px;
}

.choice-modal-card h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 0.95;
}

.choice-modal-sub {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.choice-template-note {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 32px;
  margin: 0;
  border: 2px dashed rgba(23, 23, 23, 0.42);
  border-radius: 999px;
  background: #fffdf2;
  color: var(--ink);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}

.choice-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
}

.page-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.page-choice-card {
  display: grid;
  min-height: 148px;
  align-content: start;
  gap: 7px;
  padding: 16px;
  text-align: left;
  white-space: normal;
}

.page-choice-card:nth-child(2) {
  transform: rotate(0.4deg);
}

.page-choice-card:nth-child(3) {
  transform: rotate(-0.3deg);
}

.page-choice-card strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 0.9;
}

.page-choice-card span {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.page-choice-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
}

.page-choice-card.recommended {
  background: var(--paper-2);
}

.page-choice-card.is-selected {
  background: #dff7fb;
  box-shadow: var(--ring), 4px 5px 0 rgba(23, 23, 23, 0.14);
  transform: translate(-1px, -1px) rotate(0.2deg);
}

.choice-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.choice-modal-actions button {
  min-width: 132px;
}

body.choice-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 18, 28, 0.92);
  color: #f3f5fb;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 30px rgba(15, 18, 28, 0.28);
  max-width: min(82vw, 460px);
  text-align: center;
  pointer-events: none;
  animation: toast-pop 0.2s ease-out;
}

.toast.error {
  background: rgba(196, 67, 53, 0.95);
}

@keyframes toast-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Stripe top-up button + modal */

.topup-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid rgba(23, 23, 23, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.topup-button::before {
  content: "+";
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.topup-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(23, 23, 23, 0.18);
}

.topup-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.topup-button[hidden] {
  display: none;
}

.topup-modal {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.topup-modal[hidden] {
  display: none;
}

.topup-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 11, 0.45);
  backdrop-filter: blur(2px);
}

.topup-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(560px, 100%);
  gap: 12px;
  padding: 28px 28px 22px;
  border: 2px solid var(--ink);
  border-radius: 18px 12px 22px 14px;
  background: var(--paper-2);
  box-shadow: var(--shadow-md);
}

.topup-modal-card .eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topup-modal-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.topup-modal-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.topup-modal-bonus {
  margin: 0;
  padding: 8px 12px;
  border: 1px dashed rgba(46, 125, 50, 0.4);
  border-radius: 999px;
  background: rgba(95, 207, 137, 0.18);
  color: #1f5132;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.topup-modal-bonus[hidden] {
  display: none;
}

.topup-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 20px;
  line-height: 1;
}

.topup-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.topup-amount-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.topup-amount-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(23, 23, 23, 0.16);
}

.topup-amount-card.is-selected {
  background: #dff7fb;
  box-shadow: var(--ring), 4px 5px 0 rgba(23, 23, 23, 0.14);
  transform: translate(-1px, -1px) rotate(0.2deg);
}

.topup-amount-card strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.topup-amount-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.topup-amount-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.topup-custom {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topup-custom input {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 12px;
  font-size: 16px;
  color: var(--ink);
}

.topup-custom input:focus {
  outline: none;
  box-shadow: var(--ring);
}

.topup-summary {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(23, 23, 23, 0.04);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  min-height: 44px;
}

.topup-summary strong {
  font-weight: 800;
}

.topup-error {
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(196, 67, 53, 0.12);
  color: var(--red);
  font-size: 12px;
}

.topup-error[hidden] {
  display: none;
}

.topup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.topup-actions button {
  min-width: 132px;
}

.topup-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

body.topup-open {
  overflow: hidden;
}
