:root {
  --bg: #fdf6ef;
  --surface: #ffffff;
  --ink: #1d1b19;
  --muted: #6b655e;
  --line: #eeddda;
  --accent: #cf5f7e;
  --accent-ink: #ffffff;
  --gold: #a8894f;
  --shadow: 0 1px 2px rgba(30, 20, 10, .06), 0 8px 24px rgba(30, 20, 10, .08);
  --serif: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1518;
    --surface: #2a1f24;
    --ink: #f1ece4;
    --muted: #a39b90;
    --line: #453239;
    --accent: #e79fb4;
    --accent-ink: #1a0d08;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10px 12px, rgba(207, 95, 126, .05) 3px, transparent 4.2px),
    radial-gradient(circle at 32px 36px, rgba(207, 95, 126, .038) 2.2px, transparent 3.4px);
  background-size: 54px 54px;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
}
a { color: inherit; }
img { display: block; max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 36px;
  text-align: center;
  background:
    radial-gradient(560px 260px at 50% -60px, color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--gold) 7%, transparent), transparent 78%);
}
.hero .kicker {
  margin: 0 0 14px;
  font-size: .72rem;
  letter-spacing: .42em;
  text-indent: .42em;
  color: var(--accent);
  font-weight: 700;
}
.hero .wrap { position: relative; z-index: 1; }
.yorkie { position: absolute; pointer-events: none; z-index: 0; height: auto; image-rendering: pixelated; filter: drop-shadow(0 4px 8px rgba(120, 70, 20, .18)); }
.yorkie-foot { image-rendering: pixelated; }
.y-left { left: max(10px, 4vw); bottom: 6px; width: 104px; animation: floaty 3.8s ease-in-out infinite; }
.y-right { right: max(10px, 4vw); top: 14px; width: 84px; animation: floaty 4.6s ease-in-out infinite reverse; }
.yorkie { shape-rendering: crispEdges; }
.paw-deco { position: absolute; pointer-events: none; z-index: 0; animation: twinkle 3s ease-in-out infinite; }
.pd1 { left: 16%; top: 22px; width: 22px; height: 22px; }
.pd2 { right: 17%; bottom: 26px; width: 18px; height: 18px; animation-delay: .7s; }
.pd3 { left: 24%; bottom: 14px; width: 16px; height: 16px; animation-delay: 1.3s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2.5deg); } }
@keyframes twinkle { 0%, 100% { opacity: .3; transform: scale(.9) rotate(-8deg); } 50% { opacity: .85; transform: scale(1.1) rotate(7deg); } }
.foot-in { text-align: center; }
.pet { position: fixed; left: 0; bottom: 4px; z-index: 60; pointer-events: none; will-change: transform; }
.pet .flipwrap { display: block; }
.pet img { display: block; width: 100%; height: auto; image-rendering: pixelated; filter: drop-shadow(0 3px 5px rgba(120, 70, 20, .2)); }
.pet.walking img { animation: walk-bob .34s ease-in-out infinite alternate; transform-origin: bottom center; }
.pet.sleeping img { animation: pet-breathe 2.8s ease-in-out infinite; transform: rotate(-3deg); }
.pet.barking img { animation: pet-hop .32s ease-in-out 3; }
@keyframes walk-bob { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-3.5px) rotate(2deg); } }
@keyframes pet-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.05; } }
@keyframes pet-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }
.pet .bubble {
  position: absolute; left: 50%; bottom: 97%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--line); color: var(--accent);
  font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
  padding: 1px 9px; border-radius: 999px; box-shadow: var(--shadow);
}
.poop-counter { position: fixed; right: 10px; bottom: 8px; z-index: 61; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .8rem; box-shadow: var(--shadow); }
.poop { position: fixed; bottom: 6px; width: 24px; z-index: 55; pointer-events: auto; cursor: pointer; animation: poop-pop .35s cubic-bezier(.22, 1.4, .36, 1); transition: opacity .8s ease, transform .8s ease; }
.poop svg { display: block; width: 100%; height: 24px; }
.poop.bye { opacity: 0; transform: translateY(4px) scale(.8); }
.poop.picked { opacity: 0; transform: scale(1.3); transition: all .18s ease; }
@keyframes poop-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.yorkie-foot { display: block; width: 68px; margin: 0 auto 6px; animation: floaty 4.2s ease-in-out infinite; }
@media (max-width: 720px) {
  .y-left { width: 64px; } .y-right { width: 56px; }
  .pd1 { left: 6%; } .pd2 { right: 6%; } .pd3 { display: none; }
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(2.9rem, 9vw, 4.6rem);
  letter-spacing: .1em;
  line-height: 1.2;
  white-space: nowrap;
  margin: 0 0 14px;
  background: linear-gradient(180deg, #b07f3f 10%, #7c4f21 55%, #9a6a2c 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255, 251, 240, .95)) drop-shadow(0 6px 12px rgba(124, 79, 33, .30));
}
.hero p { margin: 0 auto; color: var(--muted); max-width: 40em; }
.hero-rule { display: flex; justify-content: center; margin-top: 22px; }
.hero-rule span {
  display: block; width: 180px; height: 5px;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  opacity: .75;
}

.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; margin: 4px 0 6px;
}
.tab {
  font: inherit; font-weight: 700; color: var(--muted); white-space: nowrap;
  background: transparent; border: none; border-radius: 999px;
  padding: 10px 2px; cursor: pointer; text-align: center;
  font-size: clamp(.78rem, 3.4vw, 1rem);
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  padding: 12px 0 24px;
}
.toolbar input[type="search"] {
  flex: 1 1 220px; min-width: 0;
  font: inherit; color: inherit;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.toolbar input:focus-visible, .chip:focus-visible, .card:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: .85rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* grid */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-bottom: 72px;
  align-content: start;
}
.card {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow); }
.card .thumb { aspect-ratio: 3 / 4; overflow: hidden; background: var(--line); position: relative; }
.role {
  display: inline-block; font-family: var(--serif); font-weight: 800; letter-spacing: .12em;
  font-size: .95rem; line-height: 1; padding: 7px 12px 7px 14px; border-radius: 999px;
  color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.role.seme { background: #b5452f; }
.role.uke { background: #2f6fb5; }
.role.rev { background: #6b4fa0; }
.modal .role-line { margin-bottom: 12px; }
.modal .role-line .role { font-size: 1.12rem; padding: 10px 22px 10px 24px; box-shadow: 0 4px 14px rgba(0, 0, 0, .30); }
.card .marks { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 6px 0 2px; }
.card .mark {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; line-height: 1;
  padding: 6px 10px; border-radius: 999px; color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.card .mark.plot { background: linear-gradient(135deg, #c9a227, #a8894f); }
.card .mark.proxy { background: #243447; }
.card.has-plot { border-color: var(--gold); box-shadow: 0 6px 20px rgba(168, 137, 79, .22); }
.card.has-proxy { border-color: #243447; }
.card .mark.uchiyoso { background: #2e8b72; }
.card.has-uchiyoso { border-color: #2e8b72; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .45s ease; }
.card:hover .thumb img { transform: scale(1.045); }
.card .meta { padding: 12px 14px 16px; }
.card .name {
  font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .name:has(ruby) { line-height: 2.05; }
.card .name rt { font-family: var(--sans); font-size: .5em; font-weight: 400; letter-spacing: .06em; color: var(--muted); }
.modal h2:has(ruby) { line-height: 1.75; }
.modal h2 rt { font-family: var(--sans); font-size: .36em; font-weight: 700; letter-spacing: .12em; color: var(--accent); }
.card .sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; grid-column: 1 / -1; }

/* modal */
dialog {
  border: none; padding: 0; background: var(--surface); color: var(--ink);
  width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
}
dialog::backdrop { background: rgba(10, 8, 6, .6); }
dialog[open] { animation: nuru-in .34s cubic-bezier(.22, 1.2, .36, 1); transform-origin: center bottom; }
dialog[open]::backdrop { animation: backdrop-in .25s ease; }
@keyframes nuru-in {
  from { opacity: 0; transform: translateY(26px) scale(.965); }
  60% { opacity: 1; }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.card:active { transform: scale(.97); }
.modal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-height: calc(100dvh - 24px); }
.modal .gallery { background: var(--line); display: flex; flex-direction: column; min-height: 0; }
.modal .gallery .main { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.modal .gallery .main img { width: 100%; height: 100%; max-height: calc(100dvh - 24px - 84px); object-fit: contain; }
.modal .thumbs { display: flex; gap: 8px; padding: 10px; justify-content: center; }
.modal .thumbs button {
  all: unset; cursor: pointer; width: 52px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; opacity: .65;
}
.modal .thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.modal .thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.modal .info { padding: 32px 28px 28px; overflow: auto; }
.modal h2 { font-family: var(--serif); font-size: 1.9rem; margin: 0; line-height: 1.3; }
.modal .age { color: var(--accent); font-weight: 700; margin: 2px 0 14px; }
.modal .summary { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 20px; }
.plot-links { border: 2px solid var(--gold); background: #fff8e6; border-radius: 14px; padding: 14px; margin: 0 0 20px; }
.plot-links-title { color: #8a6414; font-weight: 700; letter-spacing: .08em; margin-bottom: 10px; }
.plot-link-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.plot-link { color: #fff; text-decoration: none; font-weight: 700; padding: 10px 16px; border-radius: 999px; box-shadow: 0 3px 8px rgba(90, 60, 0, .18); }
.plot-link.zeta { background: #6c4bd8; }
.plot-link.chacha { background: #e56b8c; }
.plot-link.moox { background: #2f8f83; }
.modal dl { margin: 0; }
.modal dt { font-size: .75rem; letter-spacing: .14em; color: var(--muted); margin-top: 16px; }
.modal dd { margin: 2px 0 0; }
.modal .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px; }
.modal .tags span { font-size: .8rem; border: 1px solid var(--line); color: var(--muted); padding: 1px 10px; border-radius: 999px; }
.close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface); color: var(--ink); font-size: 1.3rem; line-height: 1;
  box-shadow: var(--shadow);
}

footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: .85rem; }

@media (max-width: 720px) {
  .hero { padding-top: 36px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .card { border-radius: 12px; }
  .card .meta { padding: 7px 8px 9px; }
  .card .name { font-size: .78rem; }
  .card .sub { font-size: .66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .thumb .role { font-size: .66rem; padding: 4px 8px 4px 9px; top: 6px; left: 6px; }
  .card .marks { top: 6px; right: 6px; gap: 4px; }
  .card .mark { font-size: .6rem; padding: 4px 7px; }
  .modal { grid-template-columns: 1fr; overflow: auto; }
  .modal .gallery .main img { max-height: 60dvh; }
  .modal .info { padding: 20px 18px 28px; overflow: visible; }
  dialog { overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; } .card:hover { transform: none; }
  dialog[open], dialog[open]::backdrop { animation: none; }
  .yorkie, .paw-deco, .yorkie-foot { animation: none; }
  .pet img, .poop { animation: none; }
}

/* admin */
.admin h1 { font-family: var(--serif); font-size: 1.8rem; margin: 40px 0 4px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 20px 0; }
.panel h2 { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 12px; }
.panel details > summary { cursor: pointer; font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }
.field { display: grid; gap: 4px; margin: 12px 0; }
.field label, .field .lbl { font-size: .85rem; color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field input[type="search"], .field input[type="url"], .field textarea {
  font: inherit; font-size: 16px; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
.field textarea { min-height: 84px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 999px; padding: 10px 22px; min-height: 46px;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .5; cursor: progress; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.note { color: var(--muted); font-size: .85rem; }
.status { margin-top: 12px; min-height: 1.6em; font-size: .9rem; }
.status.err { color: var(--accent); font-weight: 700; }
.list { display: grid; gap: 8px; }
.list .item { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.list .item img { width: 56px; height: 72px; object-fit: cover; object-position: top; border-radius: 8px; background: var(--line); }
.list .item .t { flex: 1; min-width: 0; }
.list .item .t small { color: var(--muted); display: block; }
.imgs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.imgs figure { margin: 0; width: 84px; text-align: center; font-size: .75rem; color: var(--muted); }
.imgs img { width: 84px; height: 108px; object-fit: cover; object-position: top; border-radius: 8px; background: var(--line); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }

/* admin usability */
.role-btn { font-size: 1rem; font-weight: 700; padding: 10px 26px; min-height: 46px; }
.role-btn[data-role="攻め"][aria-pressed="true"] { background: #b5452f; border-color: #b5452f; color: #fff; }
.role-btn[data-role="受け"][aria-pressed="true"] { background: #2f6fb5; border-color: #2f6fb5; color: #fff; }
.role-btn[data-role="リバ"][aria-pressed="true"] { background: #6b4fa0; border-color: #6b4fa0; color: #fff; }
.tag-suggest { margin-top: 8px; }
.tag-suggest-btn.plot { border: 1px solid var(--gold); color: var(--gold); font-weight: 700; }
.tag-suggest-btn.uchiyoso { border: 1px solid #2e8b72; color: #2e8b72; font-weight: 700; }
#intro-field { border-left: 3px solid var(--gold); padding-left: 12px; }
[hidden] { display: none !important; }
.plot-url-field { border: 2px solid var(--gold); background: #fffaf0; border-radius: 14px; padding: 14px; }
.plot-url-field .plot-url-title { color: #8a6414; font-size: 1rem; font-weight: 700; }
.plot-url-field label { margin-top: 6px; color: var(--ink); font-weight: 700; }
.tag-suggest .chip { padding: 7px 14px; min-height: 38px; }
.tag-suggest .chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #fff; }
.savebar {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 0 4px; margin-top: 20px;
}
.savebar .btn[type="submit"] { flex: 1 1 auto; }
.list .item { padding: 10px; }
.list .item .btn { min-height: 42px; padding: 8px 16px; }

.modal .secret {
  filter: blur(7px); cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: filter .25s ease;
}
.modal .secret.revealed { filter: none; user-select: text; -webkit-user-select: text; }
.modal .secret-hint { display: block; margin-top: 5px; font-size: .74rem; color: var(--muted); }

.modal .prompt-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.modal .copy-btn {
  display: block; margin-top: 7px; font: inherit; font-size: .78rem; font-weight: 700;
  padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.modal .copy-btn:active { transform: scale(.96); }

.list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.list .note { grid-column: 1 / -1; }
.acard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-align: center; cursor: pointer;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.acard img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; display: block; background: var(--line); }
.acard .aimg-empty { width: 100%; aspect-ratio: 4 / 5; background: var(--line); }
.acard .aname { font-weight: 700; font-size: .84rem; padding: 7px 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .afoot { display: flex; gap: 6px; justify-content: center; padding: 5px 6px 10px; }
.acard .afoot .btn { min-height: 34px; padding: 5px 12px; font-size: .78rem; }
.acard.dragging {
  outline: 3px solid var(--accent); transform: scale(1.03);
  opacity: .94; box-shadow: 0 18px 40px rgba(31, 27, 23, .35);
}
.acard img { pointer-events: none; -webkit-user-drag: none; }
.acard-ph { border: 2px dashed var(--line); border-radius: 14px; background: rgba(31, 27, 23, .06); }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 600px; margin: 28px auto 4px;
}
.pager[hidden] { display: none; }
.pager-btn {
  font: inherit; font-weight: 700; letter-spacing: .05em; cursor: pointer;
  padding: 13px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--ink); color: var(--bg);
  flex: 0 0 148px; text-align: center; white-space: nowrap;
}
#page-prev { background: var(--surface); color: var(--ink); }
.pager-btn:active { transform: scale(.97); }
.pager-info { font-weight: 700; color: var(--muted); white-space: nowrap; }
@keyframes pOutNext { to { transform: translateX(-72px); opacity: 0; } }
@keyframes pInNext { from { transform: translateX(72px); opacity: 0; } }
@keyframes pOutPrev { to { transform: translateX(72px); opacity: 0; } }
@keyframes pInPrev { from { transform: translateX(-72px); opacity: 0; } }
.page-out-next { animation: pOutNext .22s cubic-bezier(.5, 0, .75, 0) forwards; will-change: transform, opacity; }
.page-in-next { animation: pInNext .34s cubic-bezier(.22, .61, .21, 1); will-change: transform, opacity; }
.page-out-prev { animation: pOutPrev .22s cubic-bezier(.5, 0, .75, 0) forwards; will-change: transform, opacity; }
.page-in-prev { animation: pInPrev .34s cubic-bezier(.22, .61, .21, 1); will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
  .page-out-next, .page-in-next, .page-out-prev, .page-in-prev { animation: none; }
}

/* ===== Classical refinement（上品クラシカル） ===== */
:root { --gold-line: color-mix(in srgb, var(--gold) 42%, var(--line)); }

/* ヒーロー：内側に額縁のような二重の枠 */
.hero {
  box-shadow:
    inset 0 0 0 1px var(--gold-line),
    inset 0 0 0 9px var(--bg),
    inset 0 0 0 10px color-mix(in srgb, var(--gold) 30%, transparent);
}
/* キッカー：両側に金のライン */
.hero .kicker { display: flex; align-items: center; justify-content: center; gap: 16px; text-indent: 0; }
.hero .kicker::before, .hero .kicker::after {
  content: ""; height: 1px; width: min(76px, 16vw);
}
.hero .kicker::before { background: linear-gradient(90deg, transparent, var(--gold)); }
.hero .kicker::after { background: linear-gradient(90deg, var(--gold), transparent); }

.hero p { letter-spacing: .04em; }

/* タブ・チップ：金の差し色と深み */
.tabs { border-color: var(--gold-line); box-shadow: 0 2px 10px rgba(30, 20, 10, .05), inset 0 0 0 3px var(--bg); }
.tab[aria-selected="true"] {
  background: linear-gradient(180deg, #3b332a, var(--ink));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 3px 8px rgba(30, 20, 10, .22);
}
.chip { border-color: var(--gold-line); }
.chip[aria-pressed="true"] { background: linear-gradient(180deg, #3b332a, var(--ink)); border-color: var(--ink); }
.toolbar input[type="search"] { border-color: var(--gold-line); box-shadow: inset 0 1px 4px rgba(30, 20, 10, .05); }

/* カード：金の縁取りと深い影、写真にマットの内枠 */
.card {
  border-color: var(--gold-line);
  box-shadow: 0 1px 2px rgba(30, 20, 10, .05), 0 12px 28px rgba(30, 20, 10, .08);
}
.card:hover { box-shadow: 0 2px 3px rgba(30, 20, 10, .06), 0 18px 38px rgba(124, 79, 33, .18); }
.card .thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .30), inset 0 0 0 5px rgba(29, 27, 25, .05);
}
.card .meta {
  border-top: 1px solid var(--gold-line);
  background: color-mix(in srgb, var(--gold) 5%, var(--surface));
}
.card .name { letter-spacing: .03em; }

/* 詳細モーダル：外枠と内枠の額縁 */
dialog {
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  box-shadow: 0 30px 70px rgba(20, 12, 4, .38), 0 4px 18px rgba(20, 12, 4, .22);
}
.modal { position: relative; }
.modal::after {
  content: ""; position: absolute; inset: 7px; z-index: 4; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent);
  border-radius: 6px;
}
/* ギャラリー：マット（余白）＋額縁 */
.modal .gallery {
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 16%, var(--line)), var(--line));
  padding: 16px;
}
.modal .gallery .main {
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 12px 30px rgba(30, 20, 10, .22), inset 0 0 0 4px color-mix(in srgb, var(--gold) 10%, var(--surface));
}
.modal .thumbs { padding: 12px 2px 2px; }
.modal .thumbs button { border-radius: 4px; box-shadow: 0 2px 6px rgba(30, 20, 10, .18); }

/* 情報側：見出しの飾り線、引用風サマリー、仕様書風の罫 */
.modal h2 { padding-bottom: 12px; }
.modal h2::after {
  content: ""; display: block; width: 68px; height: 3px; margin-top: 10px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), color-mix(in srgb, var(--gold) 15%, transparent));
}
.modal .age { letter-spacing: .1em; }
.modal .summary {
  border-left: 3px solid color-mix(in srgb, var(--gold) 70%, transparent);
  padding: 4px 0 4px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 8%, transparent), transparent 72%);
}
.modal dt { color: color-mix(in srgb, var(--gold) 78%, var(--ink)); font-weight: 700; }
.modal dd { border-bottom: 1px dotted var(--gold-line); padding-bottom: 10px; }
.modal .prompt-text {
  background: color-mix(in srgb, var(--gold) 6%, var(--bg));
  border: 1px solid var(--gold-line); border-radius: 8px;
  padding: 10px 12px; font-size: .94rem;
}
.modal .copy-btn { border-color: var(--gold-line); }
.modal .copy-btn:hover { border-color: var(--gold); }
.modal .tags span {
  border-color: var(--gold-line); color: color-mix(in srgb, var(--gold) 72%, var(--ink));
  background: color-mix(in srgb, var(--gold) 6%, var(--surface)); letter-spacing: .05em;
}
.plot-links { box-shadow: inset 0 0 0 3px #fffdf4, inset 0 0 0 4px color-mix(in srgb, var(--gold) 35%, transparent), 0 6px 16px rgba(90, 60, 0, .10); }
.close { border: 1px solid var(--gold-line); }

/* フッター：二重線 */
footer { border-top: 3px double var(--gold-line); }

/* ページャーボタン：影で浮かせる */
.pager-btn { box-shadow: 0 5px 14px rgba(30, 20, 10, .16); }
#page-prev { border-color: var(--gold-line); }

@media (max-width: 720px) {
  .modal .gallery { padding: 10px; }
  .modal::after { inset: 5px; }
}

/* ===== Loading screen ===== */
.loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .45s ease;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-img {
  width: min(400px, 84vw); height: auto;
  border-radius: 14px; border: 1px solid var(--gold-line);
  box-shadow: 0 16px 40px rgba(30, 20, 10, .16);
  background: #f7efe3;
  animation: loader-bob .38s ease-in-out infinite alternate;
}
@keyframes loader-bob {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-7px) rotate(1.2deg); }
}
.loader-text {
  margin: 0; font-family: var(--serif); font-weight: 700; font-size: .95rem;
  letter-spacing: .34em; text-indent: .34em;
  color: color-mix(in srgb, var(--gold) 80%, var(--ink));
  animation: loader-pulse 1.6s ease-in-out infinite;
}
@keyframes loader-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .loader { transition: none; }
  .loader-text { animation: none; }
  .loader-img { animation: none; }
}

/* ===== Loading progress bar ===== */
.loader-progress {
  position: relative;
  width: min(300px, 74vw);
  margin-top: 34px;
}
.loader-runner {
  position: absolute;
  left: 0%;
  bottom: calc(100% + 1px);
  width: 74px; height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 3px rgba(30, 20, 10, .22));
  animation: runner-bob .3s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes runner-bob {
  from { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  to { transform: translateX(-50%) translateY(-4px) rotate(2deg); }
}
.loader-bar {
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--gold) 22%, var(--bg));
  border: 1px solid var(--gold-line);
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), #8a6a2f);
  transition: width .18s ease;
}
.loader-pct {
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .loader-runner { animation: none; }
  .loader-bar-fill { transition: none; }
}

/* ===== 推しプロット紹介ページ ===== */
.hero-sub { padding: 40px 0 26px; }
.back-line { margin: 0 0 10px; text-align: left; }
.back-link { color: var(--gold); font-weight: 700; font-size: .9rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.hero-nav { margin: 20px 0 0; }
.plots-link {
  display: inline-block;
  padding: 10px 26px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  color: color-mix(in srgb, var(--gold) 82%, var(--ink));
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: .12em;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.plots-link:hover { background: var(--gold); color: #fff; }
.plot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 18px;
  padding: 26px 0 10px;
}
.plot-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--gold-line, var(--line));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.plot-card:hover { transform: translateY(-3px); }
.plot-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 26%, var(--bg)), color-mix(in srgb, var(--accent) 20%, var(--bg)));
  overflow: hidden;
}
.plot-thumb-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 800; font-size: 1.5rem; letter-spacing: .14em;
  color: color-mix(in srgb, var(--gold) 75%, var(--ink));
}
.plot-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.plot-badge {
  position: absolute; left: 10px; bottom: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  box-shadow: 0 2px 6px rgba(30, 20, 10, .25);
}
.plot-badge.zeta { background: #6c4bd8; }
.plot-badge.chacha { background: #e56b8c; }
.plot-badge.moox { background: #2f8f83; }
.plot-badge.other { background: #8a7a5c; }
.plot-meta { padding: 14px 16px 16px; }
.plot-meta h3 {
  margin: 0 0 6px;
  font-family: var(--serif); font-size: 1.06rem; line-height: 1.5;
}
.plot-comment { margin: 0 0 10px; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.plot-open { color: var(--gold); font-weight: 700; font-size: .88rem; letter-spacing: .06em; }

/* 管理画面：推しプロット一覧 */
.prow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--line);
}
.prow img { width: 76px; height: 50px; object-fit: cover; border-radius: 8px; flex: none; }
.pthumb-empty {
  width: 76px; height: 50px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: .78rem;
}
.prow .ptitle { flex: 1; font-weight: 700; line-height: 1.5; }
.field select {
  width: 100%;
  font: inherit; font-size: 16px;
  padding: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}

/* ===== ドット文字（タイトル・見出し） ===== */
:root { --dot: "DotGothic16", "Zen Kaku Gothic New", sans-serif; }
.hero h1,
.modal h2,
.card .name,
.plot-meta h3 {
  font-family: var(--dot);
  font-weight: 400;
  letter-spacing: .04em;
}

/* ===== キャラ詳細：プロットリンクのサムネ＋タイトル ===== */
.plot-rich { display: flex; flex-direction: column; gap: 10px; }
.plot-rich-card {
  display: flex; gap: 12px; align-items: center;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.plot-rich-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.plot-rich-thumb {
  position: relative; flex: none;
  width: 118px; aspect-ratio: 16 / 9;
  border-radius: 8px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 26%, var(--bg)), color-mix(in srgb, var(--accent) 20%, var(--bg)));
}
.plot-rich-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plot-rich-thumb .plot-thumb-fallback { font-size: 1rem; }
.plot-rich-meta { min-width: 0; }
.plot-rich-title {
  font-weight: 700; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plot-rich-svc { font-size: .8rem; font-weight: 700; margin-top: 2px; }
.plot-rich-card.zeta .plot-rich-svc { color: #6c4bd8; }
.plot-rich-card.chacha .plot-rich-svc { color: #e56b8c; }
.plot-rich-card.moox .plot-rich-svc { color: #2f8f83; }

/* ===== タイトル調整：太字ドット・ページ間位置揃え ===== */
.hero h1 { font-weight: 700; }
.hero-sub { padding: 68px 20px 46px; }
.hero-sub .hero-nav { position: absolute; top: 14px; left: 18px; margin: 0; z-index: 3; }
.hero-sub h1 { max-width: 100%; }

/* ===== タイトル見栄え修正＋プロットページのタブ・自プロット ===== */
.hero .y-right { top: auto; bottom: 12px; }
.hero-sub .back-line { position: absolute; top: 14px; left: 18px; margin: 0; z-index: 3; }
.plot-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface); border: 1px solid var(--gold-line);
  border-radius: 999px; padding: 4px; margin: 20px 0 18px;
  box-shadow: 0 2px 10px rgba(30, 20, 10, .05), inset 0 0 0 3px var(--bg);
}
.ptab {
  appearance: none; border: 0; background: transparent; border-radius: 999px;
  padding: 12px 8px; font: inherit; font-family: var(--serif); font-weight: 700;
  font-size: 1.02rem; color: var(--ink); cursor: pointer;
}
.ptab[aria-selected="true"] {
  background: linear-gradient(180deg, #3b332a, var(--ink)); color: var(--bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 3px 8px rgba(30, 20, 10, .22);
}
.own-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.own-card {
  background: var(--surface); border: 1px solid var(--gold-line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.own-thumb { aspect-ratio: 4 / 3; background: color-mix(in srgb, var(--gold) 14%, var(--bg)); }
.own-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.own-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.own-name { font-family: var(--dot); font-size: 1.3rem; line-height: 1.35; }
.own-intro { font-size: .92rem; line-height: 1.7; white-space: pre-wrap; margin: 0; }
.own-links { display: flex; flex-direction: column; gap: 8px; }
.own-nolink { font-size: .85rem; opacity: .75; margin: 0; }

/* ===== 最終微調整：戻るリンク重なり解消・自プロット画像の見切れ対策 ===== */
.hero-sub { padding: 34px 20px 46px; }
.hero-sub .back-line { position: static; margin: 0 0 10px; }
.own-thumb { aspect-ratio: 3 / 4; }
.own-thumb img { object-position: top; }

/* ===== 管理画面：グループ絞り込み・ページ内ジャンプ ===== */
.group-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.gbtn {
  appearance: none; border: 1px solid var(--gold-line); background: var(--surface);
  color: var(--ink); border-radius: 999px; padding: 9px 14px;
  font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer;
}
.gbtn[aria-pressed="true"] { background: linear-gradient(180deg, #3b332a, var(--ink)); color: var(--bg); }
.jump-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; margin: 0 0 12px; }

/* ===== 展示風カード（プロット紹介ページ共通） ===== */
.exhibit-grid { gap: 22px; }
.exhibit-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: 8px;
  padding: 10px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
a.exhibit-card:hover { transform: translateY(-3px); }
.exhibit-frame {
  position: relative;
  background: color-mix(in srgb, var(--bg) 82%, #ffffff);
  border: 1px solid var(--gold-line);
  padding: 8px;
}
.exhibit-no {
  position: absolute; top: -9px; left: 8px; z-index: 2;
  background: var(--ink); color: var(--bg);
  font-family: var(--serif); font-size: .7rem; font-weight: 700;
  letter-spacing: .14em; padding: 3px 8px; border-radius: 3px;
}
.exhibit-img {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 26%, var(--bg)), color-mix(in srgb, var(--accent) 20%, var(--bg)));
}
.exhibit-img.wide { aspect-ratio: 3 / 4; }
.exhibit-img.tall { aspect-ratio: 3 / 4; }
.exhibit-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.exhibit-img.tall img { object-position: top; }
.exhibit-caption { padding: 12px 4px 6px; }
.exhibit-title { font-family: var(--dot); font-size: 1.15rem; line-height: 1.45; margin: 0 0 4px; }
.exhibit-meta { font-size: .84rem; font-weight: 700; color: #8a6d3b; margin: 0 0 6px; }
.exhibit-desc { font-size: .9rem; line-height: 1.7; margin: 0 0 8px; white-space: pre-wrap; }
.exhibit-open { font-size: .88rem; font-weight: 700; color: var(--gold); }

/* ===== 管理画面：トップへ戻るボタン・詳細設定フォールド ===== */
#to-top {
  position: fixed; right: 14px; bottom: 84px; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--ink); color: var(--bg);
  font-size: 1.3rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
#to-top.show { opacity: 1; pointer-events: auto; }
.fold { border: 1px dashed var(--gold-line); border-radius: 10px; padding: 6px 12px; margin: 0 0 14px; }
.fold summary { cursor: pointer; font-weight: 700; padding: 8px 0; }

/* ===== UI統一：ナビボタン・ページャー・見出し ===== */
.back-link {
  display: inline-block;
  padding: 10px 26px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  color: color-mix(in srgb, var(--gold) 82%, var(--ink));
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: .12em;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.back-link:hover { background: var(--gold); color: #fff; text-decoration: none; }
.hero-sub { padding: 68px 20px 46px; }
.hero-sub .back-line { position: static; margin: 20px 0 0; text-align: center; }
.pager-btn {
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  color: color-mix(in srgb, var(--gold) 82%, var(--ink));
  border: 1.5px solid var(--gold);
  font-family: var(--serif);
  letter-spacing: .12em;
  box-shadow: none;
  transition: background .2s ease, color .2s ease, transform .1s ease;
}
.pager-btn:hover { background: var(--gold); color: #fff; }
#page-prev {
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  color: color-mix(in srgb, var(--gold) 82%, var(--ink));
  border-color: var(--gold);
}
body.admin h1, body.admin h2, body.admin h3 { font-family: var(--dot); font-weight: 400; letter-spacing: .04em; }
