body[data-theme="myeongju"] {
  --accent: #64488a;
  --accent-hover: #4f3770;
  --accent-soft: #efeaf7;
  --hero-ink: #18171c;
}
body[data-theme="cheongyeon"] {
  --hanji-bg: #eff3f1;
  --hanji-surface: #fafcfb;
  --hanji-elevated: #e2eae7;
  --accent: #2e645f;
  --accent-hover: #224e4a;
  --accent-soft: #e1efea;
  --hero-ink: #151d1e;
  --lantern-gold: #b07d32;
}
@media (prefers-color-scheme: dark) {
  body[data-theme="myeongju"] {
    --accent: #d3bde9; --accent-hover: #e6d5f7; --accent-soft: #382c49; --accent-ink: #2b1c3a;
  }
  body[data-theme="cheongyeon"] {
    --hanji-bg: #152121; --hanji-surface: #202e2e; --hanji-elevated: #2e4140;
    --accent: #9ed9cf; --accent-hover: #bee8e0; --accent-soft: #2a4240; --accent-ink: #162c29;
  }
}
body { transition: background-color 240ms ease; }
.hall-select select { min-height: 44px; width: auto; padding: .35rem; font-weight: 700; }
.shrine-hero { position: relative; isolation: isolate; border-radius: 20px; overflow: hidden; background: var(--hero-ink); color: #fcf9f3; }
.hall-art { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 540px; }
.hall-art img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 350ms ease;
}
.hall-art img.current { opacity: 1; }
.shrine-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(15deg, var(--hero-ink), transparent 75%);
}
.hall-caption { position: absolute; z-index: 1; inset: auto auto 0 0; padding: clamp(1rem, 4vw, 3rem); }
#hall-seal { display: inline-block; border: 1px solid #d0b884; border-radius: 3px; padding: .15rem .5rem; color: #ffe6b5; font: 1rem/1.6 var(--display); letter-spacing: .12em; }
.hall-caption h1 { margin: .55rem 0; }
.hall-caption p { max-width: 34rem; }
.shrine-switcher { display: flex; gap: .5rem; margin-top: 1rem; }
.shrine-switcher button { min-height: 44px; background: #19171de8; color: #fff; border-color: #ffffff7a; }
.shrine-switcher button[aria-pressed="true"], .shrine-switcher button:hover { background: #fcf9f3; color: #25212d; }
.shrine-workbench { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
#birth-form, .result, .method {
  min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: clamp(1rem, 2.4vw, 1.75rem); box-shadow: var(--shadow-hanji);
}
#birth-form { display: grid; gap: .85rem; }
#birth-form label { display: grid; gap: .3rem; font-weight: 700; font-size: .9rem; }
#birth-form .check { min-height: 44px; margin: 0 !important; }
#birth-form fieldset { min-width: 0; margin: 0; border: 1px solid var(--line); }
#birth-form details label { margin-block: .5rem; }
#birth-form button[type="submit"] { background: var(--accent); color: var(--accent-ink); }
#birth-form button[type="submit"]:hover { background: var(--accent-hover); }
#solar-hint { margin-top: .3rem; }
#form-feedback {
  margin: 0; padding: .65rem .75rem; border: 1px solid var(--warning);
  border-radius: .45rem; background: var(--warning-bg); color: var(--warning);
}
#birth-form [aria-invalid="true"] { border-color: var(--warning); }
.result { scroll-margin-top: 1rem; }
.pair, .date-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.date-parts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.note, #status { font-size: .875rem; color: var(--muted); }
#status { margin: .35rem 0 .85rem; }
#shrine-guide { position: relative; border-top: 1px solid var(--line); padding-top: 1rem; }
#shrine-guide h3 { margin-top: .9rem; }
.guide-mark { float: right; width: 54px; margin: 0 0 .5rem .75rem; fill: none; stroke: var(--accent); opacity: .5; }
#shrine-example { color: var(--accent); }
.method { margin-top: 1.5rem; }
.method p { margin-top: .75rem; }
#birth-form summary, .method summary { cursor: pointer; color: var(--accent); min-height: 44px; padding-block: .55rem; font-weight: 700; }
.analysis-section { padding-top: 1.15rem; margin-top: 1.15rem; border-top: 1px solid var(--line); }
.analysis-section > p { margin-top: .35rem; }
.analysis-section > h4 { margin-top: .75rem; }
.five-elements-viz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: .75rem; }
.five-elements-viz svg { display: block; width: 100%; }
.five-elements-viz > svg { max-width: 260px; margin: auto; }
.five-elements-viz text { fill: var(--ink); font: 14px system-ui; }
.five-elements-viz .chart-scale { fill: var(--muted); font-size: 10px; }
.radar-grid { fill: none; stroke: var(--line-strong); vector-effect: non-scaling-stroke; }
.radar-data { fill: var(--accent); fill-opacity: .24; stroke: var(--accent); stroke-width: 2.2; }
.radar-dot, .bar-fill { fill: var(--pigment); }
.radar-zero { fill: none; stroke: var(--pigment); stroke-width: 1.6; stroke-dasharray: 2 2; }
.radar-dot { stroke: var(--surface); }
.bar-track { fill: var(--hanji-elevated); }
.element-row { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) minmax(5.5rem, auto); gap: .3rem .5rem; align-items: center; padding: .32rem 0; font-size: .875rem; }
.element-row span { text-align: right; }
.candidate-seal { grid-column: 2 / -1; justify-self: end; border: 1px solid var(--lantern-gold); padding: .05rem .4rem; border-radius: 4px; color: var(--ink); }
.timeline-direction { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; color: var(--accent); margin-top: .45rem; }
.timeline-direction svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.luck-timeline { overflow-x: auto; scroll-snap-type: x mandatory; margin-top: .5rem; padding: 4px 3px 10px; }
.luck-track { min-width: 576px; }
.luck-track > svg { display: block; width: 100%; height: 22px; overflow: visible; }
.luck-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.luck-dot.active { fill: var(--accent); }
.luck-cards { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.luck-card { display: grid; justify-items: center; gap: .2rem; margin-inline: 2px; padding: .42rem .1rem; font-size: .8rem; white-space: nowrap; scroll-snap-align: start; }
.luck-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.luck-card:focus-visible { outline-offset: -3px; }
.luck-glyphs { display: flex; gap: 2px; font: 700 1.35rem/1.2 var(--display); }
.luck-glyphs span { color: var(--pigment-ink); background: var(--pigment-paper); padding: .2rem .13rem; border-radius: 3px; }
.luck-summary { padding: .55rem .7rem; background: var(--accent-soft); border-radius: 6px; color: var(--accent); }
.timeline-pending svg { display: block; width: 120px; }
.pending-axis { stroke: var(--line-strong); stroke-dasharray: 4 4; }
@media (max-width: 1020px) { .shrine-workbench { grid-template-columns: 320px minmax(0, 1fr); gap: 16px; } }
@media (max-width: 760px) {
  .shrine-workbench, .five-elements-viz { grid-template-columns: minmax(0, 1fr); }
  .hall-art { aspect-ratio: 16 / 10; }
  .hall-caption { position: relative; }
  .shrine-hero::after { display: none; }
}

@media (prefers-color-scheme: dark) {
  .radar-dot, .bar-fill { fill: color-mix(in srgb, var(--pigment) 70%, white); }
  .radar-zero { stroke: color-mix(in srgb, var(--pigment) 60%, white); }
}

.reading-links { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: .6rem 0; }
.reading-links a { display: inline-flex; align-items: center; min-height: 44px; }
#natal-reading p { max-width: 65ch; margin-top: .6rem; }
#natal-reading h4 { margin-top: 1.2rem; }
.analysis-section[id] { scroll-margin-top: 1rem; }

#compatibility-reading label { display: grid; gap: .35rem; }
.privacy-policy { max-width: 45rem; margin: 1.5rem auto; }
.privacy-policy h2 { margin-top: 1.75rem; }

/* Keep the entry form visible while retaining the hall identity. */
body[data-theme] .skip-link:not(:focus-visible) { clip-path: inset(50%); }
body[data-theme] .skip-link:focus-visible { clip-path: none; top: 8px; }
.hall-art { height: clamp(142px, 22vw, 215px); aspect-ratio: auto; }
.hall-caption { padding: 1rem clamp(1rem, 4vw, 3rem); }
.hall-caption h1 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
.hall-caption p { line-height: 1.4; }
.five-elements-viz > svg { max-width: 320px; }
.five-elements-viz { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.month-grid { padding: 0; margin: 1rem 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.month-grid li { min-width: 0; border: 1px solid var(--line); border-radius: .65rem; padding: .75rem; }
.month-grid p { margin-top: .45rem; overflow-wrap: anywhere; }
.month-badge { display: inline-block; margin-top: .3rem; border-radius: .35rem; padding: .1rem .45rem; color: var(--accent); background: var(--accent-soft); }
.month-badge[data-badge="균형"] { color: var(--muted); background: var(--hanji-elevated); }
.month-badge[data-badge="주의"] { color: var(--warning); background: var(--warning-bg); }
#compatibility-reading .partner-form { display: grid; gap: .75rem; margin-block: .75rem; }
.partner-form label { font-weight: 700; font-size: .9rem; }
#compatibility-reading .check { display: flex; align-items: center; min-height: 44px; }
#compatibility-reading [hidden] { display: none; }
.compatibility-result h4 { margin-block: .85rem .25rem; }
@media (max-width: 740px) {
  .hall-art { height: 78px; }
  #birth-form { gap: .55rem; }
  .hall-caption { position: relative; padding: .7rem 1rem; }
  .hall-caption #hall-seal { display: none; }
  .shrine-switcher { margin-top: .45rem; }
  .month-grid, .five-elements-viz { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .five-elements-viz { grid-template-columns: minmax(0, 1fr); }
  .luck-track { min-width: 0; }
  .luck-track > svg { display: none; }
  .luck-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.result-panel > summary, .reading-topic > summary { cursor: pointer; min-height: 44px; padding-block: .55rem; font-weight: 750; }
.result-panel > summary { font-size: 1.15rem; color: var(--accent); }
.reading-topic { border-top: 1px solid var(--line); margin-top: .35rem; }
.month-grid summary { cursor: pointer; font-weight: 700; min-height: 40px; }
.month-evidence { font-size: .875rem; color: var(--muted); }
.compatibility-overview { margin-block: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--accent-soft); }
.compatibility-overview h4 { margin: 0; }
.relationship-counts { font-weight: 700; margin-block: .4rem; }
@media (max-width: 740px) {
  .month-grid { grid-template-columns: minmax(0, 1fr); }
}
