/* The Coloring Sheets v6 — inner pages, admin and sheet page.
   Landing template theme (cream #faf9f4, green #b9e36b / #294c2c, ink
   #20231f, DM Sans body + Outfit headings). Loaded AFTER landing.css,
   which owns the site chrome (header, footer, .wrap, .btn, .chips,
   .pricing-grid, .section-head). This file adds only what landing.css
   does not cover: masonry .pin cards, the sheet page, admin tables,
   auth cards, flashes and forms. */
:root {
  --bg: #faf9f4;
  --surface: #ffffff;
  --fg: #20231f;
  --muted: #697165;
  --line: #e7e9df;
  --accent: #294c2c;
  --accent-fg: #ffffff;
  --accent-soft: #eef4e3;
  --warm: #b9e36b;
  --warm-fg: #24351e;
  --good: #2f7a3d;
  --good-soft: #e6f4e2;
  --bad: #c93a46;
  --bad-soft: #fdeaec;
  --warn-soft: #fff4d6;
  --warn-fg: #6b4b00;
  --paper: #fffdf9;
  --ink: #1b1b22;
  --text: var(--fg);
  --red: #e5483f;
  --red-dark: #c73a33;
  --shadow: 0 8px 28px rgba(32, 35, 31, .08);
  --display: 'Outfit', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ui: 'DM Sans', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.55;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.625rem, 3vw, 2.125rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: clamp(1.25rem, 2vw, 1.625rem); font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 1.02rem; font-weight: 600; }
.btn, .chip, .pill, .mode, label, .badge, .count, .eyebrow, summary, .ov a, table, .status, .crumbs { font-family: var(--ui); }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.fine { font-size: .84rem; color: var(--muted); }
section { padding-block: 44px; }
.acct-meta { font-size: .85rem; color: var(--muted); font-weight: 600; }
@media (max-width: 900px) { .acct-meta { display: none; } }

/* buttons and forms */
.btn:not(:where(.site-header *)) { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-warm { background: var(--warm); color: var(--warm-fg); }
.btn-warm:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--fg); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-small { min-height: 34px; padding: 5px 12px; font-size: .88rem; border-radius: 8px; }
.btn[disabled], .btn.locked { opacity: .6; cursor: not-allowed; }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=search], input[type=password], select, textarea {
  font: inherit; width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 14px; background: var(--surface); color: var(--fg);
}
textarea { min-height: 90px; resize: vertical; }
label { font-weight: 600; font-size: .9rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.chip { font: inherit; font-size: .9rem; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 5px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on, .chip[aria-pressed="true"] { background: #25281f; color: #fff; border-color: #25281f; }
.pill { font-size: .74rem; font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); display: inline-block; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label { font-weight: 500; }
.radios input { position: absolute; opacity: 0; pointer-events: none; }
.radios span { display: inline-block; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.radios input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.radios input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* flash messages */
.flash { margin: 12px 0 0; padding: 12px 16px; border-radius: 10px; font-weight: 500; }
.flash.success { background: var(--good-soft); color: var(--good); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.info { background: var(--accent-soft); color: var(--accent); }

/* category chips and masonry gallery */
.cats { display: flex; gap: 8px; overflow-x: auto; padding-block: 6px 14px; scrollbar-width: thin; }
.cats .chip { flex: 0 0 auto; }
.head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.head.center { align-items: center; text-align: center; }
.head p { color: var(--muted); max-width: 62ch; }
.masonry { column-width: 220px; column-gap: 14px; }
.pin { break-inside: avoid; margin: 0 0 14px; position: relative; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.pin .shot { display: block; background: var(--paper); padding: 10px; }
.pin .shot svg { width: 100%; height: auto; display: block; }
.pin img { display: block; width: 100%; height: auto; }
.pin .cap { padding: 9px 12px 11px; display: flex; flex-direction: column; gap: 2px; }
.pin .cap a { text-decoration: none; }
.pin .cap b { font-size: .92rem; line-height: 1.25; }
.pin .cap span { font-size: .76rem; color: var(--muted); }
.ov { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 6px; padding: 10px; opacity: 0; transition: opacity .15s; }
.pin:hover .ov, .pin:focus-within .ov { opacity: 1; }
@media (hover: none) { .ov { opacity: 1; } }
.ov a { font-size: .74rem; font-weight: 700; text-decoration: none; background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); border-radius: 8px; padding: 4px 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, .12); }
.ov a:hover { border-color: var(--accent); color: var(--accent); }
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; align-items: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--surface); border: 1.5px dashed var(--line); border-radius: 14px; }

/* plans (admin dashboard) */
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.plan { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan.best { border: 2.5px solid var(--accent); }
.badge { position: absolute; top: -12px; left: 18px; background: var(--accent); color: var(--accent-fg); font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 3px 12px; }
.price { font-family: var(--display); font-weight: 700; font-size: 2rem; }
.price small { font-family: var(--body); font-size: .88rem; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: .92rem; flex: 1; }
.plan li { padding-left: 22px; position: relative; }
.plan li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 10px; height: 6px; border-left: 2.5px solid var(--good); border-bottom: 2.5px solid var(--good); transform: rotate(-45deg); }

/* FAQ */
details:not(:where(.site-header *)) { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; }
details + details:not(:where(.site-header *)) { margin-top: 10px; }
summary:not(:where(.site-header *)) { font-weight: 700; cursor: pointer; }
details p { color: var(--muted); margin-top: 8px; max-width: 72ch; }

/* page detail */
.crumbs { font-size: .86rem; color: var(--muted); padding-block: 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); }
.detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 32px; align-items: start; }
.sheet { background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: clamp(10px, 3vw, 28px); box-shadow: var(--shadow); }
.sheet img { display: block; margin-inline: auto; max-height: 82vh; width: auto; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.dlgrid { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.dlgrid .wide { grid-column: 1 / -1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.notice { background: var(--warn-soft); color: var(--warn-fg); border-radius: 10px; padding: 10px 14px; font-size: .9rem; font-weight: 500; }
.box { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 20px; }
.narrow { max-width: 520px; margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* generator */
.progress { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.spinner { width: 20px; height: 20px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.result { display: grid; gap: 14px; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
.result .sheet { padding: 10px; }

/* admin tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; font-size: .92rem; vertical-align: top; }
th { background: var(--accent-soft); }

@media (max-width: 820px) {
  .detail, .result { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  body { background: #fff; padding: 0; }
  header, footer, .panel, .crumbs, .flash, .related, .skip { display: none !important; }
  .detail { display: block; }
  .sheet { border: 0; box-shadow: none; padding: 0; }
  .sheet img { max-height: none; width: 100%; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .chip { transition: border-color .15s, filter .15s, color .15s; } }

/* auth cards and small helpers */
.authcard { max-width: 440px; margin: 48px auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.authcard h1 { font-size: 1.5rem; margin-bottom: 6px; }
.authcard form { display: grid; gap: 12px; margin-top: 16px; }
.authcard label, .fld label { font: 500 .85rem var(--ui); display: block; margin-bottom: 4px; }
.authcard input, .fld input, .fld textarea, .fld select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: 400 1rem var(--body); }
.fld { display: grid; gap: 4px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.qr { display: block; margin: 12px auto; border-radius: 8px; }
.codebox { font: 500 .9rem/1.4 ui-monospace, monospace; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--line); }
.acgrid { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .acgrid { grid-template-columns: 1fr; } }
.prose { max-width: 760px; }
.prose p { margin: 0 0 14px; }
.plainlist { list-style: none; padding: 0; display: grid; gap: 8px; }
.plainlist li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }

/* StockCake-style sheet page (Poppins title, per user spec) */
.sheet-page, .profile-page { font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; }
.sheet-page h1 { font-family: 'Poppins', sans-serif; font-weight: 400; font-size: 24px; line-height: 32px; }
@media (min-width: 1024px) { .sheet-page h1 { font-size: 30px; line-height: 36px; } }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; padding: 24px 0; }
@media (max-width: 900px) { .sheet-grid { grid-template-columns: 1fr; } }
.sheet-left { background: #fffdf9; border-radius: 16px; padding: 24px; position: relative; }
/* v7.2: the dark EDIT rail was removed from the sheet page (user request).
   Resize lives in the form under the artwork; Recreate is a button next
   to the Download buttons. Video/Song were placeholders and are gone. */
.describe { display: flex; gap: 8px; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 18px; margin: 0 0 16px; }
.describe input { flex: 1; border: 0; outline: none; font: inherit; font-size: 1rem; background: transparent; }
.describe button { width: 44px; height: 44px; border-radius: 50%; background: #253323; color: #fff; border: 0; cursor: pointer; font-size: 1.1rem; }
.sheet-art { background: #fff; border-radius: 12px; padding: 12px; }
.sheet-art svg { width: 100%; height: auto; display: block; }
.sheet-art img { width: 100%; height: auto; display: block; }
.versions { margin: 16px 0 0; font-size: .9rem; color: var(--muted); }
.versions a { margin-right: 12px; }
.license-pill { display: inline-flex; align-items: center; gap: 6px; background: #dcfce7; color: #166534; border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: .88rem; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.download-free { width: 100%; min-height: 52px; border-radius: 999px; font-size: 1rem; }
.prompt-box { background: #f7f8f1; border-radius: 12px; padding: 16px; margin: 18px 0; }
.prompt-box h2 { font-family: 'Poppins', sans-serif; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: #52525b; }
.prompt-box .meta { float: right; font-size: .8rem; color: #71717a; }
.tag { background: #f4f4f5; border-radius: 999px; padding: 5px 14px; font-size: .88rem; text-decoration: none; color: #27272a; }
.colors { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.colors .dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; vertical-align: -3px; margin-right: 6px; }
.tabs { display: flex; gap: 8px; border-bottom: 1.5px solid var(--line); margin-top: 24px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.on { color: var(--fg); border-bottom: 2.5px solid var(--fg); }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 20px; height: 20px; }
.guide { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 20px; margin: 18px 0; }
.guide h2 { font-family: 'Poppins', sans-serif; font-size: 1.15rem; margin-bottom: 8px; }
.guide h3 { font-family: 'Poppins', sans-serif; margin: 14px 0 6px; }
.profile-head { display: flex; gap: 18px; align-items: center; padding: 28px 0; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }
.color-studio { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin: 12px 0; }
.color-studio button { height: 40px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.color-studio button.on { border-color: #253323; }
@media print { .sheet-page .describe, .sheet-page form, .no-print { display: none !important; } .sheet-left { background: #fff; } }

/* v7 admin panel: dark navy sidebar + cream content (landing theme). */
.admin-shell { display: flex; min-height: 100vh; background: var(--bg); }
.admin-side { width: 240px; flex: none; background: #16233f; color: #e8ecf5; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .admin-brand { color: #fff; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.05rem; display: flex; gap: 8px; align-items: center; padding: 4px 8px 14px; }
.admin-side .brandmark { color: var(--warm); }
.admin-who { font-size: .8rem; color: #9fb0d0; padding: 0 8px 12px; margin: 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; flex: 1; }
.admin-side nav a { color: #cdd7ea; text-decoration: none; font-size: .92rem; font-weight: 500; padding: 9px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.admin-side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-side nav a.on { background: #294c2c; color: #fff; font-weight: 700; }
.admin-badge { background: #e5483f; color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.admin-side-foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-side-foot a { color: #cdd7ea; text-decoration: none; font-size: .92rem; padding: 8px 10px; border-radius: 8px; }
.admin-side-foot a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-main { flex: 1; min-width: 0; padding: 28px 28px 48px; }
.admin-content { max-width: 1300px; margin: 0 auto; }
.admin-head { margin-bottom: 18px; }
.admin-head h1 { font-size: 1.7rem; }
.admin-head p { color: var(--muted); margin-top: 6px; max-width: 72ch; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 18px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.stat-card:hover { border-color: var(--accent); }
.stat-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-big { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1.1; }
.stat-sub { font-size: .85rem; color: var(--muted); }
.admin-cols { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.admin-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.admin-filter input, .admin-filter select { width: auto; }
.health-pass { color: var(--good); font-weight: 700; }
.health-fail { color: var(--bad); font-weight: 700; }
tr.unread-row { background: #fff8e6; }
.footer-news input { max-width: 260px; }
@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .admin-cols { grid-template-columns: 1fr; }
  .admin-main { padding: 18px 14px 36px; }
}

#main > .wrap > section { padding-block: var(--section-space); }
.admin-main { padding: clamp(1rem, 3vw, 2rem); }
.admin-head, .admin-actions, .stat-grid, .admin-filter { margin-block-end: 1rem; }
.admin-content { overflow-wrap: anywhere; }
.navright form, .admin-side-foot form { margin: 0; }

.browse-title h1, .profile-head h1 { font-size: clamp(1.625rem, 3vw, 2.125rem); }
.crumbs:has(+ .browse-title) { padding-block: 20px 12px; }
.browse-title { margin: 0 0 20px; }
.cats { justify-content: flex-start; flex-wrap: wrap; overflow: visible; padding: 0; gap: 6px 8px; }
.cats + .cats { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
#main > .wrap > :is(.cats,.browse-title) + section { padding-block-start: 24px; }
.profile-page { padding-bottom: var(--section-space); }
.profile-head { padding-block: 28px 24px; }
.profile-head > div { min-width: 0; overflow-wrap: anywhere; }
.profile-head .avatar { flex: none; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.admin-side { background: #203326; }
.admin-side .brandmark { color: var(--ink); }
.admin-side-foot { gap: 8px; }
.admin-nav-toggle { margin: 8px 0; padding: 10px; text-align: left; border: 1px solid #758a7b; border-radius: 8px; background: transparent; color: white; cursor: pointer; }
@media (max-width: 900px) {
  .admin-nav-toggle:not([hidden]) { display: block; }
  .admin-nav-toggle:not([hidden])[aria-expanded="false"] + nav { display: none; }
  .admin-side-foot { flex-direction: row; align-items: center; }
}
@media (min-width: 901px) { .admin-nav-toggle { display: none; } }
@media (max-width: 560px) {
  .profile-head { align-items: flex-start; gap: 12px; }
  .profile-head .avatar { width: 48px; height: 48px; font-size: 1.25rem; }
}

.browse-library .browse-title { margin: 0 0 24px; padding: clamp(22px, 4vw, 48px); background: #edf2e6; border-radius: 18px; }
.browse-library .browse-title p { max-width: 65ch; }
.browse-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 20px; }
.browse-toolbar label { display: grid; gap: 5px; flex: 0 1 230px; min-width: 0; font-size: .9rem; font-weight: 700; }
.browse-toolbar select { width: 100%; min-height: 44px; }
.browse-toolbar .btn { min-height: 44px; }
.browse-toolbar .browse-count { align-self: end; padding: 10px 0; margin-left: auto; color: var(--muted); font-size: .9rem; }
@media (max-width: 560px) {
    .browse-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .browse-toolbar .btn { justify-content: center; }
}
.browse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 16px; columns: auto; }
.browse-grid .pin { margin: 0; }
.browse-grid .shot { display: grid; place-items: center; aspect-ratio: 4 / 5; }
.browse-grid .shot img, .browse-grid .shot svg { height: 100%; min-height: 0; max-height: 100%; object-fit: contain; }
.browse-grid .cap { padding: 12px 14px; }
@media (max-width: 560px) {
    .browse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .browse-grid .cap { padding: 9px; }
}

.book-studio { max-width: 980px; margin: 0 auto; padding: clamp(20px, 5vw, 48px) 0; }
.book-studio h1 { overflow-wrap: anywhere; }
.book-form { display: grid; gap: 16px; max-width: 680px; margin-block: 24px; }
.book-form label { display: grid; gap: 6px; }
.book-form textarea { width: 100%; min-height: 72px; }
.book-form .btn { justify-self: start; }
.book-options, .book-pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 16px; }
.book-pages { list-style: none; padding: 0; margin-block: 28px; }
.book-pages li { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow-wrap: anywhere; }
.book-pages img { display: block; width: 100%; height: auto; margin-block: 10px; }
.book-pages p { margin-bottom: 0; }

.book-progress-card { padding: 18px 22px; margin-block: 18px; background: #edf2e6; border-radius: 16px; color: #203b29; }
.book-progress-title, .book-visibility { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.book-progress-card progress { display: block; width: 100%; height: 14px; margin: 9px 0; accent-color: #376740; }
.book-progress-card p { margin: 0; }


.book-reader { display: grid; align-items: start; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(20px, 5vw, 52px); margin-block: 26px; }
.book-reader figure { margin: 0; text-align: center; }
.book-reader img { display: block; width: 100%; max-height: 75vh; object-fit: contain; background: #fff; border-radius: 12px; }
.book-reader figcaption { padding: 10px; color: var(--muted); }
.book-reader nav { display: flex; justify-content: center; gap: 10px; }
.book-reader aside { padding: clamp(16px, 3vw, 28px); background: #edf2e6; border-radius: 18px; overflow-wrap: anywhere; }
.book-reader aside h2 { margin-top: 0; }
.book-reader aside li { margin-bottom: 8px; }
.book-collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 195px), 1fr)); gap: 16px; }
.book-collection a { display: flex; flex-direction: column; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.book-collection img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #edf2e6; }
.book-collection strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 1.35;
    height: 2.7em;
    box-sizing: content-box;
    margin: 12px 14px 4px;
}
.book-collection span { padding: 0 14px 12px; color: var(--muted); }
@media (max-width: 650px) { .book-reader { grid-template-columns: 1fr; } }

.book-studio { max-width: 1120px; }
.book-create h1, .book-reader h1 { font-size: clamp(1.625rem, 3vw, 2.125rem); line-height: 1.08; margin: 0 0 12px; }
.book-maker > .book-form { padding: clamp(18px, 4vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); max-width: 820px; }
.book-maker > .book-form textarea { min-height: 110px; }
.book-maker > .book-form small, .book-back a { color: var(--muted); }
.book-shelf { max-width: 1120px; margin: 0 auto clamp(28px, 5vw, 60px); }
.book-reader { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); }
.book-reader figure { background: #eef0e8; border-radius: 20px; padding: clamp(12px, 3vw, 26px); }
.book-reader figure > img { max-height: min(76vh, 820px); width: auto; max-width: 100%; margin-inline: auto; border-radius: 6px; box-shadow: 0 8px 24px #203b2920; }
.book-reader aside { background: var(--surface); border: 1px solid var(--line); padding: clamp(20px, 3vw, 34px); }
.book-reader aside > details { border-top: 1px solid var(--line); padding-top: 14px; }
.book-reader aside summary { cursor: pointer; font-weight: 700; }
.book-reader aside .book-form { margin-block: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.book-reader .book-visibility { font-size: .875rem; padding-block: 12px; }
.book-edition { color: var(--muted); }
.book-collection { grid-template-columns: repeat(auto-fill, minmax(min(100%, 185px), 1fr)); }
.book-collection a:focus-visible, .book-collection a:hover { border-color: #597945; }
.book-collection img, .book-card-placeholder { aspect-ratio: 3 / 4; background: #eef0e8; }
.book-card-placeholder { display: grid; place-items: center; color: var(--muted); }
@media (max-width: 650px) {
    .book-reader { grid-template-columns: minmax(0, 1fr); }
    .book-collection { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

.book-back { margin: 0 0 24px; }
.book-reader { gap: clamp(20px, 4vw, 54px); margin: 0; }
.book-reader figure > img { width: 100%; height: auto; }
.book-reader aside > details, .book-reader .book-form details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.book-reader aside .book-form { max-width: none; }
.book-reader aside .book-form details { width: 100%; }
.book-reader aside details[open] summary { margin-bottom: 10px; }
.book-related { padding-top: 12px; }
.book-related .book-collection { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
    .book-related .book-collection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.book-intro { max-width: 680px; margin: 0 auto 28px; text-align: center; }
.book-intro p { color: var(--muted); margin: 0; }
.book-maker { display: grid; align-items: start; gap: clamp(18px, 4vw, 42px); max-width: 680px; margin: 0 auto; }
.book-maker-with-preview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); max-width: none; }
.book-maker > .book-form { width: 100%; max-width: none; margin: 0; }
.book-maker h2 { margin: 0; font-size: 1.35rem; }
.book-maker .book-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.book-maker .book-options :is(input, select) { width: 100%; min-width: 0; }
.book-example { display: block; overflow: hidden; border-radius: 20px; background: #edf2e6; border: 1px solid var(--line); }
.book-example img { display: block; width: 100%; height: clamp(240px, 33vw, 460px); object-fit: contain; }
.book-example > span { display: grid; gap: 4px; padding: 14px 18px; }
.book-example > span > span { color: #355531; font-size: .9rem; }
.book-studio:has(> .book-collection):not(.book-related) { padding-top: 10px; }
.book-studio > h2 + .book-collection, .book-shelf > h2 + .book-collection { margin-top: 14px; }
@media (max-width: 720px) {
    .book-maker-with-preview { grid-template-columns: minmax(0, 1fr); }
    .book-example { grid-row: 2; }
}
@media (max-width: 380px) {
    .book-maker .book-options { grid-template-columns: 1fr; }
}

.book-mode { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.book-mode legend { font-weight: 700; }
.book-mode label { display: flex; align-items: center; gap: 6px; }
.book-mode input { accent-color: #355531; }

.book-outline { max-width: none; }
.book-scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.book-scene { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.book-scene textarea { min-height: 100px; }
.book-scene-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 680px) { .book-scenes { grid-template-columns: 1fr; } }

.account-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 14px; margin-block: 24px; }
.account-summary > div { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.account-summary span { color: var(--muted); }
.account-summary strong { font-size: 1.4rem; }
.account-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.account-overview .table-wrap { overflow-x: auto; }

#main > .wrap > .creations-page { padding-block: clamp(20px, 3vw, 36px); }
.creations-page h1 { margin-bottom: 14px; }
.creations-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.creations-empty { margin: 0; color: var(--muted); }
.book-pen-loader { display: none; position: relative; width: 100px; height: 32px; margin: 0 0 10px; }
.is-drawing .book-pen-loader, .book-loading .book-pen-loader { display: block; }
.book-pen-loader::before { content: ""; position: absolute; bottom: 3px; left: 2px; width: 80px; height: 2px; background: #54804a; transform-origin: left; }
.book-pen-loader span { position: absolute; bottom: 4px; left: 80px; width: 9px; height: 24px; border-radius: 4px 4px 1px 1px; background: #376740; transform: rotate(28deg); transform-origin: bottom center; }
.book-pen-loader span::after { content: ""; position: absolute; bottom: -5px; left: 1px; border: 3.5px solid transparent; border-top: 5px solid #376740; border-bottom: 0; }
@media (prefers-reduced-motion: no-preference) {
    .book-pen-loader::before { animation: book-ink 1.65s ease-in-out infinite; }
    .book-pen-loader span { animation: book-pen 1.65s ease-in-out infinite; }
    @keyframes book-ink { 0% { transform: scaleX(0); } 80%, 100% { transform: scaleX(1); } }
    @keyframes book-pen { 0% { left: 2px; } 80%, 100% { left: 82px; } }
}

.book-outline-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: #edf2e6; border-radius: 12px; }
.book-outline-start p { margin: 0; flex: 1 1 240px; }

.book-reader nav[hidden] { display: none; }
.book-reader nav button[aria-disabled="true"] { cursor: default; opacity: .55; transform: none; }

.profile-book-collection { margin-top: 14px; }
.profile-book-collection > a > strong { margin-bottom: 12px; }
.profile-book-collection > a > img,
.profile-book-collection > a > .book-card-placeholder { flex: none; }
.profile-book-collection > a > span { padding-top: 12px; }
