/* =====================================================================
 * REISSUE — styles
 * Aesthetic: a State document gone to seed. Amber bureaucratic chrome,
 * warm serif narrative on near-black, monospace system labels.
 * ===================================================================== */

:root {
  --bg:        #0d0e0c;
  --bg-panel:  #14150f;
  --bg-raise:  #1b1c14;
  --ink:       #d8d2c2;   /* narrative text */
  --ink-dim:   #8c8775;
  --amber:     #d9a441;   /* State accent */
  --amber-dim: #6e5a2c;
  --rust:      #b4503a;   /* danger / spite */
  --green:     #6f9b5c;   /* positive bonds */
  --line:      #2a2b20;
  --serif:     Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --mono:      'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
}

.hidden { display: none !important; }
.muted { color: var(--ink-dim); }

/* ---- Title screen ---------------------------------------------------- */
#title-screen {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background:
    radial-gradient(1300px 760px at 50% 38%, rgba(20,21,15,0.28) 0%, rgba(13,14,12,0.80) 72%),
    url("../art/img/title.webp") center / cover no-repeat,
    var(--bg);
  padding: 24px;
}
.title-card {
  max-width: 560px; width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--amber);
  padding: 40px 38px 30px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.stamp {
  position: absolute; top: 14px; right: 16px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  color: var(--amber-dim); border: 1px solid var(--amber-dim);
  padding: 3px 7px; transform: rotate(4deg); opacity: .8;
}
.title-card h1 {
  font-family: var(--mono); font-size: 46px; letter-spacing: .12em;
  margin: 6px 0 2px; color: var(--amber); font-weight: 700; line-height: 1.05;
}
.tagline { font-style: italic; color: var(--ink-dim); margin: 0 0 18px; letter-spacing: .02em; }
.blurb { line-height: 1.6; font-size: 15.5px; }
.name-field { display: block; margin: 22px 0 8px; }
.name-field span {
  display: block; font-family: var(--mono); font-size: 11px;
  letter-spacing: .18em; color: var(--ink-dim); text-transform: uppercase; margin-bottom: 6px;
}
#name-input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); font-family: var(--serif); font-size: 18px; padding: 11px 13px;
}
#name-input:focus { outline: none; border-color: var(--amber); }
.title-buttons { display: flex; gap: 12px; margin-top: 16px; }
.foot { margin-top: 22px; font-size: 12.5px; }

/* ---- Buttons --------------------------------------------------------- */
button { cursor: pointer; font-family: var(--mono); }
.primary {
  background: var(--amber); color: #20180a; border: none;
  padding: 12px 20px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700;
}
.primary:hover { background: #eab955; }
.ghost {
  background: transparent; color: var(--amber); border: 1px solid var(--amber-dim);
  padding: 12px 20px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
}
.ghost:hover { border-color: var(--amber); }

/* ---- Game layout ----------------------------------------------------- */
#game {
  display: grid; grid-template-columns: 1fr 330px;
  height: 100vh; max-width: 1180px; margin: 0 auto;
}
#stage {
  overflow-y: auto; padding: 46px 54px 80px;
  border-right: 1px solid var(--line);
  /* a darkened, location-specific generated backdrop (set per scene by UI) */
  background-image:
    linear-gradient(rgba(13,14,12,0.86), rgba(13,14,12,0.94)),
    var(--art, none);
  background-size: cover;
  background-position: center;
  transition: background-image .4s ease;
}
.stage-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-dim);
  border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 26px;
}
.chapter-label { color: var(--amber); }

/* cast strip — portraits of whoever is present in the scene */
.cast-strip { display: flex; gap: 20px; flex-wrap: wrap; margin: 0 0 32px; }
.cast-strip.hidden { display: none; }
.cast-card { margin: 0; width: 132px; }
.cast-card.noface { display: none; }
.cast-face {
  display: block; width: 132px; height: 170px; object-fit: cover; object-position: 50% 14%;
  border: 1px solid var(--amber-dim); background: var(--bg);
  filter: grayscale(.3) contrast(1.04) brightness(.95);
}
.cast-card figcaption {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-dim); margin-top: 7px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.scene-text { font-size: 17.5px; line-height: 1.72; max-width: 62ch; }
.scene-text p { margin: 0 0 1.1em; }
.scene-text strong { color: var(--amber); font-weight: 700; }
.scene-text em { color: #e7e0cf; }
.scene-text code {
  font-family: var(--mono); font-size: .85em; color: var(--rust);
  background: #1d140f; padding: 1px 5px; border-radius: 2px;
}

/* ---- Choices --------------------------------------------------------- */
.choices { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; max-width: 62ch; }
.choice {
  text-align: left; background: var(--bg-panel); border: 1px solid var(--line);
  border-left: 3px solid var(--amber-dim); color: var(--ink);
  padding: 14px 16px; font-family: var(--serif); font-size: 16px; line-height: 1.4;
  display: flex; flex-direction: column; gap: 5px; transition: border-color .12s, background .12s;
}
.choice:hover:not(.locked) { border-left-color: var(--amber); background: var(--bg-raise); }
.choice-text { font-size: 16.5px; }
.choice-text strong { color: var(--amber); }
.choice-text em { font-style: italic; color: #e7e0cf; }
.choice-tip { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); letter-spacing: .02em; }
.choice-tags { display: inline-flex; gap: 6px; margin-top: 2px; }
.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 6px; border: 1px solid var(--line);
}
.spite-tag { color: var(--rust); border-color: #4a261d; }
.check-tag { color: var(--amber); border-color: var(--amber-dim); }
.choice.locked { opacity: .5; cursor: not-allowed; border-left-color: var(--line); }
.choice-lock { font-family: var(--mono); font-size: 11px; color: var(--rust); }

/* ---- Dossier (right column) ----------------------------------------- */
.dossier {
  background: var(--bg-panel); overflow-y: auto;
  padding: 26px 22px 60px; font-size: 14px;
}
.dossier-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.cit-name { font-family: var(--mono); font-size: 19px; letter-spacing: .06em; color: var(--ink); }
.cit-body { font-family: var(--mono); font-size: 11.5px; color: var(--amber); letter-spacing: .05em; margin-top: 4px; text-transform: capitalize; }
.cit-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 4px; }

.block { margin-bottom: 20px; }
.block-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 9px;
}

/* reissues + spite */
.reissues { font-size: 22px; letter-spacing: 4px; }
.reissue-pip { color: #33342a; }
.reissue-pip.on { color: var(--amber); }
.deaths { font-family: var(--mono); font-size: 11px; margin-top: 4px; }
.spite { display: flex; gap: 5px; }
.spite-pip { width: 16px; height: 16px; border: 1px solid #4a261d; background: transparent; transform: rotate(45deg); }
.spite-pip.on { background: var(--rust); border-color: var(--rust); }

/* attributes */
.attr { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.attr-name { width: 64px; font-size: 13px; color: var(--ink); }
.attr-pips { display: flex; gap: 3px; flex: 1; }
.pip { width: 11px; height: 11px; border: 1px solid var(--amber-dim); }
.pip.on { background: var(--amber); }
.attr-val { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); width: 12px; text-align: right; }

/* axes */
.axis { margin-bottom: 12px; }
.axis-ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .04em; margin-bottom: 4px; }
.axis.pos .axis-ends span:last-child,
.axis.neg .axis-ends span:first-child { color: var(--amber); }
.axis-track { position: relative; height: 4px; background: #26271d; }
.axis-track::before { content:''; position:absolute; left:50%; top:-2px; width:1px; height:8px; background:#3a3b2c; }
.axis-mark { position: absolute; top: -3px; width: 10px; height: 10px; background: var(--amber); transform: translateX(-50%) rotate(45deg); }
.axis.neutral .axis-mark { background: var(--ink-dim); }

/* bonds */
.bond { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 13.5px; }
.bond-name { flex: 1; }
.bond-val { font-family: var(--mono); font-size: 12px; }
.bond-val.pos { color: var(--green); }
.bond-val.neg { color: var(--rust); }
/* portrait thumbnail; tall source image cropped to a square chip */
.bond-face {
  width: 34px; height: 34px; flex: 0 0 34px; object-fit: cover; object-position: 50% 22%;
  border: 1px solid var(--amber-dim); background: var(--bg);
  filter: grayscale(.35) contrast(1.05) brightness(.95);
}
.bond-face.noface { display: none; }

/* the Record — persistent consequence ledger */
.record-block { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 16px; }
.record-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: transparent; border: none; padding: 0; cursor: pointer;
}
.record-toggle .block-label { margin-bottom: 0; }
.record-caret { font-size: 11px; color: var(--amber); }
.record-toggle:hover .block-label { color: var(--ink); }
.record {
  list-style: none; margin: 12px 0 0; padding: 0;
  counter-reset: rec; max-height: 320px; overflow-y: auto;
}
.record li {
  position: relative; font-family: var(--mono); font-size: 11px; line-height: 1.5;
  color: var(--ink-dim); padding: 7px 0 7px 14px; border-bottom: 1px solid #1f201780;
}
.record li::before {
  content: ''; position: absolute; left: 2px; top: 12px;
  width: 4px; height: 4px; background: var(--amber-dim); transform: rotate(45deg);
}
.record li strong { color: var(--ink); font-weight: 400; }
.record li.rec-death { color: #c98a78; }
.record li.rec-death::before { background: var(--rust); }
.record li.rec-death strong { color: var(--rust); }

/* ---- ARCHIVED rubber-stamp (true-death ending) ---------------------- */
.ending-card { position: relative; overflow: hidden; }
.archived-stamp {
  position: absolute; top: 26px; right: -14px; z-index: 2; pointer-events: none;
  font-family: var(--mono); font-weight: 700; font-size: 30px; letter-spacing: .14em;
  color: rgba(180,80,58,.82);
  border: 4px solid rgba(180,80,58,.82); border-radius: 6px;
  padding: 7px 16px; transform: rotate(11deg);
  text-shadow: 0 0 1px rgba(180,80,58,.4);
  /* distressed ink: erode the fill with a noisy alpha mask */
  -webkit-mask-image: radial-gradient(circle at 18% 32%, #000 38%, transparent 39%),
                      radial-gradient(circle at 72% 64%, #000 30%, transparent 31%),
                      radial-gradient(circle at 88% 18%, #000 24%, transparent 25%),
                      linear-gradient(#000, #000);
  -webkit-mask-composite: source-out;
          mask-composite: subtract;
  opacity: .9;
}
.is-archived #ending-title { letter-spacing: .2em; }

/* memories */
.memories { margin: 0; padding-left: 16px; }
.memories li { font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; color: #c8c2b1; }
.memories li strong { color: var(--amber); }
/* borrowed ("not yours") memories — a bleed from another mind (§2a) */
.memories li.mem-foreign {
  color: #9bb0c0; list-style: none; margin-left: -16px; padding-left: 14px;
  border-left: 2px solid #3a5566; font-style: italic;
}
.memories li.mem-foreign strong { color: #b9d2e3; }
.mem-tag {
  font-family: var(--mono); font-style: normal; font-size: 8.5px; letter-spacing: .12em;
  text-transform: uppercase; color: #7fa8c0; border: 1px solid #3a5566;
  padding: 0 4px; margin-right: 4px; vertical-align: 1px;
}

/* ---- Ending overlay -------------------------------------------------- */
#ending-screen {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(6,6,4,.9); padding: 24px;
}
.ending-card {
  max-width: 560px; width: 100%; background: var(--bg-panel);
  border: 1px solid var(--line); border-top: 3px solid var(--rust);
  padding: 38px 36px;
}
.ending-card h2 {
  font-family: var(--mono); letter-spacing: .2em; color: var(--rust);
  margin: 0 0 18px; font-size: 26px;
}
#ending-body { line-height: 1.68; font-size: 16px; margin-bottom: 26px; }
#ending-body strong { color: var(--amber); }
#ending-body em { color: #e7e0cf; }

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 820px) {
  #game { grid-template-columns: 1fr; height: auto; }
  #stage { border-right: none; padding: 30px 22px 60px; }
  .dossier { border-top: 1px solid var(--line); }
  .title-card h1 { font-size: 32px; }
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #2a2b20; }
::-webkit-scrollbar-track { background: transparent; }
