[data-ink="yui"] { --ink-choice:#885028; --ink-dot:#c17741; }
[data-ink="mio"] { --ink-choice:#304e73; --ink-dot:#355578; }
[data-ink="ritsu"] { --ink-choice:#765a15; --ink-dot:#e2b735; }
[data-ink="mugi"] { --ink-choice:#894c65; --ink-dot:#e1a4b9; }
[data-ink="azusa"] { --ink-choice:#79384b; --ink-dot:#843d52; }

#guestbook {
 --book-ink:#3e3226;
 --book-paper:#f4ead5;
 width:min(1100px, calc(100% - 36px));
 max-width:none;
 max-height:calc(100dvh - 28px);
 padding:clamp(14px, 3vw, 26px);
 color:var(--book-ink);
 font-family:"Songti SC","Noto Serif CJK SC","SimSun",serif;
 background:#f5eddc;
 border:1px solid #8c6346;
 border-radius:7px;
 box-shadow:0 24px 88px #1c170f91, inset 0 0 0 4px #8c63461e;
}

#guestbook::backdrop { background:#1e1a14a0; }
#guestbook [hidden] { display:none; }
#guestbook:has(#guestbookReader[hidden]) { width:min(710px, calc(100% - 28px)); }
#guestbook:has(#guestbookReader[data-fitting]) { overflow:hidden; }
#guestbookReader[data-fitting] .guestbook-spread { visibility:hidden; }
#guestbook button {
 border:1px solid #b6a487;
 border-radius:3px;
 background:#f6eddb;
 padding:.46rem .72rem;
 min-height:36px;
 white-space:nowrap;
}
#guestbook button:not(:disabled):hover { background:#e8ddc5; }
#guestbook button:disabled { opacity:.43; cursor:default; }
#guestbook .guestbook-primary {
 color:#fff7e6;
 background:#4e6047;
 border-color:#4e6047;
}
#guestbook .guestbook-primary:not(:disabled):hover { background:#3e5138; }

.guestbook-heading,.guestbook-footer,.guestbook-pagination,.guestbook-submit {
 display:flex;
 align-items:center;
 gap:.55rem;
}
.guestbook-heading,.guestbook-footer { justify-content:space-between; }
.guestbook-heading { margin-bottom:13px; }
#guestbookReader .guestbook-footer { margin-top:12px; }
.guestbook-heading h2 {
 margin:0;
 color:#513b28;
 font-size:clamp(1.35rem, 3vw, 1.82rem);
 letter-spacing:.08em;
}
#guestbookClose { font-size:1.4rem; line-height:1; }
.guestbook-spread {
 position:relative;
 display:grid;
 grid-template-columns:1fr 1fr;
 min-height:clamp(250px, calc(100dvh - 196px), 650px);
 padding:5px;
 border:1px solid #583a28;
 border-radius:5px;
 background:#724a35;
 box-shadow:0 3px 0 #473126, 0 7px 12px #4b34262c;
}
.guestbook-spread::before {
 content:"";
 width:10px;
 position:absolute;
 top:5px;
 bottom:5px;
 left:50%;
 transform:translateX(-50%);
 pointer-events:none;
 z-index:1;
 background:linear-gradient(90deg,transparent,#5842284d 48%,#76563155 53%,transparent);
}
.guestbook-leaf {
 min-width:0;
 padding:12px clamp(10px, 3vw, 28px) 9px;
 background:
  radial-gradient(ellipse at top,#fffaf080,transparent 65%),
  linear-gradient(90deg,#d4bb915c,transparent 8% 93%,#d8be922e),
  var(--book-paper);
 border-radius:3px;
 box-shadow:inset 0 -3px 0 #9f80563b;
 display:flex;
 flex-direction:column;
}
.guestbook-leaf ol {
 list-style:none;
 padding:0;
 margin:0;
 flex:1;
 display:grid;
 grid-auto-rows:minmax(48px,auto);
}
.guestbook-leaf li {
 color:var(--ink-choice,var(--book-ink));
 padding:7px 0 8px;
 min-width:0;
 border-bottom:1px solid #9279584a;
}
.guestbook-leaf li div {
 display:flex;
 align-items:baseline;
 justify-content:space-between;
 gap:6px 12px;
 flex-wrap:wrap;
}
.guestbook-leaf strong { overflow-wrap:anywhere; font-size:.91rem; }
.guestbook-leaf time {
 color:#705e49;
 font: .72rem/1.3 ui-monospace, monospace;
}
.guestbook-leaf p {
 margin:4px 0 0;
 font-size:.9rem;
 line-height:1.48;
 overflow-wrap:anywhere;
}
.guestbook-folio {
 display:block;
 margin-top:8px;
 text-align:center;
 color:#736049;
 font-size:.76rem;
}
.guestbook-reader-feedback {
 display:flex;
 align-items:center;
 gap:10px;
 padding-top:6px;
 min-height:24px;
 font-size:.86rem;
}
.guestbook-reader-feedback:has(p:empty):has(button[hidden]) { display:none; }
#guestbookReaderStatus,#guestbookFormStatus { margin:0; }
#guestbookPageCount {
 min-width:2.7em;
 text-align:center;
 font-variant-numeric:tabular-nums;
 font-size:.83rem;
}
#guestbookForm { max-width:600px; margin:10px auto 0; }
#guestbookForm > label {
 display:block;
 font-weight:600;
 margin:14px 0 6px;
}
#guestbookForm > label span {
 color:#73614c;
 font-size:.84rem;
 font-weight:400;
 margin-left:.4rem;
}
#guestbookForm input[type="text"],#guestbookForm textarea {
 display:block;
 width:100%;
 font:inherit;
 color:var(--book-ink);
 border:1px solid #b7a07f;
 border-radius:3px;
 padding:.57rem .64rem;
 background:#fffbef;
}
.guestbook-writing { position:relative; }
#guestbookForm textarea { resize:vertical; min-height:7em; padding-bottom:1.8em; }
#guestbookCount {
 position:absolute;
 right:9px;
 bottom:7px;
 background:#fffbef;
 color:#73614c;
 font-size:.79rem;
 pointer-events:none;
}
.guestbook-ink { border:0; padding:0; margin:1rem 0; }
.guestbook-ink legend { margin-bottom:.45rem; font-weight:600; }
.guestbook-ink label { position:relative; display:inline-grid; place-items:center; width:36px; height:36px; cursor:pointer; }
.guestbook-ink input { position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.guestbook-ink span { width:22px; height:22px; border-radius:50%; background:var(--ink-dot); pointer-events:none; }
.guestbook-ink input:checked + span { outline:1px solid var(--ink-choice); outline-offset:4px; }
.guestbook-ink input:focus-visible + span { outline:2px solid #513b28; outline-offset:4px; }
#guestbookFormStatus { min-height:1.7em; color:#79384b; }
#guestbookNotice { color:#695840; line-height:1.5; }

@media (max-width:690px) {
 #guestbook { width:calc(100% - 16px); padding:10px; max-height:calc(100dvh - 16px); }
 .guestbook-heading { margin-bottom:8px; }
 .guestbook-spread { grid-template-columns:1fr; min-height:clamp(180px, calc(100dvh - 150px), 530px); }
 .guestbook-spread::before { display:none; }
 .guestbook-leaf { padding:7px 9px; }
 .guestbook-leaf li { padding:4px 0; }
 .guestbook-leaf p { margin-top:2px; font-size:.82rem; line-height:1.35; }
 .guestbook-footer { align-items:flex-start; flex-wrap:wrap; }
 #guestbookReader .guestbook-footer { margin-top:8px; gap:5px; }
 #guestbookWrite { margin-left:auto; }
 .guestbook-pagination { gap:.2rem; }
 #guestbook :is(.guestbook-pagination button,#guestbookWrite) { padding:.3rem .39rem; font-size:.79rem; }
 #guestbookPageCount { min-width:2.45em; }
 .guestbook-leaf li div { line-height:1.2; gap:2px 6px; }
 .guestbook-leaf strong { font-size:.82rem; }
 .guestbook-leaf ol { grid-auto-rows:minmax(45px,auto); }
 .guestbook-submit { flex:1; justify-content:flex-end; }
 .guestbook-leaf time { font-size:.66rem; }
}
