/* 深井回响 ECHO WELL — UI chrome: 炭黑 + 琥珀，像素密度 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0b0e; }
body {
  font-family: "VT323", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", monospace;
  color: #d8d2c0;
  user-select: none;
  -webkit-user-select: none;
}
#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #14161c 0%, #07080b 70%);
}
#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  background: #101216;
  box-shadow: 0 0 80px rgba(0,0,0,.8), 0 0 24px rgba(224,164,88,.06);
  cursor: crosshair;
}
.hidden { display: none !important; }
.num { font-family: "VT323", monospace; letter-spacing: .5px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hudTL { position: absolute; top: 14px; left: 16px; }
#hpwrap {
  width: 180px; height: 16px; background: #1a1214; border: 2px solid #3a2e2a;
  position: relative; box-shadow: 0 2px 0 #000;
}
#hpbar { height: 100%; width: 100%; background: linear-gradient(#c85048, #8a2e28); transition: width .15s; }
#hptxt { position: absolute; right: 4px; top: 0; font-size: 14px; color: #f0e8d8; text-shadow: 1px 1px 0 #000; line-height: 14px; }
#floorinfo { margin-top: 6px; display: flex; gap: 10px; align-items: baseline; }
#floorname { font-size: 18px; color: #e8d8b0; text-shadow: 1px 1px 0 #000; letter-spacing: 2px; }
#depth { font-size: 15px; color: #8a9a8a; }
#hudTR { position: absolute; top: 14px; right: 16px; display: flex; gap: 14px; align-items: center; }
#goldwrap { display: flex; align-items: center; gap: 6px; font-size: 19px; color: #e8c860; text-shadow: 1px 1px 0 #000; }
.gem { width: 10px; height: 10px; background: #e8c860; display: inline-block; transform: rotate(45deg); box-shadow: 0 0 6px #e8c86088; }
#mutebtn { font-size: 17px; color: #7a7a6a; cursor: pointer; pointer-events: auto; padding: 2px 6px; border: 1px solid #333; }
#mutebtn.off { color: #4a4a3a; text-decoration: line-through; }

#bossbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 340px; text-align: center; }
#bossname { font-size: 17px; color: #e89080; letter-spacing: 4px; text-shadow: 1px 1px 0 #000; margin-bottom: 3px; }
.bbwrap { height: 10px; background: #1c1010; border: 2px solid #4a2a2a; }
#bbfill { height: 100%; width: 100%; background: linear-gradient(#d86050, #7a2020); transition: width .12s; }

#hotbar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.slot {
  width: 42px; height: 42px; background: rgba(14,15,20,.85); border: 2px solid #3a3f4a;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.slot canvas { image-rendering: pixelated; width: 28px; height: 28px; }
.slot .k { position: absolute; bottom: 1px; right: 3px; font-size: 11px; color: #6a6a5a; }
.slot b { position: absolute; top: 0; left: 3px; font-size: 14px; color: #e8d8b0; text-shadow: 1px 1px 0 #000; }
#dashpip { width: 26px; height: 4px; background: #2a2e38; position: relative; overflow: hidden; }
#dashpip::after { content: ""; position: absolute; inset: 0; background: #7fd0e8; transform-origin: left; }
#slotD.ready #dashpip::after { transform: scaleX(1); }
#slotD:not(.ready) #dashpip::after { transform: scaleX(var(--p, 0)); }
#dashBtn {
  position: absolute; bottom: 90px; right: 22px; width: 74px; height: 74px; border-radius: 50%;
  background: rgba(20,24,32,.8); border: 2px solid #3a4a5a; color: #9ad8e8;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  pointer-events: auto;
}
#hint {
  position: absolute; bottom: 66px; left: 50%; transform: translateX(-50%);
  font-size: 16px; color: #e8d8b0; text-shadow: 1px 1px 0 #000; letter-spacing: 1px;
  background: rgba(10,10,14,.6); padding: 2px 12px;
}

/* ---------- toasts / tooltip ---------- */
#toasts { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  font-size: 17px; color: #f0e8d0; background: rgba(12,13,18,.9); border: 1px solid #4a4438;
  padding: 4px 16px; letter-spacing: 1px; text-shadow: 1px 1px 0 #000;
  animation: toastIn .25s ease-out; white-space: nowrap;
}
.toast small { color: #9a9a8a; margin-left: 8px; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

#tip {
  position: absolute; z-index: 40; max-width: 250px; pointer-events: none;
  background: rgba(10,11,15,.95); border: 2px solid #4a4438; padding: 8px 10px;
  font-size: 15px; line-height: 1.35; box-shadow: 0 4px 16px rgba(0,0,0,.6);
}
#tip .tname { font-size: 17px; letter-spacing: 1px; }
#tip .trar { font-size: 13px; }
#tip .tdesc { color: #9a9a8a; font-size: 14px; margin-top: 3px; }
#tip .stat { display: flex; justify-content: space-between; gap: 12px; }
#tip .up { color: #7fd08a; } #tip .dn { color: #e0705f; } #tip .eq { color: #8a8a7a; }

/* ---------- panels ---------- */
.panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, 92vw); max-height: 86vh; overflow-y: auto;
  background: rgba(13,14,19,.97); border: 2px solid #4a4438;
  box-shadow: 0 12px 48px rgba(0,0,0,.8), inset 0 0 40px rgba(0,0,0,.4);
  z-index: 30; padding: 12px 14px;
}
.phead { display: flex; justify-content: space-between; align-items: center; font-size: 20px; letter-spacing: 3px; color: #e8c860; border-bottom: 1px solid #33302a; padding-bottom: 6px; margin-bottom: 10px; }
.pclose { cursor: pointer; color: #8a8a7a; font-size: 16px; padding: 0 4px; }
.pclose:hover { color: #f0e8d0; }
.pfoot { margin-top: 8px; font-size: 13px; color: #6a6a5a; text-align: center; }
.eqRow { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.eqSlot { width: 52px; height: 52px; border: 2px solid #6a5a30; background: #171410; display: flex; align-items: center; justify-content: center; }
.eqSlot canvas { image-rendering: pixelated; width: 36px; height: 36px; }
#eqInfo { font-size: 16px; line-height: 1.4; }
#eqInfo .rar { font-size: 13px; }
#invGrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.icell {
  aspect-ratio: 1; background: #15161b; border: 2px solid #2c2e36; position: relative;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icell:hover { border-color: #6a6a5a; background: #1c1e24; }
.icell canvas { image-rendering: pixelated; width: 26px; height: 26px; }
.icell.equipped { border-color: #e8c860; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  flex: 1; background: #15161b; color: #9a9a8a; border: 2px solid #2c2e36;
  font: inherit; font-size: 17px; letter-spacing: 3px; padding: 5px 0; cursor: pointer;
}
.tab.on { color: #e8c860; border-color: #6a5a30; background: #1c1a14; }
.srow { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-bottom: 1px solid #26262a; font-size: 16px; }
.srow canvas { image-rendering: pixelated; width: 26px; height: 26px; flex: none; }
.srow .sinfo { flex: 1; line-height: 1.3; }
.srow .sinfo small { display: block; color: #8a8a7a; font-size: 14px; }
.buybtn {
  background: #2a2416; color: #e8c860; border: 2px solid #6a5a30; font: inherit;
  font-size: 15px; padding: 3px 10px; cursor: pointer; white-space: nowrap;
}
.buybtn:hover:not(:disabled) { background: #3a301c; }
.buybtn:disabled { opacity: .35; cursor: default; }
.qbar { height: 6px; background: #22242a; margin-top: 3px; }
.qbar i { display: block; height: 100%; background: #7fb8e8; }
.qrow { padding: 7px 6px; border-bottom: 1px solid #26262a; font-size: 16px; }
.qrow .qtop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qrow.done .qtxt { color: #7fd08a; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,7,10,.88);
}
.tinner { text-align: center; max-width: 520px; padding: 20px; }
.tinner h1 { font-size: 52px; letter-spacing: 14px; color: #e8c860; text-shadow: 0 0 24px rgba(232,200,96,.25), 3px 3px 0 #2a2010; margin-bottom: 6px; }
.tinner .sub { font-size: 18px; letter-spacing: 6px; color: #7a8a7a; margin-bottom: 22px; }
.tinner .lore { font-size: 17px; color: #9a9a8a; line-height: 1.7; margin-bottom: 22px; }
.ctrls { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: 15px; color: #8a8a7a; margin-bottom: 28px; }
.ctrls b { color: #d8d2c0; }
.bigbtn {
  display: block; margin: 0 auto 10px; background: #2a2416; color: #e8c860;
  border: 2px solid #8a6a30; font: inherit; font-size: 24px; letter-spacing: 8px;
  padding: 10px 44px; cursor: pointer; transition: all .15s;
}
.bigbtn:hover { background: #3a301c; box-shadow: 0 0 20px rgba(232,200,96,.2); }
.bigbtn.ghost { font-size: 17px; letter-spacing: 4px; color: #8a8a7a; border-color: #4a4438; padding: 7px 30px; }
#bestDepth { margin-top: 14px; color: #5a6a5a; font-size: 15px; letter-spacing: 2px; }
#endStats { font-size: 18px; color: #b0a890; line-height: 2; margin-bottom: 24px; }
#endStats b { color: #e8c860; }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .45s; z-index: 40; }
#fade.on { opacity: 1; pointer-events: auto; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.5) 100%); z-index: 5; }

@media (pointer: coarse) { #dashBtn { display: flex !important; } }
@media (max-width: 720px) {
  .tinner h1 { font-size: 36px; letter-spacing: 8px; }
  #invGrid { grid-template-columns: repeat(6, 1fr); }
}
