/* 生物誌、老物件卡牌（類名 cd-；生物卡 cdk-、老物件卡 cdo-） */
.cd { --cd-n: #f7f5ef; --cd-r: #c8ced6; --cd-sr: #d9a520; --cd-ur: #b4372a; --cd-paper: #efe4c8; --cd-ink: #3a2f22; }
.cd .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cd-hero { padding-top: 22px; padding-bottom: 8px; }
.cd-title { font-size: clamp(26px, 4.6vw, 42px); line-height: 1.25; margin: 6px 0 14px; }
.cd-sep { color: var(--ink-faint); }
.cd-wait { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); }

/* 一年的生物曆 */
.cd-cal { margin: 0; padding: 12px 12px 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cd-cal__cap { font-size: 13px; color: var(--ink-muted); margin-bottom: 8px; }
.cd-cal__m, .cd-cal__row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 46px; align-items: center; gap: 8px; }
.cd-cal__m { margin-bottom: 4px; }
.cd-cal__ms { display: flex; justify-content: space-between; margin: 0 -10px; }
.cd-cal__mon { width: 20px; }
.cd-cal__mon { border: 0; background: none; font: 600 12px var(--font-mono); color: var(--ink-faint); padding: 4px 0; cursor: pointer; border-radius: 6px; min-height: 28px; }
.cd-cal__mon.is-now { color: #c2560c; }
.cd-cal__mon.is-on { background: var(--tide); color: #fff; }
.cd-cal__v { font: 600 12px var(--font-mono); color: var(--ink-muted); text-align: right; }
.cd-cal__row { border-top: 1px solid var(--line); padding: 2px 0; }
.cd-cal__lab { border: 0; background: none; text-align: left; font-size: 14px; color: var(--ink); cursor: pointer; padding: 6px 2px; min-height: 32px; }
.cd-cal__lab.is-on { color: var(--tide); font-weight: 700; }
.cd-cal__row.is-dim { opacity: .35; }
.cd-cal__svg { width: 100%; height: 34px; display: block; }
.cd-cal__now { stroke: #c2560c; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cd-cal__n { font: 700 14px var(--font-mono); text-align: right; }
.cd-strip { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 12px 0 4px; font-size: 13px; color: var(--ink-muted); }
.cd-strip b { font: 700 16px var(--font-mono); color: var(--ink); margin-right: 3px; }
.cd-strip__rk { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-pill); padding: 4px 10px 4px 8px; font-size: 13px; cursor: pointer; color: var(--ink-muted); min-height: 32px; }
.cd-strip__rk.is-on { border-color: var(--tide); box-shadow: inset 0 0 0 1px var(--tide); }
.cd-strip__rk::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--rk); }
.cd-rk--N { --rk: #e9e4d6; } .cd-rk--R { --rk: linear-gradient(135deg, #e8ecf1, #9aa4b1); } .cd-rk--SR { --rk: linear-gradient(135deg, #f5d77a, #b88910); } .cd-rk--UR { --rk: linear-gradient(135deg, #e3523e, #7d1e15); }

/* 工具列 */
.cd-body { padding-top: 10px; }
.cd-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.cd-mode { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.cd-mode__b { border: 0; background: var(--surface); padding: 0 14px; min-height: 36px; font-size: 14px; cursor: pointer; color: var(--ink-muted); }
.cd-mode__b.is-on { background: var(--tide); color: #fff; }
.cd-q { flex: 1 1 180px; min-width: 0; }
.cd-q input { width: 100%; min-height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 0 14px; font-size: 15px; background: var(--surface); box-sizing: border-box; }
.cd-today, .cd-moreb { border: 1px solid var(--tide); color: var(--tide); background: var(--surface); border-radius: var(--radius-pill); min-height: 36px; padding: 0 14px; font-size: 14px; cursor: pointer; }
.cd-moreb { display: block; margin: 16px auto; }
.cd-sel { font-size: 14px; color: var(--ink-muted); }
.cd-sel select, .cd-more select { min-height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 14px; }
.cd-grps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cd-grp { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-pill); padding: 0 12px; min-height: 32px; font-size: 14px; cursor: pointer; color: var(--ink); }
.cd-grp small { color: var(--ink-faint); margin-left: 4px; font-family: var(--font-mono); }
.cd-grp.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cd-grp.is-on small { color: #d8dde0; }
.cd-more { margin: 4px 0 8px; }
.cd-more summary { cursor: pointer; font-size: 14px; color: var(--tide); min-height: 32px; display: inline-flex; align-items: center; }
.cd-more__in { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 0; font-size: 14px; color: var(--ink-muted); }
.cd-count { font-size: 13px; color: var(--ink-muted); margin: 4px 0 10px; }

/* 生物卡 */
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(212px, 46%), 1fr)); gap: 14px; }
@media (max-width: 560px) { .cd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.cdk { position: relative; aspect-ratio: 63 / 88; container-type: inline-size; border-radius: 4.5cqw; padding: 3.2cqw; background: var(--cd-n); border: 0; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px -8px rgba(20,40,50,.35); display: flex; flex-direction: column; text-align: left; font: inherit; color: #1d2a2e;
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease, box-shadow .25s ease; width: 100%; }
.cdk:hover { box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 14px 24px -10px rgba(20,40,50,.45); }
.cdk:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.cdk__in { flex: 1; display: flex; width: 100%; box-sizing: border-box; flex-direction: column; border-radius: 3cqw; background: #fff; overflow: hidden; border: .8cqw solid var(--gc, #0c7078); min-height: 0; }
.cdk__top { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; padding: 2cqw 3cqw; background: var(--gc, #0c7078); color: #fff; font-size: max(11px, 5.4cqw); }
.cdk__grp { font-weight: 700; white-space: nowrap; }
.cdk__stars { letter-spacing: .5px; white-space: nowrap; color: #ffe39a; font-size: max(10px, 5cqw); }
.cdk__ph { position: relative; flex: 0 0 auto; width: 100%; aspect-ratio: 4 / 3; background: #e6ebe8; overflow: hidden; }
.cdk__ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cdk__noph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gc, #0c7078); opacity: .55; font-size: max(11px, 5cqw); text-align: center; padding: 4cqw; }
.cdk__noph svg { width: 34%; height: auto; }
.cdk__b { padding: 2.5cqw 3.2cqw 3cqw; display: flex; flex-direction: column; gap: 1cqw; min-height: 0; }
.cdk__name { font-size: max(13px, 8cqw); font-weight: 800; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cdk__sci { font-size: max(11px, 5.2cqw); font-style: italic; color: #5d6b6f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdk__tags { display: flex; flex-wrap: wrap; gap: 1.2cqw; margin-top: auto; }
.cdk__tag { font-size: max(10px, 4.6cqw); padding: .4cqw 2cqw; border-radius: 9cqw; background: #eef2f1; color: #2c4045; white-space: nowrap; }
.cdk__tag.is-end { background: #fde7d9; color: #8a3a0c; } .cdk__tag.is-prot { background: #fbe1df; color: #8a1d14; } .cdk__tag.is-alien { background: #ececec; color: #555; }
.cdk__rk { position: absolute; right: 5cqw; top: 23cqw; z-index: 2; font: 800 max(11px, 6cqw) var(--font-mono); padding: .4cqw 2cqw; border-radius: 2cqw; background: rgba(255,255,255,.9); color: #333; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.cdk__seen { position: absolute; left: 5cqw; top: 23cqw; z-index: 2; font-size: max(10px, 4.6cqw); padding: .4cqw 2cqw; border-radius: 2cqw; background: #1f5a8a; color: #fff; }
.cdk--R { background: linear-gradient(135deg, #f3f5f8, #aab3bf 45%, #eef1f5 60%, #98a2ae); }
.cdk--R .cdk__rk { background: linear-gradient(135deg, #fff, #c5ccd5); }
.cdk--SR { background: linear-gradient(135deg, #fbe8a6, #c99a1e 40%, #fff1bf 55%, #a77b0c); }
.cdk--SR .cdk__rk { background: linear-gradient(135deg, #fff3c4, #e0b23c); color: #5a3d00; }
.cdk--SR::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.9) 0 .6cqw, transparent 1cqw), radial-gradient(circle at 70% 12%, rgba(255,255,255,.8) 0 .5cqw, transparent .9cqw),
    radial-gradient(circle at 85% 70%, rgba(255,255,255,.85) 0 .5cqw, transparent .9cqw), radial-gradient(circle at 10% 85%, rgba(255,255,255,.7) 0 .4cqw, transparent .8cqw); mix-blend-mode: screen; }
.cdk--UR { background: linear-gradient(120deg, #ff6b6b, #ffd166, #6be585, #4ecdc4, #5f7dff, #c56cf0, #ff6b6b); background-size: 300% 300%; animation: cdkHolo 8s linear infinite; }
.cdk--UR .cdk__rk { background: linear-gradient(135deg, #e3523e, #7d1e15); color: #fff; }
.cdk--UR .cdk__in { border-color: #fff; }
@keyframes cdkHolo { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
@media (prefers-reduced-motion: reduce) { .cdk--UR { animation: none; } .cdk { transition: none; } }

/* 收集冊 */
.cd-album__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cd-album__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 14px; border-radius: var(--radius-md); color: #fff; margin-bottom: 10px; }
.cd-album__head b { font-size: 18px; }
.cd-album__bar { flex: 1 1 160px; height: 8px; border-radius: 8px; background: rgba(255,255,255,.3); overflow: hidden; min-width: 0; }
.cd-album__bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff6b6b, #ffd166, #6be585, #4ecdc4, #5f7dff); }
.cd-album__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(120px, 30%), 1fr)); gap: 10px; }
.cd-slot { aspect-ratio: 63 / 88; border: 2px dashed var(--line-strong); border-radius: 10px; display: grid; place-items: center; font: 700 14px var(--font-mono); color: var(--ink-faint); background: var(--surface-sunken); cursor: pointer; padding: 0; }
.cd-slot .cdk { cursor: pointer; }
.cd-album__pg { display: flex; justify-content: center; gap: 10px; align-items: center; margin: 14px 0; font-size: 14px; }
.cd-album__pg button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); cursor: pointer; }

/* 對話框與卡背 */
.cd-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; overscroll-behavior: contain; }
.cd-modal[hidden] { display: none; }
.cd-modal__bg { position: absolute; inset: 0; background: rgba(12, 22, 26, .78); }
.cd-modal__box { position: relative; width: min(380px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.cd-modal__x { position: absolute; right: -6px; top: -6px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; font-size: 22px; cursor: pointer; }
.cd-modal__card { perspective: 1200px; }
.cd-flip { position: relative; transform-style: preserve-3d; transition: transform .5s ease; }
.cd-flip.is-back { transform: rotateY(180deg); }
.cd-flip__f, .cd-flip__b { backface-visibility: hidden; }
.cd-flip__b { position: absolute; inset: 0; transform: rotateY(180deg); visibility: hidden; }
.cd-flip.is-back .cd-flip__b { visibility: visible; } .cd-flip.is-back .cd-flip__f { visibility: hidden; }
.cd-modal__act { display: flex; gap: 8px; justify-content: center; }
.cd-modal__act button { min-height: 40px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid #fff; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; cursor: pointer; }
.cd-modal__act button.is-on { background: #1f5a8a; border-color: #1f5a8a; }
html:has(.cd-modal:not([hidden])) { overflow: hidden; }
.cdkb { aspect-ratio: 63 / 88; border-radius: 16px; background: #fbfaf6; overflow: auto; padding: 14px; box-sizing: border-box; font-size: 13.5px; line-height: 1.55; color: #22303a; }
.cdkb__h { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.cdkb__h img, .cdkb__h .cdkb__ni { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #e6ebe8; flex: none; }
.cdkb__h b { font-size: 17px; display: block; line-height: 1.2; }
.cdkb__h i { font-size: 12px; color: #5d6b6f; }
.cdkb h4 { font-size: 12px; letter-spacing: .08em; color: #0c7078; margin: 10px 0 4px; border-bottom: 1px solid #dde3e2; padding-bottom: 2px; }
.cdkb dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; }
.cdkb dt { color: #5d6b6f; white-space: nowrap; } .cdkb dd { margin: 0; overflow-wrap: anywhere; }
.cdkb a { color: #0c7078; overflow-wrap: anywhere; }
.cdkb__mon { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; align-items: end; height: 46px; }
.cdkb__mon i { display: block; background: var(--gc, #0c7078); border-radius: 2px 2px 0 0; min-height: 1px; }
.cdkb__monl { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); font: 10px var(--font-mono); color: #8a969a; text-align: center; }
.cdkb__town { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 2.6em; gap: 2px 6px; align-items: center; font-size: 12px; }
.cdkb__town i { height: 7px; border-radius: 4px; background: var(--gc, #0c7078); opacity: .75; display: block; }
.cdkb__town span:last-child { font-family: var(--font-mono); text-align: right; color: #5d6b6f; }
.cdkb__note { font-size: 13px; }
.cdkb__cred { font-size: 11.5px; color: #6b777b; }

/* 頁尾 */
.cd-foot { padding-top: 18px; padding-bottom: 36px; }
.cd-how { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.cd-how summary { cursor: pointer; padding: 10px 14px; font-weight: 700; min-height: 24px; }
.cd-how__in { padding: 0 14px 12px; font-size: 14px; color: var(--ink-muted); line-height: 1.7; }
.cd-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; display: block; overflow-x: auto; }
.cd-tbl th, .cd-tbl td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }
.cd-src { padding-left: 18px; } .cd-stamp { font-size: 12px; color: var(--ink-faint); }
.cd-gaps { margin-top: 14px; font-size: 14px; color: var(--ink-muted); }
.cd-gaps h3 { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.cd-gaps ul { padding-left: 18px; margin: 0; }

/* 老物件：頁首格子 */
.cd-otg { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cd-otg__row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 5px 0; }
.cd-otg__lab { border: 0; background: none; text-align: left; font-size: 14px; cursor: pointer; min-height: 32px; color: var(--ink); }
.cd-otg__lab.is-on { color: var(--tide); font-weight: 700; }
.cd-otg__cells { display: flex; flex-wrap: wrap; gap: 5px; }
.cd-otg__c { width: 28px; height: 36px; border-radius: 4px; border: 1px solid rgba(58,47,34,.25); background: var(--rk); cursor: pointer; padding: 0; }
.cd-otg__c.cd-rk--N { background: #efe4c8; } .cd-otg__c.cd-rk--UR { border: 2px solid #d9a520; }
.cd-otg__c.is-dim { opacity: .25; } .cd-otg__c:focus-visible { outline: 3px solid var(--focus); }
@media (max-width: 560px) { .cd-otg__row { grid-template-columns: 1fr; } .cd-cal__m, .cd-cal__row { grid-template-columns: 58px minmax(0, 1fr) 36px; } .cd-cal__lab { font-size: 13px; } }

/* 老物件卡 */
.cd-otgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(212px, 46%), 1fr)); gap: 16px; }
@media (max-width: 560px) { .cd-otgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.cdo { position: relative; container-type: inline-size; aspect-ratio: 63 / 92; border: 0; padding: 0; cursor: pointer; text-align: left; font: inherit; color: var(--cd-ink); width: 100%;
  background: radial-gradient(ellipse at 30% 20%, #f7eed6, #e8d9b2 70%, #dcc89b); border-radius: 2.5cqw; box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 8px 18px -10px rgba(60,40,10,.5); }
.cdo::before { content: ''; position: absolute; inset: 3cqw; border: .6cqw solid rgba(90,60,25,.65); outline: .3cqw solid rgba(90,60,25,.5); outline-offset: -2.2cqw; border-radius: 1.5cqw; pointer-events: none; }
.cdo::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.cdo--R::after { box-shadow: inset 0 0 0 1.4cqw #b9c0c9, inset 0 0 0 2cqw rgba(255,255,255,.6); }
.cdo--SR::after { box-shadow: inset 0 0 0 1.4cqw #c99a1e, inset 0 0 0 2cqw #f5d77a; }
.cdo--UR::after { box-shadow: inset 0 0 0 1.4cqw #9b2a1f, inset 0 0 0 2.2cqw #d9a520; }
.cdo__in { position: absolute; inset: 6cqw; display: flex; flex-direction: column; gap: 2cqw; }
.cdo__top { display: flex; justify-content: space-between; font: 700 max(11px, 5cqw) var(--font-serif); letter-spacing: .05em; color: #6a4e2a; }
.cdo__no { font-family: var(--font-mono); }
.cdo__ph { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border: .5cqw solid #6a4e2a; background: #cbb88f; }
.cdo__ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(.55) contrast(1.05) saturate(.8); }
.cdo__name { font: 800 max(13px, 7.4cqw)/1.2 var(--font-serif); min-height: 2.4em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cdo--SR .cdo__name, .cdo--UR .cdo__name { color: #7a5408; text-shadow: 0 1px 0 #fff3c4; }
.cdo__sum { font-size: max(12px, 5.2cqw); line-height: 1.45; background: rgba(255,250,235,.7); padding: 1cqw 2cqw; border-radius: 1cqw; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #3a2f22; }
.cdo__rk { font: 800 max(11px, 5cqw) var(--font-mono); }
.cdo__stamp { position: absolute; z-index: 2; font: 800 max(11px, 5cqw) var(--font-serif); padding: .8cqw 2.4cqw; border: .6cqw solid currentColor; border-radius: 1.4cqw; transform: rotate(-12deg); background: rgba(255,250,235,.55); }
.cdo__stamp--rare { right: 8cqw; top: 26cqw; color: #a3271b; }
.cdo__stamp--seen { left: 8cqw; top: 26cqw; color: #1f4f8a; transform: rotate(9deg); }
.cdob { aspect-ratio: 63 / 92; border-radius: 14px; background: radial-gradient(ellipse at 30% 20%, #f7eed6, #e8d9b2 70%, #dcc89b); overflow: auto; padding: 16px; box-sizing: border-box; color: var(--cd-ink); font-size: 13.5px; line-height: 1.65; }
.cdob h3 { font: 800 18px var(--font-serif); margin: 0 0 6px; }
.cdob h4 { font-size: 12px; letter-spacing: .08em; color: #6a4e2a; margin: 10px 0 2px; border-bottom: 1px solid rgba(106,78,42,.35); }
.cdob p { margin: 0 0 6px; white-space: pre-line; }
.cdob a { color: #7a3d0c; overflow-wrap: anywhere; }
.cdob dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 12.5px; }
.cdob dt { color: #6a4e2a; } .cdob dd { margin: 0; overflow-wrap: anywhere; }
.cd-otalbum { padding: 16px; border-radius: var(--radius-lg); background: repeating-linear-gradient(90deg, #8a5a32 0 14px, #94633a 14px 30px); }
.cd-otalbum h3 { color: #fff7e6; font: 800 16px var(--font-serif); margin: 6px 0 8px; }
.cd-otalbum__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(120px, 30%), 1fr)); gap: 10px; margin-bottom: 12px; }
.cd-otslot { aspect-ratio: 63 / 92; border: 2px dashed rgba(255,247,230,.6); border-radius: 8px; display: grid; place-items: center; font: 700 14px var(--font-mono); color: rgba(255,247,230,.8); background: rgba(0,0,0,.12); cursor: pointer; padding: 0; }
