/* ============================================================
   Dirty Little Zine — UI styles
   ============================================================ */

:root {
  /* Monochrome surfaces — black ink on near-white paper. Red is the only color. */
  --bg:         #f1f1f0; /* paper, neutral */
  --bg-card:    #ffffff; /* pure white cards */
  --paper-dark: #d8d8d7;
  --text:       #0a0a0a; /* toner ink */
  --muted:      #6b6b69;
  --border:     #c9c9c6; /* hairline */
  --sidebar:    #e8e8e6; /* sidebar / edit panel surface */
  --stage:      #18181b;
  --accent:     #0a0a0a;
  --stamp:      #1e3a6b; /* the only color — navy ink stamp */
  --stamp-dark: #15294a;

  --radius:    6px;
  --radius-sm: 4px;

  --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-label: 'Special Elite', 'Courier Prime', 'Courier New', monospace;
  --font-display: 'Mouse Memoirs', Impact, 'Arial Black', sans-serif;
  --font-hand:  'Caveat', 'Segoe Script', cursive;
  --font-mono:  'SF Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;

  --shadow-sm: 0 1px 2px rgba(40,30,20,0.08);
  --shadow-md: 0 4px 12px rgba(40,30,20,0.12);
  --shadow-lg: 0 8px 30px rgba(40,30,20,0.18);
  --transition: 0.15s ease;

  /* Paper grain — inline SVG noise, tiled. Neutral gray, no warmth. */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.05  0 0 0 0 0.05  0 0 0 0 0.05  0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  /* Halftone dot strip — two-stop radial gradient tile. */
  --halftone: radial-gradient(circle at 50% 50%, var(--text) 0.8px, transparent 1.2px);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--grain);
  background-size: 180px 180px;
  background-repeat: repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Top bar ---- */

header {
  height: 46px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  gap: 1rem;
  position: relative;
  box-shadow: 0 2px 0 var(--stamp), 0 3px 0 var(--accent);
}

/* Halftone dot strip hugging the header's bottom edge — printshop tell. */
header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 4px;
  background-image: radial-gradient(circle at 50% 50%, var(--accent) 0.9px, transparent 1.4px);
  background-size: 5px 4px;
  background-repeat: repeat-x;
  opacity: 0.55;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  line-height: 1;
}

.logo {
  font-family: 'Mouse Memoirs', Impact, sans-serif;
  color: #ffffff;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.paper-toggle {
  display: flex;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

.paper-toggle button {
  background: transparent;
  color: rgba(255,253,246,0.55);
  border: none;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  transition: all var(--transition);
}

.paper-toggle button.active {
  background: var(--bg);
  color: var(--accent);
  font-weight: 400;
  text-shadow: 0 0 0 var(--accent);
}

.paper-toggle button:not(.active):hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.08);
}

.export-btn {
  background: transparent;
  color: rgba(255,253,246,0.6);
  border: 1px solid rgba(255,253,246,0.18);
  padding: 0.32rem 0.8rem;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.export-btn:hover {
  color: var(--bg);
  border-color: rgba(255,253,246,0.45);
  background: rgba(255,253,246,0.08);
}

/* The stamp. One rotated, pressed, loud element. */
.export-btn.primary {
  color: var(--bg);
  background: var(--stamp);
  border: 2px solid var(--stamp);
  font-family: var(--font-label);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  padding: 0.38rem 0.95rem;
  transform: rotate(-2deg);
  box-shadow:
    0 0 0 2px var(--accent),
    3px 3px 0 0 var(--accent),
    inset 0 0 0 1px rgba(255,253,246,0.18);
  border-radius: 2px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.export-btn.primary:hover {
  background: var(--stamp-dark);
  transform: rotate(-2deg) translate(-1px, -1px);
  box-shadow:
    0 0 0 2px var(--accent),
    4px 4px 0 0 var(--accent),
    inset 0 0 0 1px rgba(255,253,246,0.25);
}

.export-btn.primary:active {
  transform: rotate(-2deg) translate(2px, 2px);
  box-shadow:
    0 0 0 2px var(--accent),
    1px 1px 0 0 var(--accent),
    inset 0 0 0 1px rgba(0,0,0,0.15);
}

/* ---- Workspace ---- */

.workspace {
  display: flex;
  height: calc(100vh - 46px - 36px);
  overflow: hidden;
}

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

.app-footer {
  flex-shrink: 0;
  height: 36px;
  background: var(--bg-card);
  border-top: 1.5px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1.5rem;
  gap: 0;
  font-family: var(--font-label);
  font-size: 0.72rem;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  user-select: none;
  position: relative;
}

.app-footer .footer-privacy {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-size: 0.72rem;
}

/* Made with love signature anchors the right edge. Drop its preceding middot
   so it sits apart from the rest of the row. */
.app-footer .footer-love {
  margin-left: auto;
}
.app-footer > .footer-love::before {
  content: none;
}

.app-footer > * {
  white-space: nowrap;
  flex-shrink: 0;
}

.app-footer .footer-copy,
.app-footer .footer-privacy {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colophon middot between footer items. Hidden children (e.g. privacy on
   mobile) drop their separator automatically because ::before doesn't render
   on display:none elements. */
.app-footer > * + *::before {
  content: "·";
  color: var(--muted);
  margin: 0 0.95em;
  display: inline-block;
  letter-spacing: 0;
  opacity: 0.7;
}

.app-footer .heart {
  color: var(--stamp);
  font-size: 0.82rem;
  line-height: 1;
  vertical-align: -1px;
}

.app-footer .footer-love {
  font-family: var(--font-hand);
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.app-footer a.footer-love:hover {
  color: var(--stamp);
}

.app-footer a.footer-love:hover .heart {
  transform: scale(1.15);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-footer .heart {
  display: inline-block;
  transition: transform 0.18s ease;
}

.footer-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  text-decoration-style: dashed;
  transition: color var(--transition);
  cursor: pointer;
}
.footer-link:hover { color: var(--stamp); }

.footer-tip {
  color: var(--stamp);
  text-decoration-color: var(--stamp);
}
.footer-tip:hover {
  color: var(--text);
  text-decoration-style: solid;
}

/* ---- How-it-works modal ---- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 100;
  animation: modal-fade 0.18s ease-out;
}
.modal[aria-hidden="false"] { display: flex; }

.modal-title {
  font-family: var(--font-label);
  color: var(--bg);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-align: center;
  padding: 0.25rem 0.8rem;
  border: 2px solid var(--bg);
  background: var(--stamp);
  transform: rotate(-1deg);
  box-shadow: 3px 3px 0 var(--bg);
}

/* Stamp-settle entrance — fires when the modal opens. */
.modal[aria-hidden="false"] .modal-title {
  animation: stamp-settle 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) 0.06s both;
}

@keyframes stamp-settle {
  0%   { opacity: 0; transform: rotate(4deg) scale(0.85) translateY(-6px); }
  60%  { opacity: 1; transform: rotate(-2.5deg) scale(1.03) translateY(0); }
  100% { opacity: 1; transform: rotate(-1deg) scale(1) translateY(0); }
}

.modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}

.modal img {
  max-width: 90vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  box-shadow: 6px 6px 0 var(--stamp), 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--bg);
  border-radius: 2px;
  background: var(--bg);
}

.modal-card {
  position: relative;
  display: inline-block;
  line-height: 0;
}

/* ---- How-to-fold (text steps) ---- */

#how-it-works-modal {
  overflow-y: auto;
  align-items: safe center;
}

.fold-content {
  width: min(560px, 92vw);
  max-height: none;
  padding-bottom: 0.5rem;
}

.fold-card {
  position: relative;
  background: var(--bg);
  border: 2px solid var(--text);
  border-radius: 2px;
  padding: 1.4rem 1.6rem 1.3rem;
  box-shadow: 6px 6px 0 var(--stamp), 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 100%;
}

.fold-intro {
  font-family: var(--font-label);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1.5px dashed var(--border);
  text-align: center;
}

.fold-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.fold-step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.fold-step-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
  font-family: var(--font-label);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  margin-top: 0.1rem;
  box-shadow: 2px 2px 0 var(--stamp);
}

.fold-step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.1rem;
}

.fold-step-title {
  font-family: var(--font-label);
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.fold-step-desc {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}

.fold-step-desc em {
  font-style: italic;
  color: var(--stamp);
  font-weight: 600;
}

.fold-tip {
  margin: 1.1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1.5px dashed var(--border);
  font-family: var(--font-hand);
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  transform: rotate(-0.5deg);
}

@media (max-width: 480px) {
  .fold-card { padding: 1.15rem 1.1rem 1.1rem; }
  .fold-step-num { width: 26px; height: 26px; font-size: 0.8rem; }
  .fold-step-desc { font-size: 0.82rem; }
}

.fold-videos {
  margin-top: 1.4rem;
  width: min(520px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding-top: 1.1rem;
  border-top: 1.5px dashed rgba(241, 241, 240, 0.35);
}

.fold-videos-label {
  font-family: var(--font-label);
  color: var(--bg);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.2rem 0.7rem;
  background: var(--bg);
  color: var(--text);
  transform: rotate(-1.2deg);
  box-shadow: 2px 2px 0 var(--stamp);
}

.fold-videos-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  width: 100%;
}

.fold-video {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem 0.55rem 0.55rem;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  border: 2px solid var(--text);
  border-radius: 2px;
  box-shadow: 4px 4px 0 var(--stamp);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  min-width: 200px;
}

.fold-video:nth-child(odd)  { transform: rotate(-0.8deg); }
.fold-video:nth-child(even) { transform: rotate(0.8deg); }

.fold-video:hover {
  background: var(--bg-card);
  transform: translate(-1px, -2px) rotate(0deg);
  box-shadow: 6px 6px 0 var(--stamp);
}
.fold-video:active {
  transform: translate(2px, 2px) rotate(0deg);
  box-shadow: 1px 1px 0 var(--stamp);
}
.fold-video:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 3px;
}

.fold-video-play {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--stamp);
  color: var(--bg);
  font-size: 0.7rem;
  padding-left: 2px; /* optically center the triangle */
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--bg), 0 0 0 1.5px var(--stamp);
}

.fold-video-text {
  display: inline-flex;
  flex-direction: column;
  gap: 0.12rem;
  line-height: 1.15;
}

.fold-video-name {
  font-family: var(--font-label);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fold-video-meta {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fold-video-arrow {
  flex: 0 0 auto;
  margin-left: 0.25rem;
  font-size: 0.95rem;
  color: var(--stamp);
  transition: transform 0.18s ease;
}
.fold-video:hover .fold-video-arrow {
  transform: translate(2px, -2px);
}

@media (max-width: 520px) {
  .fold-videos-list { flex-direction: column; align-items: stretch; }
  .fold-video { min-width: 0; width: 100%; }
}

/* ---- About modal: portrait + bio ---- */

.about-content {
  max-width: min(720px, 92vw);
}

.about-body {
  position: relative;
  display: flex;
  gap: 1.75rem;
  align-items: stretch;
  background: var(--bg);
  border: 2px solid var(--bg);
  padding: 1.25rem;
  border-radius: 2px;
  box-shadow: 6px 6px 0 var(--stamp), 0 20px 60px rgba(0, 0, 0, 0.5);
}

.about-modal .about-photo {
  flex: 0 0 260px;
  width: 260px;
  max-width: 260px;
  height: auto;
  max-height: 65vh;
  object-fit: cover;
  align-self: flex-start;
  border: 1px solid var(--text);
  border-radius: 0;
  filter: grayscale(1) contrast(1.05);
  background: var(--bg-card);
  box-shadow: 4px 4px 0 var(--text);
}

.about-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0.25rem 0.25rem 0.25rem 0;
}

.about-lede {
  font-family: var(--font-label);
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

.about-text p { margin: 0; }

.about-links {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1.5px dashed var(--border);
  font-family: var(--font-label);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.about-links a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.about-links a:hover { color: var(--stamp); }

.about-links .about-sep {
  display: inline-block;
  padding: 0 0.4rem;
  color: var(--muted);
}

/* ---- Tip modal ---- */

.tip-footnote {
  color: var(--muted);
  font-style: italic;
  font-size: 0.88rem;
}

.tip-cta {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  background: var(--stamp);
  color: var(--bg);
  font-family: var(--font-label);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid var(--stamp);
  border-radius: 2px;
  box-shadow: 4px 4px 0 var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.tip-cta:hover {
  background: var(--stamp-dark);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--text);
  color: var(--bg);
}
.tip-cta:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}
.tip-cta-arrow {
  display: inline-block;
  transition: transform 0.18s ease;
}
.tip-cta:hover .tip-cta-arrow {
  transform: translateX(3px);
}

@media (max-width: 640px) {
  .about-body {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .about-photo {
    flex: 0 0 auto;
    width: 100%;
    max-width: 320px;
    max-height: 40vh;
    align-self: center;
  }
  .about-text { font-size: 0.9rem; }
  .about-lede { font-size: 1.15rem; }
  .tip-cta { align-self: stretch; justify-content: center; }
}

/* ---- Confirm modal ---- */

.confirm-content {
  width: min(420px, 92vw);
}
.confirm-card {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--text);
  border-radius: 2px;
  padding: 1.4rem 1.4rem 1.2rem;
  box-shadow: 6px 6px 0 var(--stamp), 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.confirm-message {
  margin: 0;
  font-family: var(--font-body, var(--font-ui));
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  text-align: center;
}
.confirm-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
}
.confirm-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.65rem 1rem;
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.confirm-btn-cancel {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--text);
  box-shadow: 2px 2px 0 var(--text);
}
.confirm-btn-cancel:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--text);
}
.confirm-btn-cancel:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--text);
}
.confirm-btn-ok {
  background: var(--stamp);
  color: var(--bg);
  border: 2px solid var(--stamp);
  box-shadow: 3px 3px 0 var(--text);
}
.confirm-btn-ok:hover {
  background: var(--stamp-dark, var(--stamp));
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}
.confirm-btn-ok:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

.modal-close {
  position: absolute;
  top: -0.85rem;
  right: -0.85rem;
  z-index: 2;
  background: var(--text);
  color: var(--bg);
  border: 0;
  font-family: var(--font-label);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  padding: 0.55rem 0.95rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transform: rotate(4deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.55);
  opacity: 1;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.18s ease;
}
.modal-close:hover {
  transform: rotate(4deg) translate(1px, -1px) scale(1.05);
  box-shadow: 3px 5px 0 rgba(0, 0, 0, 0.6);
}
.modal-close:active {
  transform: rotate(4deg) translate(1px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}
.modal-close-x {
  font-size: 1.05rem;
  line-height: 1;
  font-family: var(--font-ui);
  letter-spacing: 0;
  opacity: 0.85;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Sidebar ---- */

#sidebar {
  width: 130px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1.5px dashed var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.8rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}

#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

.slide-thumb {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.35rem 0.35rem 0.3rem 0.4rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.07);
  transition: all var(--transition);
  position: relative;
}

.slide-thumb:hover {
  border-color: var(--text);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
}
.slide-thumb[draggable="true"] { cursor: grab; }
.slide-thumb[draggable="true"]:active { cursor: grabbing; }
.slide-thumb.dragging { opacity: 0.35; }
.slide-thumb.drag-over { border-color: var(--text); }

.slide-thumb.active {
  border-color: var(--text);
  box-shadow: 3px 3px 0 var(--accent);
}

/* Active-thumb navy bar. Slides down when selected; retracts when deselected. */
.slide-thumb::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--stamp);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
}

.slide-thumb.active::before {
  transform: scaleY(1);
}

.slide-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.slide-thumb-label {
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  line-height: 1;
}

.slide-thumb.active .slide-thumb-label {
  color: var(--text);
  font-weight: 400;
}

/* START FROM SCRATCH — sits below the back-cover thumb in the sidebar.
   Card-style with a hard navy drop shadow, matching the rad.txt CTA
   vocabulary so it reads as a real action, not a footnote. */
.clear-zine-btn {
  margin-top: 0.85rem;
  width: 100%;
  padding: 0.6rem 0.4rem;
  background: var(--bg-card);
  border: 1.5px solid var(--text);
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--stamp);
  transition: transform var(--transition), box-shadow var(--transition), color var(--transition), background var(--transition);
  /* Entrance: stamp-settle vocab without the rotation (it's a card, not a
     stamp). Fires whenever the button goes from hidden → visible, so first-
     time users notice it land. The shadow blooms then settles. */
  animation: scratch-button-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes scratch-button-in {
  0%   { opacity: 0; transform: translateY(-6px) scale(0.85); box-shadow: 0 0 0 transparent; }
  55%  { opacity: 1; transform: translateY(2px)  scale(1.05); box-shadow: 4px 4px 0 var(--stamp); }
  100% { opacity: 1; transform: translateY(0)    scale(1);    box-shadow: 2px 2px 0 var(--stamp); }
}

@media (prefers-reduced-motion: reduce) {
  .clear-zine-btn { animation: none; }
}

.clear-zine-btn:hover:not(.is-disabled) {
  color: var(--stamp);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--stamp);
}

.clear-zine-btn:active:not(.is-disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--stamp);
}

.clear-zine-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  background: transparent;
}

.clear-zine-btn[hidden] {
  display: none;
}

/* ---- Main area ---- */

#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- Slide stage ---- */

#slide-view {
  flex: 1;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
  padding: 1.5rem;
  position: relative;
}

/* Corner registration mark — small printshop tell in the top-right of the stage. */
#slide-view::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 5px, var(--stamp) 5px 6.5px, transparent 6.5px),
    linear-gradient(90deg, transparent 47%, var(--stamp) 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, var(--stamp) 47% 53%, transparent 53%);
  opacity: 0.7;
  pointer-events: none;
}

#slide-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3);
  border-radius: 2px;
  touch-action: none;
}

/* ---- Edit panel ---- */

#edit-panel {
  flex-shrink: 0;
  height: 180px;
  border-top: 1.5px dashed var(--border);
  background: var(--sidebar);
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: stretch;
  padding: 0 1.25rem;
  gap: 1.25rem;
}

/* Cover edit */

.cover-edit {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  padding: 0.9rem 0;
}

.cover-photo-zone {
  flex-shrink: 0;
  width: 96px;
  height: 140px;
  border: 1.5px dashed var(--text);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  background: var(--bg-card);
}

.cover-photo-zone:hover,
.cover-photo-zone.drag-over {
  border-color: var(--stamp);
  background: var(--bg);
  box-shadow: 2px 2px 0 var(--accent);
}

.cover-photo-zone.drag-over {
  transform: scale(1.02);
}

.cover-photo-zone .drop-label {
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.08em;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
  text-transform: uppercase;
}

.cover-photo-zone .thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 1px);
}

.cover-photo-zone .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-family: var(--font-ui);
  transition: background var(--transition);
}

.cover-photo-zone .remove-btn:hover { background: rgba(0,0,0,0.85); }

.cover-photo-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.cover-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.9rem 0;
  min-width: 0;
}

.cover-inputs .row {
  display: flex;
  gap: 0.5rem;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.edit-field label {
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.edit-field input[type="text"] {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--text);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  border-radius: 2px;
  transition: border-color 0.18s ease, box-shadow 0.2s ease, transform 0.2s ease;
  -webkit-appearance: none;
}

.edit-field input[type="text"]:focus {
  border-color: var(--stamp);
  box-shadow: 3px 3px 0 var(--accent);
  transform: translate(-1px, -1px);
}

.edit-field input[type="text"]::placeholder { color: var(--muted); opacity: 0.55; font-family: var(--font-label); letter-spacing: 0.04em; }

/* Font picker (in edit panel) */

.font-picker-row {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.font-btn {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--text);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  transition: all var(--transition);
  border-radius: 2px;
  white-space: nowrap;
}

.font-btn:hover {
  background: var(--bg);
  box-shadow: 2px 2px 0 var(--accent);
  transform: translate(-1px, -1px);
}

.font-btn.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg-card);
  box-shadow: 2px 2px 0 var(--stamp);
}

.font-btn.active:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--stamp);
}

/* Overlay slider */

.overlay-slider {
  width: 100%;
  height: 4px;
  cursor: pointer;
  accent-color: var(--text);
  border-radius: 2px;
}

/* Spread / page edit */

/* Side-by-side page columns */

.page-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 0;
  min-width: 0;
}

.page-col + .page-col {
  margin-left: 1.25rem;
  padding-left: 1.25rem;
  border-left: 1.5px dashed var(--border);
}

.page-col-top {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.page-row-name {
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.page-col-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  align-items: flex-end;
}

.page-col-controls .edit-field {
  flex: 0 0 auto;
  position: relative;
}

/* Hint floats below the Fit toggle without contributing to the field's
   height — keeps the row of toggles bottom-aligned regardless of mode. */
.page-col-controls .fit-pan-hint {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.55rem;
  pointer-events: none;
}

.page-col-controls .font-picker-row {
  flex-wrap: nowrap;
}

/* Back cover edit (simple column) */
.page-edit-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0;
}

.page-col-label {
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Page photo zone (spread panels — matches cover photo zone style) */

.page-photo-slots {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  align-items: center;
}

.photo-swap-btn {
  background: var(--bg-card);
  border: 1px solid var(--text);
  border-radius: 2px;
  color: var(--text);
  font-size: 0.8rem;
  width: 22px;
  height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all var(--transition);
  font-family: var(--font-ui);
}

.photo-swap-btn:hover {
  border-color: var(--stamp);
  color: var(--stamp);
  background: var(--bg);
  box-shadow: 2px 2px 0 var(--accent);
  transform: translate(-1px, -1px);
}

.page-photo-zone {
  flex-shrink: 0;
  width: 80px;
  height: 56px;
  border: 1.5px dashed var(--text);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  background: var(--bg-card);
}

.page-photo-zone:hover,
.page-photo-zone.drag-over {
  border-color: var(--stamp);
  background: var(--bg);
  box-shadow: 2px 2px 0 var(--accent);
}

.page-photo-zone.drag-over {
  transform: scale(1.025);
}

.page-photo-zone .drop-label {
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.08em;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
  text-transform: uppercase;
}

.page-photo-zone .thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 1px);
}

.page-photo-zone .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-family: var(--font-ui);
  transition: background var(--transition);
}

.page-photo-zone .remove-btn:hover { background: rgba(0,0,0,0.85); }

.page-photo-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Legacy photo slots (back cover) */

.photo-slots {
  display: flex;
  gap: 0.3rem;
  align-items: stretch;
}

.photo-drop-zone {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  background: rgba(0,0,0,0.015);
}

.photo-drop-zone:hover,
.photo-drop-zone.drag-over {
  border-color: var(--stamp);
  background: var(--bg);
  box-shadow: 2px 2px 0 var(--accent);
}

.photo-drop-zone.drag-over {
  transform: scale(1.03);
}

.photo-drop-zone .drop-label {
  font-family: var(--font-label);
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.06em;
  pointer-events: none;
  text-transform: uppercase;
}

.photo-drop-zone .thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 1px);
}

.photo-drop-zone .remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-family: var(--font-ui);
  transition: background var(--transition);
}

.photo-drop-zone .remove-btn:hover { background: rgba(0,0,0,0.85); }

.photo-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.caption-input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--text);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  border-radius: 2px;
  transition: border-color 0.18s ease, box-shadow 0.2s ease, transform 0.2s ease;
  resize: none;
  line-height: 1.3;
}

.caption-input:focus {
  border-color: var(--stamp);
  box-shadow: 3px 3px 0 var(--accent);
  transform: translate(-1px, -1px);
}

.caption-input::placeholder { color: var(--muted); opacity: 0.55; font-size: 0.7rem; font-family: var(--font-label); letter-spacing: 0.04em; }

/* Page edit control buttons — use same .font-btn as cover */

.caption-ctrl-btn {
  min-width: 30px !important;
  text-align: center;
}

/* Disabled caption controls */
.edit-field.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.fit-pan-hint {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-label);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.65;
  text-align: center;
}

.fit-pan-hint[hidden] {
  display: none;
}

.cover-photo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

/* ============================================================
   Spread mobile tabs — hidden on desktop, shown via @media below.
   The wrapper itself is a pass-through row on desktop so the two
   .page-col siblings keep their current side-by-side layout.
   ============================================================ */

.spread-tabs { display: none; }

/* On desktop the wrapper dissolves so .page-col children layout exactly
   as they did before this wrapper was introduced. */
.spread-edit-mobile { display: contents; }

/* ============================================================
   Mobile (≤ 767px)
   Everything below is mobile-only. Desktop layout is untouched.
   ============================================================ */

@media (max-width: 767px) {

  html, body { font-size: 13px; }

  /* ---- Header (compact) ---- */
  header {
    height: 44px;
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .logo { font-size: 1.2rem; }
  .header-right { gap: 0.4rem; }
  .paper-toggle button {
    padding: 0.35rem 0.5rem;
    font-size: 0.58rem;
  }
  .export-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.58rem;
  }

  /* ---- Workspace: stacked column. #main-area is dissolved via
     display:contents so sidebar can sit between its two children. ---- */
  .workspace {
    flex-direction: column;
    height: calc(100vh - 44px - 44px);
    height: calc(100dvh - 44px - 44px);
  }

  /* ---- App footer (mobile) ---- */
  .app-footer {
    height: 44px;
    padding: 0 0.75rem;
    gap: 0.5rem;
    font-size: 0.6rem;
  }
  .app-footer .footer-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 2px;
  }
  .app-footer .footer-privacy { display: none; }
  /* On mobile the heart signature duplicates WHO MADE THIS — keep the link,
     drop the signature so the row fits without overflow. */
  .app-footer .footer-love { display: none; }
  .app-footer .heart { font-size: 0.65rem; }
  #main-area { display: contents; }

  #slide-view {
    order: 1;
    flex: 1 1 0;
    padding: 0.65rem;
    min-height: 0;
  }

  /* ---- Sidebar → horizontal thumb strip under the canvas ---- */
  #sidebar {
    order: 2;
    width: 100%;
    height: 78px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.45rem 0.75rem;
    gap: 0.45rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  #sidebar::-webkit-scrollbar { height: 2px; width: auto; }

  /* #slide-list is block by default. On mobile make it a flex row so
     all thumbs line up horizontally inside the scrollable container.
     padding-right gives the trailing button breathing room from the
     viewport edge when scrolled fully right (#sidebar's padding-right
     and the button's margin-right are both ignored at the scroll end
     in mobile WebKit). Using `min-width: max-content` (rather than
     `width: max-content`) so the list's intrinsic width includes the
     padding instead of capping at the parent's width. */
  #slide-list {
    display: flex;
    flex-direction: row;
    gap: 0.45rem;
    width: auto;
    min-width: max-content;
    align-items: center;
    padding-right: 0.85rem;
  }

  .slide-thumb {
    flex: 0 0 auto;
    width: 56px;
    padding: 0.18rem;
    gap: 3px;
    scroll-snap-align: start;
  }
  .slide-thumb canvas {
    max-height: 44px;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
  }
  .slide-thumb-label {
    font-size: 0.48rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }

  .clear-zine-btn {
    flex: 0 0 auto;
    width: auto;
    /* Dashed separator from the thumb row so the partial-edge visibility
       reads "more here" rather than "clipped layout". */
    margin: 0 0 0 0.85rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.55rem;
    align-self: center;
    white-space: nowrap;
    box-shadow: 2px 2px 0 var(--stamp);
    position: relative;
  }


  /* Vertical dashed divider visually separating the action from the thumbs */
  .clear-zine-btn::before {
    content: '';
    position: absolute;
    left: -0.55rem;
    top: 10%;
    bottom: 10%;
    border-left: 1.5px dashed var(--border);
  }

  /* On mobile the toggles wrap to multiple rows, so an absolutely-positioned
     hint sitting at top:100% of the FIT field would overlap the SIZE label
     wrapped beneath it. Switch to in-flow positioning so the hint instead
     adds to the FIT field's height and pushes the next wrapped row down.
     (Drag-to-pan now works on touch — see Pointer Events handler.) */
  .page-col-controls .fit-pan-hint {
    position: static;
    margin-top: 0.35rem;
  }

  /* ---- Edit panel: vertical stack, bounded scroll ---- */
  #edit-panel {
    order: 3;
    height: auto;
    max-height: 45vh;
    max-height: 45dvh;
    padding: 0.85rem 0.9rem 1.1rem;
    overflow-x: hidden;
    overflow-y: auto;
    flex-direction: column;
    gap: 0.9rem;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Cover / back cover edit ---- */
  .cover-edit {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    padding: 0;
    width: 100%;
  }
  .cover-photo-zone {
    width: 100%;
    height: 112px;
  }
  .cover-photo-zone .drop-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
  }
  .cover-inputs {
    flex: none;
    padding: 0;
    gap: 0.65rem;
    width: 100%;
  }
  .cover-inputs .row {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
  }

  /* Inputs: 16px prevents iOS focus-zoom */
  .edit-field label { font-size: 0.64rem; }
  .edit-field input[type="text"] {
    font-size: 16px;
    padding: 0.55rem 0.65rem;
  }
  .caption-input {
    font-size: 16px;
    padding: 0.5rem 0.6rem;
  }
  .caption-input::placeholder { font-size: 0.82rem; }

  /* Touch-friendly toggle buttons */
  .font-btn {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    min-height: 40px;
  }
  .font-btn.caption-ctrl-btn { min-width: 44px; }
  /* Override inline style="min-width:32px" on cover size/align/hAlign buttons */
  .font-picker-row .font-btn[style*="min-width"] { min-width: 44px !important; }

  .overlay-slider { height: 6px; }

  /* ---- Spread edit: mobile tabs + single-column view ---- */
  .spread-tabs {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--text);
    border-radius: 2px;
    padding: 2px;
    gap: 2px;
    width: 100%;
    margin-bottom: 0.15rem;
  }
  .spread-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.6rem 0.5rem;
    font-family: var(--font-label);
    font-size: 0.74rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    border-radius: 0;
    transition: all var(--transition);
  }
  .spread-tab.active {
    background: var(--text);
    color: var(--bg-card);
  }

  .spread-edit-mobile {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .spread-edit-mobile .page-col { display: none; }
  .spread-edit-mobile .page-col.mobile-active { display: flex; }

  #edit-panel .page-col {
    width: 100%;
    padding: 0;
  }
  #edit-panel .page-col + .page-col {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }

  .page-col-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }
  .page-photo-slots {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .page-photo-zone {
    width: 120px;
    height: 84px;
    flex: 0 0 120px;
  }
  .page-photo-slots .photo-drop-zone {
    width: 120px;
    height: 84px;
    flex: 0 0 120px;
  }
  .page-col-controls {
    flex-wrap: wrap;
    gap: 0.85rem 1rem;
    width: 100%;
    /* On mobile the hint sits in flow under the FIT toggle (see below).
       Top-align so the hint only adds height between row 1 and row 2 —
       it doesn't shift FIT's label up relative to ALIGN/POSITION. */
    align-items: flex-start;
  }
  /* Groups wrap; buttons inside a group stay horizontal. */
  .page-col-controls .edit-field { flex: 0 0 auto; }
  .page-col-controls .font-picker-row { flex-wrap: nowrap; gap: 0.25rem; }

  /* Small toggle rows (≤4 buttons) keep their buttons on one line; the
     7-font picker keeps its wrap behavior so it doesn't overflow. */
  .font-picker-row:not(:has(> *:nth-child(5))) {
    flex-wrap: nowrap;
    gap: 0.25rem;
  }
}
