:root {
  color-scheme: dark;
  --ink: #1a1825;
  --panel: #24202e;
  --deep: #171521;
  --text: #f3ebdd;
  --muted: #bdb3c6;
  --gold: #efce9a;
  --line: #544758;
  --serif: Georgia, 'Times New Roman', serif;
  font: 100%/1.5 system-ui, sans-serif;
  background: var(--ink);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
p { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: var(--serif); font-weight: normal; line-height: 1.13; }
h2 { font-size: clamp(1.85rem, 4vw, 2.45rem); }
h3 { font-size: 1.5rem; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; overflow: hidden; }
.skip:focus { display: block; padding: .75rem; }
.site-header { border-bottom: 1px solid #382e40; }
.bar, .shell { width: min(71rem, calc(100% - 3rem)); margin-inline: auto; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-block: .95rem; }
.bar a { text-decoration: none; font-size: .88rem; }
.bar a:hover { text-decoration: underline; }
.catalog { font-weight: 650; }
.catalog span, .store { color: var(--muted); font-weight: 400; }
.masthead { padding-block: clamp(1.7rem, 5vw, 3.25rem) 1.75rem; }
.masthead h1 { font-size: clamp(2.8rem, 8.7vw, 5.25rem); letter-spacing: -.045em; }
.masthead p { color: var(--gold); margin-top: .5rem; font-size: clamp(1rem, 2.3vw, 1.2rem); }
.tabs { display: flex; flex-wrap: wrap; gap: 0 .42rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; display: block; padding: .66rem .95rem; color: var(--muted); border-bottom: 2px solid transparent; font-size: .95rem; }
.tabs a[aria-current], .tabs a:hover { color: var(--gold); }
.tabs a[aria-current] { border-color: var(--gold); }
.workspace { display: grid; grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: clip; align-items: start; background: var(--deep); }
.controls { padding: clamp(1rem, 2.8vw, 2rem); background: var(--panel); align-self: stretch; }
.controls > p, .stage-heading p { color: var(--muted); margin-top: .5rem; }
.controls > p { max-width: 36rem; }
.spreads { border: 0; display: grid; gap: .32rem; margin: 1.1rem 0 1rem; padding: 0; min-width: 0; }
.spread-choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; align-items: center; padding: .4rem .44rem; min-height: 3.05rem; border: 1px solid transparent; border-radius: 7px; cursor: pointer; line-height: 1.25; }
.spread-choice:has(:checked) { background: #393041; border-color: #69546a; }
.spread-choice:hover { background: #332b3b; }
.spread-choice input { accent-color: var(--gold); width: 1rem; height: 1rem; margin: 0; }
.spread-choice small { display: block; color: var(--muted); font-size: .81rem; margin-top: .23rem; }
.spread-choice b { font-size: .82rem; color: var(--gold); font-weight: 500; }
.primary { min-height: 46px; width: 100%; padding: .65rem .85rem; border-radius: 7px; border: 1px solid var(--gold); color: #241a20; font-weight: 700; background: var(--gold); }
.primary:hover { background: #ffdfaf; }
.stage { padding: clamp(1rem, 3vw, 2rem); min-width: 0; background: var(--deep); }
.workspace > .stage { border-left: 1px solid var(--line); min-height: 100%; }
.stage:focus { outline: 2px solid var(--gold); outline-offset: -3px; }
.cover { min-height: 33rem; height: 100%; display: grid; place-content: center; gap: 1.5rem; text-align: center; background: radial-gradient(ellipse at center, #3d2e46 2%, transparent 63%); overflow: hidden; }
.fan { --card: clamp(7rem, 15vw, 12.5rem); position: relative; width: calc(var(--card) * 2.35); max-width: 100%; height: calc(var(--card) * 1.64); margin-inline: auto; }
.fan img { position: absolute; width: var(--card); height: auto; left: 50%; bottom: 0; border: 1px solid #887057; border-radius: 8px; background: #211826; box-shadow: 0 .65rem 1.5rem #0a0811a8; }
.fan img:first-child { transform: translateX(-96%) rotate(-14deg); }
.fan img:nth-child(2) { z-index: 1; transform: translateX(-50%) translateY(-7%); }
.fan img:last-child { transform: translateX(-4%) rotate(14deg); }
.cover-caption { color: var(--gold); display: flex; justify-content: center; align-items: center; gap: .65rem; font-family: var(--serif); font-size: 1.1rem; }
.cover-caption span { width: 2rem; height: 1px; background: #8b705c; }
.stage-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; margin-bottom: 1.25rem; }
.stage-heading button { background: transparent; border: 1px solid #827083; border-radius: 6px; color: var(--text); padding: .4rem .65rem; font-size: .88rem; min-height: 40px; flex: 0 0 auto; }
.stage-heading button:hover { background: var(--panel); }
.stage-heading button[aria-disabled=true] { cursor: default; color: var(--muted); opacity: .75; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.2rem), 1fr)); gap: 1rem; align-items: start; }
.deck { border: 1px solid var(--line); border-radius: 12px; }
.deck .card-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.card-grid.single { grid-template-columns: minmax(0, 13.5rem); }
.reading-tile { display: flex; width: 100%; min-width: 0; padding: .42rem; flex-direction: column; align-items: stretch; gap: .25rem; text-align: left; background: #231d2b; color: var(--text); border: 1px solid var(--line); border-radius: 7px; }
.reading-tile:hover { border-color: var(--gold); }
.reading-tile img, .card-back { display: block; width: 100%; height: auto; aspect-ratio: 832/1216; border-radius: 4px; object-fit: cover; }
.reversed { transform: rotate(180deg); }
.position { font-weight: 650; color: var(--gold); min-height: 2.5em; padding: .05rem .18rem; display: flex; align-items: center; font-size: .88rem; line-height: 1.3; overflow-wrap: anywhere; }
.card-name { font-family: var(--serif); font-size: 1.15rem; padding-inline: .18rem; line-height: 1.13; }
.card-meta { color: var(--muted); padding-inline: .18rem; font-size: .85rem; }
.card-back { display: grid; place-items: center; border: 4px double #8b6a68; background: repeating-linear-gradient(125deg, #332444 0 1px, #211b30 1px 14px); }
.card-back i { display: grid; place-content: center; width: 54%; aspect-ratio: 1; border: 1px solid #b48d73; border-radius: 50%; font: normal clamp(1.5rem, 4vw, 2.5rem)/1 var(--serif); background: var(--panel); color: var(--gold); }
.card-back i::before { content: '✧'; }
#date-form { display: grid; gap: 1rem; margin-top: 1.45rem; }
.date-field span { display: block; margin-bottom: .35rem; }
.date-field input { width: 100%; min-width: 0; min-height: 46px; padding: .55rem .65rem; border-radius: 6px; border: 1px solid #827083; background: var(--deep); color: var(--text); }
.stage-empty { min-height: 16rem; display: grid; align-content: center; justify-items: center; column-gap: 1rem; color: var(--muted); text-align: center; }
.seal { display: grid; place-items: center; width: 4rem; height: 4rem; border: 1px solid #887057; font-family: var(--serif); font-size: 2.25rem; border-radius: 50%; color: var(--gold); margin-bottom: .65rem; }
.matrix-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
.matrix-grid > div { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--panel); padding: .6rem; border-radius: 6px; min-width: 0; }
.matrix-grid dt { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.matrix-grid dd { color: var(--gold); font: 1.4rem var(--serif); padding-block: .2rem; overflow-wrap: anywhere; }
.matrix-grid details > p { font-size: .91rem; margin: .35rem 0; }
summary { cursor: pointer; padding-block: .46rem; color: var(--gold); }
.work { padding: .8rem 0 1.35rem; color: var(--muted); }
.work strong { color: var(--text); margin-right: .4rem; }
.line-list { margin-top: .65rem; }
.line-list details { border-bottom: 1px solid var(--line); }
.line-list strong { float: right; padding-inline: .45rem; }
.line-list p { padding: 0 .45rem .25rem; }
.muted { color: var(--muted); }
.life { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.25rem; }
.life h3, .life h4 { margin-bottom: .45rem; }
.life .card-grid { margin-top: .8rem; }
.meaning-list { display: grid; gap: .55rem; }
.meaning-list dt { font-weight: 650; }
.meaning-list dd { color: var(--muted); }
.score { display: grid; text-align: center; line-height: 1.05; }
.score strong { font: 2.15rem var(--serif); color: var(--gold); }
.score span, .aspects small { color: var(--muted); }
.aspects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr)); gap: .75rem; }
.aspects section { border: 1px solid var(--line); border-radius: 7px; padding: .7rem; background: var(--panel); }
.aspects h4 { display: flex; justify-content: space-between; gap: .4rem; }
.aspects h4 span { font-size: .8rem; color: var(--gold); white-space: nowrap; font-weight: 500; }
.aspects meter { display: block; width: 100%; margin-block: .25rem; height: .7rem; accent-color: var(--gold); }
.aspects meter::-webkit-meter-optimum-value { background: #d5ad7e; }
.aspects meter::-moz-meter-bar { background: #d5ad7e; }
footer { color: var(--muted); padding-block: 1.2rem 2rem; max-width: 65ch; font-size: .88rem; }
dialog { width: min(50rem, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem); padding: 1.25rem; border: 1px solid #887083; border-radius: 12px; background: var(--panel); color: var(--text); }
dialog::backdrop { background: #0a0912cc; }
.close { display: flex; justify-content: flex-end; margin-bottom: .4rem; }
.close button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid #827083; background: var(--deep); color: var(--text); font-size: 1.35rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); align-items: start; gap: 1.1rem; }
.detail-grid > img { display: block; width: 100%; height: auto; border-radius: 5px; }
.detail-grid h3 { font-size: 1.25rem; margin-block: .8rem .25rem; }
.detail-grid .card-meta { padding: 0; }
.keywords { color: var(--gold); margin-block: .4rem .6rem; }
.active-meaning { border-left: 2px solid var(--gold); padding-left: .72rem; }
.symbols { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .65rem; }
.symbols dt { color: var(--muted); font-size: .85rem; }
@media (max-width: 720px) {
  .bar, .shell { width: calc(100% - 1.5rem); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace > .stage { border-left: 0; border-top: 1px solid var(--line); }
  .cover { min-height: 17rem; }
  .spread-choice { min-height: 2.8rem; }
}
@media (max-width: 450px) {
  .tabs a { padding-inline: .48rem; font-size: .86rem; }
  .matrix-grid > div { padding: .35rem; }
  .matrix-grid summary { font-size: .82rem; }
  .detail-grid { grid-template-columns: 1fr; gap: .6rem; }
  .detail-grid > img { width: min(100%, 10rem); margin-inline: auto; }
  .bar a { font-size: .82rem; }
}
