@import url("icons.css");

@font-face {
  font-family: Yuanwu Brush;
  src: url("../assets/fonts/ma-shan-zheng.woff2?v=2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: Yuanwu Serif;
  src: url("../assets/fonts/noto-serif-sc.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #2c231b;
  --rich: #372921;
  --text-soft: #67584b;
  --paper: #ffffff;
  --panel: var(--paper);
  --surface-muted: #f5f5f5;
  --line: #e3e3e3;
  --red: #963f2c;
  --red-dark: var(--han-color-vermilion-800);
  --jade: #31564a;
  --gold: #9c7442;
  --serif: "Yuanwu Serif", "Songti SC", "Noto Serif SC", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --shell: 1280px;
  --shadow: 0 14px 35px #5a38130d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html { min-width: 300px; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font: 15px/1.65 var(--sans); }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { color: var(--ink); font-family: var(--serif); line-height: 1.18; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 2px solid #743d2c; outline-offset: 4px; }
h1:focus { outline: none; }
img { display: block; max-width: 100%; }
.shell { max-width: var(--shell); width: calc(100% - 88px); margin-inline: auto; }
#main-content { min-height: 44vh; }
.brush { font-family: "Yuanwu Brush", KaiTi, var(--serif); font-weight: 400; }
.skip-link { position: absolute; z-index: 10; left: 1rem; top: -6rem; background: var(--panel); padding: .6rem 1rem; }
.skip-link:focus { top: 1rem; }

.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-content { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; font: 600 23px/1 var(--serif); }
.brand-mark { position: relative; width: 38px; height: 38px; flex: none; overflow: hidden; border-radius: 5px; background: #050504; }
.brand-mark img { position: absolute; width: 142%; max-width: none; height: auto; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.top-nav { display: flex; align-items: stretch; gap: 32px; align-self: stretch; }
.top-nav a { display: inline-flex; align-items: center; gap: 7px; border-bottom: 2px solid transparent; padding-top: 2px; font-weight: 500; white-space: nowrap; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--red-dark); border-color: var(--red); }
.site-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 62px; padding: 19px 0 29px;
  border-top: 1px solid var(--line); color: var(--text-soft); font-size: .79rem;
}
.site-footer a:hover { text-decoration: underline; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px;
  padding: 10px 19px; border: 1px solid transparent; border-radius: 4px;
  line-height: 1.45; font-weight: 650; letter-spacing: .025em; white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.button-primary { background: var(--red); color: #fff9ef; box-shadow: 0 5px 12px #7028171d; }
.button-primary:hover:not(:disabled) { background: var(--red-dark); }
.button-outline { color: var(--red-dark); border-color: #c2a68d; background: var(--panel); }
.button-outline:hover:not(:disabled) { border-color: var(--red); background: var(--surface-muted); }
.button-quiet { padding-inline: 8px; color: var(--red-dark); background: transparent; }
.button-quiet:hover:not(:disabled) { text-decoration: underline; }
.button:disabled { opacity: .53; cursor: default; }
.text-link, .back-link, .source-link { display: inline-flex; align-items: center; gap: 7px; color: var(--red-dark); }
.text-link:hover, .back-link:hover, .source-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-link { min-height: 36px; font-size: .86rem; font-weight: 600; }
.source-link { font-size: .78rem; }
.source-link .icon { inline-size: .88em; }
.back-link { min-height: 39px; font-size: .86rem; }
.eyebrow {
  display: flex; align-items: center; gap: 9px;
  color: var(--red-dark); font-size: .83rem; letter-spacing: .135em; font-weight: 650;
}
.eyebrow > span, .era-dates > span { width: 7px; height: 7px; flex: 0 0 auto; transform: rotate(45deg); background: var(--red); }
.chapter-meta { letter-spacing: .05em; }
.chapter-meta i, .score-rule > i:not(.icon) { width: 3px; height: 3px; border-radius: 100%; background: var(--gold); }
.page-heading { margin: 3px 0 28px; }
.page-heading h1 { font-size: clamp(2.05rem, 4.2vw, 3.48rem); font-weight: 700; letter-spacing: .065em; margin-top: 7px; }
.page-heading .dynasty-title { font-size: clamp(2.55rem, 5.2vw, 4.4rem); font-weight: 400; letter-spacing: .07em; }
.page-heading > p:last-child, .page-heading > div > p:last-child { color: var(--text-soft); margin-top: 12px; line-height: 1.65; }
.page-heading.centered { text-align: center; margin-top: 8px; margin-bottom: 35px; }
.route-top { padding-top: 19px; }

.home-hero {
  position: relative; z-index: 0; isolation: isolate; min-height: clamp(460px, 43vw, 594px); display: flex; align-items: center;
  overflow: hidden; margin-top: 24px; background: var(--paper);
  box-shadow: 0 13px 35px #6b452819;
}
.hero-art { position: absolute; inset: 0 0 0 auto; width: 82%; height: 100%; object-fit: cover; object-position: 68% 43%; z-index: -3; }
.hero-fade {
  position: absolute; z-index: -2; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, #fff 20%, #ffffffeb 33%, #ffffff75 47%, transparent 66%);
}
.hero-frame {
  position: absolute; z-index: -1; inset: 11px; border: 1px solid #805c3b50; pointer-events: none;
  outline: 1px solid #fff7de74; outline-offset: 3px;
}
.hero-content { position: relative; max-width: 54%; padding: 42px 0 45px clamp(35px, 5.4vw, 83px); }
.hero-content .eyebrow { font-size: .9rem; letter-spacing: .22em; }
.logo-type { color: #33231a; white-space: nowrap; margin: 14px 0 9px -5px; font-size: clamp(63px, 7.25vw, 112px); letter-spacing: .03em; line-height: 1.04; }
.hero-line { font: 700 clamp(18px, 2vw, 26px)/1.55 var(--serif); letter-spacing: .09em; margin-top: 8px; }
.hero-intro { max-width: 332px; color: #564433; margin-top: 13px; line-height: 1.75; font-size: clamp(.9rem, 1.2vw, 1rem); }
.hero-action { margin-top: 27px; }
.hero-action .button { min-height: 52px; min-width: 166px; justify-content: space-between; padding-inline: 21px; }
.home-era-list { margin-top: 32px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 13px; }
.section-heading h2 { letter-spacing: .08em; font-size: 25px; }
.home-chapters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.home-chapter { position: relative; isolation: isolate; height: 125px; display: flex; align-items: end; justify-content: space-between; padding: 12px 15px; overflow: hidden; background: var(--era); color: #fff6e5; }
.home-chapter img, .chapter-shade { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; object-fit: cover; object-position: var(--art-focus); }
.home-chapter img { transition: transform 380ms ease; }
.home-chapter:hover img { transform: scale(1.045); }
.chapter-shade { z-index: -1; background: linear-gradient(0deg, #1f150ee8, #29201739 90%), linear-gradient(90deg,#281a12c4,transparent); }
.chapter-copy { display: flex; align-items: center; gap: 11px; }
.chapter-copy b, .chapter-copy small { display: block; }
.chapter-copy small { color: #f2e4cc; font-size: .78rem; margin-top: 1px; }
.chapter-glyph { font-size: 40px; line-height: 1; }
.home-chapter > .icon { margin-bottom: 5px; }

.era-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.era-card { min-width: 0; display: block; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.era-card-art { position: relative; isolation: isolate; height: clamp(148px, 18vw, 257px); background: var(--era); overflow: hidden; }
.era-card-art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg,#2d1e15b8,transparent 78%); }
.era-card-art img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: var(--art-focus); transition: transform 400ms ease; }
.era-card:hover img { transform: scale(1.045); }
.era-card-glyph { position: absolute; bottom: 8px; left: 18px; font-size: clamp(42px, 6vw, 78px); line-height: 1; color: #fff2d8; text-shadow: 0 2px 10px #2d2016; }
.era-card-body { padding: 15px 17px 16px; }
.era-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-soft); font-size: .75rem; }
.era-dates span { width: 4px; height: 4px; background: var(--era); }
.era-card h2 { margin-top: 8px; font-size: clamp(17px, 2vw, 25px); letter-spacing: .04em; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 17px; }
.era-state { display: inline-flex; align-items: center; gap: 5px; font-size: .73rem; color: var(--text-soft); }
.era-state.available { color: var(--jade); font-weight: 650; }
.circle-arrow { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--red); }
.era-card:hover .circle-arrow { border-color: var(--red); background: var(--red); color: #fff4df; }

.map-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 2.25fr) minmax(235px, .82fr); gap: 23px; }
.map-frame { padding: 7px; min-width: 0; background: var(--panel); border: 1px solid #ba9a76; box-shadow: var(--shadow); }
.map-picture { position: relative; isolation: isolate; aspect-ratio: 1.9; background: var(--surface-muted); }
.map-picture img { width: 100%; height: 100%; object-fit: cover; object-position: var(--art-focus); }
.map-picture::after { position: absolute; z-index: 0; content: ""; inset: 0; box-shadow: inset 0 0 0 1px #6c492b54; pointer-events: none; }
.map-frame figcaption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; padding: 8px 8px 4px; font-size: .77rem; color: var(--text-soft); }
.map-pin { position: absolute; z-index: 1; top: var(--y); left: var(--x); transform: translate(-50%,-50%); display: grid; place-items: center; width: 45px; height: 45px; padding: 0; border: 0; border-radius: 50%; background: #fae8bf63; }
.pin-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #fff2d7;
  border-radius: 50%; background: var(--era); color: #fff6e1; font: 700 17px/1 var(--serif); box-shadow: 0 3px 9px #382c1a60;
}
.pin-label {
  position: absolute; max-width: 150px; top: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  background: var(--panel); padding: 3px 8px; border: 1px solid #a5845b; border-radius: 2px;
  white-space: nowrap; font-size: .74rem; font-weight: 650; color: var(--ink); box-shadow: 0 2px 9px #30251a35;
}
.map-pin:hover, .map-pin:focus-visible { background: #fff1c999; z-index: 2; }
.map-pin:hover .pin-mark { background: var(--red-dark); }
.map-aside { align-self: stretch; background: var(--panel); border: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.map-aside h2 { display: flex; align-items: center; gap: 8px; font-size: 24px; }
.map-aside h2 .icon { color: var(--red); font-size: .8em; }
.map-aside p { color: var(--text-soft); font-size: .82rem; margin-top: 7px; }
.spot-list { margin-block: 14px; border-top: 1px solid var(--line); }
.spot-list-item { border: 0; border-bottom: 1px solid var(--line); display: grid; width: 100%; gap: 9px; grid-template-columns: auto 1fr auto; align-items: center; text-align: left; padding: 11px 1px; background: transparent; }
.spot-list-item:hover { background: var(--surface-muted); }
.spot-list-item b, .spot-list-item small { display: block; }
.spot-list-item b { font-size: .9rem; }
.spot-list-item small, .map-next small { color: var(--text-soft); font-size: .75rem; }
.spot-list-item > .icon { color: var(--red); }
.spot-glyph { width: 35px; height: 35px; display: grid; place-items: center; font: 600 19px/1 var(--serif); color: var(--era); background: var(--surface-muted); border: 1px solid var(--line); border-radius: 3px; }
.map-next > .button { width: 100%; justify-content: space-between; }
.map-next > small { margin-top: 8px; display: block; }

.dance-heading, .reward-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.score-rule { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .78rem; color: var(--text-soft); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.score-rule > .icon { color: var(--red); }
.dance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dance-panel { min-width: 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); }
.dance-panel header { display: flex; justify-content: space-between; align-items: center; gap: 5px; min-height: 32px; margin: 0 3px 7px; }
.dance-panel h2 { display: flex; align-items: center; gap: 6px; font-size: 1.13rem; }
.dance-panel header span { white-space: nowrap; color: var(--text-soft); font-size: .75rem; }
.dance-panel h2 .icon { color: var(--red); }
.guide-well, .camera-well { position: relative; display: grid; place-items: center; aspect-ratio: 1.77; overflow: hidden; }
.guide-well { background-color: #121418; }
.camera-well { color: #eaddc2; background: radial-gradient(ellipse,#365448,#20382f 73%); }
.guide-well > canvas, .camera-well > canvas, .camera-well > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.camera-well[data-mirrored="true"] > video,
.camera-well[data-mirrored="true"] > #camera-skeleton { transform: scaleX(-1); }
.camera-well[data-active="true"] { background-color: #1e372c; }
.camera-placeholder { display: grid; gap: 7px; place-items: center; padding: 12px 16px; border: 1px solid #f3deaf60; border-radius: 5px; background: #20382f24; color: inherit; font-size: .82rem; letter-spacing: .09em; }
.camera-placeholder:hover:not(:disabled) { border-color: #f3deaf; background: #d4bd8427; }
.camera-placeholder:focus-visible { outline-color: #fff1c9; outline-offset: 3px; }
.camera-placeholder:disabled { opacity: .65; }
.camera-aim { position: absolute; top: 50%; left: 50%; z-index: 1; transform: translate(-50%, -50%); border: 1px dashed #fff7da; border-radius: 8px; box-shadow: 0 0 0 1px #1f201e86, inset 0 0 0 1px #1f201e68; pointer-events: none; }
.lens-mark { font-size: 58px; color: #f3deaf; display: grid; place-items: center; }
.countdown { position: absolute; z-index: 2; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; color: #fff8e7; background: #7b392be8; font: 700 42px/1 Georgia, serif; box-shadow: 0 2px 15px #3a24155c; }
.preview-control { min-height: 40px; margin-top: 3px; font-size: .82rem; }
.camera-picker { display: flex; gap: 5px; min-width: 0; max-width: 220px; padding: 3px; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); }
.camera-picker label { position: relative; flex: 1; min-width: 0; }
.camera-picker input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; cursor: pointer; opacity: 0; }
.camera-picker span { display: grid; min-height: 37px; place-items: center; padding: 3px 7px; border: 1px solid transparent; border-radius: 3px; color: var(--text-soft); font-size: .82rem; font-weight: 650; }
.camera-picker input:checked + span { border-color: #c9998d; color: var(--red-dark); background: var(--paper); }
.camera-picker input:focus-visible + span { outline: 2px solid var(--red); outline-offset: -2px; }
.camera-picker:disabled { opacity: .64; }
.camera-picker:disabled input { cursor: default; }
.camera-note { display: flex; align-items: center; gap: 5px; color: var(--text-soft); margin: 12px 3px 3px; font-size: .75rem; }
.dance-console { margin-top: 15px; border: 1px solid var(--line); background: var(--panel); padding: 15px 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.dance-meter { flex: 1 1 320px; }
.meter-label { display: flex; justify-content: space-between; gap: 6px; font-weight: 650; }
.meter-label time { font-variant-numeric: tabular-nums; }
#dance-hint { color: var(--text-soft); font-size: .77rem; min-height: 1.6em; }
#retry-reference { min-height: 40px; margin-top: 6px; font-size: .8rem; }
#dance-progress { height: 7px; width: 100%; display: block; margin: 8px 0 6px; border: 0; border-radius: 6px; overflow: hidden; background: var(--line); color: var(--red); accent-color: var(--red); }
#dance-progress::-webkit-progress-bar { background: var(--line); }
#dance-progress::-webkit-progress-value { background: var(--red); }
#dance-progress::-moz-progress-bar { background: var(--red); }
.dance-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dance-actions .button { font-size: .83rem; }
.reward-shortcut { flex-basis: 100%; }

.reward-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.reward-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px; }
.reward-art { position: relative; display: grid; place-items: center; min-height: 280px; height: clamp(280px, 29vw, 365px); overflow: hidden; background-color: var(--paper); }
.reward-art img { width: 100%; height: 100%; object-fit: contain; }
.costume-frame { background: var(--paper); }
.costume-frame img { padding: 8px; }
.fabric-piece { width: 51%; aspect-ratio: 1.1; transform: rotate(-7deg); box-shadow: 0 12px 25px #52371f4d; outline: 1px solid #71533270; outline-offset: 5px; border: 6px solid #ddd0b3; background: var(--era); overflow: hidden; }
.fabric-piece img { object-fit: cover; }
.reward-copy { padding: 14px 12px 12px; }
.reward-copy > p { display: flex; align-items: center; gap: 6px; color: var(--red-dark); font-size: .82rem; font-weight: 650; }
.reward-copy h2 { font-size: clamp(17px, 2.1vw, 22px); margin: 6px 0; }
.reward-copy small { font-size: .78rem; color: var(--text-soft); }
.reward-score { display: flex; align-items: center; gap: 9px; white-space: nowrap; color: var(--red); font-size: .85rem; }
.reward-score strong, .result-big strong { font-family: Georgia, serif; font-weight: 400; line-height: .97; }
.reward-score strong { font-size: 53px; }
.reward-score small { color: var(--text-soft); }
.next-chapter { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 19px 21px; margin-top: 20px; border: 1px solid var(--line); background: var(--panel); }
.next-chapter h2 { font-size: 22px; }
.next-chapter p { color: var(--text-soft); margin-top: 5px; font-size: .84rem; }
.empty-state { display: grid; justify-items: center; gap: 13px; padding: 56px 18px; text-align: center; background: var(--panel); border: 1px solid var(--line); }
.empty-state h1 { font-size: 2.5rem; }
.reward-medallion { font-size: 24px; color: var(--red); }

.scan-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.scan-tab { min-height: 42px; padding: 8px 17px; display: inline-flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; color: var(--text-soft); }
.scan-tab:hover { border-color: var(--red); }
.scan-tab[aria-current] { color: #fff4df; background: var(--red); border-color: var(--red); }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: 18px; }
.relic-panel, .scan-panel { border: 1px solid var(--line); padding: 8px; background: var(--panel); box-shadow: var(--shadow); }
.relic-art { position: relative; height: clamp(215px, 25vw, 340px); background: var(--paper); overflow: hidden; }
.relic-art img, .dialog-relic img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.relic-art img { position: absolute; inset: 0; padding: 11px; }
.relic-copy { padding: 11px 13px 12px; }
.relic-copy h2 { margin: 4px 0 5px; font-size: clamp(20px,2.3vw,30px); }
.scan-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; padding: 22px; text-align: center; }
.scan-panel h2 { font-size: 25px; }
.scan-copy p { color: var(--text-soft); font-size: .85rem; margin-top: 5px; }
.scan-target { position: relative; width: min(100%, 226px); aspect-ratio: 1; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: 0 5px 19px #251d1510; }
.scan-target > img { width: 100%; height: 100%; image-rendering: pixelated; }
.scan-target > b { position: absolute; width: 19px; height: 19px; border: 2px solid var(--red); pointer-events: none; }
.scan-target > b:nth-of-type(1) { left: 8px; top: 8px; border-right: 0; border-bottom: 0; }
.scan-target > b:nth-of-type(2) { right: 8px; top: 8px; border-left: 0; border-bottom: 0; }
.scan-target > b:nth-of-type(3) { left: 8px; bottom: 8px; border-right: 0; border-top: 0; }
.scan-target > b:nth-of-type(4) { right: 8px; bottom: 8px; border-left: 0; border-top: 0; }
.scan-sweep { display: none; position: absolute; top: 10px; left: 12px; right: 12px; height: 2px; background: #a0442b; box-shadow: 0 0 8px 1px #a0442b; pointer-events: none; }
.scanning .scan-sweep { display: block; animation: sweep .8s ease-in-out forwards; }
@keyframes sweep { from { top: 10px; } to { top: calc(100% - 12px); } }

.site-dialog {
  border: 1px solid #baa07f; border-radius: 5px; width: min(94vw, 530px); max-width: none;
  max-height: min(91vh, 91dvh); padding: 0; background: var(--panel); color: var(--ink);
  box-shadow: 0 20px 70px #22150969; overscroll-behavior: contain;
}
.site-dialog::backdrop { background: #251d15a8; }
.dialog-inner { position: relative; padding: 27px; }
.dialog-close { display: grid; place-items: center; position: absolute; top: 10px; right: 10px; width: 39px; height: 39px; border: 1px solid transparent; border-radius: 50%; background: var(--surface-muted); color: var(--ink); font-size: 19px; }
.dialog-close:hover { border-color: #bca287; }
.dialog-inner > .eyebrow { margin-right: 30px; }
.dialog-inner h2 { font-size: clamp(24px,4.4vw,35px); margin: 7px 36px 0 0; overflow-wrap: anywhere; }
.dialog-text { line-height: 1.75; color: var(--text-soft); margin-block: 12px 17px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 9px; }
.dialog-relic { height: 170px; margin-top: 12px; background: var(--paper); }
.result-dialog { width: min(94vw, 498px); }
.result-summary { display: grid; justify-items: center; text-align: center; }
.result-summary .eyebrow { margin: 8px auto 0; justify-content: center; }
.result-summary h2 { margin: 5px 0 0; }
.result-medallion { border: 1px solid #cda998; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; color: #894b38; background: #edddcd; font-size: 26px; }
.result-medallion.passed { color: #315749; background: #e1e9d8; border-color: #adbd9a; }
.result-big { display: flex; gap: 7px; justify-content: center; align-items: baseline; color: var(--red); margin-top: 5px; }
.result-big strong { font-size: 84px; }
.result-note { color: var(--text-soft); font-size: .81rem; margin: 3px auto 0; }
.result-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); text-align: center; margin: 17px 0; }
.result-breakdown > div { background: var(--panel); padding: 7px 3px; }
.result-breakdown dt { font-size: .75rem; color: var(--text-soft); }
.result-breakdown dd { color: var(--red-dark); font: 600 22px/1.25 Georgia, serif; }
.result-replay { border: 1px solid var(--line); border-radius: 4px; margin: 12px 0; }
.result-replay summary { padding: 10px 12px; color: var(--red-dark); font-weight: 650; cursor: pointer; }
.result-replay video { display: block; width: 100%; max-height: min(46vh, 360px); background: #21372e; object-fit: contain; }
.result-replay-note { margin: 12px 0; color: var(--text-soft); font-size: .82rem; text-align: center; }
.result-actions { justify-content: center; }
.clip-dialog { width: min(94vw, 740px); }
.clip-figure figcaption { display: flex; align-items: center; gap: 7px; color: var(--red-dark); font-weight: 650; font-size: .9rem; margin-bottom: 5px; }
.clip-figure video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 52vh; background: #21372e; object-fit: contain; }
.clip-figure { margin-bottom: 12px; }
.demo-figure { margin-top: 14px; }
.demo-figure video { background: #121418; }

.credits-page { max-width: 930px; }
.credits-page > section:not(.page-heading) { margin-top: 17px; border: 1px solid var(--line); background: var(--panel); padding: 20px; }
.credits-page h2 { font-size: 1.4rem; margin-bottom: 10px; }
.credits-page p + p { margin-top: 9px; }
.credits-page ul { margin: 0; padding-inline-start: 1.4em; }
.credits-page li + li { margin-top: 7px; }
.credits-page section a { color: var(--red-dark); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 48px); }
  .home-hero { min-height: clamp(390px, 55vw, 500px); }
  .logo-type { font-size: clamp(56px, 9.2vw, 95px); }
  .hero-content { max-width: 56%; }
  .home-chapter { padding: 9px; height: 104px; }
  .chapter-copy { gap: 5px; }
  .chapter-glyph { font-size: 33px; }
  .era-grid { gap: 13px; }
  .era-card-body { padding: 12px 11px; }
  .map-layout { gap: 12px; }
  .map-aside { padding: 15px; }
  .pin-label { display: none; }
  .map-pin:hover .pin-label, .map-pin:focus-visible .pin-label { display: block; }
  .dance-console { align-items: start; }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 30px); }
  .header-content { min-height: 61px; gap: 8px; }
  .brand { gap: 6px; font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; }
  .top-nav { gap: 12px; font-size: .79rem; }
  .top-nav a { gap: 3px; }
  .top-nav a > .icon { display: none; }
  .site-footer { margin-top: 34px; padding-bottom: 20px; font-size: .72rem; }
  .home-hero { display: block; min-height: 0; margin-top: 12px; }
  .hero-frame { inset: 7px; outline-offset: 2px; }
  .hero-art { width: 100%; height: clamp(240px, 82vw, 400px); object-position: 75% 44%; }
  .hero-fade { background: linear-gradient(180deg, transparent 25%, #ffffff35 42%, #fff 65%); }
  .hero-content { max-width: none; min-height: 0; padding: clamp(186px, 65vw, 315px) 19px 24px; }
  .hero-content .eyebrow { font-size: .76rem; letter-spacing: .12em; }
  .logo-type { margin: 7px 0 3px -3px; font-size: clamp(53px, 13vw, 76px); }
  .hero-line { font-size: 19px; margin-top: 5px; }
  .hero-intro { font-size: .84rem; margin-top: 5px; }
  .hero-action { margin-top: 14px; }
  .hero-action .button { min-height: 45px; min-width: 144px; }
  .home-era-list { margin-top: 20px; }
  .section-heading { margin-bottom: 9px; }
  .section-heading h2 { font-size: 21px; }
  .home-chapters, .era-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .home-chapter { height: 91px; }
  .home-chapter > .icon { font-size: .8rem; }
  .route-top { padding-top: 9px; }
  .page-heading { margin-bottom: 17px; }
  .page-heading h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .page-heading.centered { margin: 4px 0 19px; }
  .page-heading p:last-child { margin-top: 8px; font-size: .88rem; }
  .era-card-art { height: clamp(115px, 32vw, 174px); }
  .era-card-glyph { left: 11px; }
  .era-card h2 { margin-top: 5px; }
  .era-dates { gap: 4px; font-size: .69rem; }
  .card-bottom { margin-top: 9px; }
  .circle-arrow { width: 25px; height: 25px; }
  .map-layout, .scan-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .map-picture { aspect-ratio: 1.45; }
  .map-frame { padding: 4px; }
  .map-frame figcaption { padding: 5px; }
  .map-aside { padding: 13px; }
  .spot-list { margin-block: 9px 12px; }
  .pin-label { display: block; font-size: .63rem; }
  .pin-mark { width: 29px; height: 29px; font-size: 15px; }
  .dance-heading, .reward-heading { display: block; position: relative; }
  .dance-panel { padding: 5px; }
  .dance-grid { gap: 7px; }
  .dance-panel header { margin: 0 1px 3px; min-height: 35px; }
  .dance-panel h2 { font-size: .88rem; gap: 3px; }
  .dance-panel header span { font-size: .62rem; }
  .guide-well, .camera-well { aspect-ratio: .92; }
  .lens-mark { font-size: 42px; }
  .camera-note { font-size: .64rem; }
  .camera-picker { margin-top: 5px; }
  .camera-picker span { min-height: 40px; }
  .preview-control { min-height: 42px; }
  .score-rule { margin-top: 7px; padding-block: 5px; font-size: .72rem; }
  .dance-console { margin-top: 9px; padding: 11px; gap: 9px; }
  .dance-actions { gap: 5px; }
  .dance-actions .button { gap: 4px; padding-inline: 8px; font-size: .74rem; }
  .reward-score { margin-top: 10px; }
  .reward-score strong { font-size: 38px; }
  .reward-grid { gap: 8px; }
  .reward-card { padding: 5px; }
  .reward-art { min-height: 0; height: clamp(125px, 38vw, 200px); }
  .reward-copy { padding: 7px 3px; }
  .reward-copy h2 { font-size: .97rem; }
  .fabric-piece { width: 67%; border-width: 3px; outline-offset: 2px; }
  .next-chapter { align-items: start; flex-direction: column; padding: 14px; margin-top: 11px; }
  .scan-tabs { gap: 5px; }
  .scan-tab { flex: 1; justify-content: center; padding-inline: 8px; font-size: .85rem; }
  .relic-art { height: 170px; }
  .scan-panel { gap: 12px; padding: 16px; }
  .dialog-inner { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
