/*! © 2026 烏蜃工房 | 愛すべき隣人たち | 無断転載・改変再配布禁止 */
:root {
  --ink: #303344;
  --muted: #636778;
  --paper: #fffdf7;
  --line: #e2e1da;
  --accent: #ed9879;
  --tint: #fff0e8;
  --bounce-speed: 240ms;
  --bar-speed: 750ms;
  --glow-speed: 2200ms;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid #383c72; outline-offset: 5px; }
.site-header {
  padding: 44px 20px 32px;
  text-align: center;
  background: linear-gradient(135deg, #fff0da, #f4edff 60%, #eaf3ff);
  border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: .8rem; letter-spacing: .12em; font-weight: 700; }
h1 { margin: 8px 0; font-size: clamp(1.5rem, 4vw, 2.6rem); line-height: 1.4; }
.site-subtitle { margin: 0 0 12px; font-size: .95rem; color: var(--muted); }
h2, h3, p { margin-top: 0; }
.site-header p:last-child { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
main { max-width: 1160px; margin: auto; padding: 32px 24px 48px; }
.collection-panel { margin-bottom: 28px; padding: 18px 20px; border: 2px solid var(--line); border-radius: 20px; background: white; }
.collection-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
#collection-text { margin: 0; font-weight: 700; }
.reset-button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: .85rem; }
.collection-progress { height: 16px; overflow: hidden; border: 1px solid #ddd8ed; border-radius: 999px; background: #f1eff8; }
.collection-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #b69bd6, #7daedc); transition: width var(--bar-speed) ease-out; }
.collection-panel.complete { border-color: #b69bd6; animation: collection-glow var(--glow-speed) ease-in-out infinite alternate; }
@keyframes collection-glow { to { box-shadow: 0 0 14px #b69bd680; } }
.storage-warning { margin: 8px 0 0; color: var(--muted); font-size: .75rem; }
.section-heading { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; }
.section-heading h2 { font-size: 1.25rem; }
#list-count { color: var(--muted); font-size: .85rem; }
.category-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.category-tab {
  border: 2px solid var(--accent);
  background: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
}
.category-tab[aria-pressed="true"] { background: var(--tint); box-shadow: 0 3px 0 var(--accent); }
.list-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.search-control { flex: 1 1 280px; min-width: 0; }
.sort-control { flex: 0 1 240px; min-width: 0; }
.control-label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 700; }
.search-field { display: flex; gap: 8px; }
#character-search, #character-sort {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
#character-search { flex: 1; }
#character-search::placeholder { color: var(--muted); }
#character-sort { cursor: pointer; }
#character-search:focus-visible, #character-sort:focus-visible { outline: 3px solid #383c72; outline-offset: 3px; }
#clear-search {
  flex: 0 0 48px;
  min-height: 48px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: white;
  font-size: 1.4rem;
}
.no-result { padding: 28px 20px; border: 1px solid var(--line); border-radius: 20px; background: white; color: var(--muted); text-align: center; }
@media (max-width: 720px) {
  .list-controls { flex-direction: column; align-items: stretch; }
  .search-control, .sort-control { flex: none; width: 100%; }
}
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.character-card {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: 22px;
  background: white;
  box-shadow: 0 5px 0 var(--tint), 0 8px 16px #30334408;
  transition: transform var(--bounce-speed), box-shadow var(--bounce-speed);
}
@media (hover: hover) {
  .character-card:hover { transform: translateY(-6px) rotate(-1deg); }
}
.character-card:active { transform: translateY(-4px) scale(1.025); }
.character-card.rare { animation: rare-glow var(--glow-speed) ease-in-out infinite alternate; }
.encounter-stamp { position: absolute; top: 12px; right: 10px; z-index: 1; padding: 3px 8px; border: 2px solid #49675a; border-radius: 6px; background: #ffffffed; color: #49675a; font-size: .75rem; font-weight: 800; line-height: 1.5; transform: rotate(8deg); pointer-events: none; }
@keyframes rare-glow { to { box-shadow: 0 0 15px var(--accent), 0 5px 0 var(--tint); } }
.portrait {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 14px;
  background: var(--tint);
}
.portrait img { position: absolute; width: 100%; height: 100%; object-fit: contain; }
.silhouette { width: 100%; height: 100%; max-height: 260px; color: var(--accent); }
.card-number { display: block; margin-top: 12px; font-size: .75rem; color: var(--muted); }
.card-name { display: block; margin: 2px 0; font-weight: 800; font-size: 1.1rem; }
.card-alias { display: block; font-size: .8rem; color: var(--muted); }
.rarity { display: block; color: #886207; letter-spacing: .08em; font-size: 1rem; }
.detail-view { max-width: 900px; margin: auto; }
.detail-navigation { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.detail-nav-button {
  min-width: 88px;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--tint);
  font-weight: 700;
}
.detail-nav-button:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line); background: #f0f1f5; }
.detail-position { min-width: 64px; margin: 0; text-align: center; color: var(--muted); font-size: .9rem; }
.route-notice { padding: 14px 18px; border: 1px solid var(--accent); border-radius: 14px; background: var(--tint); }
.share-controls { margin-top: 24px; text-align: center; }
.encounter-controls { margin-top: 24px; text-align: center; }
.encounter-button { min-height: 48px; padding: 10px 24px; border: 2px solid var(--accent); border-radius: 999px; background: white; font-weight: 700; }
.encounter-button[aria-pressed="true"] { background: var(--tint); box-shadow: 0 3px 0 var(--accent); }
.copy-button { min-height: 48px; padding: 10px 24px; border: 2px solid var(--accent); border-radius: 999px; background: var(--tint); font-weight: 700; }
.copy-button:disabled { opacity: .6; cursor: wait; }
.copy-status { min-height: 1.8em; margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.manual-copy { max-width: 600px; margin: 12px auto 0; text-align: left; }
.manual-copy label { display: block; margin-bottom: 6px; font-size: .85rem; }
.manual-copy textarea { width: 100%; min-height: 170px; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font: inherit; font-size: 1rem; resize: vertical; }
.manual-copy textarea:focus-visible { outline: 3px solid #383c72; outline-offset: 3px; }
.detail-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 2px solid var(--accent);
  border-radius: 24px;
  background: var(--tint);
}
.detail-hero h2 { margin: 4px 0 8px; font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.4; }
.detail-hero .portrait { background: #ffffff90; }
.category-badge { display: inline-block; font-size: .8rem; background: white; padding: 3px 12px; border-radius: 999px; }
.panel { margin-top: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.panel h3 { margin-bottom: 16px; font-size: 1.1rem; }
.info-list { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.info-list dt { font-size: .85rem; font-weight: 700; color: var(--muted); }
.info-list dd { margin: 0; }
.stats-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 24px; }
.radar { width: 100%; height: auto; }
.radar-grid { fill: none; stroke: #d9dce5; stroke-width: 1; }
.radar-area { fill: var(--accent); fill-opacity: .28; stroke: var(--accent); stroke-width: 2; }
.radar text { fill: var(--ink); font-size: 11px; text-anchor: middle; }
.chart-note { font-size: .75rem; color: var(--muted); text-align: center; margin: 0; }
.stat-row + .stat-row { margin-top: 12px; }
.stat-label { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; margin-bottom: 4px; }
.stat-track { height: 13px; border-radius: 999px; background: #f0f1f5; overflow: hidden; border: 1px solid #e1e3ea; }
.stat-fill { height: 100%; border-radius: inherit; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform var(--bar-speed) ease-out; }
.bars-ready .stat-fill { transform: scaleX(1); }
.passive { padding: 14px 16px; background: var(--tint); border-radius: 12px; margin-bottom: 12px; }
.passive h4 { margin: 0 0 4px; }
.passive p { margin: 0; font-size: .9rem; }
.special { margin-top: 18px; border: 2px solid var(--accent); border-radius: 16px; overflow: hidden; }
.special-title { padding: 16px 22px; background: linear-gradient(115deg, var(--accent) 0%, var(--tint) 85%); }
.special-title small { font-weight: 800; }
.special-title h4 { margin: 0; font-size: 1.3rem; }
.special .info-list { padding: 18px; }
.trait-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.trait-grid .panel { padding: 20px; }
.trait-grid h3 { margin-bottom: 8px; }
.trait-grid p, .panel > p { margin-bottom: 0; }
.good-point { border-color: var(--accent); background: var(--tint); }
.back-button { display: block; margin: 28px auto 0; padding: 12px 30px; border: 2px solid var(--ink); border-radius: 999px; background: white; font-weight: 700; box-shadow: 0 4px 0 var(--ink); }
.back-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.site-footer { padding: 24px; text-align: center; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.site-footer p { margin: 4px 0; }
@media (max-width: 1000px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  main { padding: 24px 16px 36px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .character-card { padding: 10px; border-radius: 18px; }
  .card-name { font-size: .95rem; }
  .category-tab { padding: 7px 12px; font-size: .8rem; }
  .detail-hero { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .detail-hero .portrait { max-width: 360px; width: 100%; margin: auto; }
  .stats-layout, .trait-grid { grid-template-columns: 1fr; }
  .radar { max-width: 360px; display: block; margin: auto; }
  .panel { padding: 20px; }
  .trait-grid { gap: 0; }
  .info-list { grid-template-columns: 80px minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 359px) { .card-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stat-fill { transform: scaleX(1); }
}

/* 公開情報は既存フッターの末尾に控えめに表示します。 */
.site-footer .publication-meta { font-size: 0.75rem; color: #796e66; margin: 0.4rem 0; }
.publication-link { font: inherit; color: inherit; border: 0; background: transparent; padding: 0.35rem; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.publication-dialog { width: min(34rem, calc(100% - 2rem)); max-height: 80vh; max-height: 80dvh; padding: 0; border: 1px solid #e4d7c7; border-radius: 1rem; background: #fffaf2; color: #493b32; box-shadow: 0 1rem 3rem #0003; overflow: auto; }
.publication-dialog::backdrop { background: #30271e77; }
.publication-panel { padding: clamp(1rem, 4vw, 1.75rem); }
.publication-panel h2 { margin-top: 0; font-size: 1.2rem; }
.publication-content { overflow-wrap: anywhere; line-height: 1.8; font-size: 0.9rem; }
#publication-close { display: block; margin: 1rem 0 0 auto; padding: 0.5rem 1rem; font: inherit; color: inherit; background: #fff; border: 1px solid #cdbba8; border-radius: 0.5rem; cursor: pointer; }
