/* ===== Spell and Spread — pagan · witchy · a little dark at the edges ===== */
/* ---------- the colours of the house: six palettes, chosen at the top right (site.js sets html[data-palette]) ---------- */
:root {
  --bg: #0d0a0f; --bg-2: #1a1219;
  --bg-rgb: 13, 10, 15; --panel-rgb: 27, 19, 25; --well-rgb: 10, 7, 10; --deep-rgb: 9, 6, 10; --shadow-rgb: 0, 0, 0;
  --ink: #ecdfc6; --ink-dim: #a8978a; --ink-rgb: 236, 223, 198; --ink-dim-rgb: 168, 151, 138;
  --gold: #d9a94a; --gold-soft: #f0d28a; --accent-rgb: 217, 169, 74; --accent-soft-rgb: 240, 210, 138;
  --tint-rgb: 74, 40, 70; --plum-rgb: 181, 122, 160; --blood-rgb: 208, 87, 79;
  --ember: #c9683a; --moss: #8aa374; --plum: #b57aa0; --blood: #d0574f;
  --frame: #120c14; --thumb-bg: #1a1019; --art-bg: #e9e2cf;
  --sky-top: #251a2a; --sky-bottom: #1e1410; --glow-a: #3b1f3a; --glow-b: #4a2a12;
  --btn-1: #e6bd5e; --btn-2: #b8862e; --btn-ink: #1a1208;
  --tint-hi: #3a2238; --tint-mid: #2e1a30; --tint-lo: #190f1c;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23d9a94a' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
  --panel: rgba(var(--panel-rgb), 0.88);
  --panel-edge: rgba(var(--accent-rgb), 0.22);
  --gold-dim: rgba(var(--accent-rgb), 0.35); /* borders, rules and ornaments only: too faint for text */
  --gold-text: rgba(var(--accent-rgb), 0.8);  /* small labels and fine print: AA contrast on the page and panel backgrounds */
  --gold-faint: rgba(var(--accent-rgb), 0.14);
  --well: rgba(var(--well-rgb), 0.65); /* the dark inside inputs and tables */
  --card-w: 150px;
  --card-h: 256px; /* Rider–Waite–Smith proportions (about 1 : 1.71) */
  --serif: "Cormorant Garamond", "Georgia", serif;
  --display: "Cinzel", "Cormorant Garamond", "Georgia", serif;
}
:root[data-palette="moonlight"] {
  --bg: #0a0d16; --bg-2: #141a2b;
  --bg-rgb: 10, 13, 22; --panel-rgb: 20, 27, 43; --well-rgb: 6, 9, 16; --deep-rgb: 5, 7, 13; --shadow-rgb: 0, 0, 0;
  --ink: #e6e9f2; --ink-dim: #9aa3b8; --ink-rgb: 230, 233, 242; --ink-dim-rgb: 154, 163, 184;
  --gold: #b9c6e6; --gold-soft: #e4ebff; --accent-rgb: 185, 198, 230; --accent-soft-rgb: 228, 235, 255;
  --tint-rgb: 40, 52, 80; --plum-rgb: 140, 160, 210; --blood-rgb: 214, 96, 110;
  --ember: #c98a6a; --moss: #8aa3a0; --plum: #8c9fd2; --blood: #d6606e;
  --frame: #0f1320; --thumb-bg: #141a29; --art-bg: #e6e9f2;
  --sky-top: #1a2237; --sky-bottom: #10141f; --glow-a: #22304f; --glow-b: #2b2140;
  --btn-1: #dfe6fa; --btn-2: #9fb0d8; --btn-ink: #0d1220;
  --tint-hi: #2a3554; --tint-mid: #1f2740; --tint-lo: #131828;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23b9c6e6' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-palette="forest"] {
  --bg: #0a100c; --bg-2: #12201a;
  --bg-rgb: 10, 16, 12; --panel-rgb: 18, 30, 24; --well-rgb: 6, 10, 7; --deep-rgb: 5, 8, 6; --shadow-rgb: 0, 0, 0;
  --ink: #e8e6d4; --ink-dim: #a3a894; --ink-rgb: 232, 230, 212; --ink-dim-rgb: 163, 168, 148;
  --gold: #b6c97e; --gold-soft: #dcebb2; --accent-rgb: 182, 201, 126; --accent-soft-rgb: 220, 235, 178;
  --tint-rgb: 30, 52, 38; --plum-rgb: 120, 170, 130; --blood-rgb: 204, 92, 78;
  --ember: #c98a4a; --moss: #9ab88a; --plum: #8fb7a3; --blood: #cc5c4e;
  --frame: #0e1611; --thumb-bg: #142019; --art-bg: #e8e6d4;
  --sky-top: #16261c; --sky-bottom: #121a10; --glow-a: #1f3a2a; --glow-b: #3a3a12;
  --btn-1: #cbe08f; --btn-2: #7f9a4f; --btn-ink: #0f160c;
  --tint-hi: #27402f; --tint-mid: #1c3024; --tint-lo: #111d16;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23b6c97e' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-palette="ember"] {
  --bg: #120a08; --bg-2: #221210;
  --bg-rgb: 18, 10, 8; --panel-rgb: 34, 19, 16; --well-rgb: 12, 6, 5; --deep-rgb: 10, 5, 4; --shadow-rgb: 0, 0, 0;
  --ink: #f0e2d4; --ink-dim: #b39a8a; --ink-rgb: 240, 226, 212; --ink-dim-rgb: 179, 154, 138;
  --gold: #e08a4a; --gold-soft: #f5c39a; --accent-rgb: 224, 138, 74; --accent-soft-rgb: 245, 195, 154;
  --tint-rgb: 80, 36, 28; --plum-rgb: 200, 120, 90; --blood-rgb: 214, 80, 70;
  --ember: #e07a3a; --moss: #a3a374; --plum: #c8785a; --blood: #d65046;
  --frame: #160c0a; --thumb-bg: #221410; --art-bg: #efe3d6;
  --sky-top: #2c1612; --sky-bottom: #1d1008; --glow-a: #4a1e14; --glow-b: #5a3010;
  --btn-1: #f0a25f; --btn-2: #b45f28; --btn-ink: #1a0e08;
  --tint-hi: #4a2420; --tint-mid: #351a17; --tint-lo: #1e100d;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e08a4a' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-palette="rose"] {
  --bg: #130a10; --bg-2: #241220;
  --bg-rgb: 19, 10, 16; --panel-rgb: 36, 19, 31; --well-rgb: 12, 6, 10; --deep-rgb: 10, 5, 8; --shadow-rgb: 0, 0, 0;
  --ink: #f1e3ea; --ink-dim: #b0969f; --ink-rgb: 241, 227, 234; --ink-dim-rgb: 176, 150, 159;
  --gold: #e3a0b8; --gold-soft: #f6cfdc; --accent-rgb: 227, 160, 184; --accent-soft-rgb: 246, 207, 220;
  --tint-rgb: 80, 36, 60; --plum-rgb: 220, 140, 180; --blood-rgb: 214, 80, 96;
  --ember: #d07a6a; --moss: #9aa38a; --plum: #dc8cb4; --blood: #d65060;
  --frame: #170b13; --thumb-bg: #24141e; --art-bg: #f1e6ea;
  --sky-top: #2c1424; --sky-bottom: #1e0f18; --glow-a: #4a1e3a; --glow-b: #4a2030;
  --btn-1: #f2b5cb; --btn-2: #b86a8a; --btn-ink: #1a0a12;
  --tint-hi: #4a2440; --tint-mid: #351a2e; --tint-lo: #1e1019;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23e3a0b8' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-palette="parchment"] {
  --bg: #efe6d3; --bg-2: #e3d7bf;
  --bg-rgb: 239, 230, 211; --panel-rgb: 248, 242, 229; --well-rgb: 255, 251, 244; --deep-rgb: 232, 222, 200; --shadow-rgb: 90, 65, 30;
  --ink: #2b2118; --ink-dim: #6e6052; --ink-rgb: 43, 33, 24; --ink-dim-rgb: 110, 96, 82;
  --gold: #8a5a1e; --gold-soft: #6b4315; --accent-rgb: 138, 90, 30; --accent-soft-rgb: 107, 67, 21;
  --tint-rgb: 200, 180, 140; --plum-rgb: 150, 110, 130; --blood-rgb: 170, 50, 40;
  --ember: #a8532a; --moss: #5f7a4a; --plum: #8a5c78; --blood: #aa3228;
  --frame: #3a2a1e; --thumb-bg: #d9cdb4; --art-bg: #fbf7ee;
  --sky-top: #f7f1e3; --sky-bottom: #e6dcc4; --glow-a: #d8c39a; --glow-b: #e2c9a0;
  --btn-1: #c99a4e; --btn-2: #8a5a1e; --btn-ink: #fff8ea;
  --tint-hi: #d9cbb0; --tint-mid: #e4d8c0; --tint-lo: #efe6d3;
  --pentacle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%238a5a1e' stroke-width='1.6'%3E%3Ccircle cx='50' cy='50' r='38'/%3E%3Ccircle cx='50' cy='50' r='33' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M50 18 L68.81 75.89 L19.57 40.11 L80.43 40.11 L31.19 75.89 Z' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-palette="parchment"] { --panel: rgba(var(--panel-rgb), 0.94); --well: rgba(var(--well-rgb), 0.9); --gold-text: #6b4315; /* the light palette: small gold text must be the dark brown to read */ }
:root[data-palette="parchment"] .sigil-bg { opacity: .07; }
:root[data-palette="parchment"] .glow { opacity: .35; }

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100vh;
  padding: 0 clamp(16px, 3vw, 40px) 40px;
  position: relative;
  overflow-x: hidden;
}

/* ---------- the night: stars, a faint sigil, candle glow ---------- */
.sky {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(1.2px 1.2px at 8% 12%, rgba(var(--accent-soft-rgb), .7), transparent 70%),
    radial-gradient(1px 1px at 22% 32%, rgba(var(--ink-rgb), .5), transparent 70%),
    radial-gradient(1.4px 1.4px at 37% 8%, rgba(var(--accent-soft-rgb), .6), transparent 70%),
    radial-gradient(1px 1px at 58% 22%, rgba(var(--ink-rgb), .45), transparent 70%),
    radial-gradient(1.6px 1.6px at 71% 6%, rgba(var(--accent-soft-rgb), .75), transparent 70%),
    radial-gradient(1px 1px at 84% 28%, rgba(var(--ink-rgb), .5), transparent 70%),
    radial-gradient(1.2px 1.2px at 93% 14%, rgba(var(--accent-soft-rgb), .6), transparent 70%),
    radial-gradient(1px 1px at 14% 58%, rgba(var(--ink-rgb), .35), transparent 70%),
    radial-gradient(1.3px 1.3px at 47% 44%, rgba(var(--accent-soft-rgb), .4), transparent 70%),
    radial-gradient(1px 1px at 77% 52%, rgba(var(--ink-rgb), .35), transparent 70%),
    radial-gradient(1.1px 1.1px at 30% 78%, rgba(var(--accent-soft-rgb), .35), transparent 70%),
    radial-gradient(1px 1px at 64% 84%, rgba(var(--ink-rgb), .3), transparent 70%),
    radial-gradient(1.2px 1.2px at 90% 72%, rgba(var(--accent-soft-rgb), .4), transparent 70%),
    radial-gradient(ellipse at 50% -10%, var(--sky-top), transparent 60%),
    radial-gradient(ellipse at 50% 115%, var(--sky-bottom), transparent 55%),
    var(--bg);
}
.sigil-bg {
  position: fixed; z-index: -2; pointer-events: none;
  left: 50%; top: -18vmin; width: 88vmin; height: 88vmin; transform: translateX(-50%);
  background: var(--pentacle) center / contain no-repeat;
  opacity: .055;
  animation: turn 240s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes turn { from { transform: translateX(-50%) rotate(0deg); } to { transform: translateX(-50%) rotate(360deg); } }
.glow { position: fixed; z-index: -1; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.glow-a { width: 42vw; height: 42vw; left: -12vw; top: 8vh; background: var(--glow-a); opacity: .5; }
.glow-b { width: 38vw; height: 38vw; right: -10vw; bottom: 2vh; background: var(--glow-b); opacity: .45; animation: flicker 6s ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { opacity: .42; } 18% { opacity: .5; } 33% { opacity: .38; } 51% { opacity: .52; } 74% { opacity: .44; } 88% { opacity: .55; }
}

/* ---------- header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between;
  padding: 28px 0 18px;
  border-bottom: 1px solid var(--panel-edge);
  box-shadow: 0 3px 0 -2px rgba(var(--accent-rgb), .08);
}
.brand { display: flex; gap: 16px; align-items: center; }
.sigil {
  width: 50px; height: 50px; color: var(--gold); flex: none;
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), .5));
  animation: candle 4s ease-in-out infinite;
}
@keyframes candle { 0%, 100% { filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), .5)); } 50% { filter: drop-shadow(0 0 16px rgba(var(--accent-rgb), .75)); } }
h1 {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3.6vw, 40px);
  letter-spacing: .07em; color: var(--gold-soft); text-shadow: 0 0 28px rgba(var(--accent-rgb), .25);
}
h1 a { color: inherit; text-decoration: none; }
h1 a:hover { color: var(--gold); }
h1 a:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 4px; border-radius: 2px; }
.tagline { margin: 2px 0 0; color: var(--ink-dim); font-style: italic; font-size: 16px; letter-spacing: .01em; }
/* the right side of the header: the deck menu above, the almanac below */
.header-side { display: grid; gap: 10px; justify-items: end; }

/* deck menu: a small button at the top right that opens the deck tiles */
.deck-menu { position: relative; }
.deck-btn {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; cursor: pointer;
  background: var(--well); color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 4px; font: inherit; text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.deck-btn:hover, .deck-btn[aria-expanded="true"] { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); }
.deck-btn:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.deck-btn-thumb { width: 26px; height: 44px; object-fit: cover; border-radius: 2px; border: 1px solid rgba(var(--accent-rgb), .5); background: var(--thumb-bg); display: block; }
.deck-btn-text { display: grid; line-height: 1.2; }
.deck-btn-text .k { font-family: var(--display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.deck-btn-text .v { font-size: 16px; color: var(--gold-soft); }
.deck-btn-caret { color: var(--gold); font-size: 12px; margin-left: 2px; }
.deck-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: min(560px, calc(100vw - 32px));
  padding: 14px; border-radius: 6px;
  background: rgba(var(--panel-rgb), .97); border: 1px solid var(--panel-edge);
  box-shadow: 0 30px 80px rgba(var(--shadow-rgb), .6), inset 0 1px 0 rgba(255, 255, 255, .03);
  animation: rise .25s ease both;
}
.deck-pop-title { margin: 0 0 10px; font-family: var(--display); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.deck-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.deck-card { position: relative; display: block; cursor: pointer; }
.deck-card input { position: absolute; opacity: 0; inset: 0; }
.deck-card .dc-body {
  display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 4px; height: 100%;
  background: var(--well); border: 1px solid var(--gold-dim);
  transition: border-color .15s ease, background .15s ease;
}
.deck-card .dc-thumb {
  width: 44px; height: 75px; object-fit: cover; border-radius: 3px; display: block;
  border: 1px solid rgba(var(--accent-rgb), .5); background: var(--thumb-bg);
}
.deck-card .dc-text { display: grid; gap: 2px; min-width: 0; }
.deck-card .dc-name { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .04em; line-height: 1.25; }
.deck-card .dc-desc { font-size: 13px; color: var(--ink-dim); line-height: 1.3; font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.deck-card input:checked + .dc-body { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .35); }
.deck-card input:checked + .dc-body .dc-name { color: var(--gold-soft); }
.deck-card input:focus-visible + .dc-body { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
/* a themed back: the theme's own image replaces the pentacle design */
.card-back.themed { background: var(--back-image) center / cover no-repeat, var(--frame); }
.card-back.themed::before, .card-back.themed::after { display: none; }

.almanac { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 0; align-items: baseline; }
.almanac li { display: flex; gap: 8px; align-items: baseline; }
.almanac li + li::before { content: "✦"; color: var(--gold-dim); font-size: 9px; margin: 0 14px; align-self: center; }
.almanac .k { font-family: var(--display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.almanac .v { font-size: 16px; color: var(--gold-soft); }

/* ---------- the tabs: the rooms of the house ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 10px 0 0; border-bottom: 1px solid var(--panel-edge); }
.tabs a {
  display: inline-block; padding: 10px 18px 12px; margin-bottom: -1px; text-decoration: none;
  font-family: var(--display); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim);
  border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.tabs a:hover { color: var(--gold-soft); background: rgba(var(--accent-rgb), .05); }
.tabs a[aria-current="page"] { color: var(--gold-soft); background: var(--panel); border-color: var(--panel-edge); position: relative; }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.tabs a:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }
.reading-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- stages / panels ---------- */
.stage-host { max-width: 1100px; margin: 0 auto; }
.stage { padding-top: 28px; animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: clamp(18px, 3vw, 32px);
  box-shadow: 0 30px 80px rgba(var(--shadow-rgb), .5), inset 0 1px 0 rgba(255, 255, 255, .03);
  backdrop-filter: blur(6px);
}
.panel::after {
  /* a second, fainter frame, like an old plate */
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(var(--accent-rgb), .08); border-radius: 3px; pointer-events: none;
}
.panel + .panel { margin-top: 24px; }
.panel.intake { max-width: 660px; margin: 0 auto; }
h2 {
  margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 23px; letter-spacing: .06em; color: var(--gold-soft);
}
.panel > h2::after, .spread-head h2::after, .reading-head h2::after {
  content: ""; display: block; width: 72px; height: 1px; margin: 10px 0 0;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.lede { margin: 0 0 20px; color: var(--ink-dim); }
.small { font-size: 14px; color: var(--ink-dim); }

/* ---------- form ---------- */
form { display: grid; gap: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.label { font-family: var(--display); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.label small { font-family: var(--serif); font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink-dim); font-style: italic; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  font-size: 17px;
  color-scheme: dark;
}
input::placeholder, textarea::placeholder { color: rgba(var(--ink-dim-rgb), .7); font-style: italic; }
input:focus, select:focus, textarea:focus, .deck-strip:focus { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
textarea { resize: vertical; }
.mode-switch { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mode-switch legend { padding: 0; margin-bottom: 6px; width: 100%; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span {
  display: inline-block; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold-dim); font-size: 15px; color: var(--ink-dim);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.chip input:checked + span { background: var(--gold-faint); border-color: var(--gold); color: var(--gold-soft); }
.chip input:focus-visible + span { outline: 2px solid var(--gold-soft); }
.derived { font-size: 16px; color: var(--gold-soft); min-height: 1.4em; font-style: italic; }
.derived b { color: var(--ink); font-weight: 600; font-style: normal; }

/* spread chooser */
.spread-pick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.spread-desc { font-size: 16px; color: var(--ink-dim); line-height: 1.4; font-style: italic; }
.spread-preview {
  display: grid; gap: 10px; padding: 12px 14px; border-radius: 4px;
  background: var(--well); border: 1px solid var(--gold-dim);
}
.preview-wrap { position: relative; overflow: hidden; }
.preview-table { position: relative; transform-origin: 0 0; }
.preview-table .mini {
  position: absolute; display: grid; place-items: center; border-radius: 2px;
  background: linear-gradient(160deg, var(--tint-hi), var(--thumb-bg)); border: 1px solid rgba(var(--accent-rgb), .6);
  color: var(--gold-soft); font-family: var(--display); font-size: 10px; font-weight: 600;
  transform-origin: 50% 50%;
}
.preview-legend { margin: 0; padding: 0 0 0 22px; font-size: 13px; color: var(--ink-dim); line-height: 1.35; columns: 2; column-gap: 28px; }
.preview-legend li { break-inside: avoid; margin-bottom: 3px; }
.preview-legend b { color: var(--ink); font-weight: 600; }
.preview-legend span { display: block; font-style: italic; }

/* reader chooser */
.reader-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reader-pick legend { padding: 0; margin-bottom: 8px; }
.reader-card { position: relative; display: block; cursor: pointer; }
.reader-card input { position: absolute; opacity: 0; inset: 0; }
.reader-card .rc-body {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 4px; height: 100%;
  background: var(--well); border: 1px solid var(--gold-dim);
  transition: border-color .15s ease, background .15s ease;
}
.reader-card .rc-name { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: .06em; line-height: 1.2; }
.reader-card .rc-tag { font-size: 14px; color: var(--ink-dim); line-height: 1.35; font-style: italic; }
.reader-card .rc-via { font-family: var(--display); font-size: 10px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.reader-card input:checked + .rc-body { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .35); }
.reader-card input:checked + .rc-body .rc-name { color: var(--gold-soft); }
.reader-card input:focus-visible + .rc-body { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.reader-card.away { cursor: not-allowed; }
.reader-card.away .rc-body { opacity: .45; }
.reader-card.away .rc-via { color: var(--blood); }
.form-error { margin: 0; color: var(--blood); font-size: 16px; font-style: italic; }

.btn {
  font-family: var(--display); font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  padding: 13px 24px; border-radius: 4px; cursor: pointer; border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn.primary {
  background: linear-gradient(135deg, var(--btn-1), var(--btn-2));
  color: var(--btn-ink); font-weight: 700;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .5), 0 10px 30px rgba(var(--accent-rgb), .16);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(var(--accent-soft-rgb), .8), 0 14px 34px rgba(var(--accent-rgb), .28); }
.btn.primary:disabled { opacity: .5; cursor: wait; transform: none; }
.btn.ghost { background: transparent; color: var(--gold-soft); border-color: var(--gold-dim); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover, .link-btn:focus-visible { color: var(--gold-soft); }
.from-profile { margin: 0 0 14px; color: var(--ink-dim); font-style: italic; font-size: 16px; text-align: center; }
.intake .who-line { text-align: left; margin: 0 0 18px; }
.btn.ghost:hover { background: var(--gold-faint); }

/* ---------- cards ---------- */
.card {
  width: var(--card-w); height: var(--card-h);
  perspective: 1000px;
  position: relative;
}
.card-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-back, .card-face {
  position: absolute; inset: 0; border-radius: 10px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
}
/* back: a pentacle in gold on deep plum */
.card-back {
  background:
    var(--pentacle) center / 64% no-repeat,
    radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), .16), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, var(--tint-mid), var(--tint-lo) 60%, var(--frame));
  border: 2px solid rgba(var(--accent-rgb), .6);
  box-shadow: inset 0 0 0 5px var(--frame), inset 0 0 0 6px rgba(var(--accent-rgb), .4), 0 10px 24px rgba(var(--shadow-rgb), .55);
}
.card-back::before, .card-back::after {
  /* small stars in the corners */
  content: "✦ ✦"; position: absolute; left: 10px; right: 10px; display: flex; justify-content: space-between;
  font-size: 9px; color: rgba(var(--accent-rgb), .55);
}
.card-back::before { top: 9px; }
.card-back::after { bottom: 9px; }
/* face: the Rider–Waite–Smith artwork inside a gold frame */
.card-face {
  transform: rotateY(180deg);
  background: var(--frame);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--frame), 0 10px 24px rgba(var(--shadow-rgb), .55);
  padding: 5px;
}
.card-face .art {
  display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 4px;
  background: var(--art-bg);
}
.card.reversed .card-face .art { transform: rotate(180deg); }
/* fallback design, shown only if the artwork fails to load */
.card-face .face-fallback {
  display: none; position: absolute; inset: 5px; border-radius: 4px;
  background: linear-gradient(170deg, var(--tint-mid), var(--frame));
  grid-template-rows: auto 1fr auto; padding: 8px; text-align: center;
}
.card.no-art .card-face .art { display: none; }
.card.no-art .card-face .face-fallback { display: grid; }
.card-face .numeral { font-family: var(--display); font-size: 11px; color: var(--gold); letter-spacing: .12em; text-align: left; }
.card-face .glyph { display: grid; place-items: center; font-size: 56px; filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), .35)); }
.card-face .name { font-size: 17px; font-weight: 700; line-height: 1.15; }
.card-face .kw { font-size: 11px; color: var(--ink-dim); line-height: 1.3; margin-top: 4px; font-style: italic; }
.card.reversed .face-fallback > * { transform: rotate(180deg); }
.card.reversed .face-fallback .numeral { order: 3; text-align: right; }
.card.reversed .face-fallback .name-block { order: 1; }
.card.reversed .face-fallback .glyph { order: 2; }

/* ---------- shuffle table ---------- */
.table {
  position: relative; height: 340px; margin: 0 0 16px;
  border-radius: 6px;
  background: radial-gradient(ellipse at center, rgba(var(--tint-rgb), .35), transparent 70%);
  overflow: hidden;
}
.table .card { position: absolute; left: calc(50% - var(--card-w) / 2); top: calc(50% - var(--card-h) / 2); transition: transform .38s cubic-bezier(.3, .8, .3, 1); will-change: transform; }
.table .card .card-back { box-shadow: inset 0 0 0 5px var(--frame), inset 0 0 0 6px rgba(var(--accent-rgb), .4), 0 4px 10px rgba(var(--shadow-rgb), .6); }
.working {
  margin: 0; padding: 14px 18px; min-height: 120px; max-height: 190px; overflow: hidden;
  background: var(--well); border: 1px solid var(--panel-edge); border-radius: 4px;
  font-size: 17px; font-style: italic; color: var(--ink); line-height: 1.7; white-space: pre-wrap;
}
.working .soft { color: var(--ink-dim); }
.working .gold { color: var(--gold-soft); }

/* ---------- cut ---------- */
.cut-wrap { margin: 8px 0 20px; }
.deck-strip {
  display: flex; gap: 1px; height: 140px; padding: 14px 0 10px; cursor: crosshair; position: relative;
  touch-action: pan-y; user-select: none; border-radius: 4px;
}
.deck-strip .sliver {
  flex: 1 1 0; min-width: 0; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--tint-hi), var(--tint-lo));
  border-top: 2px solid rgba(var(--accent-rgb), .6);
  transition: transform .35s ease, filter .2s ease;
  transform: translateY(0);
}
.deck-strip .sliver.lifted { transform: translateY(-14px); filter: brightness(1.3); }
.deck-strip .sliver.cut-edge { box-shadow: -2px 0 0 var(--gold-soft), 0 0 14px var(--gold); }
.deck-strip.animating .sliver { transition: transform .6s cubic-bezier(.3, .8, .3, 1); }
.cut-readout { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-dim); font-style: italic; }
.cut-readout .readout { color: var(--ink); }
.cut-readout b { color: var(--gold-soft); font-weight: 600; }
.cut-readout .hint { font-family: var(--display); font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; align-self: center; }

/* ---------- spread ---------- */
.spread-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.deck-pile { --card-w: 70px; --card-h: 112px; flex: none; }
.deck-pile .card-back::before, .deck-pile .card-back::after { font-size: 6px; left: 6px; right: 6px; }
/* the cloth: cards are absolutely placed by the spread's layout, then the whole
   table is scaled down to fit the panel (see layTable in app.js) */
.table-wrap {
  position: relative; margin-top: 8px; overflow: hidden; border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(var(--plum-rgb), .10), transparent 65%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 6px),
    rgba(var(--deep-rgb), .6);
  border: 1px solid rgba(var(--accent-rgb), .16);
}
.table-wrap.pans { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.table-wrap.pans::after {
  content: "← drag to see the whole table →"; position: sticky; left: 0; bottom: 0; display: block; width: 100%;
  text-align: center; font-size: 13px; font-style: italic; color: var(--ink-dim); padding: 2px 0 4px;
  background: linear-gradient(transparent, rgba(var(--deep-rgb), .9));
}
.table-layout { position: relative; transform-origin: 0 0; }
.slot { position: absolute; transform-origin: 50% 50%; }
.slot::before {
  /* the empty place on the cloth, before a card lands */
  content: ""; position: absolute; inset: 0; border-radius: 8px;
  border: 1px dashed rgba(var(--accent-rgb), .3); background: rgba(var(--accent-rgb), .03);
  transition: border-color .3s ease, background .3s ease;
}
.slot.hi::before { border-color: var(--gold-soft); background: var(--gold-faint); }
.slot.hi .card { filter: drop-shadow(0 0 10px rgba(var(--accent-soft-rgb), .6)); }
.slot .badge {
  position: absolute; left: 50%; top: -30px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap; max-width: 220%;
  padding: 2px 9px; border-radius: 999px; background: rgba(var(--well-rgb), .88); border: 1px solid var(--gold-dim);
  font-size: 12px; line-height: 1.5; pointer-events: none;
}
.slot .badge .n { font-family: var(--display); font-size: 10px; color: var(--gold); letter-spacing: .12em; }
.slot .badge .t { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.slot.rotated .badge {
  /* the slot is turned 90° clockwise, so its right edge is the screen's bottom: park the
     badge past that edge and turn it back so it reads the right way up */
  left: calc(100% + 20px); top: 50%; transform: translate(-50%, -50%) rotate(-90deg);
}
.slot .card { position: absolute; inset: 0; transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .4s ease, filter .3s ease; }
.slot .card.arriving { opacity: 0; }
/* once turned, a card lifts toward you under the pointer and can be picked up with a click */
.slot.turned .card { cursor: zoom-in; transition: transform .25s ease, opacity .4s ease, filter .25s ease; }
.slot.turned:hover { z-index: 100 !important; }
.slot.turned .card:hover { transform: translateY(-14px) scale(1.09); filter: drop-shadow(0 22px 26px rgba(var(--shadow-rgb), .7)) drop-shadow(0 0 14px rgba(var(--accent-soft-rgb), .45)); }
.slot.rotated.turned .card:hover { transform: translateX(-14px) scale(1.09); }

/* ---------- lightbox: the card held up close ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; justify-items: center; gap: 8px;
  padding: 16px; background: rgba(var(--deep-rgb), .9); backdrop-filter: blur(6px);
  animation: rise .25s ease both;
}
.lb-figure { margin: 0; display: grid; gap: 14px; justify-items: center; max-width: 100%; }
.lb-card {
  padding: 6px; border-radius: 14px; background: var(--frame); border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--frame), 0 40px 90px rgba(var(--shadow-rgb), .8), 0 0 40px rgba(var(--accent-rgb), .18);
  animation: pickup .3s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes pickup { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.lb-art { display: block; max-height: min(80vh, 1100px); max-width: min(92vw, 640px); height: auto; width: auto; border-radius: 8px; background: var(--art-bg); }
.lb-art.reversed { transform: rotate(180deg); }
.lb-caption { display: grid; gap: 4px; text-align: center; max-width: 640px; }
.lb-pos { font-family: var(--display); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.lb-title { font-size: 26px; font-weight: 600; color: var(--gold-soft); line-height: 1.2; }
.lb-title .orient { font-family: var(--display); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-left: 10px; vertical-align: middle; }
.lb-kw { font-style: italic; color: var(--ink-dim); font-size: 17px; }
.lb-hint { font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(var(--ink-dim-rgb), .6); margin-top: 6px; }
.lb-close, .lb-nav {
  background: transparent; color: var(--gold-soft); border: 1px solid var(--gold-dim); border-radius: 999px; cursor: pointer;
  font: inherit; line-height: 1; display: grid; place-items: center; transition: background .15s ease, border-color .15s ease;
}
.lb-close:hover, .lb-nav:hover { background: var(--gold-faint); border-color: var(--gold); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; font-size: 30px; }
.lb-nav { width: 44px; height: 44px; font-size: 32px; padding-bottom: 4px; }
.lb-nav[disabled] { opacity: .25; cursor: default; }
body.lit { overflow: hidden; }


/* the legend: what each position means, and the card that landed there */
.legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 18px; }
.legend li {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  padding: 8px 10px; border-radius: 4px; border: 1px solid transparent; transition: border-color .2s ease, background .2s ease;
}
.legend li.hi, .legend li:hover { border-color: var(--gold-dim); background: rgba(var(--accent-rgb), .05); }
.legend .ln { font-family: var(--display); font-size: 10px; color: var(--gold); letter-spacing: .12em; padding-top: 6px; }
.legend .lbody { display: grid; gap: 2px; min-width: 0; }
.legend .lt { font-size: 19px; font-weight: 600; line-height: 1.15; }
.legend .lh { font-size: 14px; color: var(--ink-dim); line-height: 1.3; font-style: italic; }
.legend .lcard { display: block; margin-top: 4px; opacity: 0; transition: opacity .4s ease .5s; }
.legend li.turned .lcard { opacity: 1; }
.legend .cname { font-size: 17px; font-weight: 700; line-height: 1.15; color: var(--gold-soft); }
.legend .corient { font-family: var(--display); font-size: 10px; color: var(--gold); letter-spacing: .1em; text-transform: uppercase; margin-left: 6px; }
.legend .ckw { display: block; font-size: 14px; color: var(--ink-dim); line-height: 1.35; margin-top: 2px; font-style: italic; }

/* ---------- reading ---------- */
.reading-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.reading-status { color: var(--ink-dim); font-style: italic; font-size: 16px; }
.reading-status.live { color: var(--gold-soft); }
.reading-status.live::before { content: "✦ "; animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.reading {
  margin-top: 14px; padding: 26px clamp(16px, 3vw, 36px);
  background: rgba(var(--deep-rgb), .65); border: 1px solid var(--panel-edge); border-radius: 6px;
  font-size: 19px; line-height: 1.65; min-height: 120px;
}
.reading h2 { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .08em; margin: 26px 0 10px; color: var(--gold); }
.reading h2:first-child { margin-top: 0; }
.reading h3 { font-size: 22px; margin: 18px 0 6px; color: var(--gold-soft); font-weight: 600; }
.reading p { margin: 0 0 12px; }
.reading ul { margin: 0 0 12px; padding-left: 22px; }
.reading li { margin-bottom: 6px; }
.reading li::marker { color: var(--gold); }
.reading em { color: var(--plum); }
.reading strong { color: var(--ink); }
.reading .cursor { display: inline-block; width: 8px; height: 1em; background: var(--gold); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
.reading-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; color: var(--ink-dim); font-style: italic; }

/* ---------- footer ---------- */
.site-footer {
  max-width: 800px; margin: 44px auto 0; color: var(--ink-dim); font-size: 15px; line-height: 1.6; text-align: center;
  border-top: 1px solid var(--panel-edge); padding-top: 18px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer .ornament { color: var(--gold-dim); letter-spacing: .4em; font-size: 14px; }
.site-footer .fine { font-family: var(--display); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); margin-top: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --card-w: 120px; --card-h: 205px; }
  .card-face .glyph { font-size: 44px; }
  .spread-pick { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  :root { --card-w: 128px; --card-h: 219px; }
  .row, .reader-pick { grid-template-columns: 1fr; }
  .table { height: 280px; }
  .legend { grid-template-columns: 1fr; }
  .preview-legend { columns: 1; }
  .deck-pile { display: none; }
  .almanac li + li::before { margin: 0 8px; }
  .tabs { gap: 2px; }
  .tabs a { padding: 9px 11px 11px; font-size: 10px; letter-spacing: .1em; }
  .header-side { justify-items: start; width: 100%; }
  .deck-pop { right: auto; left: 0; }
  .lightbox { grid-template-columns: 1fr; padding: 12px; align-content: center; }
  .lb-nav { display: none; }
  .lb-art { max-height: 66vh; }
  .lb-title { font-size: 21px; }
  .lb-hint { display: none; }
  .deck-options { grid-template-columns: 1fr; }
  .almanac .v { font-size: 14px; }
  .sigil-bg { width: 120vmin; height: 120vmin; top: -30vmin; }
}
@media (prefers-reduced-motion: reduce) {
  .card-inner, .table .card, .slot .card, .deck-strip .sliver { transition-duration: .01s !important; }
  .stage, .sigil-bg, .glow-b, .sigil, .lightbox, .lb-card { animation: none; }
  .slot.turned .card:hover { transform: none; }
}

/* ---------- the account link: a small key at the top right of every room ---------- */
.header-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
.account-link {
  display: grid; align-content: center; line-height: 1.2; padding: 6px 12px; text-decoration: none;
  background: var(--well); border: 1px solid var(--gold-dim); border-radius: 4px;
  transition: border-color .15s ease, background .15s ease;
}
.account-link:hover, .account-link[aria-current="page"] { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); }
.account-link:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.account-link .k { font-family: var(--display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.account-link .v { font-size: 16px; color: var(--gold-soft); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.account-link .v::before { content: "⚷ "; color: var(--gold); }
.account-link[data-state="in"] .v::before { content: "☽ "; }

/* ---------- after the reveal: read them yourself, or call the reader ---------- */
.choice-panel { text-align: center; }
.choice-panel > h2::after { margin-left: auto; margin-right: auto; }
.choice-panel .lede { max-width: 640px; margin-left: auto; margin-right: auto; }
.choice-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.self-cards { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.self-cards li {
  display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 4px 16px; align-items: baseline;
  padding: 10px 12px; border: 1px solid var(--panel-edge); border-radius: 4px; background: rgba(var(--well-rgb), .3);
}
.self-cards .sc-pos { font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.self-cards .sc-card b { color: var(--gold-soft); font-size: 18px; }
.self-cards .sc-kw { grid-column: 2; font-size: 14px; font-style: italic; color: var(--ink-dim); }
.self-cards .sc-link { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); text-decoration: none; white-space: nowrap; }
.self-cards .sc-link:hover { color: var(--gold-soft); text-decoration: underline; }
.self-panel .field { margin-top: 4px; }
@media (max-width: 560px) {
  .self-cards li { grid-template-columns: 1fr; }
  .self-cards .sc-kw, .self-cards .sc-link { grid-column: 1; grid-row: auto; }
}

/* ---------- the colour menu: to the left of the sign-in link ---------- */
.palette-menu { position: relative; }
.palette-btn {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; cursor: pointer; height: 100%;
  background: var(--well); color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 4px; font: inherit; text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.palette-btn:hover, .palette-btn[aria-expanded="true"] { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); }
.palette-btn:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.palette-dot, .po-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--dot-bg, var(--bg)); border: 2px solid var(--dot-accent, var(--gold));
  box-shadow: inset 0 0 0 3px var(--dot-panel, var(--bg-2)), 0 0 10px rgba(var(--accent-rgb), .25);
}
.palette-pop { width: min(420px, calc(100vw - 32px)); }
.palette-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette-option { position: relative; display: block; cursor: pointer; }
.palette-option input { position: absolute; opacity: 0; inset: 0; }
.palette-option .po-body {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 4px; height: 100%;
  background: var(--well); border: 1px solid var(--gold-dim); transition: border-color .15s ease, background .15s ease;
}
.palette-option .po-text { display: grid; gap: 1px; min-width: 0; }
.palette-option .po-name { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .04em; line-height: 1.25; }
.palette-option .po-note { font-size: 13px; color: var(--ink-dim); font-style: italic; line-height: 1.3; }
.palette-option input:checked + .po-body { border-color: var(--gold); background: rgba(var(--accent-rgb), .07); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .35); }
.palette-option input:checked + .po-body .po-name { color: var(--gold-soft); }
.palette-option input:focus-visible + .po-body { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
@media (max-width: 560px) { .palette-options { grid-template-columns: 1fr; } .palette-pop { right: auto; left: 0; } }

/* ---------- the shared footer, the notice on every reading, the first-time acknowledgement ---------- */
.site-footer .footer-ai { color: var(--ink-dim); font-size: 14.5px; margin-top: 10px; }
.site-footer p a, .site-footer .footer-ai a, .site-footer .footer-links a { color: var(--gold-soft); text-decoration: underline; text-decoration-color: var(--gold-dim); text-underline-offset: 3px; }
.site-footer .footer-links { font-family: var(--display); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 12px 0 2px; }
.site-footer .footer-links a { text-decoration: none; padding: 4px 2px; }
.site-footer .footer-links a:hover { color: var(--gold); }
.site-footer .footer-links a:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; border-radius: 2px; }
.site-footer .footer-links span { color: var(--gold-dim); }
.ai-notice { margin: 0 0 12px; padding: 8px 12px; border-left: 2px solid var(--gold-dim); color: var(--ink-dim); font-size: 15px; font-style: italic; }
.ai-notice a { color: var(--gold-soft); }
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 12px; font-size: 16px; line-height: 1.45; color: var(--ink); }
.agree input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.agree a { color: var(--gold-soft); }
dialog.ack { background: var(--panel); color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 14px; padding: 26px 28px 22px; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.ack::backdrop { background: rgba(8,4,10,.72); backdrop-filter: blur(3px); }
dialog.ack h2 { margin: 0 0 10px; }
dialog.ack p { margin: 0 0 12px; line-height: 1.55; }
dialog.ack .ornament { text-align: center; color: var(--gold-dim); letter-spacing: .4em; font-size: 14px; margin-bottom: 6px; }
dialog.ack .ack-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
dialog.ack .btn:disabled { opacity: .5; cursor: not-allowed; }
dialog.ack a { color: var(--gold-soft); text-decoration-color: var(--gold-dim); text-underline-offset: 3px; }
dialog.ack a:focus-visible, .agree a:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; border-radius: 2px; }

.crisis-line { margin: 0 0 12px; padding: 12px 16px; border: 1px solid var(--gold); border-radius: 10px; background: rgba(var(--accent-rgb), .1); color: var(--ink); font-size: 16px; line-height: 1.5; }
.crisis-line a { color: var(--gold-soft); }
.card:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 4px; border-radius: 10px; }

/* ---------- language: the body is veiled until the chosen locale's strings are in place (site.js lifts it) ---------- */
html[data-i18n-pending] body { visibility: hidden; }
.lang-menu .palette-dot { display: none; }
.lang-options .po-name { font-family: var(--serif); font-size: 17px; letter-spacing: 0; text-transform: none; }
html[lang="ja"] body, html[lang="ja"] .btn, html[lang="ja"] input, html[lang="ja"] select, html[lang="ja"] textarea { font-family: "Cormorant Garamond", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Noto Serif JP", "Source Han Serif JP", serif; }
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] .tabs a, html[lang="ja"] .btn, html[lang="ja"] .label, html[lang="ja"] .k, html[lang="ja"] .fine, html[lang="ja"] .footer-links, html[lang="ja"] .legal-kicker { font-family: "Cinzel", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Noto Serif JP", serif; letter-spacing: 0; text-transform: none; }
html[lang="ja"] body { line-height: 1.8; }
