:root{
  --ink:#1B1510;
  --ink-deep:#0E0B08;
  --slate:#3A2C20;
  --bone:#F2E3C4;
  --bone-dim:#CBB894;
  --gold:#C89445;
  --gold-hi:#F0CF84;
  --verd:#5E8F76;
  --ox:#8E3328;
  --ameth:#7A5488;
  --amber:#D47B3A;
  --frost:#7FA9C4;
  --display:'Cinzel', 'Times New Roman', serif;
  --text:'EB Garamond', Georgia, serif;
  --mono:'IBM Plex Mono', 'Courier New', monospace;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  overflow:hidden;
  background:var(--ink-deep);
  color:var(--bone);
  font-family:var(--text);
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}
button{font:inherit;color:inherit;}
img{max-width:100%;}

#wall{
  position:fixed;
  inset:0;
  background:url(assets/background_wall.webp) center / cover no-repeat;
  filter:sepia(.55) saturate(1.15) brightness(.92) contrast(1.06);
  z-index:0;
}
#vignette{
  position:fixed;
  inset:0;
  z-index:1;
  pointer-events:none;
  background:
    radial-gradient(125% 90% at 50% 40%, rgba(60,42,24,0) 38%, rgba(30,20,12,.34) 80%, rgba(12,8,5,.62) 100%),
    linear-gradient(180deg, rgba(64,44,26,.1), rgba(22,15,10,.24));
}
#vignette::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(44% 40% at 11% 16%, rgba(235,178,90,.18), transparent 72%),
    radial-gradient(48% 44% at 80% 38%, rgba(178,120,58,.10), transparent 72%);
}
body::after{
  content:"";
  position:fixed;
  inset:0;
  z-index:4;
  pointer-events:none;
  background:linear-gradient(135deg,rgba(210,155,72,.16),rgba(130,78,34,.10));
  mix-blend-mode:soft-light;
}

#app{
  position:relative;
  z-index:3;
  height:100dvh;
  display:grid;
  grid-template-columns:minmax(180px,.92fr) minmax(0,2.16fr) minmax(216px,1.04fr);
  grid-template-rows:clamp(102px,17.5vh,178px) minmax(0,1fr) clamp(54px,8vh,74px);
  grid-template-areas:
    "top top top"
    "map center right"
    "controls controls controls";
  gap:8px;
  padding:10px 14px 12px;
  max-width:1720px;
  margin:0 auto;
}

/* ---------- top bar ---------- */
#topbar{
  grid-area:top;
  position:relative;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 16px 0 6px;
  background:url(assets/panel_frames_01_top_bar.webp) center / 100% 100% no-repeat, var(--ink);
  filter:brightness(1.32) contrast(1.05) drop-shadow(0 1px 0 rgba(0,0,0,.5));
}
#topbar::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(210,155,72,.18),rgba(72,42,20,.26));
  mix-blend-mode:overlay;
}
#topbar::after{
  content:"";
  position:absolute;
  inset:6px;
  border:1px solid rgba(232,223,201,.14);
  pointer-events:none;
  transition:border-color .08s linear;
}
#hero-block{
  display:flex;
  align-items:center;
  gap:10px;
  height:calc(100% - 6px);
  min-width:150px;
  position:relative;
  z-index:2;
}
.hero-art{
  height:100%;
  display:flex;
  align-items:flex-end;
  flex:0 0 auto;
}
#hero-img{
  height:calc(100% + 10px);
  max-height:164px;
  width:auto;
  object-fit:contain;
  object-position:bottom;
  margin-bottom:-3px;
  display:block;
  transition:opacity .12s linear;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.5));
}
.hero-vitals{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding-bottom:0;
  min-width:118px;
  transform:translateY(-2px);
}
.crest-row{display:flex;align-items:center;gap:4px;}
#hp-text{
  font-size:clamp(7px,.7vw,10px);
  color:var(--bone-dim);
  letter-spacing:.02em;
  margin-left:2px;
  white-space:nowrap;
}
#crest{height:clamp(22px,2.6vw,32px);width:auto;display:block;filter:brightness(1.08);}
#hearts{display:flex;align-items:center;gap:1px;}
.heart-wrap{position:relative;display:flex;align-items:center;flex:0 0 auto;}
.heart{
  display:block;
  height:clamp(16px,2vw,24px);
  width:clamp(14px,1.55vw,20px);
  object-fit:contain;
  flex:0 0 auto;
}
.heart-wrap.crack::after{
  content:"";
  position:absolute;
  left:46%;
  top:2%;
  width:1px;
  height:96%;
  background:#B23A3A;
  transform:rotate(16deg);
  animation:crackFlash .36s ease-out forwards;
}
@keyframes crackFlash{
  0%{opacity:1;transform:rotate(16deg) scaleY(.2);}
  45%{opacity:1;transform:rotate(16deg) scaleY(1.1);}
  100%{opacity:0;transform:rotate(16deg) scaleY(1);}
}
#hero-stats{
  font-size:clamp(8px,.8vw,11px);
  letter-spacing:.08em;
  color:var(--bone-dim);
  white-space:nowrap;
  text-shadow:0 1px 3px rgba(0,0,0,.85);
}
#hero-stats b{color:var(--gold-hi);font-weight:500;display:inline-block;min-width:1.15ch;text-align:center;font-variant-numeric:tabular-nums;}
#hero-stats .sep{color:rgba(232,223,201,.34);padding:0 2px;}
#xp-wrap{display:flex;align-items:center;gap:6px;}
#xp-bar{
  width:clamp(64px,6.6vw,104px);
  height:3px;
  background:rgba(232,223,201,.14);
  border:1px solid rgba(232,223,201,.18);
  overflow:hidden;
}
#xp-fill{
  display:block;
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#6B4A8F,#B08BD0);
  transition:width .3s ease;
}
#xp-text{font-size:clamp(7px,.66vw,9px);letter-spacing:.06em;color:var(--bone-dim);white-space:nowrap;text-shadow:0 1px 3px rgba(0,0,0,.85);}

#gold-block{
  display:flex;
  align-items:center;
  gap:7px;
  font-size:clamp(15px,1.65vw,26px);
  color:var(--gold-hi);
  letter-spacing:.04em;
  position:relative;
  z-index:2;
}
#gold-block img{height:clamp(20px,2.2vw,34px);width:auto;display:block;filter:brightness(1.38) saturate(1.15) contrast(1.05);}
#gold-num{line-height:1;min-width:2ch;text-align:left;}

#title-block{
  position:absolute;
  left:50%;
  top:48%;
  transform:translate(-50%,-50%);
  text-align:center;
  width:min(54%,760px);
  z-index:1;
  pointer-events:none;
}
#title{
  margin:0;
  font-family:var(--display);
  font-weight:400;
  font-size:clamp(24px,3.2vw,56px);
  line-height:.98;
  letter-spacing:.055em;
  background:linear-gradient(180deg,#F6E5B2 0%,#E1BA6D 25%,#B7833C 52%,#E9C983 71%,#8C5D27 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.55));
}
#title .three{
  font-size:.95em;
  padding:0 .02em;
}
#turn-strip{
  margin-top:clamp(2px,.5vh,7px);
  font-size:clamp(7px,.8vw,12px);
  letter-spacing:.22em;
  color:var(--bone-dim);
}
#turn-strip b{color:var(--bone);font-weight:500;font-size:1.08em;}
#turn-strip .bar{color:var(--gold);padding:0 .8em;}
#combo-num{display:inline-block;transition:color .15s ease;}
#combo-num.tick{animation:comboTick .5s ease-out;}
@keyframes comboTick{
  0%{transform:scale(1.45);color:var(--gold-hi);}
  100%{transform:scale(1);color:var(--bone);}
}

#top-right{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  align-items:center;
  gap:12px;
  z-index:3;
}
#depth-chip{
  background:rgba(34,23,14,.55);
  border:1px solid rgba(192,138,62,.5);
  color:var(--bone);
  font-size:clamp(7px,.7vw,10px);
  letter-spacing:.16em;
  padding:7px 10px;
  cursor:pointer;
  transition:border-color .15s ease,color .15s ease;
}
#depth-chip b{color:var(--gold-hi);font-weight:500;}
#depth-chip:hover{border-color:rgba(192,138,62,.8);color:var(--bone);}
.round-plaque{
  width:clamp(34px,3.4vw,50px);
  aspect-ratio:1;
  padding:0;
  border:0;
  background:none;
  cursor:pointer;
  transition:transform .12s ease,filter .12s ease;
}
.round-plaque img{width:100%;height:100%;display:block;}
.round-plaque:hover{transform:translateY(-1px);filter:brightness(1.12);}

/* ---------- panels ---------- */
.panel{
  position:relative;
  background:#241B14;
  border:12px solid transparent;
  border-image:url(assets/panel_frames_01_top_bar.webp) 40 stretch;
  border-image-width:12px;
  box-shadow:inset 0 0 0 1px rgba(232,223,201,.16), inset 0 0 46px rgba(0,0,0,.5);
  overflow:hidden;
  min-height:0;
  transition:box-shadow .1s linear;
}
.panel::after{
  content:"";
  position:absolute;
  inset:0;
  border:1px solid rgba(232,223,201,.2);
  pointer-events:none;
  transition:border-color .08s linear;
}
.panel-inner{
  position:relative;
  z-index:2;
  height:100%;
  display:flex;
  flex-direction:column;
  padding:8px 12px;
}

/* ---------- map ---------- */
#map-panel{grid-area:map;}
.map-bg{
  position:absolute;
  inset:0;
  background:url(assets/panel_frames_02_map_column.webp) center / cover no-repeat;
  opacity:.34;
  filter:sepia(.4) saturate(1.1) brightness(.82);
}
.map-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(46,32,18,.52) 0%,rgba(35,23,13,.78) 55%,rgba(22,14,8,.94) 100%);
}
.map-inner{gap:4px;}
.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;}
.map-head{
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  padding:3px 0 1px;
}
h2{
  font-family:var(--display);
  font-weight:400;
  margin:0;
  color:var(--bone);
}
.map-head h2{
  font-size:clamp(12px,1.1vw,18px);
  letter-spacing:.28em;
  text-indent:.28em;
  text-shadow:0 1px 3px rgba(0,0,0,.8);
}
.map-sub{
  font-size:clamp(8px,.68vw,10px);
  letter-spacing:.2em;
  color:var(--gold-hi);
  text-shadow:0 1px 3px rgba(0,0,0,.8);
}
.map-sub::before{content:"DEPTH ";}
.map-sub::after{content:"";}
#node-label{
  min-height:15px;
  font-size:clamp(9px,.8vw,13px);
  font-style:italic;
  color:var(--bone-dim);
  text-align:center;
  line-height:1.1;
}
#map-scroll{
  flex:1;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  display:flex;
  justify-content:center;
  scrollbar-width:thin;
  scrollbar-color:rgba(192,138,62,.45) transparent;
}
#map-scroll::-webkit-scrollbar{width:5px;}
#map-scroll::-webkit-scrollbar-thumb{background:rgba(192,138,62,.4);}
#map-nodes{
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:center;
  width:100%;
  padding:4px 0;
  min-height:100%;
}
#map-nodes::before{
  content:"";
  position:absolute;
  left:50%;
  top:26px;
  bottom:26px;
  border-left:1px dotted rgba(232,223,201,.5);
}
.map-node{
  position:relative;
  z-index:1;
  width:clamp(32px,3.1vw,48px);
  aspect-ratio:1;
  padding:0;
  border:0;
  background:none;
  display:grid;
  place-items:center;
  cursor:default;
}
.map-node.boss{width:clamp(42px,4vw,62px);}
.map-node .node-art{width:100%;height:100%;object-fit:contain;display:block;filter:brightness(1.02) saturate(1);}
.map-node .ring{
  position:absolute;
  left:50%;
  top:50%;
  width:148%;
  height:auto;
  transform:translate(-50%,-50%);
  pointer-events:none;
  animation:ringPulse 2.8s ease-in-out infinite;
}
@keyframes ringPulse{
  0%,100%{opacity:.55;transform:translate(-50%,-50%) scale(.95);}
  50%{opacity:1;transform:translate(-50%,-50%) scale(1.05);}
}
.map-node.visited .node-art{opacity:.48;filter:grayscale(.65) brightness(.85);}
.map-node.visited::after{
  content:"";
  position:absolute;
  inset:18%;
  border:1px solid rgba(232,223,201,.35);
  transform:rotate(-13deg);
}
.map-node.visited::before{
  content:"";
  position:absolute;
  left:50%;
  top:12%;
  width:1px;
  height:76%;
  background:rgba(139,46,46,.75);
  transform:rotate(28deg);
}
.map-node.upcoming .node-art{opacity:.7;filter:grayscale(.25) brightness(.95);}
.map-node.current .node-art{filter:brightness(1.22) saturate(1.1);}
.map-node:hover .node-art{filter:brightness(1.25) saturate(1.1);}

/* ---------- board ---------- */
#center{
  grid-area:center;
  min-width:0;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:2px;
}
#board-wrap{
  position:relative;
  flex:0 0 auto;
  width:100px;
  height:100px;
  cursor:pointer;
  touch-action:none;
}
#board-wrap::after{
  content:"";
  position:absolute;
  inset:0;
  border:1px solid rgba(232,223,201,.16);
  pointer-events:none;
  transition:border-color .08s linear;
}
#phaser{position:fixed;inset:0;z-index:2;pointer-events:none;}
#phaser canvas{display:block;width:100%!important;height:100%!important;}
#board-glow{
  position:absolute;
  inset:0;
  border:2px solid var(--gold);
  opacity:0;
  pointer-events:none;
  z-index:3;
  transition:opacity .25s ease;
}
#board-glow.on{
  opacity:1;
  animation:borderGlow 1.1s ease-in-out infinite;
}
@keyframes borderGlow{
  0%,100%{opacity:.45;box-shadow:inset 0 0 10px rgba(192,138,62,.18);}
  50%{opacity:1;box-shadow:inset 0 0 26px rgba(231,196,127,.38);}
}
#combat-log{
  position:absolute;
  z-index:5;
  top:2.5%;
  left:50%;
  transform:translateX(-50%);
  font-size:clamp(7px,.78vw,11px);
  letter-spacing:.11em;
  color:var(--bone);
  background:rgba(30,20,12,.9);
  border:1px solid rgba(232,223,201,.25);
  padding:3px 8px;
  opacity:0;
  transition:opacity .18s ease;
  white-space:nowrap;
  pointer-events:none;
}
#combat-log.show{opacity:1;}
#combat-log .plus{color:var(--verd);}
#combat-log .gold{color:var(--gold-hi);}
#combat-log .bad{color:#D98A8A;}
#combat-log .ward{color:#CFC6AE;}
#combat-log .frost{color:var(--frost);}
#combat-log .xp{color:#B08BD0;}
#hint-strip{
  position:absolute;
  z-index:4;
  left:50%;
  top:2.6%;
  bottom:auto;
  transform:translateX(-50%);
  font-size:clamp(8px,.95vw,13px);
  font-style:italic;
  color:#CFC6AE;
  background:rgba(30,20,12,.75);
  padding:2px 9px;
  white-space:nowrap;
  pointer-events:none;
  opacity:1;
  transition:opacity .45s ease;
}
#hint-strip.gone{opacity:0;}

/* ---------- right column ---------- */
#right-column{
  grid-area:right;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
#hero-card{display:none;}
#enemy-card{flex:1 1 auto;min-height:0;}
.card-bg{
  position:absolute;
  inset:0;
  background:url(assets/panel_frames_03_portrait_card.webp) center top / cover no-repeat;
  opacity:.17;
  filter:sepia(.45) saturate(.9) brightness(.88);
}
.card-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(48,33,19,.48),rgba(23,15,9,.92));
}
.enemy-inner{gap:4px;}
.enemy-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;}
.enemy-title{min-width:0;}
.enemy-title h2{
  font-size:clamp(10px,.95vw,15px);
  letter-spacing:.15em;
  color:var(--bone);
  text-shadow:0 1px 0 rgba(0,0,0,.5);
}
#enemy-flavour{
  margin-top:1px;
  font-size:clamp(8px,.72vw,11px);
  font-style:italic;
  color:var(--bone-dim);
  line-height:1.15;
}
#enemy-hp-text{
  font-size:clamp(8px,.72vw,10px);
  color:#D99A9A;
  white-space:nowrap;
  padding-top:2px;
}
#portrait-frame{
  position:relative;
  flex:1;
  min-height:0;
  border:1px solid rgba(232,223,201,.28);
  background:
    radial-gradient(62% 60% at 50% 44%,rgba(190,135,62,.16),transparent 72%),
    repeating-linear-gradient(90deg,rgba(232,223,201,.028) 0 1px,transparent 1px 7px),
    #1A130E;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
#enemy-img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
  transition:opacity .18s ease,transform .18s ease,filter .3s ease;
  transform-origin:center center;
}
#portrait-frame.boss{border-color:rgba(192,138,62,.55);}
#portrait-frame.boss::after{
  content:"";
  position:absolute;
  inset:0;
  border:1px solid rgba(139,46,46,.3);
  pointer-events:none;
}
#portrait-frame.attacking #enemy-img{transform:translateY(6%) scale(1.06);}
#portrait-frame.hit #enemy-img{transform:translateY(2%) scale(.98);filter:brightness(1.35);}
.tear{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  margin:0;
  object-fit:cover;
  object-position:center;
  opacity:0;
  pointer-events:none;
  transition:transform .8s cubic-bezier(.4,0,.7,1),opacity .8s ease;
}
#tear-left{clip-path:inset(0 50% 0 0);}
#tear-right{clip-path:inset(0 0 0 50%);}
#enemy-card.torn #enemy-img{opacity:0;}
#enemy-card.torn #tear-left{opacity:1;transform:translate(-76%,18%) rotate(-15deg);}
#enemy-card.torn #tear-right{opacity:1;transform:translate(76%,18%) rotate(15deg);}
#frost-chip{
  position:absolute;
  top:4px;
  right:5px;
  font-size:clamp(6px,.58vw,8px);
  letter-spacing:.12em;
  color:var(--frost);
  background:rgba(30,20,12,.86);
  border:1px solid rgba(127,169,196,.5);
  padding:2px 5px;
  opacity:0;
  transition:opacity .2s ease;
}
#frost-chip.on{opacity:1;}
#frost-chip b{font-weight:500;}
#enemy-hp{
  display:flex;
  gap:2px;
  height:clamp(8px,.95vw,13px);
  flex:0 0 auto;
}
#enemy-hp .seg{
  flex:1;
  background:#2A1F16;
  border:1px solid rgba(232,223,201,.13);
  transition:background .15s ease,box-shadow .15s ease;
}
#enemy-hp .seg.full{
  background:linear-gradient(180deg,#A83E3E,#6E2222);
  border-color:rgba(232,223,201,.2);
}
#enemy-hp .seg.hurt{box-shadow:inset 0 0 8px rgba(255,190,150,.8);}

#relic-panel{flex:0 0 auto;min-height:clamp(112px,24vh,170px);}
.relic-bg{
  position:absolute;
  inset:0;
  background:url(assets/panel_frames_04_relic_tray.webp) center / cover no-repeat;
  opacity:.18;
  filter:sepia(.45) saturate(.9) brightness(.9);
}
.relic-bg::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(48,33,19,.6),rgba(23,15,9,.93));
}
.relic-head{padding:0 1px 4px;}
.relic-head h2{font-size:clamp(9px,.85vw,13px);letter-spacing:.24em;}
#relic-count{font-size:clamp(7px,.62vw,9px);color:var(--bone-dim);letter-spacing:.08em;}
#relic-note{
  margin:4px 0 auto;
  text-align:center;
  font-size:clamp(9px,.8vw,12px);
  font-style:italic;
  color:rgba(232,223,201,.5);
  line-height:1.2;
}
#relic-slots{
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:clamp(3px,.45vw,7px);
  margin-top:auto;
}
.relic-slot{
  position:relative;
  aspect-ratio:1;
  border:1px dashed rgba(232,223,201,.26);
  background:rgba(6,7,15,.24);
  display:grid;
  place-items:center;
  padding:2px;
  cursor:default;
}
.relic-slot.lit{
  border:1px solid rgba(192,138,62,.62);
  background:radial-gradient(circle at 50% 45%,rgba(192,138,62,.17),rgba(6,7,15,.35) 72%);
  cursor:pointer;
}
.relic-slot.lit:hover{border-color:var(--gold-hi);}
.relic-slot img{width:92%;height:92%;object-fit:contain;display:block;}
.relic-slot .empty-mark{
  font-family:var(--mono);
  font-size:clamp(6px,.55vw,8px);
  color:rgba(232,223,201,.24);
}

/* ---------- controls ---------- */
#controls{
  grid-area:controls;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:clamp(8px,2.2vw,28px);
}
#controls::before{
  content:"";
  position:absolute;
  left:2%;
  right:2%;
  top:50%;
  border-top:1px solid rgba(232,223,201,.18);
}
.plaque{
  position:relative;
  z-index:1;
  width:clamp(38px,4.6vw,68px);
  aspect-ratio:1;
  padding:0;
  border:0;
  background:none;
  cursor:pointer;
  transition:transform .12s ease,filter .12s ease,opacity .15s ease;
}
.plaque img{width:100%;height:100%;display:block;}
.plaque:hover{transform:translateY(-1px);filter:brightness(1.12);}
.plaque:active{transform:translateY(0);filter:brightness(.94);}
.plaque.dim{opacity:.42;}
.plaque.off{opacity:.5;filter:grayscale(.4) brightness(.85);}

/* ---------- hit flash ---------- */
#app.hit .panel::after,
#app.hit #topbar::after,
#app.hit #board-wrap::after{
  border-color:rgba(160,48,48,.95)!important;
}

/* ---------- modal ---------- */
#modal{
  position:fixed;
  inset:0;
  z-index:80;
  display:grid;
  place-items:center;
  padding:16px;
  background:rgba(16,10,6,.76);
}
#modal.hidden{display:none;}
.modal-card{
  position:relative;
  width:min(580px,94vw);
  max-height:90dvh;
  overflow-y:auto;
  background:linear-gradient(180deg,#2A2018,#151008);
  border:12px solid transparent;
  border-image:url(assets/panel_frames_01_top_bar.webp) 40 stretch;
  border-image-width:12px;
  padding:18px 22px 20px;
  scrollbar-width:thin;
  scrollbar-color:rgba(192,138,62,.45) transparent;
}
.modal-card::-webkit-scrollbar{width:6px;}
.modal-card::-webkit-scrollbar-thumb{background:rgba(192,138,62,.4);}
.modal-kicker{
  font-family:var(--mono);
  font-size:9px;
  letter-spacing:.22em;
  color:var(--gold);
  text-align:center;
  margin-bottom:2px;
}
.modal-card h2{
  font-size:clamp(18px,2.5vw,30px);
  letter-spacing:.13em;
  text-align:center;
  color:var(--gold-hi);
  margin:0 0 2px;
  line-height:1.1;
}
.modal-sub{
  text-align:center;
  font-style:italic;
  color:var(--bone-dim);
  font-size:clamp(11px,1.1vw,14px);
  margin:0 0 12px;
  line-height:1.3;
}
.modal-body{font-size:clamp(12px,1.1vw,15px);line-height:1.5;color:#D6CDB7;}
.modal-body p{margin:0 0 10px;}
.modal-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:10px;
  margin-top:14px;
}
.btn{
  font-family:var(--mono);
  font-size:clamp(9px,.9vw,11px);
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--ink);
  background:linear-gradient(180deg,#EFE7D2,#D8CCB1);
  border:1px solid #B7AA8E;
  padding:10px 16px;
  cursor:pointer;
  transition:filter .12s ease,transform .12s ease;
}
.btn:hover{filter:brightness(1.07);transform:translateY(-1px);}
.btn:active{transform:translateY(0);}
.btn.ghost{
  background:rgba(46,32,18,.7);
  color:var(--bone);
  border:1px solid rgba(232,223,201,.36);
}
.btn.gold{
  background:linear-gradient(180deg,#E8C983,#B7833C);
  border-color:#8C5D27;
  color:#1A130A;
}
.btn:disabled{opacity:.4;cursor:default;transform:none;filter:none;}

.legend{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 14px;
  margin:12px 0 4px;
}
.legend-item{display:flex;align-items:center;gap:8px;}
.legend-item img{width:26px;height:30px;object-fit:contain;flex:0 0 auto;}
.legend-item .ln{font-family:var(--display);font-size:10px;letter-spacing:.1em;color:var(--gold-hi);display:block;}
.legend-item .ld{font-size:11px;color:var(--bone-dim);display:block;line-height:1.2;}

.relic-choice{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:10px;
  margin-top:8px;
}
.relic-card{
  background:rgba(34,23,14,.6);
  border:1px solid rgba(232,223,201,.26);
  padding:10px 8px 11px;
  text-align:center;
  cursor:pointer;
  transition:border-color .15s ease,transform .15s ease,background .15s ease;
}
.relic-card:hover{border-color:var(--gold);transform:translateY(-2px);background:rgba(30,33,54,.7);}
.relic-card img{width:56px;height:56px;object-fit:contain;display:block;margin:0 auto 4px;}
.relic-card h3{
  font-family:var(--display);
  font-size:11px;
  letter-spacing:.09em;
  color:var(--gold-hi);
  margin:2px 0;
  font-weight:600;
}
.relic-card p{margin:0;font-size:11px;color:var(--bone-dim);line-height:1.25;}
.relic-card .price{
  display:block;
  margin-top:5px;
  font-family:var(--mono);
  font-size:10px;
  color:var(--gold-hi);
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
  margin:12px 0 6px;
  text-align:center;
}
.stats-grid div{
  border:1px solid rgba(232,223,201,.2);
  padding:7px 2px 6px;
  background:rgba(34,23,14,.42);
}
.stats-grid .k{
  display:block;
  font-family:var(--mono);
  font-size:7px;
  letter-spacing:.14em;
  color:var(--bone-dim);
}
.stats-grid .v{
  display:block;
  font-family:var(--mono);
  font-size:clamp(13px,1.4vw,18px);
  color:var(--gold-hi);
  margin-top:2px;
}
.board-note{
  text-align:center;
  font-family:var(--mono);
  font-size:8px;
  letter-spacing:.12em;
  color:rgba(232,223,201,.4);
  margin-top:6px;
}
.leaderboard{
  margin:12px 0 2px;
  border-top:1px solid rgba(232,223,201,.18);
  padding-top:7px;
}
.leaderboard h3{
  font-family:var(--display);
  font-size:10px;
  letter-spacing:.2em;
  color:var(--bone-dim);
  text-align:center;
  margin:0 0 4px;
  font-weight:400;
}
.leaderboard ol{list-style:none;margin:0;padding:0;font-family:var(--mono);font-size:9px;color:var(--bone-dim);}
.leaderboard li{display:flex;justify-content:space-between;gap:8px;padding:2px 0;border-bottom:1px dotted rgba(232,223,201,.1);}
.leaderboard a{color:var(--gold-hi);text-decoration:none;}
.leaderboard a:hover{text-decoration:underline;}

.hero-big{
  display:block;
  height:clamp(100px,17vh,170px);
  width:auto;
  margin:2px auto 0;
  object-fit:contain;
}
.modal-credits{
  text-align:center;
  font-family:var(--mono);
  font-size:7px;
  letter-spacing:.12em;
  color:rgba(232,223,201,.3);
  margin-top:10px;
}

#toast{
  position:fixed;
  z-index:90;
  left:50%;
  bottom:calc(12% + env(safe-area-inset-bottom,0px));
  transform:translateX(-50%) translateY(6px);
  background:rgba(30,20,12,.95);
  border:1px solid rgba(232,223,201,.36);
  padding:8px 14px;
  font-size:clamp(10px,1vw,13px);
  color:var(--bone);
  max-width:88vw;
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s ease,transform .25s ease;
}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0);}

#ink{
  position:fixed;
  inset:0;
  z-index:70;
  pointer-events:none;
  background:radial-gradient(130% 100% at 50% 112%,#07080F 0%,#07080F 52%,rgba(7,8,15,.92) 66%,rgba(7,8,15,0) 78%);
  transform:translateY(102%);
  transition:transform 1.15s cubic-bezier(.4,0,.6,1);
  border-radius:46% 54% 0 0 / 10% 14% 0 0;
}
#ink.rise{transform:translateY(-18%);}

.mono{font-family:var(--mono);font-variant-numeric:tabular-nums;}
.hidden{display:none!important;}

/* ---------- narrow screens ---------- */
@media (max-width:859px), (max-aspect-ratio:6/5){
  #app{
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto minmax(0,1fr) auto auto;
    grid-template-areas:
      "top"
      "right"
      "center"
      "map"
      "controls";
    gap:4px;
    padding:4px max(4px,env(safe-area-inset-right,0px)) calc(4px + env(safe-area-inset-bottom,0px)) max(4px,env(safe-area-inset-left,0px));
    max-width:none;
  }
  #topbar{
    height:clamp(68px,12.2dvh,88px);
    padding:3px 8px 4px;
    display:grid;
    grid-template-columns:auto 1fr auto;
    grid-template-rows:auto auto;
    grid-template-areas:
      "title title title"
      "hero . gold";
    align-items:center;
    gap:0 6px;
  }
  #topbar::after{inset:3px;}
  #title-block{
    position:static;
    transform:none;
    width:auto;
    grid-area:title;
    text-align:center;
    margin:0;
    padding:0;
  }
  #title{font-size:clamp(17px,4.9vw,26px);letter-spacing:.03em;}
  #turn-strip{font-size:6.5px;letter-spacing:.14em;margin-top:0;}
  #turn-strip .bar{padding:0 .5em;}
  #hero-block{grid-area:hero;height:auto;min-width:0;gap:5px;align-items:center;align-self:end;}
  #hero-img{height:36px;max-height:36px;margin:0;}
  .hero-vitals{padding-bottom:0;gap:1px;min-width:0;transform:none;}
  #crest{height:16px;}
  .heart{height:12px;}
  #hero-stats{font-size:7.2px;letter-spacing:.02em;}
  #xp-wrap{gap:3px;}
  #xp-bar{width:50px;height:2px;}
  #xp-text{font-size:6.2px;}
  #gold-block{grid-area:gold;justify-self:end;align-self:end;position:static;font-size:14px;gap:4px;z-index:5;margin-right:14px;margin-bottom:2px;}
  #gold-block img{height:16px;}
  #top-right{display:none;}
  #depth-chip{display:none;}

  .panel{border-image-width:7px;box-shadow:inset 0 0 0 1px rgba(232,223,201,.16);}
  .panel-inner{padding:4px 7px;}

  .hero-art{display:none;}
  #right-column{
    display:grid;
    grid-template-columns:0.95fr 1.15fr 0.9fr;
    grid-template-rows:minmax(0,1fr);
    grid-template-areas:"hero enemy relic";
    gap:3px;
    height:clamp(114px,20.3dvh,144px);
    min-height:0;
  }
  #hero-card{display:flex;grid-area:hero;min-height:0;overflow:hidden;}
  #hero-card .panel-inner{
    position:relative;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-end;
    gap:0;
    padding:2px 3px 1px;
    background:radial-gradient(62% 55% at 42% 50%,rgba(235,180,92,.26),transparent 74%);
  }
  #hero-card-img{
    flex:1 1 auto;
    min-height:0;
    width:100%;
    object-fit:contain;
    object-position:bottom;
    display:block;
    filter:brightness(1.55) contrast(1.08) sepia(.16) saturate(1.12);
  }
  .hero-card-name{
    width:100%;
    text-align:center;
    font-size:6.4px;
    letter-spacing:.02em;
    color:var(--gold-hi);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    line-height:1.1;
  }

  #enemy-card{grid-area:enemy;position:relative;min-height:0;overflow:hidden;}
  #enemy-card .panel-inner{position:absolute;inset:0;display:block;padding:0;}
  .enemy-head{
    position:absolute;
    left:0;
    right:0;
    top:0;
    z-index:3;
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:4px;
    padding:3px 5px;
    background:linear-gradient(180deg,rgba(30,20,12,.94),rgba(30,20,12,0));
    pointer-events:none;
  }
  .enemy-title{min-width:0;}
  .enemy-title h2{font-size:8px;letter-spacing:.04em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--bone);}
  #enemy-flavour{display:none;}
  #enemy-hp-text{font-size:6.5px;color:#E2A0A0;padding:0;white-space:nowrap;}
  #portrait-frame{position:absolute;inset:0;border:0;width:100%;height:100%;min-height:0;}
  #enemy-img{max-width:100%;max-height:100%;}
  #enemy-hp{position:absolute;left:3px;right:3px;bottom:3px;z-index:3;height:5px;margin:0;}
  #frost-chip{font-size:5px;padding:1px 3px;top:auto;bottom:10px;right:3px;}

  #relic-panel{grid-area:relic;height:100%;min-height:0;}
  .relic-inner{padding:3px 5px;gap:2px;}
  #relic-note{display:none;}
  .relic-head{padding:0;display:flex;align-items:baseline;justify-content:space-between;gap:2px;}
  .relic-head h2{font-size:7px;letter-spacing:.1em;}
  #relic-count{font-size:5.5px;}
  #relic-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;margin-top:auto;}
  .relic-slot{aspect-ratio:1;padding:1px;}

  #center{padding:0;}
  #hint-strip{font-size:7px;top:2.4%;bottom:auto;padding:1px 6px;}
  #combat-log{font-size:6.5px;padding:2px 5px;top:2.4%;}

  #map-panel{min-height:0;}
  .map-inner{display:flex;flex-direction:row;align-items:center;gap:6px;padding:2px 6px;}
  .map-head{
    flex-direction:row;
    align-items:baseline;
    gap:4px;
    padding:0;
    flex:0 0 auto;
  }
  .map-head h2{font-size:7.5px;letter-spacing:.14em;text-indent:.14em;}
  .map-sub{font-size:6px;letter-spacing:.05em;}
  #node-label{display:none;}
  #map-scroll{overflow-x:auto;overflow-y:hidden;justify-content:flex-start;flex:1;}
  #map-scroll::-webkit-scrollbar{height:0;}
  #map-nodes{
    flex-direction:row-reverse;
    min-height:0;
    height:100%;
    padding:2px 0;
    gap:3px;
    justify-content:space-between;
    align-items:center;
  }
  #map-nodes::before{
    left:14px;
    right:14px;
    top:50%;
    bottom:auto;
    border-left:0;
    border-top:1px dotted rgba(232,223,201,.3);
  }
  .map-node{width:clamp(18px,5.4vw,30px);}
  .map-node.boss{width:clamp(22px,6.4vw,34px);}

  #controls{gap:clamp(6px,3.6vw,18px);}
  .plaque{width:clamp(38px,11vw,54px);}

  .modal-card{padding:12px 14px 14px;border-width:8px;border-image-width:8px;}
  .legend{grid-template-columns:1fr;gap:6px;}
  .stats-grid{grid-template-columns:repeat(2,1fr);}
  .hero-big{height:clamp(70px,12vh,120px);}
}

/* ---------- short landscape phones ---------- */
@media (max-height:560px) and (min-aspect-ratio:5/4){
  #app{
    grid-template-columns:minmax(124px,.9fr) minmax(0,2.2fr) minmax(168px,1fr);
    grid-template-rows:clamp(48px,13.4vh,72px) minmax(0,1fr) clamp(30px,8vh,42px);
    grid-template-areas:
      "top top top"
      "map center right"
      "controls controls controls";
    gap:4px;
    padding:4px 8px 5px;
  }
  #topbar{display:flex;align-items:center;height:100%;padding:0 8px 0 2px;gap:6px;}
  #title-block{position:absolute;left:50%;top:48%;transform:translate(-50%,-50%);width:min(54%,760px);text-align:center;}
  #title{font-size:clamp(17px,2.4vw,24px);letter-spacing:.05em;}
  .hero-art{display:flex;}
  #hero-card{display:none;}
  #hero-block{height:calc(100% - 4px);min-width:96px;gap:5px;align-self:center;align-items:center;}
  #hero-img{height:calc(100% + 6px);max-height:70px;margin-bottom:-3px;}
  .hero-vitals{padding-bottom:0;min-width:78px;gap:1px;transform:translateY(-1px);}
  #gold-block{position:static;justify-self:auto;align-self:center;margin-bottom:0;}
  #crest{height:14px;}
  .heart{height:11px;}
  #hero-stats{font-size:5.5px;}
  #xp-bar{width:44px;height:2px;}
  #xp-text{font-size:5px;}
  #gold-block{font-size:12px;gap:4px;}
  #gold-block img{height:15px;}
  #title{font-size:clamp(16px,2.5vw,22px);}
  #turn-strip{font-size:6px;margin-top:1px;}
  .panel{border-image-width:6px;}
  .panel-inner{padding:3px 6px;}

  #map-panel{min-height:0;}
  .map-inner{display:flex;flex-direction:column;align-items:stretch;gap:2px;padding:3px 6px;}
  .map-head{flex-direction:column;align-items:center;gap:0;padding:0;}
  .map-head h2{font-size:8px;letter-spacing:.16em;text-indent:.16em;}
  #map-panel .map-sub{font-size:5.5px;}
  #node-label{display:block;font-size:6px;line-height:1.1;min-height:7px;max-height:14px;overflow:hidden;}
  #map-scroll{flex:1;overflow-y:auto;overflow-x:hidden;}
  #map-nodes{flex-direction:column;gap:0;min-height:100%;padding:1px 0;justify-content:space-between;}
  #map-nodes::before{left:50%;top:12px;bottom:12px;right:auto;border-left:1px dotted rgba(232,223,201,.35);border-top:0;}
  #map-scroll .map-node{width:22px;height:22px;}
  #map-scroll .map-node.boss{width:28px;height:28px;}
  #map-scroll .map-node .ring{width:32px;}

  #right-column{display:flex;flex-direction:column;height:auto;gap:4px;min-height:0;}
  #hero-card{display:none;}
  #enemy-card{flex:1 1 auto;height:auto;min-height:0;position:relative;}
  #enemy-card .panel-inner{position:static;inset:auto;display:flex;flex-direction:column;gap:2px;padding:4px 6px;}
  .enemy-head{position:static;inset:auto;display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:4px;background:none;padding:0;}
  .enemy-title h2{font-size:8px;letter-spacing:.06em;}
  #enemy-flavour{display:none;}
  #enemy-hp-text{font-size:6.5px;padding:0;}
  #portrait-frame{position:static;inset:auto;flex:1;min-height:0;width:auto;height:auto;border:1px solid rgba(232,223,201,.28);}
  #enemy-img{max-width:100%;max-height:100%;}
  #enemy-hp{position:static;left:auto;right:auto;bottom:auto;height:6px;margin:0;}
  #frost-chip{font-size:5px;padding:1px 3px;top:2px;right:3px;bottom:auto;}

  #relic-panel{height:46px;min-height:46px;flex:0 0 auto;}
  .relic-inner{display:flex;flex-direction:column;padding:3px 6px;}
  .relic-head{display:flex;align-items:baseline;justify-content:space-between;padding:0;}
  .relic-head h2{font-size:7px;letter-spacing:.16em;}
  #relic-count{font-size:6px;}
  #relic-slots{display:grid;grid-template-columns:repeat(6,1fr);gap:2px;margin-top:2px;}
  .relic-slot{padding:1px;aspect-ratio:1;}

  #controls{gap:10px;}
  .plaque{width:clamp(28px,4vw,38px);}
  #hint-strip{font-size:6.5px;top:2.2%;bottom:auto;}
  #combat-log{font-size:6px;}
}

@media (prefers-reduced-motion:reduce){
  .map-node .ring{animation:none;opacity:.9;}
  #board-glow.on{animation:none;opacity:.85;}
  .heart-wrap.crack::after{animation:none;}
}

/* ================================================================== */
/* CHIBI THEME                                                         */
/* ================================================================== */
:root{
  --ink:#FFF9F2;
  --ink-deep:#FFEAF2;
  --slate:#F4D8E3;
  --bone:#4B3340;
  --bone-dim:#8A6A78;
  --gold:#F29E4C;
  --gold-hi:#F6B756;
  --verd:#6FBF9F;
  --ox:#E86A6A;
  --ameth:#B58CD9;
  --amber:#F5A25D;
  --frost:#8FC9E8;
  --display:'Baloo 2','Trebuchet MS','Arial Rounded MT Bold',sans-serif;
  --text:'Baloo 2','Trebuchet MS','Arial Rounded MT Bold',sans-serif;
  --mono:'Trebuchet MS','Arial Rounded MT Bold',sans-serif;
}
body{background:#FFE9F2;color:#4B3340;}
#wall{
  background:url(assets/chibi_bg.webp) center / cover no-repeat;
  filter:none;
}
#vignette{
  background:
    radial-gradient(125% 90% at 50% 38%, rgba(255,255,255,.02) 40%, rgba(255,220,235,.12) 82%, rgba(120,70,100,.24) 100%);
}
#vignette::after{
  background:
    radial-gradient(40% 36% at 10% 10%, rgba(255,246,170,.22), transparent 72%),
    radial-gradient(42% 38% at 90% 18%, rgba(200,244,255,.18), transparent 72%);
}
body::after{
  background:linear-gradient(135deg,rgba(255,255,255,.06),rgba(255,200,225,.05));
  mix-blend-mode:soft-light;
}

/* header */
#topbar{
  background:linear-gradient(180deg,#FFFCF5,#FFE9F2);
  border:3px solid #F3B7CB;
  border-radius:24px;
  filter:none;
  box-shadow:0 6px 0 rgba(228,170,190,.35),0 12px 24px rgba(170,110,140,.16);
}
#topbar::before,#topbar::after{display:none;}
#hero-img{filter:drop-shadow(0 3px 2px rgba(120,60,80,.18));}
#title{
  font-family:var(--display);
  font-weight:800;
  letter-spacing:.005em;
  transform:rotate(-1.2deg);
  background:linear-gradient(180deg,#FFE06A 0%,#FFA845 45%,#FF6E9C 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  -webkit-text-stroke:2.5px #FFFDF7;
  paint-order:stroke fill;
  filter:drop-shadow(0 3px 0 #F2A9C2) drop-shadow(0 8px 12px rgba(190,90,120,.24));
}
#title-block::before,#title-block::after{
  content:"\2726";
  position:absolute;
  top:-2%;
  color:#FFD35C;
  font-size:clamp(12px,1.5vw,24px);
  text-shadow:0 2px 0 #FFF8E0,0 0 8px rgba(255,205,90,.7);
  animation:chibiTwinkle 2.4s ease-in-out infinite;
  pointer-events:none;
}
#title-block::before{left:6%;}
#title-block::after{right:6%;animation-delay:1.2s;color:#FF9EC4;}
@keyframes chibiTwinkle{
  0%,100%{transform:scale(.75) rotate(0deg);opacity:.6;}
  50%{transform:scale(1.15) rotate(18deg);opacity:1;}
}
#turn-strip{color:#9A6A7C;letter-spacing:.16em;}
#turn-strip b{color:#E47A44;}
#turn-strip .bar{color:#F2B6C8;}
#gold-block{color:#B0642A;}
#gold-block img{display:none;}
#gold-block::before{
  content:"★";
  display:grid;
  place-items:center;
  width:1.12em;
  height:1.12em;
  border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#FFF3B0,#F6B94A 55%,#D98A2E);
  color:#A65A18;
  font-size:.76em;
  box-shadow:inset 0 -2px 0 #C98125,0 2px 0 rgba(120,70,20,.14);
}
#depth-chip{
  background:#FFF3D6;
  border:2px solid #F2C26A;
  border-radius:999px;
  color:#8A5A30;
}
#depth-chip b{color:#E07A3A;}
.round-plaque{
  background:#FFE6EF;
  border:3px solid #F3B7CB;
  border-radius:50%;
  box-shadow:0 4px 0 #EDC0D0;
  display:grid;
  place-items:center;
}
.round-plaque img{display:none;}
.round-plaque::before{content:"❚❚";font-size:.8em;color:#A85674;font-weight:700;letter-spacing:-.08em;}

/* hearts */
#crest{filter:drop-shadow(0 2px 0 rgba(160,100,60,.18));}
.heart-pip{
  display:inline-block;
  width:clamp(15px,1.7vw,22px);
  height:clamp(15px,1.7vw,22px);
  font-size:clamp(15px,1.7vw,22px);
  line-height:1;
  color:#F26D8A;
  text-align:center;
  text-shadow:0 1px 0 #FFF,0 2px 0 rgba(200,100,130,.18);
}
.heart-pip::before{content:"♥";}
.heart-pip.half::before{
  background:linear-gradient(90deg,#F26D8A 50%,#F2D8E1 50%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  text-shadow:none;
}
.heart-pip.empty::before{color:#F2D8E1;text-shadow:none;}
.heart-wrap.crack::after{background:#E24C6A;}

/* panels */
.panel{
  background:linear-gradient(180deg,rgba(255,251,245,.97),rgba(255,239,246,.95));
  border:3px solid #F3B7CB;
  border-image:none;
  border-radius:20px;
  box-shadow:0 6px 0 rgba(228,170,190,.3),0 12px 22px rgba(170,110,140,.13);
}
.panel::after{display:none;}
h2{font-family:var(--display);font-weight:800;color:#4B3340;letter-spacing:.04em;}
.map-bg,.card-bg,.relic-bg{display:none;}
.map-head h2{color:#B05274;}
.map-sub{color:#E07A3A;}
#node-label{color:#8A6A78;}
#map-scroll{scrollbar-color:rgba(240,170,195,.6) transparent;}
#map-scroll::-webkit-scrollbar-thumb{background:rgba(240,170,195,.55);}
#map-nodes::before{
  border-left:2px dotted #F3C3D3;
  border-top:2px dotted #F3C3D3;
}
.map-node{
  background:#FFF4FA;
  border:2px solid #F3BFD2;
  border-radius:50%;
  box-shadow:0 3px 0 #EBC6D3;
  display:grid;
  place-items:center;
  transition:transform .15s ease,box-shadow .15s ease;
}
.map-node .node-art,.map-node .ring{display:none;}
.map-node::before{font-size:clamp(10px,1.2vw,20px);line-height:1;filter:drop-shadow(0 1px 0 rgba(160,100,130,.2));}
.map-node.combat::before{content:"⚔";}
.map-node.elite::before{content:"⭐";}
.map-node.shop::before{content:"🛒";}
.map-node.rest::before{content:"🔥";}
.map-node.treasure::before{content:"🎁";}
.map-node.boss::before{content:"👑";font-size:clamp(12px,1.5vw,25px);}
.map-node.current{
  background:#FFF0C8;
  border-color:#F2B04A;
  box-shadow:0 0 0 3px #FFE3A8,0 4px 0 #EAB65C;
  animation:chibiNodePulse 1.6s ease-in-out infinite;
}
.map-node.visited{opacity:.5;filter:saturate(.5);}
.map-node.visited::before{content:"✓";position:static;width:auto;height:auto;background:none;transform:none;border:0;color:#C7A6B5;font-size:clamp(10px,1.1vw,18px);}
.map-node.visited::after{display:none;}
.map-node:hover{transform:translateY(-1px);}
@keyframes chibiNodePulse{
  0%,100%{transform:scale(1);}
  50%{transform:scale(1.07);}
}

/* hero card */
#hero-card .panel-inner{
  background:radial-gradient(62% 58% at 50% 46%,#FFFDF7,#FFEAF2);
}
#hero-card-img{filter:drop-shadow(0 2px 2px rgba(150,80,100,.12));}
.hero-card-name{color:#B05274;font-weight:700;}

/* enemy */
#enemy-card{background:linear-gradient(180deg,#FFFCF6,#FFEDF3);}
#portrait-frame{
  background:radial-gradient(circle at 50% 42%,#FFFDF6,#FFE3EE);
  border:2px solid #F3C3D3;
  border-radius:16px;
}
#enemy-img,.tear{object-fit:contain;object-position:center bottom;}
#enemy-name{color:#7A3A5A;}
.enemy-title h2{color:#7A3A5A;}
#enemy-flavour{color:#9A7A88;}
#enemy-hp-text{color:#D75A6A;}
#enemy-hp .seg{
  background:#FBE1E9;
  border:1px solid #F3C3D3;
  border-radius:3px;
}
#enemy-hp .seg.full{
  background:linear-gradient(180deg,#FF9A8A,#F26D7E);
  border-color:#F6B6C0;
}
#frost-chip{
  background:#EAF8FF;
  border:1px solid #A9D8EE;
  color:#4A8CA8;
  border-radius:999px;
}
#enemy-card .enemy-head{
  background:linear-gradient(180deg,rgba(255,249,243,.94),rgba(255,249,243,0));
}

/* relic */
#relic-panel{background:linear-gradient(180deg,#FFFCF7,#FFF0F5);}
.relic-head h2{color:#B05274;}
#relic-count{color:#9A7A88;}
#relic-note{color:#B08A9A;}
.relic-slot{
  border:2px dashed #F3C3D3;
  background:#FFF7FB;
  border-radius:12px;
}
.relic-slot.lit{
  border:2px solid #F2B64E;
  background:radial-gradient(circle at 50% 45%,#FFF7DD,#FFF0D0);
}
.relic-slot.lit:hover{border-color:#E8A231;}
.relic-slot .empty-mark{color:#E2C0CE;}

/* board and counters */
#combat-log{
  background:rgba(255,250,245,.95);
  border:2px solid #F3C3D3;
  border-radius:10px;
  color:#5A3446;
  box-shadow:0 2px 0 rgba(225,170,190,.25);
}
#combat-log .bad{color:#D9536A;}
#combat-log .plus{color:#3E9B78;}
#combat-log .gold{color:#C9842A;}
#combat-log .ward{color:#8A6A78;}
#combat-log .frost{color:#4A8CA8;}
#combat-log .xp{color:#9A5AB8;}
#hint-strip{
  background:rgba(255,249,243,.94);
  border-radius:10px;
  color:#7A4A60;
}
#combo-num.tick{animation:comboTick .5s ease-out;color:#E47A44;}
#board-glow{border-color:#F4B44E;}
#board-wrap::after{border-color:#F3C3D3;}
#app.hit .panel::after,#app.hit #topbar::after,#app.hit #board-wrap::after{border-color:#E86A6A!important;}
#depth-chip b{color:#E07A3A;}

/* controls */
#controls::before{border-top:2px dotted #F3C3D3;}
.plaque{
  background:#FFF0F6;
  border:3px solid #F4B6C9;
  border-radius:50%;
  box-shadow:0 5px 0 #EFC2D0;
  display:grid;
  place-items:center;
}
.plaque img{display:none;}
.plaque::before{font-size:clamp(15px,1.7vw,24px);color:#A85674;line-height:1;font-weight:700;}
.plaque:hover{transform:translateY(-2px);background:#FFF7FA;}
.plaque:active{transform:translateY(2px);box-shadow:0 2px 0 #EFC2D0;}
#btn-play::before{content:"▶";}
#btn-pause::before{content:"❚❚";font-size:clamp(12px,1.4vw,20px);letter-spacing:-.08em;}
#btn-restart::before{content:"↻";}
#btn-help::before{content:"?";}
#btn-sound::before{content:"♪";}
#btn-sound.off{opacity:.55;}
#btn-sound.off::before{color:#C7A6B5;}

/* modals */
#modal{background:rgba(120,70,95,.34);}
.modal-card{
  background:linear-gradient(180deg,#FFFCF6,#FFEEF4);
  border:3px solid #F2B7CB;
  border-image:none;
  border-radius:24px;
  box-shadow:0 8px 0 rgba(228,170,190,.3),0 16px 30px rgba(170,110,140,.18);
  color:#4B3340;
}
.modal-card h2{color:#E86A8A;}
.modal-kicker{color:#E4924A;}
.modal-sub{color:#8A6A78;}
.modal-body{color:#5A3A4A;}
.btn{
  background:#FFD9E4;
  border:2px solid #F4A9C0;
  border-radius:14px;
  color:#5A3446;
  font-family:var(--text);
  font-weight:700;
  box-shadow:0 3px 0 #F0BFD0;
}
.btn:hover{filter:brightness(1.03);transform:translateY(-1px);}
.btn.gold{background:#FFE3A8;border-color:#F2B95C;color:#6A4018;box-shadow:0 3px 0 #E8C27E;}
.btn.ghost{background:#FFF;border-color:#F3C3D3;color:#7A4A60;box-shadow:0 3px 0 #F0D3DD;}
.relic-card{background:#FFF7FA;border:2px solid #F3C3D3;border-radius:16px;}
.relic-card:hover{border-color:#F2A9C0;background:#FFFDF8;}
.relic-card h3{color:#C0587A;}
.relic-card p{color:#7A5A68;}
.relic-card .price{color:#D9823A;}
.stats-grid div{background:#FFF7FA;border:2px solid #F3C3D3;border-radius:12px;}
.stats-grid .k{color:#9A7A88;}
.stats-grid .v{color:#E07A3A;}
.leaderboard{border-top:2px dotted #F3C3D3;}
.leaderboard h3{color:#9A7A88;}
.leaderboard li{color:#7A5A68;}
.leaderboard a{color:#D9823A;}
.leaderboard ol{border:0;}
.legend-item .ln{color:#C0587A;}
.legend-item .ld{color:#7A5A68;}
.board-note{color:#B08A9A;}
.hero-big{filter:none;}

/* toast */
#toast{
  background:#FFF9F2;
  border:2px solid #F3C3D3;
  border-radius:14px;
  color:#5A3446;
  box-shadow:0 4px 0 rgba(225,170,190,.3);
}
#ink{
  background:radial-gradient(130% 100% at 50% 112%,#4A2438 0%,#4A2438 52%,rgba(74,36,56,.85) 66%,rgba(74,36,56,0) 78%);
}

/* chibi character motion */
#hero-card.strike #hero-card-img,
#hero-img.strike{animation:chibiHop .45s ease-out;}
#hero-card.hurt #hero-card-img,
#hero-img.hurt{animation:chibiShake .45s ease-in-out;}
#hero-card.victory #hero-card-img,
#hero-img.victory{animation:chibiHop .8s ease-out;}
#hero-card.defeat #hero-card-img{transform:rotate(8deg) translateY(6px);filter:saturate(.5);}
@keyframes chibiHop{
  0%,100%{transform:translateY(0) rotate(0);}
  35%{transform:translateY(-10px) rotate(-2deg);}
  70%{transform:translateY(0) rotate(0);}
}
@keyframes chibiShake{
  0%,100%{transform:translateX(0);}
  25%{transform:translateX(-4px);}
  50%{transform:translateX(4px);}
  75%{transform:translateX(-2px);}
}
#portrait-frame.attacking #enemy-img{animation:chibiHop .4s ease-out;}
#portrait-frame.hit #enemy-img{animation:chibiShake .4s ease-in-out;filter:brightness(1.15);}
#portrait-frame.defeated #enemy-img{transform:rotate(6deg) translateY(4px);filter:saturate(.55);}
.hero-big.win{animation:chibiHop .8s ease-out;}
.hero-big.lose{transform:rotate(7deg);filter:saturate(.55);}

/* chibi icon layer */
#crest{display:none;}
.crest-row::before{
  content:"🛡️";
  font-size:clamp(14px,1.55vw,21px);
  line-height:1;
  filter:drop-shadow(0 2px 0 rgba(160,100,130,.18));
}
.relic-emoji{
  display:block;
  text-align:center;
  font-size:clamp(15px,1.7vw,28px);
  line-height:1;
  filter:drop-shadow(0 2px 0 rgba(160,100,130,.16));
}
.card-emoji{
  display:block;
  text-align:center;
  font-size:clamp(34px,3.2vw,52px);
  line-height:1;
  margin:2px 0 7px;
  filter:drop-shadow(0 3px 0 rgba(160,100,130,.16));
}

/* chibi squish: soft sticker highlights */
#topbar,.panel{
  box-shadow:inset 0 3px 0 rgba(255,255,255,.9),inset 0 -5px 0 rgba(240,175,198,.16),0 6px 0 rgba(228,170,190,.35),0 12px 24px rgba(170,110,140,.16);
}
.plaque{
  box-shadow:inset 0 3px 0 rgba(255,255,255,.95),0 5px 0 #EFC2D0,0 9px 13px rgba(190,130,160,.16);
}
.round-plaque{
  box-shadow:inset 0 2px 0 rgba(255,255,255,.95),0 4px 0 #EDC0D0;
}
.relic-slot{
  box-shadow:inset 0 2px 0 rgba(255,255,255,.95),inset 0 -3px 0 rgba(240,190,210,.22);
}
.btn{
  box-shadow:inset 0 2px 0 rgba(255,255,255,.85),0 3px 0 #F0BFD0;
}
.modal-card{
  box-shadow:inset 0 3px 0 rgba(255,255,255,.9),0 8px 0 rgba(228,170,190,.3),0 16px 30px rgba(170,110,140,.18);
}
#toast{
  box-shadow:inset 0 2px 0 rgba(255,255,255,.9),0 4px 0 rgba(225,170,190,.3);
}

/* chibi vitals: candy progress track */
#hero-stats .sep{color:#E9A6BE;}
#hp-text{color:#B08A9A;}
#xp-bar{
  height:5px;
  background:#F7DDE7;
  border:1px solid #EEBED1;
  border-radius:999px;
  overflow:hidden;
}
#xp-fill{
  background:linear-gradient(90deg,#FFC7DE,#FF6FA3);
  border-radius:999px;
}
#xp-text{color:#B07C90;}
