:root {
  color-scheme: dark;
  --space: #181b23;
  --panel: #20252f;
  --graphite: #303643;
  --line: #484e5a;
  --silver: #bfc4cd;
  --ivory: #eae5d9;
  --metal: #d1b693;
  --ink: #292a2e;
  --sans: "Instrument Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif: "Baskervville", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ivory);
  background: radial-gradient(ellipse at 66% 0%, #2a303d, transparent 57rem), var(--space);
  font: 16px/1.55 var(--sans);
}
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #f1cf9f; outline-offset: 4px; }
.shell { width: min(100% - 40px, 1080px); margin-inline: auto; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; inset: 10px auto auto 10px; z-index: 3; padding: 10px; color: var(--ink); background: var(--ivory); }

.mast { border-bottom: 1px solid #575e6d88; background: #181b23ab; }
.mast-inner, .mast nav, .brand { display: flex; align-items: center; }
.mast-inner { justify-content: space-between; min-height: 62px; gap: 14px; }
.brand { gap: 12px; font-weight: 650; font-size: .88rem; letter-spacing: .08em; text-decoration: none; }
.mark { position: relative; display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #b59d7e; border-radius: 50%; color: var(--metal); flex: none; }
.mark::before, .mark::after { content: ""; position: absolute; background: currentColor; }
.mark::before { width: 34px; height: 1px; transform: rotate(-34deg); opacity: .7; }
.mark::after { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 0 3px #181b23; }
.mark i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: currentColor; inset: 2px 1px auto auto; }
.mast nav { gap: clamp(12px, 3vw, 27px); font-size: .83rem; }
.mast nav a { text-decoration: none; color: var(--silver); padding-block: 12px; }
.mast nav a:hover { color: var(--ivory); text-decoration: underline; }
#language { min-height: 44px; padding: 0 11px; background: transparent; border: 1px solid var(--line); border-radius: 5px; white-space: nowrap; }
#language:hover { background: var(--graphite); }

.archive-intro {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(26px, 3.35vw, 46px) 0 clamp(23px, 2.5vw, 34px);
  border-bottom: 1px solid var(--line);
}
.intro-copy { position: relative; z-index: 1; max-width: 660px; }
.collection-kicker { color: var(--metal); font-size: .87rem; font-weight: 700; letter-spacing: .08em; }
h1 { margin-top: 10px; font-size: clamp(2.8rem, 6.4vw, 5.5rem); line-height: 1.02; letter-spacing: .055em; }
html[lang=en] h1 { font: 650 clamp(2.65rem, 6.7vw, 5.7rem)/.95 var(--serif); letter-spacing: -.055em; }
.translation { margin-top: 12px; color: var(--silver); font: 650 .79rem/1.45 var(--mono); letter-spacing: .17em; }
.archive-description { margin-top: 20px; color: var(--ivory); font-size: clamp(.98rem, 2vw, 1.12rem); max-width: 595px; line-height: 1.75; }
.intro-disclaimer { margin-top: 13px; padding-top: 11px; border-top: 1px solid #60657480; color: var(--silver); font-size: .84rem; line-height: 1.6; max-width: 595px; }
.instrument {
  position: absolute; width: min(51%, 520px); height: 118%; top: -10%; right: -10px;
  opacity: .68; pointer-events: none; color: #c5c9d0;
  background: repeating-linear-gradient(0deg, transparent 0 34px, #95a5ba10 34px 35px);
  mask-image: linear-gradient(90deg, transparent, black 27%, black 94%, transparent);
}
.orbit { position: absolute; border: 1px solid #a9b7c24d; border-radius: 50%; transform: rotate(-22deg); }
.orbit-outer { width: 90%; height: 62%; top: 18%; left: 6%; }
.orbit-mid { width: 72%; height: 47%; top: 25%; left: 15%; }
.orbit-inner { width: 54%; height: 31%; top: 33%; left: 24%; border-style: dashed; }
.orbit-sweep { position: absolute; width: 83%; height: 74%; top: 9%; left: 10%; border: 1px solid transparent; border-top-color: #e5c49d9c; border-radius: 50%; transform: rotate(34deg); }
.axis { position: absolute; background: #a7b6c044; left: 50%; top: 48%; }
.axis-x { width: 96%; height: 1px; transform: translateX(-50%); }
.axis-y { width: 1px; height: 88%; transform: translateY(-50%); }
.plot-point { position: absolute; top: 48%; left: 50%; width: 7px; aspect-ratio: 1; border: 1px solid #f5dcc0; border-radius: 50%; background: #b5a186; transform: translate(-50%, -50%); box-shadow: 0 0 0 6px #a8977e34, 0 0 20px #e4c69970; }
.plot-point-secondary { top: 35%; left: 76%; width: 5px; box-shadow: 0 0 0 4px #b6c3d23d; }
#style-selection { padding-block: 23px 43px; }
.section-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 19px; margin-bottom: 14px; }
.section-line h2, .collection-head h2 { font-size: clamp(1.26rem, 2.5vw, 1.78rem); }
.section-line p, .collection-instructions { color: var(--silver); font-size: .88rem; }
.style-panels { display: grid; gap: 12px; }
.dusk { --finish: #d8ad86; --finish-rgb: 216,173,134; }
.frontier { --finish: #bbc9d8; --finish-rgb: 187,201,216; }
.print { --finish: #d7be97; --finish-rgb: 215,190,151; }
.style-panel {
  position: relative; display: grid; grid-template-columns: minmax(86px, 30%) minmax(0, 1fr);
  align-items: stretch; min-height: 128px; padding: 0; text-align: start;
  border: 1px solid #515865; border-radius: 4px; background: #20242d;
  box-shadow: inset 0 -2px 0 rgba(var(--finish-rgb), .28);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.style-panel:hover, .style-panel:focus-visible { border-color: var(--finish); background: #292e38; box-shadow: inset 0 -2px 0 var(--finish), 0 0 18px rgba(var(--finish-rgb), .15); }
.style-image { display: block; position: relative; overflow: hidden; border-radius: 3px 0 0 3px; }
.style-image img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 68%; }
.style-panel.frontier .style-image img { object-position: 55% 72%; }
.style-panel.print .style-image img { object-position: 42% 57%; }
.style-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 65%, #181b234a); }
.style-panel-copy { display: grid; align-content: center; gap: 4px; padding: 12px 13px; }
.style-name { color: var(--ivory); font-size: clamp(1rem, 2.5vw, 1.31rem); font-weight: 750; padding-inline-end: 19px; line-height: 1.2; }
.style-panel small { font-size: .73rem; color: var(--finish); line-height: 1.15; }
.style-description { color: #d4d7de; font-size: .86rem; line-height: 1.52; margin-top: 4px; }
.style-arrow { position: absolute; top: 11px; right: 12px; color: var(--finish); }
.collection-head { display: grid; gap: 12px; padding: 20px 0 14px; border-bottom: 1px solid var(--line); }
.collection-instructions { margin-top: 4px; }
.archive-entered .archive-intro { padding-block: 24px; }
.archive-entered .archive-description { margin-top: 10px; }
.archive-entered .intro-disclaimer { margin-top: 10px; }
.archive-entered h1 { font-size: clamp(2.35rem, 5.2vw, 4rem); }
.archive-entered .instrument { opacity: .49; }
#collection { animation: archive-reveal .36s ease-out both; }
@keyframes archive-reveal { from { opacity: .25; transform: translateY(5px); } }
.style-updated { animation: style-confirm .25s ease-out both; }
@keyframes style-confirm { from { opacity: .78; } }

.style-group { min-height: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.style-button {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 48px; padding: 5px 4px; text-align: start;
  color: var(--silver); background: #20242e; border: 1px solid var(--line); border-radius: 5px;
  font-weight: 680; font-size: .78rem; line-height: 1.15;
}
.style-button small { display: block; margin-top: 4px; color: #bfc4cd; font-size: .67rem; font-weight: 500; }
.style-button[aria-pressed=true] { color: var(--ivory); background: #393844; border-color: #b79e80; }
.style-button[aria-pressed=true] small { color: #e0cbb0; }
.style-button:hover { border-color: var(--metal); }
.swatch { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.swatch.dusk { background: #c98975; }
.swatch.frontier { background: #aeb9c9; }
.swatch.print { background: #d3b48d; }

.gallery-grid { display: grid; gap: 25px; padding-block: 24px 45px; }
.gallery-grid:empty { min-height: 100vh; }
.gallery-card { min-width: 0; width: min(100%, 324px); margin-inline: auto; }
.flip-scene {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1122 / 1402;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  perspective: 1200px;
  user-select: none;
  -webkit-user-select: none;
}
.flip-scene[data-finish=dusk] { --edge: 216,173,134; }
.flip-scene[data-finish=frontier] { --edge: 187,201,216; }
.flip-scene[data-finish=print] { --edge: 215,190,151; }
.flip-scene { --edge: 191,196,205; }
.card-rotor {
  display: block;
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform 660ms cubic-bezier(.36,.05,.23,1);
}
.flip-scene[data-side=back] .card-rotor { transform: rotateY(180deg); }
.card-face {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #292e38;
  border: 1px solid rgba(var(--edge), .60);
  border-radius: 9px;
  box-shadow: 0 3px 5px #0007, 0 12px 27px #0c0d1590, 0 0 10px rgba(var(--edge), .15);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face-front { transform: translateZ(.25px); }
.face-back { transform: rotateY(180deg) translateZ(.25px); background: #373a40; }
.card-face img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.card-rail, .detail-rail { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.card-number { color: var(--metal); font: 650 .77rem/1 var(--mono); letter-spacing: .09em; }
.card-rail .card-number { padding-inline: 3px; }
.flip-control, .inspect-button, .read-button, .return-button, .close-button {
  min-height: 44px; padding: 0 9px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; font-size: .83rem; font-weight: 640;
}
.flip-control { color: var(--silver); }
.flip-control[aria-pressed=true] { color: var(--ivory); }
.flip-control > span:first-child { color: var(--metal); font-size: 1.1em; }
.inspect-button { margin-inline-start: auto; color: var(--ivory); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.expand-icon { display: inline-block; width: 12px; height: 12px; color: var(--metal); background: linear-gradient(currentColor,currentColor) left top / 5px 1px no-repeat, linear-gradient(currentColor,currentColor) left top / 1px 5px no-repeat, linear-gradient(currentColor,currentColor) right bottom / 5px 1px no-repeat, linear-gradient(currentColor,currentColor) right bottom / 1px 5px no-repeat; }
@media (hover: hover) and (pointer: fine) {
  .flip-scene:hover .card-face { border-color: rgb(var(--edge)); box-shadow: 0 10px 26px #08090fb0, 0 0 16px rgba(var(--edge), .42); }
  .flip-control:hover, .inspect-button:hover, .return-button:hover { background: var(--graphite); color: var(--ivory); }
}

.flip-scene:focus-visible .card-face { border-color: rgb(var(--edge)); box-shadow: 0 0 16px rgba(var(--edge), .46); }
.activated::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 20px rgba(var(--edge), .58); animation: edge-response .48s ease-out both;
}
@keyframes edge-response { from { opacity: .92; } to { opacity: 0; } }

footer { border-top: 1px solid var(--line); background: #14171e; padding-block: 29px 39px; }
.footer-layout { display: block; }
footer p { color: var(--silver); font-size: .85rem; max-width: 86ch; }
.disclaimer p { font-size: .79rem; line-height: 1.65; }
.disclaimer p + p { margin-top: 6px; }
.creator-credit { margin-top: 17px; border-top: 1px solid #454b57; padding-top: 12px; }
.creator-credit p + p { margin-top: 4px; }
.creator-credit a { color: var(--metal); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.creator-credit a:hover { color: var(--ivory); }

dialog {
  width: min(100% - 16px, 884px);
  max-width: none; max-height: calc(100dvh - 16px);
  padding: 0; border: 1px solid #616571; border-radius: 11px;
  background: var(--panel); color: var(--ivory); box-shadow: 0 24px 100px #000b;
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
dialog::backdrop { background: #0a0c14e3; }
.detail-header {
  position: sticky; z-index: 2; top: 0; display: flex; gap: 11px; align-items: center;
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 9px 12px;
}
.detail-heading { flex: 1; min-width: 0; }
.detail-heading h2 { font-size: clamp(1rem, 3.7vw, 1.45rem); line-height: 1.3; }
.detail-heading p { margin-top: 3px; color: var(--silver); font-size: .82rem; line-height: 1.3; }
.close-button { flex: none; width: 44px; padding: 0; border-color: var(--line); background: #262b35; font-size: 1.55rem; line-height: 1; }
.close-button:hover { border-color: var(--metal); }
.detail-origin {
  padding: 8px 12px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 9px;
  border-bottom: 1px solid var(--line); color: var(--silver); font-size: .83rem;
}
.origin-label { color: var(--metal); font-weight: 700; }
#share-status { color: var(--ivory); font-size: .83rem; align-self: center; }
.detail-layout { display: grid; gap: 14px; padding: 12px; }
.detail-stage { min-width: 0; display: grid; justify-items: center; align-content: start; }
.detail-stage .flip-scene { width: min(100%, 360px, 46dvh); }
.detail-rail { width: min(100%, 360px, 46dvh); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.detail-rail .flip-control, .read-button { color: var(--ivory); border-color: var(--line); background: #262b35; }
.read-button { color: #231f1b; background: var(--metal); border-color: var(--metal); }
.read-button:hover { background: #e6c9a5; }
.detail-sidebar { display: grid; align-content: start; gap: 12px; min-width: 0; }
.episode-block { border-top: 1px solid var(--line); padding-top: 11px; }
.episode-label, .episode-block .primary-language { font-weight: 750; }
.episode-block .secondary-language, .preview-label, .print-note { color: var(--silver); font-size: .83rem; }
.episode-reference { overflow-wrap: anywhere; margin-top: 4px; }
.preview-label { margin-top: 6px; }
.episode-links, .art-links { display: flex; flex-wrap: wrap; gap: 0 15px; list-style: none; padding: 0; margin: 0; }
.episode-links a, .art-links a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 3px; color: var(--metal); font-size: .88rem; font-weight: 700; }
.art-links { border-top: 1px solid var(--line); }
.print-note { margin-top: -10px; }

.reading-view { max-width: 72ch; margin-inline: auto; padding: 12px 14px 30px; }
.return-button { border-color: var(--line); background: #262b35; margin-bottom: 15px; }
.story-title.primary-language { font-size: clamp(1.4rem, 4vw, 2.05rem); line-height: 1.3; }
.story-title.secondary-language { color: var(--metal); font-weight: 650; margin-top: 5px; line-height: 1.35; }
.reading-view .episode-block { margin-top: 16px; }
.story-section { margin-top: 17px; padding: 15px 14px; border: 1px solid var(--line); border-radius: 6px; background: #252a34; }
.story-section h3 { font-size: 1.03rem; margin-bottom: 8px; color: var(--metal); }
.story-section h3 small { margin-inline-start: 5px; font-size: .82rem; color: var(--silver); }
.story-section p { font-size: 1.05rem; line-height: 1.78; }
.story-section p + p { margin-top: 11px; padding-top: 11px; border-top: 1px solid #505663; color: #e0e1e4; }
.story-section.question { border-color: #9d866e; background: #322d31; }

@media (max-width: 380px) {
  .shell { width: calc(100% - 32px); }
  .brand { gap: 8px; font-size: .77rem; }
  .mast nav { gap: 9px; font-size: .76rem; }
  .swatch { display: none; }
}
@media (min-width: 600px) {
  .shell { width: min(100% - 64px, 1080px); }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 26px; }
  .gallery-card { width: min(100%, 310px); }
  .collection-head { grid-template-columns: 1fr minmax(270px, 1fr); align-items: end; gap: 20px; }
  .style-panels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .style-panel { grid-template-columns: 1fr; grid-template-rows: clamp(100px, 14vw, 171px) 1fr; }
  .style-image { border-radius: 3px 3px 0 0; }
  .style-image::after { background: linear-gradient(0deg, #181b2350, transparent 62%); }
  .style-panel-copy { padding: 15px; align-content: start; }
  .style-arrow { top: calc(clamp(100px, 14vw, 171px) + 13px); }
}
@media (min-width: 720px) {
  dialog { max-height: calc(100dvh - 44px); }
  .detail-header { padding: 12px 19px; }
  .detail-layout { grid-template-columns: 1.08fr 1fr; gap: 22px; padding: 16px 19px; }
  .detail-stage .flip-scene { width: min(100%, 368px, 54dvh); }
  .detail-rail { width: min(100%, 368px, 54dvh); }
  .reading-view { padding-inline: 23px; }
}
@media (min-width: 920px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 27px 25px; padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .card-rotor, .style-panel { transition: none; }
  #collection, .style-updated { animation: none; }
  .activated::after { display: none; }
}

@media (max-width: 599px) {
  .instrument { width: 62%; right: -25%; opacity: .38; }
  .archive-entered .instrument { opacity: .26; }
  .archive-description { max-width: 45ch; }
}

/* v1.3.2: pick up a card, inspect, and return to its place. */
html { scrollbar-gutter: stable; }
.gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
@media (min-width: 920px) { .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 27px 25px; } }
.gallery-card .card-rail { gap: 3px; }
.gallery-card .inspect-button { padding-inline: 5px; }
.detail-stage .flip-scene, .detail-rail { width: min(100%, 470px, calc((100dvh - 300px) * .800285)); }
.collection-return { padding: 0 12px 12px; }
.collection-return .return-button { margin: 0; }
.pickup-proxy { position: fixed; margin: 0; z-index: 10; pointer-events: none; transform-origin: top left; overflow: hidden; border: 1px solid var(--metal); border-radius: 9px; background: #373a40; box-shadow: 0 16px 40px #0009; }
.pickup-proxy img { width: 100%; height: 100%; display: block; object-fit: contain; }
#detail[open] { animation: viewer-fade 180ms ease-out; }
@keyframes viewer-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #detail[open] { animation: none; } }


/* v1.3.3: Center the physical card; keep supporting information secondary. */
dialog { width: min(calc(100% - 20px), 760px); }
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  padding: 16px 20px 20px;
}
.detail-stage {
  width: 100%;
  min-width: 0;
  justify-items: center;
  align-content: start;
  padding-block: 3px 5px;
}
.detail-stage .flip-scene,
.detail-rail {
  width: min(100%, 580px, calc((100dvh - 205px) * .800285));
}
.detail-stage .flip-scene {
  max-width: 100%;
  min-width: 0;
}
.detail-sidebar {
  width: min(100%, 590px);
  margin-inline: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  gap: 13px;
}
.detail-sidebar .style-group { width: 100%; }
.collection-return {
  width: min(100%, 630px);
  margin-inline: auto;
}
@media (max-width: 599px) {
  dialog { width: calc(100% - 12px); }
  .detail-layout { padding: 10px 12px 16px; gap: 16px; }
  .detail-stage .flip-scene,
  .detail-rail { width: min(100%, 520px, calc((100dvh - 205px) * .800285)); }
  .detail-sidebar { padding-top: 12px; }
}
@media (max-height: 570px) and (min-width: 600px) {
  .detail-stage .flip-scene,
  .detail-rail { width: min(100%, 580px, calc((100dvh - 180px) * .800285)); }
}
