/* ============ PHARAOH — painted papyrus ============ */

:root {
  --papyrus: #e6d5a0;
  --papyrus-dark: #d8c288;
  --papyrus-edge: #b89a5a;
  --ink: #241a10;
  --ink-soft: #4a3a24;
  --gold: #c9a227;
  --gold-bright: #ecc94b;
  --lapis: #26619c;
  --lapis-bright: #3b82c4;
  --ochre: #b5651d;
  --blood: #8e2a1e;
  --night: #0d0a06;
  --duat: #1a1430;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--night);
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  overflow: hidden;
}

.hidden { display: none !important; }

.fullscreen {
  position: fixed; inset: 0; z-index: 50;
}

button { font-family: inherit; cursor: pointer; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, #9a7a1a);
  border: 2px solid #6e5510;
  color: #241a08;
  font-weight: bold;
  letter-spacing: 0.12em;
  padding: 12px 28px;
  border-radius: 4px;
  box-shadow: 0 3px 0 #58430c, 0 6px 18px rgba(0,0,0,0.45);
  text-transform: uppercase;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
}
.btn-gold:hover { filter: brightness(1.1); }
.btn-gold:active { transform: translateY(2px); box-shadow: 0 1px 0 #58430c; }
.btn-gold.big { width: 100%; padding: 14px 10px; font-size: 15px; }
.btn-gold:disabled { filter: grayscale(0.8) brightness(0.7); cursor: default; }

.btn-plain {
  background: none; border: none; color: #8a7550;
  text-decoration: underline; font-size: 12px; margin-top: 14px;
}

/* ============ ENTRY GATE ============ */
#gate {
  background: radial-gradient(ellipse at 50% 40%, #1c1409 0%, var(--night) 70%);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.gate-inner { text-align: center; animation: gate-breathe 4s ease-in-out infinite; }
@keyframes gate-breathe { 0%,100% { opacity: 0.92; } 50% { opacity: 1; } }
.gate-glyphs { font-size: 44px; color: var(--gold); opacity: 0.8; letter-spacing: 0.4em; margin-bottom: 18px; }
.gate-title {
  font-size: 72px; letter-spacing: 0.28em; color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(201,162,39,0.4); font-weight: normal;
}
.gate-sub { color: #9a8046; letter-spacing: 0.3em; margin: 10px 0 40px; font-variant: small-caps; }
.gate-hint { color: #5a4a2c; font-size: 12px; margin-top: 18px; font-style: italic; }

/* ============ INTRO ============ */
#intro { background: var(--night); z-index: 90; }
#intro-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#intro-narration {
  position: absolute; bottom: 9%; left: 0; right: 0;
  text-align: center; color: #d8c288; font-size: 24px;
  font-variant: small-caps; letter-spacing: 0.14em;
  text-shadow: 0 2px 12px #000;
  opacity: 0; transition: opacity 1.2s;
  padding: 0 10%;
  pointer-events: none;
}
#intro-skip {
  position: absolute; bottom: 20px; right: 24px;
  background: none; border: 1px solid #4a3a24; color: #8a7550;
  padding: 6px 14px; border-radius: 3px; font-size: 13px;
  opacity: 0.7;
}
#intro-skip:hover { opacity: 1; color: var(--gold); border-color: var(--gold); }

/* ============ BOOK COVER ============ */
#cover {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(201,162,39,0.10), transparent 55%),
    var(--night);
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
}
.cover-book {
  background: linear-gradient(160deg, #3a2c16 0%, #241a0c 55%, #1a1208 100%);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.8), inset 0 0 60px rgba(0,0,0,0.6);
  animation: cover-rise 1.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes cover-rise { from { transform: translateY(50px) scale(0.94); opacity: 0; } }
.cover-border {
  border: 3px double var(--gold);
  border-radius: 5px;
  padding: 56px 80px;
  text-align: center;
}
.cover-scarab { font-size: 64px; color: var(--gold); text-shadow: 0 0 24px rgba(236,201,75,0.5); }
.cover-title {
  font-size: 64px; letter-spacing: 0.3em; color: var(--gold-bright);
  margin: 14px 0 4px; font-weight: normal;
  text-shadow: 0 0 26px rgba(201,162,39,0.35);
}
.cover-sub { color: #a08a52; font-variant: small-caps; letter-spacing: 0.18em; margin-bottom: 30px; }
.cover-stats { color: #8a7550; font-size: 14px; margin-bottom: 26px; line-height: 1.7; }
.cover-stats b { color: var(--gold); }

/* ============ GAME LAYOUT ============ */
#game {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,244,200,0.5), transparent 50%),
    repeating-linear-gradient(90deg, rgba(120,90,40,0.05) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(0deg, rgba(120,90,40,0.04) 0 2px, transparent 2px 22px),
    linear-gradient(150deg, #ecd9a4, var(--papyrus) 40%, var(--papyrus-dark));
}

/* --- top bar --- */
#topbar {
  display: flex; align-items: stretch; gap: 14px;
  padding: 10px 16px 8px;
  border-bottom: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(180,140,70,0.22), rgba(180,140,70,0.05));
}
#year-badge {
  text-align: center; padding: 2px 14px;
  border: 2px solid var(--ink); border-radius: 4px;
  background: var(--papyrus-dark);
  min-width: 82px;
}
.yb-label { font-size: 10px; letter-spacing: 0.3em; color: var(--ink-soft); }
.yb-num { font-size: 30px; font-weight: bold; line-height: 1; }
.yb-loop { font-size: 11px; color: var(--ochre); font-style: italic; }

#plague-track { display: flex; gap: 6px; flex: 1; align-items: stretch; }
.cartouche {
  flex: 1; border: 2px solid var(--ink); border-radius: 18px;
  background: var(--papyrus-dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 58px; position: relative;
  transition: all 0.25s;
  user-select: none;
}
.cartouche .c-year { font-size: 9px; letter-spacing: 0.15em; color: var(--ink-soft); }
.cartouche .c-glyph { font-size: 22px; line-height: 1.1; }
.cartouche .c-name { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.cartouche.veiled { background: repeating-linear-gradient(45deg, #cbb27c 0 6px, #c0a76f 6px 12px); cursor: pointer; }
.cartouche.veiled:hover { border-color: var(--lapis); box-shadow: 0 0 0 2px rgba(38,97,156,0.35); }
.cartouche.veiled .c-glyph { color: #8a7550; }
.cartouche.current { border-color: var(--blood); background: #e5b894; box-shadow: 0 0 14px rgba(142,42,30,0.5); transform: scale(1.06); }
.cartouche.past { opacity: 0.45; }
.cartouche.pinned::after {
  content: "𓏟"; position: absolute; top: -9px; right: 6px; font-size: 12px; color: var(--blood);
}
.cartouche .c-cost {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  background: var(--lapis); color: #fff; font-size: 9px; padding: 0 6px; border-radius: 6px;
  opacity: 0; transition: opacity 0.2s; white-space: nowrap;
}
.cartouche.veiled:hover .c-cost { opacity: 1; }

#top-actions { display: flex; gap: 8px; align-items: center; }
#top-actions button {
  background: var(--papyrus-dark); border: 2px solid var(--ink);
  border-radius: 4px; padding: 8px 12px; font-size: 15px;
}
#top-actions button:hover { background: var(--gold-bright); }

/* --- main row --- */
#main-row { flex: 1; display: flex; min-height: 0; }
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map-svg { width: 100%; height: 100%; display: block; }

#plague-banner {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #2a1006, #4a1c0c);
  color: #f0c9a0; border: 2px solid var(--blood);
  padding: 12px 30px; border-radius: 4px; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  max-width: 70%;
  animation: banner-drop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  z-index: 5;
}
@keyframes banner-drop { from { transform: translate(-50%, -80px); opacity: 0; } }
#plague-banner .pb-name { font-size: 22px; letter-spacing: 0.2em; color: #ff9d6e; font-variant: small-caps; }
#plague-banner .pb-desc { font-size: 13px; margin-top: 4px; font-style: italic; }

/* --- sidebar --- */
#sidebar {
  width: 300px; flex-shrink: 0;
  border-left: 3px solid var(--ink);
  background: linear-gradient(180deg, rgba(160,120,50,0.16), rgba(160,120,50,0.04));
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.side-block {
  border: 1.5px solid var(--ink-soft); border-radius: 4px;
  padding: 10px 12px; background: rgba(255,246,214,0.35);
}
.side-block h3 {
  font-size: 11px; letter-spacing: 0.28em; color: var(--ochre);
  border-bottom: 1px solid var(--papyrus-edge); padding-bottom: 5px; margin-bottom: 8px;
}
.res-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 3px 0;
}
.res-row b { margin-left: auto; font-size: 15px; }
.res-ico { width: 22px; text-align: center; }
.duat-row { border-top: 1px dashed var(--papyrus-edge); margin-top: 5px; padding-top: 7px; }
.duat-row b { color: var(--duat); }

.judgment-meter {
  position: relative; height: 18px; margin-top: 8px;
  border: 1.5px solid var(--ink); border-radius: 9px;
  background: #cdb47e; overflow: hidden;
}
#judgment-fill {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, var(--duat), #4b3a8c);
  transition: width 0.8s ease;
}
#judgment-label {
  position: absolute; inset: 0; text-align: center;
  font-size: 10px; line-height: 17px; letter-spacing: 0.1em;
  color: #fff; text-shadow: 0 1px 2px #000; mix-blend-mode: normal;
}

.side-note { font-size: 11.5px; color: var(--ink-soft); font-style: italic; line-height: 1.45; }
#scry-status { font-size: 12px; margin-top: 6px; color: var(--lapis); }

#curse-list { font-size: 12.5px; line-height: 1.5; }
#curse-list .curse { color: var(--blood); margin-bottom: 6px; }
#curse-list .curse b { font-variant: small-caps; letter-spacing: 0.06em; }
.dim { color: #8a7550; font-style: italic; }

#log-block { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
#log { flex: 1; overflow-y: auto; font-size: 12px; line-height: 1.55; }
#log .entry { margin-bottom: 3px; }
#log .entry.year-head { color: var(--ochre); font-weight: bold; margin-top: 7px; letter-spacing: 0.1em; }
#log .entry.bad { color: var(--blood); }
#log .entry.good { color: #2a6a30; }
#log .entry.duat { color: var(--duat); }

/* ============ MAP SVG ============ */
.node-label {
  font-family: Georgia, serif; font-size: 15px; fill: var(--ink);
  text-anchor: middle; letter-spacing: 0.08em; font-variant: small-caps;
}
.node-sub { font-size: 10.5px; fill: var(--ink-soft); text-anchor: middle; font-style: italic; }
.node-stat { font-size: 12px; fill: var(--lapis); text-anchor: middle; font-weight: bold; }

.channel { fill: none; stroke-linecap: round; }
.channel-bed { stroke: #8a6b38; opacity: 0.55; }
.channel-water { stroke: var(--lapis-bright); opacity: 0; }
.channel.open .channel-water { opacity: 0.85; stroke-dasharray: 10 14; animation: flow-dash 1.1s linear infinite; }
.channel.filthy .channel-water { stroke: var(--blood); }
@keyframes flow-dash { to { stroke-dashoffset: -24; } }

.gate-hit { cursor: pointer; }
.gate-slab { transition: transform 0.25s, fill 0.25s; }
.gate-hit:hover .gate-ring { stroke: var(--gold-bright); stroke-width: 3; }
.gate-hit.stuck { cursor: not-allowed; }

.float-label {
  font-family: Georgia, serif; font-size: 16px; font-weight: bold;
  text-anchor: middle; pointer-events: none;
  animation: float-up 1.8s ease-out forwards;
}
@keyframes float-up {
  0% { opacity: 0; transform: translateY(8px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-34px); }
}

.node-flash { animation: node-flash 0.9s ease-out; }
@keyframes node-flash { 30% { filter: drop-shadow(0 0 12px var(--gold-bright)); } }

/* ============ OVERLAYS ============ */
#overlay {
  background: rgba(10, 7, 3, 0.86);
  display: flex; align-items: center; justify-content: center;
  z-index: 70;
  backdrop-filter: blur(2px);
}
#overlay-card {
  background:
    repeating-linear-gradient(90deg, rgba(120,90,40,0.06) 0 2px, transparent 2px 26px),
    linear-gradient(160deg, #ecd9a4, var(--papyrus-dark));
  border: 3px solid var(--ink);
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
  max-width: 860px; width: 92%;
  max-height: 88vh; overflow-y: auto;
  padding: 34px 44px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.9);
  animation: card-in 0.45s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes card-in { from { transform: translateY(36px) scale(0.96); opacity: 0; } }

#overlay-card h2 {
  font-size: 26px; letter-spacing: 0.2em; font-variant: small-caps;
  color: var(--blood); text-align: center; font-weight: normal;
  margin-bottom: 6px;
}
#overlay-card h2.gold { color: #7a5c10; }
#overlay-card .ov-sub { text-align: center; font-style: italic; color: var(--ink-soft); margin-bottom: 22px; }
#overlay-card p { line-height: 1.6; margin-bottom: 12px; }

.decree-choices { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.decree-card {
  border: 2px solid var(--ink-soft); border-radius: 5px;
  background: rgba(255,248,220,0.55);
  padding: 14px 18px; cursor: pointer; text-align: left;
  transition: all 0.15s;
  font-family: inherit;
}
.decree-card:hover { border-color: var(--gold); background: rgba(255,240,190,0.85); transform: translateX(4px); }
.decree-card .d-name { font-size: 17px; font-variant: small-caps; letter-spacing: 0.08em; color: #5a3c0c; }
.decree-card .d-text { font-style: italic; color: var(--ink-soft); font-size: 13px; margin: 4px 0; }
.decree-card .d-effect { font-size: 13px; color: var(--lapis); }
.decree-card .d-warn { font-size: 12.5px; color: var(--blood); margin-top: 6px; font-weight: bold; }
.decree-card.erase { border-style: dashed; }
.decree-card.erase .d-name { color: var(--blood); }

.ledger-page { columns: 2; column-gap: 30px; margin-top: 14px; }
.ledger-entry {
  break-inside: avoid; margin-bottom: 14px; padding: 8px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(255,248,220,0.4);
  font-size: 13px;
}
.ledger-entry .d-name { font-variant: small-caps; font-size: 15px; }
.ledger-entry.cursed { border-left-color: var(--blood); }
.ledger-entry .d-axis { font-size: 10px; color: #8a7550; letter-spacing: 0.15em; text-transform: uppercase; }

.ov-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.weigh-visual { text-align: center; font-size: 50px; margin: 8px 0 14px; letter-spacing: 0.2em; }

.help-cols { display: flex; gap: 26px; margin-top: 14px; }
.help-cols > div { flex: 1; font-size: 13px; line-height: 1.55; }
.help-cols h4 { font-variant: small-caps; letter-spacing: 0.12em; color: var(--ochre); margin-bottom: 6px; }
.help-cols ul { padding-left: 18px; }
.help-cols li { margin-bottom: 5px; }

/* choice buttons inside overlays (death plague etc.) */
.choice-btn {
  display: block; width: 100%;
  background: rgba(255,248,220,0.55); border: 2px solid var(--ink-soft);
  border-radius: 5px; padding: 12px 18px; margin-bottom: 10px;
  font-size: 15px; text-align: left; font-family: inherit;
  transition: all 0.15s;
}
.choice-btn:hover:not(:disabled) { border-color: var(--gold); background: rgba(255,240,190,0.85); }
.choice-btn:disabled { opacity: 0.45; cursor: default; }
.choice-btn small { display: block; color: var(--ink-soft); font-style: italic; margin-top: 2px; }

@media (max-width: 980px) {
  #sidebar { width: 240px; }
  .cartouche .c-name { display: none; }
}

/* ============ THE DUAT (3D) ============ */
#game { position: fixed; inset: 0; background: #0a0814; }
#c3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; font-family: Georgia, serif; }
#hud > * { pointer-events: none; }

#hud-tl { position: absolute; top: 18px; left: 20px; color: #e6d5a0; }
#hud-level {
  display: inline-block; font-size: 15px; letter-spacing: 0.2em; font-weight: bold;
  color: #241a08; background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 1.5px solid #6e5510; border-radius: 4px; padding: 3px 10px;
  text-shadow: none; margin-bottom: 6px;
}
#hud-xpbar {
  width: 240px; height: 10px; border: 1.5px solid rgba(230,213,160,0.6);
  border-radius: 6px; background: rgba(10,8,20,0.55); overflow: hidden;
}
#hud-xpfill { height: 100%; width: 0%; background: linear-gradient(90deg, #7a5c10, var(--gold-bright)); transition: width 0.5s; }
#hud-xptext { font-size: 11px; color: #b8a870; margin-top: 3px; letter-spacing: 0.08em; }
#hud-quests { margin-top: 12px; font-size: 13px; line-height: 1.7; color: #d8c288; text-shadow: 0 1px 4px #000; max-width: 330px; }

#hud-tr { position: absolute; top: 18px; right: 20px; text-align: right; color: #e6d5a0; text-shadow: 0 1px 4px #000; }
#hud-tr .hold { font-size: 14px; margin-bottom: 4px; }
#hud-tr .h-ico { color: var(--gold-bright); margin-right: 4px; }
#hud-tr b { color: #fff; }

#hud-crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: rgba(236,201,75,0.9); font-size: 26px; text-shadow: 0 0 6px #000;
}
#hud-prompt {
  position: absolute; bottom: 17%; left: 50%; transform: translateX(-50%);
  background: rgba(13,10,6,0.85); border: 1.5px solid var(--gold);
  color: #ecc94b; padding: 9px 24px; border-radius: 4px;
  font-size: 16px; letter-spacing: 0.06em; white-space: nowrap;
}
#hud-resume {
  position: absolute; top: 55%; left: 50%; transform: translateX(-50%);
  color: #b8a870; font-style: italic; font-size: 15px; text-shadow: 0 1px 4px #000;
  animation: gate-breathe 2.5s ease-in-out infinite;
}
#hud-hint {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #8a7550; font-size: 12.5px; letter-spacing: 0.08em; text-shadow: 0 1px 4px #000;
  transition: opacity 2s;
}
#hud-hint.gone { opacity: 0; }

#toasts { position: absolute; top: 90px; right: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: rgba(13,10,6,0.88); border: 1.5px solid #4a3a24; border-left: 4px solid #8a7550;
  color: #e6d5a0; padding: 9px 16px; border-radius: 4px; font-size: 13.5px; line-height: 1.45;
  max-width: 340px; text-align: left;
  animation: toast-in 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
  transition: opacity 0.7s, transform 0.7s;
}
.toast b { color: var(--gold-bright); }
.toast.gold { border-left-color: var(--gold-bright); box-shadow: 0 0 18px rgba(201,162,39,0.25); }
.toast.ach { border-left-color: #3b82c4; }
.toast.gone { opacity: 0; transform: translateX(30px); }
@keyframes toast-in { from { transform: translateX(60px); opacity: 0; } }

#float-layer { position: absolute; inset: 0; overflow: hidden; }
.float-xp {
  position: absolute; top: 58%; transform: translateX(-50%);
  color: #cfe8ff; font-size: 19px; font-weight: bold; text-shadow: 0 1px 6px #000;
  animation: float-xp-up 1.8s ease-out forwards; white-space: nowrap;
}
.float-xp.gold-t { color: var(--gold-bright); }
@keyframes float-xp-up {
  0% { opacity: 0; margin-top: 20px; }
  15% { opacity: 1; }
  100% { opacity: 0; margin-top: -70px; }
}

#gold-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, rgba(236,201,75,0.35), transparent 60%); opacity: 0; }
#gold-flash.go { animation: gold-flash-a 1.2s ease-out; }
@keyframes gold-flash-a { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

#dialogue {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  width: min(760px, 92%);
  background:
    repeating-linear-gradient(90deg, rgba(120,90,40,0.06) 0 2px, transparent 2px 26px),
    linear-gradient(160deg, #ecd9a4, var(--papyrus-dark));
  border: 2.5px solid var(--ink); outline: 2px solid var(--gold); outline-offset: 3px;
  border-radius: 6px; padding: 18px 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  pointer-events: auto !important;
}
#dialogue * { pointer-events: auto; }
#dlg-name { font-variant: small-caps; letter-spacing: 0.14em; font-size: 17px; color: var(--blood); margin-bottom: 6px; }
#dlg-text { font-size: 15.5px; line-height: 1.55; color: var(--ink); margin-bottom: 14px; font-style: italic; }
#dlg-options { display: flex; flex-direction: column; gap: 7px; }
.dlg-opt {
  text-align: left; font-family: inherit; font-size: 14px;
  background: rgba(255,248,220,0.55); border: 1.5px solid var(--ink-soft);
  border-radius: 4px; padding: 8px 14px; cursor: pointer; transition: all 0.12s;
  color: var(--ink);
}
.dlg-opt:hover { border-color: var(--gold); background: rgba(255,240,190,0.9); transform: translateX(4px); }

/* ============ THE CROSSING (legacy styles kept for overlays) ============ */

/* tile queue (reuses cartouche look) */
#tile-queue { display: flex; gap: 8px; flex: 1; align-items: stretch; max-width: 560px; }
.cartouche.tile { min-height: 54px; max-width: 100px; }
.cartouche.tile .c-glyph { font-size: 26px; font-weight: bold; font-family: Georgia, serif; }
.cartouche.tile.pickable { cursor: pointer; }
.cartouche.tile.pickable:hover { border-color: var(--lapis); box-shadow: 0 0 0 2px rgba(38,97,156,0.35); }
.cartouche.tile.future { opacity: 0.45; background: repeating-linear-gradient(45deg, #cbb27c 0 6px, #c0a76f 6px 12px); }
.cartouche.tile.current { border-color: var(--lapis); background: #cfe0ef; box-shadow: 0 0 14px rgba(38,97,156,0.5); transform: scale(1.06); }

#tally { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 10px; }
.tally-row { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.tally-row b { font-size: 16px; }
.tally-row.good-t b { color: #2a6a30; }
.tally-row.bad-t b { color: var(--blood); }

/* pieces */
.piece { transition: transform 0.55s cubic-bezier(0.3, 1.15, 0.4, 1), opacity 0.5s; }
.piece.soul:hover circle:first-of-type { filter: drop-shadow(0 0 8px var(--gold-bright)); }

.hl-pulse { animation: hl-pulse 1.1s ease-in-out infinite; pointer-events: none; }
@keyframes hl-pulse { 0%,100% { opacity: 0.95; } 50% { opacity: 0.35; } }

/* ink */
.ink-pips { color: var(--lapis); font-size: 15px; letter-spacing: 2px; }

/* page display */
.page-now { font-size: 13px; line-height: 1.5; padding: 8px 10px; border-radius: 4px; background: rgba(255,248,220,0.5); border: 1.5px dashed var(--papyrus-edge); }
.page-now b { font-variant: small-caps; letter-spacing: 0.06em; font-size: 15px; }
.page-now.side-ammit { border-color: var(--blood); background: rgba(142,42,30,0.08); }
.page-now.side-ammit b { color: var(--blood); }
.page-now.side-player { border-color: #2a6a30; background: rgba(42,106,48,0.08); }
.page-now.side-player b { color: #2a6a30; }
#page-next { margin-top: 8px; }

/* chapter cards */
#hand { display: flex; flex-direction: column; gap: 7px; margin-bottom: 9px; }
.chapter-card {
  display: flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--ink-soft); border-radius: 4px;
  background: rgba(255,248,220,0.55);
  padding: 7px 9px; cursor: pointer;
  transition: all 0.15s;
}
.chapter-card:hover { border-color: var(--gold); background: rgba(255,240,190,0.85); }
.chapter-card.active { border-color: var(--lapis); box-shadow: 0 0 0 2px rgba(38,97,156,0.4); }
.chapter-card.unusable { opacity: 0.5; }
.chapter-card .ch-glyph { font-size: 24px; width: 28px; text-align: center; flex-shrink: 0; }
.chapter-card .ch-body { flex: 1; min-width: 0; }
.chapter-card .ch-body b { display: block; font-size: 12.5px; font-variant: small-caps; letter-spacing: 0.04em; }
.chapter-card .ch-body small { display: block; font-size: 10.5px; color: var(--ink-soft); line-height: 1.3; }
.chapter-card .ch-cost { font-weight: bold; color: var(--lapis); font-size: 13px; flex-shrink: 0; }

.btn-small {
  width: 100%;
  background: var(--papyrus-dark); border: 1.5px solid var(--ink-soft);
  border-radius: 4px; padding: 7px; font-size: 12.5px;
}
.btn-small:hover:not(:disabled) { background: var(--gold-bright); }
.btn-small:disabled { opacity: 0.45; cursor: default; }

/* targeting hint */
#target-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(36,26,16,0.92); color: var(--papyrus);
  padding: 9px 22px; border-radius: 4px; font-size: 14px; font-style: italic;
  border: 1px solid var(--gold); pointer-events: none;
  z-index: 6; white-space: nowrap;
}

/* page choice cards */
.decree-card.page-ammit { border-color: var(--blood); }
.decree-card.page-ammit .d-name { color: var(--blood); }
.decree-card.page-player { border-color: #2a6a30; }
.decree-card.page-player .d-name { color: #2a6a30; }
.decree-card:disabled { opacity: 0.5; cursor: default; }
