:root {
  color-scheme: light;
  --ink: #382e21;
  --muted: #71624b;
  --line: #b8a783;
  --green: var(--accent);
  --gold: var(--metal);
  --paper-texture: url("assets/paper.png");
  --serif: "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", SimSun, serif;
  --roman: "Palatino Linotype", Palatino, Georgia, var(--serif);
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --title-light: #fff6d5;
  --title-gold: #ffc654;
  --control-radius: 9px;
  --control-edge: color-mix(in srgb, var(--metal) 54%, #705538);
  --paper-wash: linear-gradient(160deg, #fff9e879, #f6e1b92b);
  --bevel: inset 0 1px 0 #fff8da80, inset 0 -1px 0 #563d2429;
  --page-ink: color-mix(in srgb, var(--night) 62%, #482910);
  font-family: var(--sans);
  font-size: 100%;
}
[data-theme="northrend"] { --title-light: #fff; --title-gold: #b9e7ff; }
[data-theme="dragonflight"] { --title-light: #fffaf0; --title-gold: #f2d7a5; }
[data-theme="dragonflight"] .chapter-banner { --ribbon-ink: var(--page-ink); --ribbon-shadow: none; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 55% 35%, var(--accent), transparent 77%), var(--night); color: var(--ink); }
button, input, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button { color: inherit; border: 0; background: none; padding: 0; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #89702f; outline-offset: 3px; }
[hidden] { display: none !important; }
canvas[data-icon] { width: 1.15rem; height: 1.15rem; flex: none; display: block; }
.shell { width: min(1152px, calc(100% - 96px)); margin-inline: auto; }
.topbar { background: var(--night); color: #f1e9da; border-bottom: 1px solid var(--metal); }
.topbar-inner { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--metal); }
.brand span { font: 700 1.85rem/1 var(--roman); letter-spacing: .035em; font-variant: small-caps; color: var(--title-light); text-shadow: 0 1px 1px #140f0a; }
.brand .brand-mark { width: 35px; height: 35px; color: var(--metal); }
.toolbar, .tool { display: flex; align-items: center; }
.toolbar { gap: 12px; }
.tool { justify-content: center; gap: 8px; min-height: 44px; padding: 0 8px; border-radius: var(--control-radius); font-size: .9rem; letter-spacing: .025em; }
.tool:active { background: color-mix(in srgb, var(--metal) 12%, transparent); }
.tool-divider { width: 1px; height: 21px; background: #5a5a48; }
.tool.sound { min-width: 44px; }
.landscape { position: relative; isolation: isolate; overflow: hidden; background: var(--night); color: #fcf0d4; }
.landscape::before {
  content: ""; position: absolute; z-index: -2; inset: 0; margin-inline: auto;
  max-width: calc(var(--sky-width) / var(--screen-density, 1));
  background: var(--sky) 60% 42% / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}
@media (min-resolution: 1.25dppx) { .landscape { --screen-density: 1.25; } }
@media (min-resolution: 1.5dppx) { .landscape { --screen-density: 1.5; } }
@media (min-resolution: 2dppx) { .landscape { --screen-density: 2; } }
@media (min-resolution: 3dppx) { .landscape { --screen-density: 3; } }
.hero-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, color-mix(in srgb,var(--night) 88%,transparent), transparent 69%), linear-gradient(0deg,var(--night),transparent 29%); }
.hero-inner { min-height: clamp(244px,18vw,320px); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 23px 6px 44px; }
.hero-rule { font: 600 .84rem/1.3 var(--serif); letter-spacing: .15em; display: flex; align-items: center; gap: 6px; color: var(--metal); text-shadow: 0 1px 4px #000; margin-bottom: 11px; }
.hero-rule::before, .hero-rule::after { content: ""; width: 37px; height: 1px; background: currentColor; }
.hero-rule::after { width: 15px; }
.hero-rule i { width: 6px; height: 6px; transform: rotate(45deg); background: currentColor; }
h1,h2,h3,p { margin: 0; }
h1 { width: fit-content; font: 500 clamp(2.7rem, 5vw, 4.55rem)/1.23 var(--serif); letter-spacing: .055em; color: var(--title-light); }
/* Only fixed labels have illustrated lettering. Keep the heading elements and
   their text for assistive technology, printing and high-contrast display. */
@supports (content: url("") / "label") {
  @media screen and (forced-colors: none) {
    #journal-title span, .brand span, .page-heading h2 span, .chapter-name {
      display: block; max-width: 100%; height: auto;
    }
    #journal-title span {
      content: var(--title-art) / "任务日志"; width: 4.65em;
      filter: drop-shadow(0 1px 1px #281809) drop-shadow(0 0 4px color-mix(in srgb, var(--metal) 55%, transparent));
    }
    .brand span { content: url("assets/lettering/wordmark.webp") / "QuestLog"; width: 5.65em; }
    [data-theme="northrend"] .brand span { filter: grayscale(1) brightness(1.18); }
    #list-title span { content: url("assets/lettering/contents.webp") / "任务目录"; }
    #detail-title span { content: url("assets/lettering/details.webp") / "任务详情"; }
    .page-heading h2 span { width: 4.4em; }
    .chapter.main .chapter-name { content: url("assets/lettering/main.webp") / "主线任务"; }
    .chapter.side .chapter-name { content: url("assets/lettering/side.webp") / "支线任务"; }
    .chapter-name { width: 4.5em; filter: brightness(0) invert(.94) sepia(.52) drop-shadow(0 1px 1px #33200f); }
    [data-theme="dragonflight"] .chapter-name { filter: none; }
  }
}
.stats { display: flex; gap: 14px; align-items: center; margin-top: 14px; color: #fff3d9; font: 550 1rem/1.5 var(--serif); text-shadow: 0 1px 3px #161311; }
.stats b { font: 700 1.23em/1 var(--roman); font-variant-numeric: lining-nums tabular-nums; color: var(--title-gold); margin-right: 2px; }
.stats i { width: 3px; height: 3px; transform: rotate(45deg); background: #c6b27e; }
.primary, .ink-btn, .plain-btn, .danger-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 10px 18px; border-radius: var(--control-radius); font-weight: 600; box-shadow: var(--bevel), 0 2px 4px #35271325; }
.primary { position: relative; font: 700 1.12rem/1.35 var(--serif); letter-spacing: .06em; color: var(--night); border: 1px solid var(--control-edge); background: linear-gradient(170deg, color-mix(in srgb, var(--metal), #fff5d2 65%), var(--metal) 70%, color-mix(in srgb, var(--metal), #79532e 18%)); box-shadow: var(--bevel), 0 3px 9px #13100c55; }
.primary::before { content: ""; position: absolute; inset: 3px; border: 1px solid #fff9dd72; border-radius: calc(var(--control-radius) - 3px); pointer-events: none; }
.primary:hover { filter: brightness(1.08); }
:is(.primary,.ink-btn,.plain-btn,.danger-btn):active:enabled { transform: translateY(1px); box-shadow: inset 0 1px 3px #503b243d; }
.hero-add { align-self: flex-end; margin-bottom: 12px; }
.mobile-action { display: none; }
.workspace { container-type: inline-size; position: relative; margin-top: -26px; padding-bottom: 24px; }
.book-cover {
  --spread-width: 100cqw;
  --head-size: calc(var(--spread-width) * var(--head-height));
  --foot-size: calc(var(--spread-width) * var(--foot-height));
  position: relative; display: grid; min-height: calc(var(--head-size) + var(--foot-size));
}
.binding-art {
  position: absolute; inset: 0; display: grid; grid-template-rows: var(--head-size) minmax(0,1fr) var(--foot-size);
  pointer-events: none; filter: drop-shadow(0 9px 9px #08090780);
}
.binding-art i { position: relative; display: block; }
.binding-head { --part: var(--frame); }
.binding-length { --part: var(--binding); }
.binding-foot { --part: var(--foot); }
.binding-art i::before, .binding-art i::after {
  content: ""; position: absolute; inset: 0; background-image: var(--part);
  background-size: var(--spread-width) 100%; background-position: left top; background-repeat: no-repeat;
}
.binding-art .binding-length::before, .binding-art .binding-length::after {
  background-size: var(--spread-width) calc(var(--spread-width) * var(--tile-height)); background-repeat: repeat-y;
}
.binding-art i::after { display: none; }
.book { display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.paper-dialog { background: var(--paper) var(--paper-texture); color: var(--ink); }
.page { min-width: 0; position: relative; padding-top: 5.4cqw; padding-bottom: 11.6cqw; }
.list-page { padding-inline: 10.6cqw 3.7cqw; }
.detail-page { display: flex; flex-direction: column; padding-inline: 4.2cqw 8.3cqw; }
.page-heading { display: flex; align-items: center; gap: 10px; color: var(--accent); margin-bottom: 20px; }
.page-heading h2 { color: var(--page-ink); font: 750 clamp(1.45rem, 2.15vw, 1.85rem)/1.3 var(--serif); letter-spacing: .035em; }
.page-heading canvas { width: 22px; height: 22px; }
.page-heading i { flex: 1; height: 1px; background: linear-gradient(90deg,#a89263b0,#a8926329); margin-left: 3px; position: relative; }
.page-heading i::after { content: ""; width: 4px; height: 4px; border: 1px solid #a89263; position: absolute; right: 0; top: -2px; transform: rotate(45deg); background: #eadcbc; }
.journal-search { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
#task-search { flex: 1; min-width: 0; min-height: 44px; }
#task-search::placeholder { color: var(--muted); }
#task-search::-webkit-search-cancel-button { -webkit-appearance: none; }
#clear-search { min-width: 44px; min-height: 44px; border-radius: var(--control-radius); color: var(--page-ink); font-size: .9rem; }
#clear-search:hover { background: var(--paper-wash); text-decoration: underline; }
#search-status:not(:empty) { margin-bottom: 14px; color: var(--muted); font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.search-group + .search-group { margin-top: 14px; }
.search-group > h3 { padding: 6px 12px; border-bottom: 1px solid var(--line); color: var(--page-ink); font: 650 1.1rem/1.45 var(--serif); }
.chapter + .chapter { margin-top: 19px; }
.quest-mark { height: 32px; width: 30px; flex: none; display: inline-grid; place-items: center; color: #ffe6a2; filter: drop-shadow(0 1px 1px #7c6944); }
.quest-mark::before { content: ""; grid-area: 1/1; align-self: stretch; justify-self: stretch; background: linear-gradient(145deg,#967238,#65491e); clip-path: polygon(3% 10%,50% 0,97% 10%,90% 71%,50% 100%,10% 71%); }
.quest-mark b { grid-area: 1/1; position: relative; font: bold 1.5rem/.95 Georgia,serif; transform: translateY(-1px); }
.quest-mark.side { color: #e8d5a8; }
.quest-mark.side::before { background: linear-gradient(145deg,var(--accent),var(--night)); }
.quest-mark.side b { font-size: 1.15rem; }
.chapter-banner {
  --ribbon: var(--main-badge);
  --ribbon-shade: #59380ee8;
  position: relative; isolation: isolate; width: 100%;
  display: flex; align-items: center; min-height: 44px; padding: 5px 22px 5px 54px; gap: 9px;
  border-image: var(--ribbon) 0 4% 0 18% fill / 0 13px 0 54px stretch;
}
.chapter.side .chapter-banner { --ribbon: var(--side-badge); --ribbon-shade: color-mix(in srgb, var(--night) 82%, transparent); }
.chapter-banner::before {
  content: ""; position: absolute; z-index: -1; inset: 18% 14% 18% 48px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--ribbon-shade) 8px, var(--ribbon-shade) 36%, transparent 92%);
}
[data-theme="dragonflight"] .chapter-banner::before { display: none; }
.list-page .page-heading { margin-right: 4cqw; }
.chapter-name { font: 700 clamp(1.1rem, 1.6vw, 1.35rem)/1.35 var(--serif); letter-spacing: .025em; color: var(--ribbon-ink, #fff1bd); text-shadow: var(--ribbon-shadow, 0 1px 2px #2d1e12); }
.fold-mark {
  display: inline-grid; place-items: center; flex: none; width: 14px; height: 16px;
  color: color-mix(in srgb, var(--page-ink) 70%, var(--muted));
}
.fold-mark::before {
  content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateX(-1px) rotate(-45deg); transition: transform .16s ease-out;
}
[aria-expanded="true"] > .fold-mark::before, #completed[open] > summary > .fold-mark::before {
  transform: translateY(-1px) rotate(45deg);
}
.chapter-rank { padding: 1px 6px; color: #fff7df; background: color-mix(in srgb,var(--accent) 68%,#3b2b1c); border-radius: 10px; font: 600 .8rem/1.45 var(--serif); white-space: nowrap; }
.chapter-total { margin-left: auto; font: 600 1.08rem/1.2 var(--roman); font-variant-numeric: lining-nums tabular-nums; color: var(--page-ink); }
.area { border-bottom: 1px solid #ac996a51; }
.area-bar { min-height: 43px; padding: 0 6px 0 12px; display: flex; align-items: center; gap: 8px; color: #65573e; }
.area-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; letter-spacing: inherit; }
.area-toggle > canvas { width: 15px; height: 15px; }
.area-bar h4 { flex: 1; font: 650 1.06rem/1.45 var(--serif); letter-spacing: .035em; color: var(--page-ink); margin: 0; }
.area-add { position: relative; isolation: isolate; color: #665033; display: grid; place-items: center; margin-left: auto; width: 44px; height: 44px; border-radius: 50%; }
.area-add::before { content: ""; position: absolute; z-index: -1; inset: 8px; border: 1px solid #a88b598f; border-radius: inherit; background: var(--paper-wash); box-shadow: var(--bevel); }
.area-add canvas { width: 15px; height: 15px; }
.area-add:is(:hover,:active)::before, .icon-button:is(:hover,:active) { background-color: #745b322e; }
.task-rows, #done-list { padding: 0 clamp(8px, 1.8cqw, 14px) 7px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.task-rows:empty { padding: 0; }
.task-row { display: flex; align-items: center; min-height: 42px; border: 1px solid transparent; border-radius: var(--control-radius); }
.task-row:hover { background-color: #9a895421; }
.task-row.selected { color: var(--page-ink); background: linear-gradient(105deg, color-mix(in srgb, var(--metal) 32%, var(--paper)), #fff5dc54); border-color: #9c80509c; box-shadow: inset 3px 0 0 var(--accent), var(--bevel); }
.row-title { flex: 1; min-width: 0; padding: 8px 12px; align-self: stretch; border-radius: inherit; text-align: left; line-height: 1.45; overflow-wrap: anywhere; }
.task-row.selected .row-title { font-weight: 600; }
.task-row.done .row-title { color: #6f6653; text-decoration: line-through; }
#completed { margin-top: 20px; border-top: 1px solid #a8926369; }
#completed summary { display: flex; align-items: center; gap: 9px; padding-inline: 12px; list-style: none; min-height: 48px; cursor: pointer; font: 650 1.1rem/1.4 var(--serif); color: var(--page-ink); }
#completed summary::-webkit-details-marker { display: none; }
.history-count { font: 600 1rem/1.2 var(--roman); font-variant-numeric: lining-nums tabular-nums; padding: 2px 7px; background: #a894621e; border: 1px solid #ad9c743e; border-radius: 20px; }
.history-range { max-width: 20rem; margin: 0 12px 10px; }
#review-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 12px 8px; }
#review-dates { color: var(--muted); font-size: .9rem; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#copy-review { padding-inline: 12px; font-size: .9rem; }
#copy-review:disabled { cursor: default; }
.review-group + .review-group { margin-top: 10px; }
.review-group-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 8px; min-height: 40px; border-bottom: 1px solid var(--line); padding-inline: 4px; }
.review-group-heading h3 { color: var(--page-ink); font: 650 1.06rem/1.45 var(--serif); }
.copy-area { min-height: 44px; padding-inline: 4px; color: var(--page-ink); font-size: .86rem; text-decoration: underline; text-underline-offset: .2em; }
.review-group .task-row.done .row-title { color: var(--ink); text-decoration: none; }
.history-empty { color: var(--muted); font-size: .88rem; padding: 4px 0 10px 27px; }
#show-deleted { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 12px; color: var(--muted); font-size: .9rem; }
#show-deleted:hover { text-decoration: underline; }
#desktop-detail { flex: 1; display: flex; flex-direction: column; }
.empty-detail { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 5px 0 26px; }
.atlas {
  flex: none; width: min(100%,440px); aspect-ratio: var(--atlas-ratio); margin: 4px 0 15px;
  background: var(--atlas) center / contain no-repeat; mix-blend-mode: multiply;
  mask-image: linear-gradient(90deg,transparent,black 9%,black 91%,transparent),
    linear-gradient(transparent,black 10%,black 90%,transparent);
  mask-composite: intersect;
}
.empty-detail h3 { font: 700 1.5rem/1.5 var(--serif); letter-spacing: .035em; color: var(--page-ink); }
.empty-detail p { max-width: 19em; font-size: 1rem; line-height: 1.7; margin-top: 7px; color: var(--ink); text-wrap: balance; }
.detail-card { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 9px 1px 2px; }
.detail-meta { display: flex; align-items: center; gap: 8px; font-size: .89rem; color: #67563a; }
.detail-meta .quest-mark { width: 23px; height: 26px; }
.detail-meta .quest-mark b { font-size: 1.1rem; }
.detail-meta .quest-mark.side b { font-size: .9rem; }
.detail-name { font: 700 clamp(1.55rem,2.6vw,2.35rem)/1.45 var(--serif); color: var(--page-ink); overflow-wrap: anywhere; margin-top: 17px; }
.detail-notes { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; margin: 16px 0 26px; }
.detail-notes.blank { font-size: .93rem; color: var(--muted); }
.detail-controls { border-top: 1px solid #b3a07788; padding-top: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ink-btn { background: linear-gradient(165deg, var(--accent), color-mix(in srgb, var(--accent) 68%, var(--night))); color: #fff9ed; border: 1px solid var(--night); }
.ink-btn:hover { filter: brightness(1.12); }
.plain-btn { color: #5b4d36; border: 1px solid #a8956a; background: var(--paper-wash); }
.plain-btn:hover { background: #a8915c21; }
.danger-btn { color: #fff1d6; background: linear-gradient(160deg, #944e40, #71392e); border: 1px solid #653629; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; }
.delete-button { margin-left: auto; color: #8b5143; }
.done-stamp { display: inline-block; width: max-content; margin-top: 12px; font: bold 1rem var(--serif); color: #50644b; border: 2px double #657553; padding: 3px 9px; transform: rotate(-4deg); }
.journal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #c1c5b4; margin: 14px 6px 0; font-size: .82rem; }
.journal-footer > span { display: inline-flex; align-items: center; gap: 7px; }
.journal-footer canvas { width: 14px; height: 14px; }
.paper-dialog { padding: 0; width: min(460px,calc(100% - 28px)); max-height: min(90dvh,800px); border: 2px solid #8e7651; border-radius: 8px; box-shadow: 0 14px 65px #070e0bd1, inset 0 0 0 3px #d3bd91; }
.paper-dialog::backdrop { background: #101a16af; }
.dialog-inner { padding: 23px 26px 24px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #aa936dbc; padding-bottom: 8px; margin-bottom: 18px; }
.dialog-heading h2 { font: 700 1.52rem var(--serif); letter-spacing: .04em; }
.dialog-heading .icon-button { margin-right: -7px; }
.dialog-inner > label, .dialog-inner legend { display: block; font-size: .93rem; font-weight: 600; color: #5a4a32; margin-bottom: 7px; }
.dialog-inner label small { font-size: .78rem; font-weight: normal; color: var(--muted); margin-left: 4px; }
#task-search, .dialog-inner input:not([type=radio]):not([type=checkbox]), .dialog-inner textarea { display: block; width: 100%; padding: 10px 12px; color: var(--ink); background: #fff9e890; border: 1px solid #ac9770; border-radius: var(--control-radius); box-shadow: inset 0 1px 3px #6649221f; font-size: 1rem; line-height: 1.45; }
.dialog-inner textarea { resize: vertical; }
.dialog-inner input::placeholder,.dialog-inner textarea::placeholder { color: #8a7b60; }
fieldset { border: 0; padding: 0; margin: 15px 0; min-width: 0; }
legend { padding: 0; }
.choices { display: flex; gap: 8px; }
.choices label { position: relative; flex: 1; }
.choices input { position: absolute; opacity: 0; }
.choices span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid #ae9b77; border-radius: var(--control-radius); cursor: pointer; background: var(--paper-wash); font-size: .93rem; }
.choices span::before { content: ""; width: 7px; height: 7px; border: 1px solid #967c55; transform: rotate(45deg); }
.choices input:checked + span { background: var(--accent); border-color: var(--night); color: #fff9ed; box-shadow: var(--bevel); font-weight: 600; }
.choices input:checked + span::before { border-color: var(--metal); background: var(--metal); }
.choices input:focus-visible + span { outline: 3px solid #89702f; outline-offset: 2px; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.form-error { color: #84392b; font-size: .92rem; margin-top: 10px; }
.import-dialog { width: min(680px,calc(100% - 28px)); }
.import-file { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.import-summary { margin: 9px 0 16px; line-height: 1.6; font-weight: 600; }
.conflict { border-top: 1px solid #b4a17d; padding-top: 12px; }
.conflict + .conflict { margin-top: 24px; }
.conflict legend { max-width: 100%; padding-right: 8px; overflow-wrap: anywhere; }
.merge-hint { margin: 0 0 8px; font-size: .9rem; line-height: 1.5; }
.merge-differences { width: 100%; margin: 10px 0; table-layout: fixed; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.merge-differences caption { text-align: start; padding-bottom: 5px; color: var(--page-ink); font-weight: 600; }
.merge-differences th, .merge-differences td { text-align: start; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.merge-differences thead { background: #a88c5830; }
.merge-differences thead th:first-child { width: 5.5em; }
.merge-differences th { font-weight: 600; }
.merge-differences td { white-space: pre-wrap; font-variant-numeric: tabular-nums; }
.version-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.version-option { min-height: 44px; padding: 9px; display: grid; align-content: center; grid-template-columns: auto minmax(0,1fr); gap: 4px 6px; border: 1px solid #b8a17d; border-radius: var(--control-radius); cursor: pointer; overflow-wrap: anywhere; }
.version-option:has(input:checked) { background: #bec5a552; border-color: #728064; }
.version-option input { accent-color: var(--green); grid-column: 1; margin: 4px 0 0; }
.version-option strong { grid-column: 2; }
.version-option span,.version-option small { grid-column: 1 / -1; white-space: pre-wrap; line-height: 1.5; }
.version-option small { color: var(--muted); }
#delete-copy { overflow-wrap: anywhere; line-height: 1.7; }
#deleted-list { list-style: none; margin: 0; padding: 0; }
#deleted-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
#deleted-list li + li { border-top: 1px solid var(--line); }
#deleted-list li > div { display: grid; gap: 4px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
#deleted-list small, .deleted-notes { color: var(--muted); }
.deleted-notes { white-space: pre-wrap; font-size: .9rem; }
#deleted-list button { flex: none; padding-inline: 12px; }
#deleted-status:not(:empty) { margin-top: 10px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%,10px); z-index: 10; pointer-events: none; opacity: 0; transition: opacity .16s,transform .16s; max-width: min(92vw,600px); width: max-content; color: #f7ecd1; background: var(--night); border: 1px solid #ac9568; box-shadow: 0 3px 18px #10181055; border-radius: 5px; padding: 10px 18px; font-size: .95rem; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast:has(#toast-undo:not([hidden])) { display: flex; align-items: center; gap: 12px; padding-block: 2px; }
#toast-message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toast-undo { flex: none; min-height: 44px; color: #fff2c4; text-decoration: underline; text-underline-offset: .2em; pointer-events: auto; }
.completion-seal { position: fixed; z-index: 8; top: 40%; left: 50%; pointer-events: none; border: 4px double #f1d590; border-radius: 5px; padding: 8px 20px; background: var(--accent); color: #fff6db; font: 700 1.6rem var(--serif); letter-spacing: .14em; box-shadow: 0 5px 23px #18241d40; animation: imprint 1.1s both; transform: translate(-50%,-50%) rotate(-7deg); }
@keyframes imprint { 0% { opacity: 0; scale: 1.2; } 17%,65% { opacity: 1; scale: 1; } 100% { opacity: 0; } }
body:has(dialog[open]) { overflow: hidden; }

.theme-dialog { width: min(700px,calc(100% - 28px)); }
.dialog-inner > .random-setting { display: flex; align-items: center; gap: 10px; width: fit-content; min-height: 40px; cursor: pointer; }
.random-setting input, .theme-card input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 16px 0 0; }
.theme-grid legend { padding-bottom: 4px; }
.theme-card { position: relative; overflow: hidden; display: grid; background: var(--night); color: #fff8ea; border: 2px solid transparent; border-radius: 5px; cursor: pointer; }
.theme-card:has(:checked) { border-color: var(--metal); box-shadow: 0 0 0 2px var(--night); }
.theme-card:focus-within { outline: 3px solid #80662d; outline-offset: 3px; }
.theme-card input { position: absolute; right: 7px; bottom: 8px; }
.theme-scenery { height: 41px; background: var(--preview) center / cover; }
.theme-caption { padding: 6px 28px 7px 8px; font: 600 .94rem/1.3 var(--serif); }
@media (max-width: 580px) { .theme-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 430px) { .theme-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .theme-scenery { height: 32px; } }

@media (min-width: 1500px) { .page { min-height: 480px; } }
@media (max-width: 900px) { .shell { width: calc(100% - 48px); }  }
@media (max-width: 740px) {
  body { min-height: 100dvh; display: flex; flex-direction: column; }
  main { flex: 1; display: flex; flex-direction: column; }
  .shell { width: calc(100% - 26px); }
  .topbar-inner { width: calc(100% - 32px); min-height: 56px; }
  .brand { gap: 6px; }.brand span { font-size: 1.36rem; }.brand .brand-mark { width: 29px; height: 29px; }
  .toolbar { gap: 1px; }.tool { width: 42px; padding: 0; }.tool span { display: none; }.tool-divider { margin: 0 5px; }
  .landscape::before { background-position: 66% 43%; mask-image: none; }
  .hero-shade { background: linear-gradient(90deg, color-mix(in srgb, var(--night) 90%, transparent), color-mix(in srgb, var(--night) 62%, transparent) 51%, transparent 83%), linear-gradient(0deg,var(--night),transparent 29%); }
  .hero-inner { min-height: 180px; padding: 20px 11px 36px; }
  h1 { font-size: 2.7rem; }.hero-rule { margin-bottom: 7px; }.stats { margin-top: 9px; font-size: .89rem; }
  .hero-add, .detail-page { display: none; }
  .workspace { flex: 1; display: flex; flex-direction: column; margin-top: -14px; padding-bottom: 0; }
  .book-cover { --spread-width: 178cqw; flex: 1 0 auto; }
  .binding-art i::before { right: 15%; }
  .binding-art i::after { display: block; left: 85%; background-position: right top; }
  .book { display: block; }
  .list-page { padding: max(24px,8.8cqw) 15cqw max(50px,20cqw); }
  .page-heading { margin-bottom: 16px; }.page-heading h2 { font-size: 1.45rem; }
  .chapter + .chapter { margin-top: 16px; }.area-bar { min-height: 44px; }.area-add { min-width: 44px; min-height: 44px; }
  .row-title { min-height: 44px; }
  #completed { margin-top: 15px; }
  .journal-footer { margin-top: 10px; font-size: .78rem; }
  .mobile-action { position: sticky; z-index: 3; display: flex; justify-content: center; bottom: 0; padding: 10px 20px max(10px,env(safe-area-inset-bottom)); background: linear-gradient(transparent,var(--night) 22%); }
  .mobile-action .primary { width: min(430px,100%); min-height: 46px; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .dialog-inner { padding: 17px 18px 20px; }.paper-dialog { max-height: 92dvh; }
  .merge-differences th, .merge-differences td { padding: 6px 4px; }
  .merge-differences thead th:first-child { width: 4.8em; }
  #mobile-detail, #editor { top: auto; bottom: 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: 91dvh; border-radius: 12px 12px 0 0; border-bottom: 0; }
  #mobile-detail .dialog-inner,#editor .dialog-inner { padding-bottom: max(20px,env(safe-area-inset-bottom)); }
  .detail-name { font-size: 1.75rem; }.detail-notes { min-height: 40px; }
}
@media (max-width: 360px) {
  .topbar-inner { width: calc(100% - 18px); gap: 4px; }
  .brand span { font-size: 1.2rem; }
  .toolbar .tool { width: 37px; min-width: 37px; }
  .chapter-banner { gap: 5px; padding-right: 13px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
