:root {
    color-scheme: dark;
    --bg: #10131a;
    --bg2: #171c27;
    --card: #1e2432;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f4f1ea;
    --muted: #9aa3b5;
    --accent: #ff4d2e;
    --accent2: #e8c47a;
    --ok: #3dd68c;
    --danger: #ff5d73;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --font: "Segoe UI", system-ui, sans-serif;
    --chrome: #0a0d14;
    --panel: #121722;
    --input: #121722;
    --btn: #2a3144;
    --topbar: rgba(16, 19, 26, 0.8);
    --hud: rgba(16, 19, 26, 0.88);
    --blank-page: #121722;
    --thumb: #0c0f16;
    --thumb-gap: #05070c;
    --thumb-blank: #161b26;
    --glow-1: rgba(255, 77, 46, 0.16);
    --glow-2: rgba(232, 196, 122, 0.1);
    --hover-fill: rgba(255, 255, 255, 0.06);
    --side-arrow: rgba(244, 241, 234, 0.72);
}
html.theme-light {
    color-scheme: light;
    --bg: #eef0f4;
    --bg2: #e4e7ee;
    --card: #ffffff;
    --line: rgba(16, 19, 26, 0.12);
    --text: #1c2230;
    --muted: #5c6578;
    --shadow: 0 16px 40px rgba(16, 19, 26, 0.12);
    --chrome: #e7eaf0;
    --panel: #f7f8fb;
    --input: #ffffff;
    --btn: #ffffff;
    --topbar: rgba(255, 255, 255, 0.9);
    --hud: rgba(255, 255, 255, 0.94);
    --blank-page: #d5dae4;
    --thumb: #dfe3ea;
    --thumb-gap: #cfd5e0;
    --thumb-blank: #eceff4;
    --glow-1: rgba(255, 77, 46, 0.08);
    --glow-2: rgba(232, 196, 122, 0.16);
    --hover-fill: rgba(16, 19, 26, 0.06);
    --side-arrow: rgba(28, 34, 48, 0.72);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 500px at 10% -10%, var(--glow-1), transparent 50%),
        radial-gradient(900px 400px at 100% 0%, var(--glow-2), transparent 45%),
        var(--bg);
    color: var(--text);
}

a { color: var(--accent2); text-decoration: none; }
img { max-width: 100%; display: block; }

.topbar {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    gap: 12px 20px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: var(--topbar);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: 0.04em; justify-self: start; }
.brand-mark {
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    padding: 4px 8px;
    font-size: 12px;
}
.shortcuts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 16px;
    color: var(--muted);
    font-size: 12px;
}
.shortcut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.shortcut kbd {
    font: 700 11px/1 var(--font);
    color: var(--text);
    background: var(--btn);
    border: 1px solid var(--line);
    border-radius: 6px;
    min-width: 22px;
    padding: 4px 7px;
    text-align: center;
}
body.hide-heat .shortcut[data-key="h"] kbd {
    color: var(--accent2);
    border-color: color-mix(in srgb, var(--accent2) 50%, transparent);
}
.topbar-right { display: flex; align-items: center; gap: 18px; justify-self: end; }
@media (max-width: 980px) {
    .topbar { grid-template-columns: 1fr auto; }
    .shortcuts { grid-column: 1 / -1; justify-content: flex-start; }
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a.is-active { color: var(--text); }
.account-chip {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent2);
    background: rgba(232, 196, 122, 0.12);
    border: 1px solid rgba(232, 196, 122, 0.28);
    border-radius: 999px;
    padding: 5px 10px;
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-chip.plan-expired {
    color: var(--danger);
    background: rgba(255, 93, 115, 0.1);
    border-color: rgba(255, 93, 115, 0.35);
}
.account-chip.plan-admin,
.account-chip.plan-active {
    color: var(--ok);
    background: rgba(61, 214, 140, 0.1);
    border-color: rgba(61, 214, 140, 0.3);
}
.langs { display: flex; flex-wrap: wrap; gap: 4px; }
.langs a {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.langs a.is-active {
    color: var(--text);
    border-color: var(--line);
    background: var(--btn);
}
.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.theme-toggle:hover {
    color: var(--accent2);
    background: var(--hover-fill);
}
.theme-toggle .embed-rail-icon {
    width: 18px;
    height: 18px;
}
.theme-toggle .embed-icon-theme {
    -webkit-mask-size: 18px 18px;
    mask-size: 18px 18px;
}

.shell { width: min(1180px, calc(100% - 32px)); margin: 28px auto 60px; }
.eyebrow { color: var(--accent2); text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px; margin: 0 0 8px; }
h1 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 44px); line-height: 1.15; }
.lede { color: var(--muted); max-width: 52ch; }

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: start;
    margin-bottom: 36px;
}
.dropzone, .progress-card, .card, .modal-card, .editor-side, .book-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.dropzone { padding: 18px; display: grid; gap: 14px; }
.dropzone-inner {
    border: 1.5px dashed rgba(232, 196, 122, 0.4);
    border-radius: 14px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}
.dropzone-inner.is-over { border-color: var(--accent); background: rgba(255, 77, 46, 0.08); }
.dropzone-inner strong { display: block; margin-bottom: 6px; }
.dropzone-inner span { color: var(--muted); font-size: 14px; }

.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--input);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
}
.field textarea { resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--btn);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(255, 93, 115, 0.4); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: transparent; }

.progress-card { padding: 20px; margin-bottom: 28px; }
.bar { height: 10px; background: var(--panel); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.2s; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card { overflow: hidden; }
.cover { position: relative; background: var(--thumb); aspect-ratio: 3 / 4; display: block; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { height: 100%; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.badge {
    position: absolute; right: 10px; bottom: 10px;
    background: rgba(0,0,0,0.7); color: #fff; border-radius: 999px; padding: 4px 8px; font-size: 12px;
}
.card-body { padding: 14px; }
.card-body h3 { margin: 0 0 6px; font-size: 17px; }
.card-body p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty, .muted { color: var(--muted); }
.suggest-box {
    background: var(--panel);
    color: var(--accent2);
}
.suggest-box.is-error { color: var(--muted); }

.viewer-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}
.viewer-head h1 { font-size: 28px; }
.viewer-head p, .back { color: var(--muted); }
.viewer-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-indicator { min-width: 70px; text-align: center; color: var(--accent2); }

.book-wrap { padding: 16px 70px; margin-bottom: 16px; overflow: visible; }
body.page-view .book-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}
#book { margin: 0 auto; }
.page-html, .page-sheet { width: 100%; height: 100%; position: relative; background: #fff; overflow: hidden; }
.page-html.page-blank,
.page-sheet-blank { background: var(--blank-page); }
.page-sheet img { width: 100%; height: 100%; object-fit: fill; user-select: none; pointer-events: none; }

.heatmap-layer { position: absolute; inset: 0; pointer-events: none; }
.heatmap {
    display: block;
    pointer-events: auto;
    position: absolute;
    z-index: 4;
    border: 2px solid color-mix(in srgb, var(--heat, #ff3b30) 80%, white);
    background:
        radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--heat, #ff3b30) 55%, transparent), transparent 58%),
        color-mix(in srgb, var(--heat, #ff3b30) 32%, transparent);
    color: #fff;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--heat, #ff3b30) 45%, transparent);
}
#book.is-flip-edge,
#book.is-flip-edge .heatmap {
    cursor: ew-resize;
}
.heatmap .heat-label {
    pointer-events: none;
    position: absolute;
    left: 6px;
    bottom: 6px;
    font-size: 11px;
    background: rgba(0,0,0,0.55);
    border-radius: 999px;
    padding: 2px 7px;
    max-width: calc(100% - 12px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.heatmap .heat-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 99px;
    pointer-events: none;
    opacity: 0;
    background-color: rgba(0, 0, 0, 0.72);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 13a5 5 0 0 0 7.54.54l1.92-1.92a5 5 0 0 0-7.07-7.07L10.5 6.5'/><path d='M14 11a5 5 0 0 0-7.54-.54L4.54 12.38a5 5 0 0 0 7.07 7.07L13.5 17.5'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
}
.heat-blur {
    display: none;
}
body.heat-overlay .heat-icon { display: none; }
body.heat-hidden .heatmap,
body.heat-icons .heatmap,
body.heat-ghost .heatmap,
body.heat-blur .heatmap {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    border-radius: 0;
}
body.heat-hidden .heatmap .heat-label,
body.heat-icons .heatmap .heat-label,
body.heat-ghost .heatmap .heat-label,
body.heat-blur .heatmap .heat-label { display: none; }
body.heat-hidden .heatmap:hover .heat-icon,
body.heat-hidden .heatmap:focus .heat-icon { opacity: 1; z-index: 2; }
body.heat-icons .heat-icon,
body.heat-ghost .heat-icon {
    opacity: 1;
    z-index: 2;
}
body.heat-ghost .heatmap:hover,
body.heat-ghost .heatmap:focus {
    background: rgba(255, 255, 255, 0.30);
    border-color: transparent;
    box-shadow: none;
}
body.heat-blur .heatmap {
    background: rgba(255, 255, 255, 0.18);
}
.heat-hover-tip {
    position: fixed;
    z-index: 80;
    max-width: min(280px, calc(100vw - 24px));
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--hud);
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: var(--shadow);
    pointer-events: none;
    font-size: 13px;
    line-height: 1.35;
}
.heat-hover-tip[hidden] { display: none; }
.heat-hover-tip strong { display: block; }
.heat-hover-tip span { display: block; margin-top: 4px; color: var(--muted); white-space: pre-wrap; }
.check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.check input { margin-top: 3px; }
.heatmap.is-selected { outline: 2px solid #fff; z-index: 3; }
.heatmap.is-empty { --heat: #ff3b30; }
.heatmap.is-complete { --heat: #22c55e; }
.heatmap.is-incomplete { --heat: #3b82f6; }
body.page-edit #heat-layer .heatmap.is-selected {
    overflow: visible;
    z-index: 8;
}
body.page-edit #heat-layer .heat-handle {
    position: absolute;
    z-index: 9;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #1a1f2c;
    border-radius: 2px;
    padding: 0;
    pointer-events: auto;
}
body.page-edit #heat-layer .heat-handle[data-dir="n"],
body.page-edit #heat-layer .heat-handle[data-dir="s"] {
    left: 50%;
    width: 28px;
    height: 8px;
    margin-left: -14px;
    cursor: ns-resize;
}
body.page-edit #heat-layer .heat-handle[data-dir="n"] { top: -4px; }
body.page-edit #heat-layer .heat-handle[data-dir="s"] { bottom: -4px; }
body.page-edit #heat-layer .heat-handle[data-dir="e"],
body.page-edit #heat-layer .heat-handle[data-dir="w"] {
    top: 50%;
    width: 8px;
    height: 28px;
    margin-top: -14px;
    cursor: ew-resize;
}
body.page-edit #heat-layer .heat-handle[data-dir="w"] { left: -4px; }
body.page-edit #heat-layer .heat-handle[data-dir="e"] { right: -4px; }
body.page-edit #heat-layer .heat-handle[data-dir="nw"],
body.page-edit #heat-layer .heat-handle[data-dir="ne"],
body.page-edit #heat-layer .heat-handle[data-dir="sw"],
body.page-edit #heat-layer .heat-handle[data-dir="se"] {
    width: 10px;
    height: 10px;
}
body.page-edit #heat-layer .heat-handle[data-dir="nw"] { top: -5px; left: -5px; cursor: nwse-resize; }
body.page-edit #heat-layer .heat-handle[data-dir="se"] { bottom: -5px; right: -5px; cursor: nwse-resize; }
body.page-edit #heat-layer .heat-handle[data-dir="ne"] { top: -5px; right: -5px; cursor: nesw-resize; }
body.page-edit #heat-layer .heat-handle[data-dir="sw"] { bottom: -5px; left: -5px; cursor: nesw-resize; }
body.page-edit .page-stage.is-resizing { touch-action: none; }
body.hide-heat .heatmap { display: none; }

.thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 2px 4px;
}
.thumb {
    flex: 0 0 auto;
    border: 2px solid transparent;
    background: var(--thumb);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}
.thumb.is-active { border-color: var(--accent); }
.thumb-spread-pages {
    display: flex;
    gap: 1px;
    height: 52px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--thumb-gap);
}
.thumb-page {
    position: relative;
    display: block;
    height: 52px;
    width: auto;
    aspect-ratio: var(--thumb-aw, 3) / var(--thumb-ah, 4);
    flex: 0 0 auto;
    min-width: 0;
}
.thumb-spread-pages .thumb-page { height: 100%; }
.thumb-page-blank {
    background: var(--thumb-blank);
}
.thumb.is-left .thumb-num {
    right: auto;
    left: 3px;
}
body.page-edit .thumb-page,
body.page-edit .thumb-spread-pages { height: 72px; }
.thumb-page img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-heats {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}
.thumb-heat {
    position: absolute;
    border: 1px solid color-mix(in srgb, var(--heat, #3b82f6) 85%, white);
    background: color-mix(in srgb, var(--heat, #3b82f6) 58%, transparent);
}
.thumb-heat.is-empty { --heat: #ff3b30; }
.thumb-heat.is-complete { --heat: #22c55e; }
.thumb-heat.is-incomplete { --heat: #3b82f6; }
.thumb-num {
    position: absolute; right: 3px; bottom: 3px; z-index: 2;
    background: rgba(0,0,0,0.72); color: #fff; font-size: 10px; border-radius: 99px; padding: 1px 5px;
    white-space: nowrap;
}
a.thumb { color: inherit; text-decoration: none; }
.flip-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.book-frame {
    position: relative;
    width: fit-content;
    max-width: 100%;
    --flip-gap: 15px;
}
body.page-view .book-frame { --flip-gap: 10px; }
.flip-side {
    position: absolute;
    top: 50%;
    z-index: 30;
    width: 48px;
    height: 88px;
    margin-top: -44px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--side-arrow);
    font-size: 52px;
    font-weight: 200;
    line-height: 88px;
    cursor: pointer;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.flip-side:hover { color: var(--accent2); }
.flip-side:disabled { opacity: 0.18; cursor: default; color: var(--muted); }
.flip-side-prev { left: calc(-1 * var(--flip-gap) - 48px); }
.flip-side-next { right: calc(-1 * var(--flip-gap) - 48px); }
.flip-hud {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 31;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    border-radius: 10px;
    background: var(--hud);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13px;
}
.flip-hud-btn {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 6px;
    padding: 0 4px;
}
.flip-hud-btn:hover { color: var(--accent2); background: var(--hover-fill); }
.flip-hud-btn:disabled { opacity: 0.28; cursor: default; }
.flip-hud-pager {
    display: inline-flex;
    align-items: center;
    gap: 0;
}
.flip-hud-pager .flip-hud-btn,
html.is-embed .flip-hud-pager .js-flip-prev,
html.is-embed .flip-hud-pager .js-flip-next {
    display: inline-flex;
}
.flip-hud-pages {
    display: none;
    min-width: 0;
    padding: 0 6px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.flip-open {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    padding: 4px 8px 4px 4px;
    border-radius: 8px;
}
.flip-open:hover { color: var(--accent2); }
.flip-open-icon,
.flip-fs-icon {
    width: 16px;
    height: 16px;
    display: block;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 3H3v5'/><path d='M16 3h5v5'/><path d='M8 21H3v-5'/><path d='M16 21h5v-5'/></svg>") center / 16px 16px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 3H3v5'/><path d='M16 3h5v5'/><path d='M8 21H3v-5'/><path d='M16 21h5v-5'/></svg>") center / 16px 16px no-repeat;
}
.flip-fs.is-exit .flip-fs-icon {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 3v6H3'/><path d='M15 3v6h6'/><path d='M9 21v-6H3'/><path d='M15 21v-6h6'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 3v6H3'/><path d='M15 3v6h6'/><path d='M9 21v-6H3'/><path d='M15 21v-6h6'/></svg>");
}
html.is-embed-hosted.is-embed-frame .flip-open { display: inline-flex; }
html.is-embed .flip-hud-pages,
html.is-embed .flip-hud-pager .js-flip-prev,
html.is-embed .flip-hud-pager .js-flip-next {
    display: inline-flex;
}
html.is-embed-page .flip-open,
html.is-embed-fs .flip-open { display: none; }
html.is-embed-page #btn-fullscreen,
html.is-embed-fs #btn-fullscreen {
    display: inline-flex;
}
html.is-embed-fs .flip-hud .js-flip-first,
html.is-embed-fs .flip-hud .js-flip-last,
html.is-embed-fs .flip-hud .js-flip-prev,
html.is-embed-fs .flip-hud .js-flip-next {
    display: inline-flex;
}
.cover .thumb-heats { border-radius: 0; }

.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: grid; place-items: center;
    z-index: 10000;
}
.modal[hidden] { display: none; }
.modal-card { width: min(480px, calc(100% - 24px)); padding: 24px; position: relative; }
.modal-close {
    position: absolute; right: 12px; top: 8px;
    border: 0; background: transparent; color: var(--text); font-size: 28px; cursor: pointer;
}

.editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
.editor-stage { min-width: 0; }
.stage-nav { display: flex; justify-content: center; gap: 10px; align-items: center; margin-bottom: 12px; }
.page-stage {
    position: relative;
    margin: 0 auto;
    width: min(100%, 720px);
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    user-select: none;
}
.page-stage.is-draw { cursor: crosshair; touch-action: none; }
.page-stage:focus { outline: none; }
.page-stage img { width: 100%; height: auto; }
.draw-box {
    position: absolute;
    border: 2px dashed var(--accent);
    background: rgba(255, 77, 46, 0.2);
    pointer-events: none;
}
.editor-side { padding: 16px; display: grid; gap: 18px; }
.heat-form { display: grid; gap: 10px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.heat-list { display: grid; gap: 8px; }
.heat-item {
    width: 100%;
    text-align: left;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
}
.heat-item.is-active { border-color: var(--accent); }
.heat-item.is-empty { box-shadow: inset 3px 0 0 #ff3b30; }
.heat-item.is-complete { box-shadow: inset 3px 0 0 #22c55e; }
.heat-item.is-incomplete { box-shadow: inset 3px 0 0 #3b82f6; }
.heat-item small { display: block; color: var(--muted); }

.settings-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: grid;
    gap: 18px;
    max-width: 720px;
}
.replace-card { margin-top: 22px; }
.settings-card.replace-card { max-width: 960px; min-width: 0; overflow: hidden; }
.replace-card h2 { margin: 0; font-size: 20px; }
.replace-card .hint { margin: 0; color: var(--muted); }
.replace-dropzone { box-shadow: none; padding: 0; background: transparent; border: 0; }
.replace-card .progress-card { margin: 0; box-shadow: none; }
.graphics-heading { margin: 4px 0 0; font-size: 15px; color: var(--muted); font-weight: 600; }
.graphics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 12px;
    min-width: 0;
}
.graphics-card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    grid-template-rows: auto 1fr;
}
.graphics-card.is-current {
    border-color: var(--accent2);
    box-shadow: 0 0 0 2px rgba(232, 196, 122, 0.28);
}
.graphics-cover { position: relative; background: var(--thumb); overflow: hidden; }
.graphics-cover img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}
.graphics-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    background: var(--accent2);
    color: #1a1408;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}
.graphics-body {
    min-width: 0;
    padding: 10px;
    display: grid;
    gap: 6px;
    align-content: start;
}
.graphics-filename {
    position: relative;
    display: block;
    min-width: 0;
    max-width: 100%;
    cursor: default;
}
.graphics-filename-text {
    display: block;
    min-width: 0;
    max-width: 100%;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.graphics-filename:hover::after {
    content: attr(title);
    position: absolute;
    z-index: 8;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    width: auto;
    padding: 8px 10px;
    background: var(--chrome);
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    pointer-events: none;
}
.graphics-body small { color: var(--muted); font-size: 12px; }
.graphics-body .form-actions {
    margin-top: 4px;
    min-width: 0;
}
.graphics-body .btn {
    min-width: 0;
    flex: 1 1 auto;
}
.flip-fieldset {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px 14px;
    display: grid;
    gap: 10px;
    margin: 0;
}
.flip-fieldset legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 13px;
}
.flip-choice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}
.flip-choice:has(input:checked) {
    border-color: var(--accent2);
    background: rgba(232, 196, 122, 0.08);
}
.flip-choice strong { display: block; color: var(--text); margin-bottom: 4px; }
.flip-choice small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.copy-row textarea {
    min-height: 78px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
}
#settings-status.is-ok { color: var(--ok); }
#settings-status.is-error { color: var(--danger); }

html.is-embed, html.is-embed body {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    background: var(--chrome);
}
body.is-embed .embed-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
body.is-embed .flip-stage {
    flex: 1;
    min-height: 0;
}
body.is-embed .book-wrap {
    flex: 1;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 64px;
    min-height: 0;
}
html.is-embed-fs .book-wrap {
    padding: 24px 72px;
}
html.is-embed-fs #book {
    margin: auto;
}
body.is-embed .empty { margin: 24px; }

.embed-app {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
}
.embed-app .flip-stage {
    flex: 1;
    min-width: 0;
}
.embed-rail {
    flex: 0 0 56px;
    width: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 12px;
    background: var(--chrome);
    border-right: 1px solid var(--line);
    z-index: 42;
}
.embed-rail-tools {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}
.embed-rail-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.embed-rail-btn:hover,
.embed-rail-btn.is-active {
    background: rgba(232, 196, 122, 0.12);
    color: var(--accent2);
}
.embed-rail-icon {
    width: 22px;
    height: 22px;
    display: block;
    background: currentColor;
}
.embed-icon-pages {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='12' height='16' rx='1.5'/><path d='M10 4h8a1.5 1.5 0 0 1 1.5 1.5V20'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='12' height='16' rx='1.5'/><path d='M10 4h8a1.5 1.5 0 0 1 1.5 1.5V20'/></svg>") center / 22px 22px no-repeat;
}
.embed-icon-search {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>") center / 22px 22px no-repeat;
}
.embed-icon-share {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='18' cy='5' r='3'/><circle cx='6' cy='12' r='3'/><circle cx='18' cy='19' r='3'/><path d='M8.6 13.5l6.8 4'/><path d='M15.4 6.5l-6.8 4'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='18' cy='5' r='3'/><circle cx='6' cy='12' r='3'/><circle cx='18' cy='19' r='3'/><path d='M8.6 13.5l6.8 4'/><path d='M15.4 6.5l-6.8 4'/></svg>") center / 22px 22px no-repeat;
}
.embed-icon-hide {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='16' height='16' rx='2'/><path d='M10 4v16'/><path d='M14 9l-3 3 3 3'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='16' height='16' rx='2'/><path d='M10 4v16'/><path d='M14 9l-3 3 3 3'/></svg>") center / 22px 22px no-repeat;
}
.embed-icon-show {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='16' height='16' rx='2'/><path d='M10 4v16'/><path d='M7 9l3 3-3 3'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='4' width='16' height='16' rx='2'/><path d='M10 4v16'/><path d='M7 9l3 3-3 3'/></svg>") center / 22px 22px no-repeat;
}
.embed-icon-theme {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'/><path d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'/><path d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/></svg>") center / 22px 22px no-repeat;
}
.js-theme.is-light .embed-icon-theme {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 14.3A8.5 8.5 0 0 1 9.7 3 7.5 7.5 0 1 0 21 14.3z'/></svg>") center / 22px 22px no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 14.3A8.5 8.5 0 0 1 9.7 3 7.5 7.5 0 1 0 21 14.3z'/></svg>") center / 22px 22px no-repeat;
}
.embed-rail .flip-fs-icon {
    width: 22px;
    height: 22px;
    -webkit-mask-size: 22px 22px;
    mask-size: 22px 22px;
}
.embed-rail-copy-mark {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--muted);
}
.embed-rail-copy:hover .embed-rail-copy-mark,
.embed-rail-copy.is-active .embed-rail-copy-mark { color: var(--accent2); }
.embed-app.is-rail-hidden .embed-rail,
.embed-app.is-rail-hidden .embed-panel {
    display: none;
}
.embed-rail-reveal {
    position: absolute;
    left: 8px;
    top: 10px;
    z-index: 50;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--hud);
    color: var(--accent2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow);
}
.embed-rail-reveal[hidden] { display: none; }
.embed-rail-reveal:hover {
    border-color: var(--accent2);
    background: var(--panel);
}
.embed-rail-reveal .embed-rail-icon {
    width: 22px;
    height: 22px;
}
.embed-panel {
    flex: 0 0 220px;
    width: 220px;
    min-width: 220px;
    background: var(--panel);
    padding: 14px 12px;
    overflow: auto;
    z-index: 41;
}
.embed-panel[hidden] { display: none; }
.embed-pane h2 {
    font-size: 13px;
    margin: 0 0 12px;
    color: var(--accent2);
    font-weight: 600;
}
.embed-panel .thumbs {
    flex-direction: column;
    overflow: visible;
    gap: 10px;
    padding: 0;
    align-items: stretch;
}
.embed-panel .thumb {
    flex: 0 0 auto;
    width: 100%;
}
.embed-panel .thumb-spread-pages {
    width: 100%;
    height: auto;
    aspect-ratio: calc((2 * var(--thumb-aw, 3)) / var(--thumb-ah, 4));
}
.embed-panel .thumb-page {
    flex: 1 1 50%;
    width: 50%;
    height: 100%;
    aspect-ratio: auto;
}
.embed-panel .thumb-page img { object-fit: cover; }
.embed-panel .thumb.is-left .thumb-num {
    right: auto;
    left: 3px;
}
.embed-search-results { display: grid; gap: 6px; margin-top: 8px; }
.embed-hit {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
}
.embed-hit:hover { border-color: var(--accent2); }
.embed-hit strong { display: block; font-size: 13px; }
.embed-hit span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.embed-share-list { display: grid; gap: 8px; }
.embed-share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.embed-share-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.share-ico {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: block;
    background: var(--share-c, currentColor);
    -webkit-mask: var(--share-i) center / 18px 18px no-repeat;
    mask: var(--share-i) center / 18px 18px no-repeat;
}
.embed-share-btn[data-share="facebook"] {
    --share-c: #1877f2;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M14.5 8.2h3.2V4.6h-3.2C11.9 4.6 10 6.5 10 9.1v2.2H7.2V15H10v7h3.6v-7h2.9l.7-3.7h-3.6V9.3c0-.6.5-1.1 1-1.1z'/></svg>");
}
.embed-share-btn[data-share="instagram"] {
    --share-c: #e1306c;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><rect x='3.2' y='3.2' width='17.6' height='17.6' rx='5' stroke='black' stroke-width='1.8'/><circle cx='12' cy='12' r='4.1' stroke='black' stroke-width='1.8'/><circle cx='17.3' cy='6.7' r='1.15' fill='black'/></svg>");
}
.embed-share-btn[data-share="whatsapp"] {
    --share-c: #25d366;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12.04 3.2A8.8 8.8 0 0 0 3.5 11.9c0 1.55.41 3.06 1.18 4.4L3.2 20.8l4.63-1.44a8.8 8.8 0 0 0 4.21 1.07h.01a8.8 8.8 0 0 0 8.8-8.76 8.76 8.76 0 0 0-8.81-8.47zm4.84 12.53c-.2.57-1.18 1.05-1.64 1.12-.42.06-.95.09-1.54-.1-.35-.11-.81-.27-1.4-.52-2.46-1.06-4.06-3.54-4.18-3.7-.13-.17-1.03-1.37-1.03-2.61s.65-1.86.88-2.11c.2-.23.5-.35.8-.35h.19c.25 0 .47 0 .68.52.22.57.74 1.98.8 2.12.07.15.1.32.02.5-.08.17-.13.28-.25.43-.13.15-.26.33-.37.45-.13.13-.26.27-.11.53.15.26.66 1.09 1.42 1.77 1 .87 1.8 1.15 2.08 1.28.26.12.42.1.58-.06.17-.17.7-.81.89-1.09.18-.28.37-.23.62-.13.26.09 1.64.77 1.92.91.28.15.47.22.54.34.07.13.07.74-.13 1.31z'/></svg>");
}
.embed-share-btn[data-share="x"] {
    --share-c: var(--text);
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4l7.1 8.5L4.4 20h2.7l5.2-6.2L17.3 20H20l-7.3-8.8L19.5 4h-2.7l-4.8 5.7L6.7 4H4z'/></svg>");
}
.embed-share-btn[data-share="telegram"] {
    --share-c: #2aa1de;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M20.6 4.4 3.7 10.9c-1.2.47-1.18 1.13-.22 1.42l4.33 1.35 10.02-6.32c.47-.29.9-.13.55.18l-8.1 7.32-.3 4.33c.44 0 .64-.2.88-.44l2.12-2.06 4.4 3.25c.81.45 1.4.22 1.6-.75l2.9-13.67c.3-1.2-.43-1.75-1.28-1.4z'/></svg>");
}
.embed-share-btn[data-share="email"] {
    --share-c: #e8c47a;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><rect x='3' y='5.5' width='18' height='13' rx='2' stroke='black' stroke-width='1.8'/><path d='M4.2 7.2 12 12.4l7.8-5.2' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.embed-share-btn[data-share="copy"] {
    --share-c: #9aa7bd;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><rect x='8' y='8' width='11' height='11' rx='2' stroke='black' stroke-width='1.8'/><path d='M6 16V6.8A1.8 1.8 0 0 1 7.8 5H16' stroke='black' stroke-width='1.8' stroke-linecap='round'/></svg>");
}
.embed-share-btn[data-share="native"] {
    --share-c: #e8c47a;
    --share-i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='18' cy='5' r='3'/><circle cx='6' cy='12' r='3'/><circle cx='18' cy='19' r='3'/><path d='M8.6 13.5l6.8 4'/><path d='M15.4 6.5l-6.8 4'/></svg>");
}
.embed-legal { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 10px; }
.embed-legal-link { font-size: 13px; }
#embed-search {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--input);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
}
.heatmap.is-search-hit {
    outline: 3px solid #e8c47a;
    outline-offset: -2px;
    z-index: 6;
}

.auth-card {
    width: min(460px, 100%);
    margin: 40px auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    display: grid;
    gap: 14px;
}
.auth-form { display: grid; gap: 14px; }
.notice {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0 0;
}
.notice strong { display: block; margin-bottom: 4px; }
.notice p { margin: 0; color: var(--muted); }
.notice-lock {
    background: rgba(255, 93, 115, 0.1);
    border: 1px solid rgba(255, 93, 115, 0.35);
}
.notice-warn {
    background: rgba(232, 196, 122, 0.1);
    border: 1px solid rgba(232, 196, 122, 0.35);
}
.notice-ok {
    background: rgba(61, 214, 140, 0.1);
    border: 1px solid rgba(61, 214, 140, 0.35);
    color: var(--ok);
}
.admin-table-wrap { overflow: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.admin-pass { min-width: 140px; }
.settings-fields { border: 0; margin: 0; padding: 0; display: grid; gap: 18px; min-width: 0; }
.embed-unavailable {
    margin: auto;
    text-align: center;
    max-width: 36ch;
    padding: 48px 20px;
}
.embed-unavailable h1 { font-size: 28px; }
.embed-unavailable p { color: var(--muted); }
body.is-locked .heat-form :is(input, textarea, button, select) { pointer-events: none; opacity: 0.55; }

@media (max-width: 900px) {
    .hero, .editor, .viewer-head { grid-template-columns: 1fr; }
    .viewer-head { align-items: start; }
    .copy-row { grid-template-columns: 1fr; }
}

html.is-scroll-catalog .page-html.page-blank {
    display: none !important;
}
html.is-scroll-catalog .flip-side {
    display: none !important;
}
html.is-scroll-catalog .flip-hud .js-flip-first,
html.is-scroll-catalog .flip-hud .js-flip-last {
    display: none !important;
}
html.is-scroll-catalog .book-frame {
    width: 100%;
    max-width: 100%;
}
html.is-scroll-catalog #book {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}
html.is-scroll-catalog #book .page-html,
html.is-scroll-catalog #book .page-sheet {
    width: 100%;
    height: auto;
    position: relative;
    overflow: hidden;
}
html.is-scroll-catalog #book .page-sheet img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}
html.is-scroll-catalog .book-wrap {
    padding: 8px 10px 8px;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
html.is-scroll-catalog body.page-view .book-wrap {
    display: block;
    align-items: stretch;
    overflow: visible;
}
.catalog-scroll-foot {
    display: none;
}
html.is-scroll-catalog .catalog-scroll-foot {
    display: block;
    padding: 12px 148px 16px 8px;
    min-height: 56px;
}
html.is-scroll-catalog .catalog-scroll-foot p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}
html.is-scroll-catalog.is-embed .book-wrap,
html.is-scroll-catalog body.is-embed .book-wrap {
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 8px 8px;
}
html.is-scroll-catalog .embed-panel {
    position: absolute;
    left: 56px;
    top: 0;
    bottom: 0;
    z-index: 45;
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.4);
}
html.is-scroll-catalog .thumb-page-blank {
    display: none;
}
html.is-scroll-catalog .embed-panel .thumb.is-right .thumb-spread-pages,
html.is-scroll-catalog .embed-panel .thumb.is-left .thumb-spread-pages {
    aspect-ratio: var(--thumb-aw, 3) / var(--thumb-ah, 4);
}
html.is-scroll-catalog .embed-panel .thumb.is-right .thumb-num,
html.is-scroll-catalog .embed-panel .thumb.is-left .thumb-num {
    right: 3px;
    left: auto;
}
