/* ============================================================
   Misprites - style (Duskfall)
   The last sunset of the old world: broken ridgeline, warm cream
   text, ember accents. The chrome follows the day cycle: render.js
   retints --panel/--panel-2/--panel-solid/--edge/--dim-2/--deep-rgb
   per sky phase (values below are the dusk defaults).
   Type: Press Start 2P (display) / VT323 (body)
   ============================================================ */

:root {
  --void:      #140f2e;   /* deep dusk base */
  --void-2:    #0d0a1e;   /* ridgeline / darkest */
  --panel:     rgba(36, 21, 49, 0.92);
  --panel-2:   rgba(20, 12, 34, 0.55);
  --panel-solid: #241531;
  --edge:      #4a3050;
  --deep-rgb:  13, 10, 30;   /* RGB triplet for translucent dark backings */
  --ink:       #f2e3d0;   /* warm cream */
  --dim:       #a08a78;   /* warm dim */
  --dim-2:     #8a7080;   /* plum dim */
  --ember:     #c96b4a;   /* primary accent */
  --gold:      #ffd166;   /* costs, rewards */
  --violet:    #b98aff;   /* the galaxy's color */
  --wrong:     #ff4fd8;   /* corruption */
  --danger:    #ff5964;

  --r-common:     #b8ab98;
  --r-uncommon:   #5ce07c;
  --r-rare:       #6f8bff;
  --r-impossible: #ff4fd8;

  --font-display: 'Press Start 2P', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
}

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

html, body { height: 100%; }

body {
  background: var(--void-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.hidden { display: none !important; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ============ Main area ============ */

#mainrow { flex: 1; position: relative; min-height: 0; }

#scene-wrap {
  position: absolute; inset: 0;
  background: var(--void-2);
  overflow: hidden;
}

#scene { display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; }

/* ============ Floating HUD ============ */

#hud-left {
  position: absolute; top: 16px; left: 20px;
  pointer-events: none;
  padding: 10px 14px;
  background: rgba(var(--deep-rgb), .42);
  text-shadow: 0 1px 3px rgba(var(--deep-rgb), .9);
}

#brand-name {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--ember);
  letter-spacing: 2px;
  text-shadow: 0 1px 3px rgba(var(--deep-rgb), .9);
}

#ending-badge {
  font-family: var(--font-display);
  font-size: 7px;
  color: var(--wrong);
  margin-top: 6px;
  animation: badge-flicker 2.2s infinite steps(2);
}
@keyframes badge-flicker { 0%,92% {opacity: 1;} 96% {opacity: .3;} 100% {opacity: 1;} }

#glitch-count {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
  margin-top: 12px;
  line-height: 1.2;
  text-shadow: 0 0 18px rgba(201, 107, 74, .45), 0 1px 3px rgba(var(--deep-rgb), .9);
}
#glitch-count.rgb-split {
  text-shadow: -2px 0 var(--wrong), 2px 0 var(--violet);
  transform: translateX(1px);
}
#glitch-count.blip {
  text-shadow: 0 0 24px rgba(255, 209, 102, .9), 0 1px 3px rgba(var(--deep-rgb), .9);
}

#glitch-sub { color: var(--dim); font-size: 20px; margin-top: 6px; display: flex; gap: 18px; }
#glitch-sub #per-click { color: var(--ink); }
#glitch-sub #per-sec { color: var(--gold); }

#hud-instability {
  position: absolute; top: 16px; right: 370px;
  width: 210px; text-align: right;
  pointer-events: none;
  padding: 10px 12px;
  background: rgba(var(--deep-rgb), .42);
  text-shadow: 0 1px 2px rgba(var(--deep-rgb), .9);
}
#inst-label { font-family: var(--font-display); font-size: 8px; color: var(--dim); }
#inst-label #inst-pct { color: var(--ember); }
#inst-bar {
  height: 8px; background: rgba(var(--deep-rgb), .6);
  border: 1px solid var(--edge);
  margin-top: 6px;
}
#inst-fill {
  height: 100%; width: 0%;
  background: var(--ember);
  transition: width .4s steps(8);
}
#inst-band { color: var(--dim); font-size: 16px; margin-top: 4px; }

/* Rift charge overlay: JS keeps it under the rift's actual screen position */
#charge-wrap {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(300px, 50%);
  text-align: center;
  pointer-events: none;
}
#charge-label { font-family: var(--font-display); font-size: 8px; color: var(--dim); margin-bottom: 5px; text-shadow: 0 1px 2px rgba(var(--deep-rgb),.8); }
#charge-bar {
  position: relative; height: 12px;
  background: rgba(var(--deep-rgb), .7);
  border: 1px solid var(--edge);
}
#charge-fill { height: 100%; width: 0%; background: var(--gold); opacity: .75; }
#charge-bar.ready #charge-fill { opacity: 1; box-shadow: 0 0 14px var(--gold); }
#charge-pct {
  position: absolute; inset: 0; line-height: 11px;
  font-size: 14px; color: var(--ink); text-shadow: 0 0 4px #140f2e;
}
#charge-hint {
  margin-top: 6px; font-family: var(--font-display); font-size: 9px;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(var(--deep-rgb), .9);
  animation: hint-pulse 1s infinite steps(2);
}
@keyframes hint-pulse { 0%,49% {opacity: 1;} 50%,100% {opacity: .35;} }

/* Duplicate / event banner */
#banner {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 8px 20px;
  background: var(--panel);
  border: 2px solid var(--edge);
  font-size: 21px;
  white-space: nowrap;
  animation: banner-in .18s steps(3);
}
#banner.shifted { border-color: var(--wrong); color: var(--wrong); text-shadow: 0 0 6px rgba(255,79,216,.6); }
@keyframes banner-in { from { transform: translateX(-50%) translateY(-16px); opacity: 0; } }

/* System log */
#log {
  position: absolute; left: 20px; bottom: 20px;
  display: flex; flex-direction: column-reverse; gap: 4px;
  max-width: 40%;
  pointer-events: none;
}
.log-line {
  font-size: 18px; line-height: 1.15;
  color: var(--dim);
  background: rgba(var(--deep-rgb), .72);
  padding: 3px 9px;
  border-left: 3px solid var(--edge);
  opacity: 1; transition: opacity 1.2s;
}
.log-line.lore   { color: var(--violet); border-left-color: var(--violet); }
.log-line.reward { color: var(--gold);   border-left-color: var(--gold); }
.log-line.wrong  { color: var(--wrong);  border-left-color: var(--wrong); }
.log-line.fading { opacity: 0; }

/* ============ Side panel (overlays the scene) ============ */

#panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 350px;
  background: var(--panel);
  border-left: 3px solid var(--ember);
  display: flex; flex-direction: column;
  min-height: 0;
}

#tabs { display: flex; border-bottom: 1px solid var(--edge); flex: 0 0 auto; }
.tab {
  flex: 1; padding: 12px 4px;
  font-family: var(--font-display); font-size: 8px;
  color: var(--dim-2);
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ember); }
#catalog-count { color: inherit; font-size: 8px; }

.tabpage { display: none; overflow-y: auto; padding: 12px; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.tabpage.active { display: block; }

.sect-head {
  font-family: var(--font-display); font-size: 8px;
  color: var(--dim-2);
  letter-spacing: 3px;
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--edge);
}
.sect-head:first-child { margin-top: 0; }
.sect-head.rules-head { color: var(--ember); border-bottom-color: var(--ember); }

/* Buy rows: warm ledger style */
.buyrow {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 7px 8px; margin-bottom: 2px;
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--edge);
}
.buyrow:hover:not(:disabled) { background: rgba(201, 107, 74, .1); }
.buyrow:disabled { opacity: .45; cursor: default; }
.buyrow .b-icon { width: 26px; text-align: center; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.buyrow .b-icon-px { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.buyrow .b-main { flex: 1; min-width: 0; }
.buyrow .b-name { display: block; font-size: 21px; color: var(--ink); }
.buyrow .b-name .owned { color: var(--gold); }
.buyrow .b-desc { display: block; font-size: 16px; color: var(--dim-2); line-height: 1.1; }
.buyrow .b-cost { font-size: 19px; color: var(--dim-2); flex: 0 0 auto; text-align: right; }
.buyrow.affordable .b-cost { color: var(--gold); }

/* Rule cards */
.rulecard {
  width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
}
.rulecard:hover:not(:disabled) { border-color: var(--ember); }
.rulecard:disabled { opacity: .5; cursor: default; }
.rulecard .rule-text { font-size: 22px; color: var(--ink); }
.rulecard .rule-sub { font-size: 16px; color: var(--dim-2); }
.rulecard .rule-cost { font-size: 18px; color: var(--ember); margin-top: 4px; }
.rulecard.broken { border-color: var(--edge); background: transparent; }
.rulecard.broken .rule-text { text-decoration: line-through; color: var(--dim-2); }
.rulecard.broken .rule-sub { color: var(--wrong); }
.rulecard.broken .rule-cost { display: none; }

/* ============ Catalog ============ */

#catalog-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.cat-cell {
  aspect-ratio: 1; position: relative;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
}
.cat-cell:hover { border-color: var(--ember); }
.cat-cell.selected { border-color: var(--gold); }
.cat-cell canvas { width: 86%; height: 86%; object-fit: contain; image-rendering: pixelated; }
.cat-cell .qmark { font-family: var(--font-display); font-size: 13px; color: var(--dim-2); position: absolute; bottom: 4px; right: 6px; }
.cat-cell .shift-dot { position: absolute; top: 3px; right: 5px; color: var(--wrong); font-size: 15px; }
.cat-cell .lvl-tag { position: absolute; bottom: 2px; left: 5px; font-size: 14px; color: var(--gold); }
.cat-cell.evolvable::after {
  content: '▲'; position: absolute; top: 2px; left: 5px; color: var(--gold);
  animation: hint-pulse 1s infinite steps(2); font-size: 13px;
}

#cat-detail { margin-top: 12px; padding: 12px; background: var(--panel-2); border: 1px solid var(--edge); }
#cat-detail .cd-head { display: flex; gap: 12px; align-items: center; }
#cat-detail .cd-sprite { width: 84px; height: 84px; object-fit: contain; image-rendering: pixelated; flex: 0 0 auto; }
#cat-detail .cd-name { font-family: var(--font-display); font-size: 13px; color: var(--ink); }
#cat-detail .cd-name.shifted-name { color: var(--wrong); }
#cat-detail .cd-epithet { color: var(--dim); font-size: 18px; margin-top: 4px; }
#cat-detail .cd-chips { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 15px; padding: 1px 8px; border: 1px solid var(--edge); color: var(--dim); }
.chip.rarity-common     { color: var(--r-common); border-color: var(--r-common); }
.chip.rarity-uncommon   { color: var(--r-uncommon); border-color: var(--r-uncommon); }
.chip.rarity-rare       { color: var(--r-rare); border-color: var(--r-rare); }
.chip.rarity-impossible { color: var(--r-impossible); border-color: var(--r-impossible); animation: badge-flicker 3s infinite steps(2); }
.chip.shifted-chip { color: var(--wrong); border-color: var(--wrong); }

.statbars { margin-top: 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; }
.statbars .s-name { font-size: 16px; color: var(--dim); }
.statbars .s-bar { height: 8px; background: rgba(var(--deep-rgb), .6); border: 1px solid var(--edge); }
.statbars .s-fill { height: 100%; }
.statbars .s-val { font-size: 15px; color: var(--ink); }
.s-fill.pulse { background: #ff8f5c; }
.s-fill.flow { background: #8dff6a; }
.s-fill.res { background: var(--violet); }
.s-fill.luck { background: var(--gold); }

.cd-ability { margin-top: 10px; font-size: 18px; }
.cd-ability .ab-name { color: var(--violet); }
.cd-note { margin-top: 8px; color: var(--dim); font-size: 18px; line-height: 1.2; font-style: italic; }
.cd-meta { margin-top: 8px; color: var(--dim-2); font-size: 16px; }
.cd-actions { margin-top: 10px; display: flex; gap: 8px; }

.pixbtn {
  font-family: var(--font-display); font-size: 9px;
  padding: 9px 14px;
  background: transparent;
  border: 2px solid var(--ember);
  color: var(--ember);
}
.pixbtn:hover:not(:disabled) { background: var(--ember); color: #140f2e; }
.pixbtn:disabled { opacity: .4; cursor: default; }
.pixbtn.gold { border-color: var(--gold); color: var(--gold); }
.pixbtn.gold:hover:not(:disabled) { background: var(--gold); color: #140f2e; }
.pixbtn.wrongbtn { border-color: var(--dim-2); color: var(--dim-2); }
.pixbtn.wrongbtn:hover:not(:disabled) { background: var(--dim-2); color: #140f2e; }

/* ============ Team ============ */

#team-slots { display: flex; flex-direction: column; gap: 8px; }
.team-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  width: 100%; text-align: left;
}
.team-slot:hover { border-color: var(--ember); }
.team-slot .ts-sprite { width: 52px; height: 52px; object-fit: contain; image-rendering: pixelated; flex: 0 0 auto; }
.team-slot .ts-empty { width: 52px; height: 52px; border: 1px dashed var(--edge); display: flex; align-items: center; justify-content: center; color: var(--dim-2); font-size: 26px; flex: 0 0 auto; }
.team-slot .ts-name { font-size: 21px; }
.team-slot .ts-sub { font-size: 16px; color: var(--dim-2); }

#team-totals { margin-top: 14px; padding: 10px; background: var(--panel-2); border: 1px solid var(--edge); font-size: 18px; }
#team-totals .tt-row { display: flex; justify-content: space-between; }
#team-totals .tt-row span:last-child { color: var(--gold); }

#team-picker { margin-top: 12px; }
.pick-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 5px 8px; margin-bottom: 4px;
  background: var(--panel-2); border: 1px solid var(--edge);
}
.pick-row:hover { border-color: var(--gold); }
.pick-row canvas { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.pick-row .pk-name { font-size: 19px; flex: 1; }
.pick-row .pk-stats { font-size: 14px; color: var(--dim-2); }

/* ============ Footer ============ */

#foot {
  display: flex; align-items: center; gap: 16px;
  padding: 6px 16px;
  background: var(--panel-solid);
  border-top: 2px solid var(--edge);
  font-size: 17px; color: var(--dim-2);
  flex: 0 0 auto;
}
.foot-spacer { flex: 1; }
.footbtn { color: var(--dim-2); font-size: 17px; padding: 2px 6px; }
.footbtn:hover { color: var(--ink); }
.footbtn.danger:hover { color: var(--danger); }

/* ============ Modals ============ */

#overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(var(--deep-rgb), .82);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#modal {
  background: var(--panel-solid);
  border: 2px solid var(--edge);
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 0 40px rgba(201, 107, 74, .18);
}
#modal.shifted-modal { border-color: var(--wrong); box-shadow: 0 0 40px rgba(255,79,216,.3); }

.m-eyebrow { font-family: var(--font-display); font-size: 9px; color: var(--dim-2); text-align: center; letter-spacing: 1px; }
.m-eyebrow.wrong { color: var(--wrong); }
.m-title { font-family: var(--font-display); font-size: 18px; color: var(--ink); text-align: center; margin-top: 12px; line-height: 1.5; }
.m-title.shifted-name { color: var(--wrong); text-shadow: -2px 0 var(--violet), 2px 0 var(--wrong); }
.m-epithet { text-align: center; color: var(--dim); font-size: 19px; margin-top: 6px; }
.m-spritebox { display: flex; justify-content: center; margin: 18px 0 6px; }
.m-spritebox canvas { width: 132px; height: 132px; object-fit: contain; image-rendering: pixelated; }
.m-spritebox.evo { gap: 18px; align-items: center; }
.m-spritebox.evo .evo-arrow { font-size: 30px; color: var(--gold); }
.m-chips { display: flex; justify-content: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.m-body { font-size: 19px; line-height: 1.25; color: var(--ink); margin-top: 10px; }
.m-body.dim-note { color: var(--dim); font-style: italic; }
.m-actions { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.m-textarea {
  width: 100%; height: 90px; margin-top: 10px;
  background: rgba(var(--deep-rgb), .6); color: var(--ink);
  border: 1px solid var(--edge);
  font-family: var(--font-body); font-size: 15px;
  padding: 8px; resize: none;
}

.ending-title { font-family: var(--font-display); font-size: 20px; color: var(--ink); text-align: center; line-height: 2; }
.ending-title .spread { color: var(--wrong); }

/* ============ Small screens (basic pass) ============ */

@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  #mainrow { position: static; }
  #scene-wrap { position: relative; height: 62vh; }
  #panel { position: static; width: auto; border-left: none; border-top: 3px solid var(--ember); }
  #hud-instability { right: 20px; }
  #glitch-count { font-size: 20px; }
  #disccard { top: 96px; }
}

/* ============ Buffs, tooltip, boot, stats ============ */

#buffs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.buff-chip {
  font-family: var(--font-display); font-size: 8px;
  padding: 4px 8px;
  border: 1px solid;
  background: rgba(var(--deep-rgb), .6);
  animation: hint-pulse 1.2s infinite steps(2);
}

#tooltip {
  position: fixed; z-index: 80;
  max-width: 290px;
  background: rgba(var(--deep-rgb), .95);
  border: 1px solid var(--gold);
  color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.2;
  padding: 7px 10px;
  pointer-events: none;
  opacity: 0; transition: opacity .12s;
}
#tooltip.show { opacity: 1; }

#charge-bar, #inst-bar { pointer-events: auto; }

#boot {
  position: fixed; inset: 0; z-index: 200;
  background: var(--void-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .9s;
  pointer-events: none;
}
#boot.gone { opacity: 0; }
.boot-word {
  font-family: var(--font-display); font-size: 30px;
  color: var(--ember);
  text-shadow: 0 0 24px rgba(201, 107, 74, .5);
  letter-spacing: 4px;
}
.boot-sub { font-family: var(--font-body); font-size: 19px; color: var(--dim-2); }

/* bulk-buy segment in the shop header */
.buyseg { float: right; display: inline-flex; gap: 3px; }
.segbtn {
  font-family: var(--font-display); font-size: 7px;
  padding: 3px 7px;
  border: 1px solid var(--edge);
  color: var(--dim-2);
}
.segbtn:hover { color: var(--ink); }
.segbtn.active { color: #140f2e; background: var(--gold); border-color: var(--gold); }

/* stats modal */
.stats-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px;
  margin-top: 16px; font-size: 19px;
}
.stats-grid .st-k { color: var(--dim); }
.stats-grid .st-v { color: var(--ink); text-align: right; }
.ach-head {
  font-family: var(--font-display); font-size: 9px; color: var(--gold);
  margin-top: 18px; padding-bottom: 6px; border-bottom: 1px solid var(--edge);
}
.ach-list { margin-top: 8px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.ach-row { display: flex; gap: 8px; padding: 3px 0; font-size: 17px; color: var(--dim-2); }
.ach-row .ach-mark { width: 16px; text-align: center; }
.ach-row.got { color: var(--ink); }
.ach-row.got .ach-mark { color: var(--gold); }
.ach-row .ach-name { color: inherit; }
.ach-row.got .ach-name { color: var(--gold); }
.ach-row .ach-desc { color: var(--dim-2); }

/* volume slider */
#vol-slider { width: 80px; accent-color: var(--ember); }

/* unlock card silhouettes */
.unlock-card { border-color: var(--violet) !important; }
.unlock-sils { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
.unlock-sil { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }

/* ============ Discovery card (non-blocking, auto-dismisses) ============ */

#disccard {
  position: absolute; top: 112px; z-index: 6;
  width: 280px;                    /* JS resizes and docks it beside the rift */
  background: var(--panel);
  border: 2px solid var(--gold);
  padding: 12px;
  animation: disc-in .22s steps(4);
}
#disccard.shifted-card { border-color: var(--wrong); box-shadow: 0 0 24px rgba(255,79,216,.3); }
@keyframes disc-in { from { transform: translateY(-14px); opacity: 0; } }

.disc-close {
  position: absolute; top: 4px; right: 8px;
  font-size: 22px; color: var(--dim-2); line-height: 1;
}
.disc-close:hover { color: var(--ink); }

.disc-eyebrow { font-family: var(--font-display); font-size: 8px; color: var(--gold); letter-spacing: 1px; }
.disc-eyebrow.wrong { color: var(--wrong); }

.disc-head { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.disc-sprite { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; flex: 0 0 auto; }
.disc-name { font-family: var(--font-display); font-size: 11px; color: var(--ink); }
.disc-name.shifted-name { color: var(--wrong); }
.disc-epithet { font-size: 17px; color: var(--dim); margin-top: 3px; }
.disc-chips { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.disc-chips .chip { font-size: 13px; padding: 0 6px; }

#disccard .statbars { margin-top: 8px; gap: 3px 7px; }
#disccard .statbars .s-name { font-size: 14px; }
#disccard .statbars .s-val { font-size: 13px; }
#disccard .statbars .s-bar { height: 6px; }

.disc-ability { margin-top: 8px; font-size: 16px; line-height: 1.15; color: var(--dim); }
.disc-ability .ab-name { color: var(--violet); }

.disc-actions { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.disc-actions .pixbtn { font-size: 8px; padding: 7px 12px; }
.disc-full { font-size: 15px; color: var(--dim-2); }

.disc-countdown {
  height: 3px; width: 100%;
  background: var(--gold);
  margin-top: 10px;
  transition: width 10s linear;
}
#disccard.shifted-card .disc-countdown { background: var(--wrong); }

/* compact mode when there is little free space beside the rift */
#disccard.disc-compact { padding: 8px; }
#disccard.disc-compact .disc-sprite { width: 40px; height: 40px; }
#disccard.disc-compact .disc-name { font-size: 9px; }
#disccard.disc-compact .disc-epithet { font-size: 14px; }
#disccard.disc-compact .disc-chips .chip { font-size: 11px; }
#disccard.disc-compact .disc-ability { font-size: 14px; }
#disccard.disc-compact .statbars .s-name { font-size: 12px; }
#disccard.disc-compact .statbars .s-val { font-size: 11px; }
#disccard.disc-compact .statbars .s-bar { height: 5px; }
#disccard.disc-compact .disc-actions .pixbtn { font-size: 7px; padding: 6px 10px; }

/* ============ Debug menu (tilde; remove by setting DEBUG:false in js/data.js) ============ */

#debug {
  position: fixed; left: 16px; top: 90px; z-index: 40;
  width: 320px; max-height: calc(100vh - 160px); overflow-y: auto;
  background: rgba(var(--deep-rgb), .96);
  border: 2px solid var(--gold);
  padding: 12px;
  font-size: 17px;
  scrollbar-width: thin; scrollbar-color: var(--edge) transparent;
}
#debug .dbg-head { font-family: var(--font-display); font-size: 9px; color: var(--gold); margin-bottom: 4px; }
#debug .dbg-note { font-size: 14px; color: var(--dim-2); margin-bottom: 8px; }
#debug .dbg-status { font-size: 16px; color: var(--violet); margin-bottom: 10px; border-bottom: 1px dotted var(--edge); padding-bottom: 6px; }
#debug .dbg-sect { font-family: var(--font-display); font-size: 7px; letter-spacing: 2px; color: var(--dim-2); margin: 10px 0 5px; }
#debug .dbg-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.dbtn {
  font-family: var(--font-body); font-size: 16px;
  padding: 2px 9px;
  background: rgba(201, 107, 74, .12);
  border: 1px solid var(--edge);
  color: var(--ink);
}
.dbtn:hover { border-color: var(--gold); color: var(--gold); }
.dbtn.danger { color: var(--danger); }
#debug select {
  background: rgba(var(--deep-rgb), .8); color: var(--ink);
  border: 1px solid var(--edge);
  font-family: var(--font-body); font-size: 16px;
  padding: 2px 4px; max-width: 150px;
}
#debug label { color: var(--dim); font-size: 15px; display: flex; align-items: center; gap: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; }
}
