/* SLAY THE SPIRE II // NEON ASCENSION — production theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #060a13;
  --panel: rgba(13, 20, 36, .92);
  --panel2: #111a30;
  --line: #1e3050;
  --cyan: #16e0ff;
  --magenta: #ff2e88;
  --gold: #ffd257;
  --green: #4dffa6;
  --red: #ff3860;
  --text: #cfe3ff;
  --dim: #6f87ad;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}
button { font-family: inherit; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.spacer { flex: 1; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

.btn {
  background: linear-gradient(180deg, #14213c, #0c1428);
  color: var(--cyan);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--cyan); box-shadow: 0 0 12px rgba(22, 224, 255, .35); transform: translateY(-1px); }
.btn:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }
.btn.gold { color: var(--gold); }
.btn.gold:hover { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 87, .35); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); box-shadow: 0 0 12px rgba(255, 56, 96, .35); }
.btn.big { font-size: 17px; padding: 13px 34px; }
.btn.mini { font-size: 11px; padding: 5px 10px; }
.kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 10px; color: var(--dim); }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; overflow-y: auto;
}
.title-block { text-align: center; }
.neon-title {
  font-size: clamp(30px, 5.6vw, 60px); letter-spacing: 6px; color: #fff;
  text-shadow: 0 0 24px var(--cyan), 0 0 60px rgba(22, 224, 255, .4);
}
.neon-sub {
  font-size: clamp(14px, 2.2vw, 22px); color: var(--magenta); letter-spacing: 10px;
  text-shadow: 0 0 18px rgba(255, 46, 136, .6);
}
.tagline { color: var(--dim); margin-top: 10px; letter-spacing: 1px; }
.footnote { color: var(--dim); font-size: 12px; max-width: 520px; text-align: center; line-height: 1.6; }
.footnote b { color: var(--cyan); }

.home-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 30px; display: flex; flex-direction: column; gap: 12px; width: min(420px, 92vw);
  box-shadow: 0 0 40px rgba(22, 224, 255, .12);
}
.home-card label { font-size: 11px; letter-spacing: 3px; color: var(--dim); }
.home-card input, .join-row input, #chat-input {
  background: #0a101f; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); padding: 10px 12px; font-size: 16px; letter-spacing: 2px; outline: none; width: 100%;
}
.home-card input:focus, .join-row input:focus, #chat-input:focus { border-color: var(--cyan); }
.home-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.join-row { display: flex; gap: 8px; }
.join-row input { width: 110px; text-transform: uppercase; text-align: center; }
.join-row .btn { flex: 1; }
.err-line { color: var(--red); font-size: 13px; min-height: 17px; }

/* ---------- lobby ---------- */
.lobby-code { font-size: 17px; letter-spacing: 2px; }
.lobby-code b { color: var(--gold); font-size: 24px; letter-spacing: 8px; }
.lobby-players { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.lobby-seat {
  width: 150px; padding: 14px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.lobby-seat .seat-art { font-size: 34px; }
.lobby-seat canvas, .class-card canvas { border-radius: 10px; display: block; margin: 0 auto 4px; max-width: 100%; }
.map-node canvas { pointer-events: none; vertical-align: middle; }
.pframe .pf-art canvas { display: block; }
.lobby-seat .seat-name { font-size: 14px; margin: 6px 0 2px; }
.lobby-seat .seat-cls { font-size: 11px; letter-spacing: 2px; }
.lobby-seat.empty { opacity: .35; border-style: dashed; }
.lobby-seat.leader { border-color: var(--gold); }
.section-label { letter-spacing: 4px; color: var(--dim); font-size: 13px; }
.class-grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.class-card {
  width: 205px; padding: 16px; cursor: pointer; text-align: center;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; transition: all .15s;
}
.class-card:hover { transform: translateY(-3px); }
.class-card.sel { box-shadow: 0 0 22px rgba(22, 224, 255, .35); }
.class-card .cc-art { font-size: 40px; }
.class-card .cc-name { font-size: 17px; letter-spacing: 3px; margin: 8px 0 4px; }
.class-card .cc-hp { font-size: 12px; color: var(--red); margin-bottom: 6px; }
.class-card .cc-tag { font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.lobby-bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.asc-row { display: flex; gap: 6px; align-items: center; font-size: 12px; letter-spacing: 2px; color: var(--dim); }
.asc-row button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--dim); cursor: pointer;
}
.asc-row button.sel { border-color: var(--magenta); color: var(--magenta); box-shadow: 0 0 8px rgba(255, 46, 136, .5); }

/* ---------- HUD ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  background: linear-gradient(180deg, rgba(10, 14, 26, .95), rgba(10, 14, 26, .75));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tb-act { color: var(--cyan); letter-spacing: 2px; font-size: 12px; }
.tb-floor { color: var(--dim); font-size: 12px; }
#party-frames { display: flex; gap: 8px; }
.pframe {
  display: flex; align-items: center; gap: 7px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 9px; min-width: 150px; position: relative;
}
.pframe.me { border-color: var(--cyan); }
.pframe.downed { filter: grayscale(1); opacity: .6; }
.pframe.dc { opacity: .4; border-style: dashed; }
.pframe .pf-art { font-size: 20px; }
.pframe .pf-body { flex: 1; }
.pframe .pf-name { font-size: 11px; letter-spacing: 1px; display: flex; gap: 5px; align-items: center; }
.pframe .pf-name .crown { color: var(--gold); }
.pframe .pf-status { font-size: 10px; min-height: 12px; color: var(--dim); }
.hpbar { height: 9px; background: #1a0d14; border: 1px solid #3a1a26; border-radius: 5px; overflow: hidden; position: relative; margin: 2px 0; }
.hpbar .fill { height: 100%; background: linear-gradient(90deg, #b3122f, var(--red)); transition: width .25s; }
.hpbar .lbl { position: absolute; inset: 0; font-size: 8px; line-height: 9px; text-align: center; color: #fff; text-shadow: 0 1px 2px #000; }
.pframe .pf-block {
  position: absolute; top: -7px; right: -7px;
  background: #10263c; border: 1px solid var(--cyan); border-radius: 9px;
  color: var(--cyan); font-size: 10px; font-weight: 700; padding: 0 6px;
}
.pframe .pf-ready { position: absolute; bottom: -6px; right: -6px; font-size: 12px; }
.relic-row { display: flex; gap: 4px; flex-wrap: wrap; max-width: 300px; }
.relic {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: help;
}
.relic.boss { border-color: var(--magenta); }
.stim-row { display: flex; gap: 4px; }
.stim {
  width: 28px; height: 28px; border-radius: 6px;
  background: #14213c; border: 1px solid var(--green);
  color: var(--green); font-size: 13px; cursor: pointer;
}
.stim:hover { box-shadow: 0 0 10px rgba(77, 255, 166, .4); }
.stim.empty { border-color: var(--line); color: var(--line); cursor: default; }

/* ---------- combat ---------- */
#combat-ui { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#combat-ui > * { pointer-events: auto; }
#combat-hint {
  position: fixed; bottom: 268px; left: 50%; transform: translateX(-50%);
  color: var(--gold); font-size: 14px; letter-spacing: 2px; text-shadow: 0 0 8px #000;
  pointer-events: none !important;
}
.energy-orb {
  position: fixed; left: 20px; bottom: 305px;
  width: 84px; height: 84px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.85) 0%, rgba(255,255,255,0) 26%),
    radial-gradient(circle at 50% 55%, #7df3ff 0%, #22b6dd 40%, #0b6d92 68%, #052c3f 100%);
  border: 3px solid rgba(150, 240, 255, .75);
  box-shadow: 0 0 30px rgba(22, 224, 255, .55), inset 0 -10px 22px rgba(0, 18, 36, .65);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 30, 50, .9);
}
#pile-counts { position: fixed; right: 16px; bottom: 78px; display: flex; flex-direction: row; gap: 4px; }
#btn-endturn {
  position: fixed; right: 18px; bottom: 130px;
  font-size: 17px; font-weight: 800; letter-spacing: 2px;
  padding: 15px 30px; border-radius: 12px;
  color: #2a1c04;
  background: linear-gradient(180deg, #ffe9a0 0%, #f6c745 40%, #d69a20 78%, #a8720f 100%);
  border: 2px solid #ffedb0;
  box-shadow: 0 5px 0 #6b4a08, 0 0 24px rgba(255, 210, 87, .45), inset 0 1px 0 rgba(255, 255, 255, .55);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
}
#btn-endturn:hover { box-shadow: 0 7px 0 #6b4a08, 0 0 34px rgba(255, 210, 87, .75), inset 0 1px 0 rgba(255, 255, 255, .55); transform: translateY(-2px); }
#btn-endturn .kbd { border: 1px solid rgba(60, 40, 0, .55); color: rgba(60, 40, 0, .8); background: rgba(255, 255, 255, .25); }
#btn-endturn.waiting {
  color: var(--dim); border-color: var(--line);
  background: linear-gradient(180deg, #17203a, #0d1424);
  box-shadow: none; text-shadow: none;
}
#btn-endturn.waiting .kbd { display: none; }
#hand {
  position: fixed; bottom: 6px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 60px 90px 0; max-width: 100vw; z-index: 16;
}
#hand .card { transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px)) scale(.88); }
#hand .card + .card { margin-left: -34px; }
#hand .card:hover { transform: translateY(-74px) scale(1.14) rotate(0deg); z-index: 8; }
#hand .card.selected { transform: translateY(-82px) scale(1.18) rotate(0deg); z-index: 9; }
.card {
  width: 128px; height: 178px; flex-shrink: 0;
  background: linear-gradient(180deg, #131d33, #0c1322);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  position: relative;
}
.card:hover { transform: translateY(-22px) scale(1.12); z-index: 5; box-shadow: 0 8px 30px rgba(0, 0, 0, .6); }
.card.attack { border-color: #7a2033; background: linear-gradient(180deg, #1c1220, #120c16); }
.card.skill { border-color: #1c5a75; }
.card.power { border-color: #7a6420; background: linear-gradient(180deg, #1c1a10, #14120a); }
.card.rare { box-shadow: 0 0 10px rgba(255, 210, 87, .25); }
.card.selected { transform: translateY(-26px) scale(1.14); box-shadow: 0 0 22px rgba(22, 224, 255, .8); border-color: var(--cyan); z-index: 6; }
.card.unplayable { opacity: .5; }
.card .c-cost {
  position: absolute; top: -8px; left: -8px;
  width: 27px; height: 27px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6ff, #0a7a99 60%);
  border: 1px solid var(--cyan);
  color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.card .c-name { font-size: 11.5px; font-weight: 600; text-align: center; padding: 3px 0 2px; letter-spacing: .3px; }
.card .c-name.upg { color: var(--green); }
.card .c-type { font-size: 8px; text-transform: uppercase; letter-spacing: 2px; text-align: center; color: var(--dim); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.card .c-art { font-size: 26px; text-align: center; padding: 6px 0 2px; filter: drop-shadow(0 0 6px rgba(22, 224, 255, .35)); }
.card .c-desc { font-size: 10.5px; color: var(--text); text-align: center; flex: 1; display: flex; align-items: center; justify-content: center; line-height: 1.4; padding: 2px; }
.card.small { width: 112px; height: 156px; }
.card.small:hover { transform: scale(1.06); }

/* ---------- map ---------- */
#map-ui {
  position: fixed; inset: 64px 0 0 0; z-index: 14; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 10px;
}
.map-legend { text-align: center; color: var(--dim); font-size: 12.5px; padding: 10px; line-height: 1.7; }
.map-legend b { color: var(--cyan); letter-spacing: 2px; }
#map-scroll { position: relative; width: 780px; max-width: 96vw; height: 1560px; flex-shrink: 0; }
#map-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-node {
  position: absolute;
  width: 50px; height: 50px; border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--dim); font-size: 20px;
  cursor: default;
  transform: translate(-50%, -50%);
  transition: all .15s; z-index: 2;
}
.map-node.avail { border-color: var(--cyan); color: #fff; cursor: pointer; animation: pulse 1.4s infinite; }
.map-node.avail:hover { transform: translate(-50%, -50%) scale(1.18); }
.map-node.avail.notleader { cursor: default; animation: pulse-dim 2s infinite; }
.map-node.visited { border-color: var(--green); color: var(--green); opacity: .65; }
.map-node.boss { width: 72px; height: 72px; font-size: 30px; border-color: var(--magenta); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 6px rgba(22, 224, 255, .5); } 50% { box-shadow: 0 0 20px rgba(22, 224, 255, .9); } }
@keyframes pulse-dim { 0%, 100% { box-shadow: 0 0 4px rgba(22, 224, 255, .25); } 50% { box-shadow: 0 0 10px rgba(22, 224, 255, .45); } }

/* ---------- panels ---------- */
#panel-wrap {
  position: fixed; inset: 42px 0 0 0; z-index: 18; overflow-y: auto;
  display: flex; justify-content: center; align-items: flex-start; padding: 24px 12px 120px;
}
.panel-screen {
  width: min(900px, 96vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 0 50px rgba(0, 0, 0, .5);
}
.panel-screen h2 { color: var(--cyan); letter-spacing: 3px; margin-bottom: 6px; font-size: 21px; }
.panel-screen .sub { color: var(--dim); margin-bottom: 16px; line-height: 1.6; font-size: 14px; }
.reward-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.reward-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; font-size: 14px;
}
.reward-item .ico { font-size: 22px; }
.reward-item .lbl { flex: 1; line-height: 1.4; }
.card-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.shop-grid { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.shop-item { text-align: center; }
.price { color: var(--gold); font-size: 12px; margin-top: 5px; }
.sold { opacity: .28; pointer-events: none; }
.shop-relic {
  width: 148px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; cursor: pointer; text-align: center;
}
.shop-relic:hover { border-color: var(--gold); }
.shop-relic .ico { font-size: 26px; }
.shop-relic .nm { font-size: 12.5px; margin: 5px 0; }
.shop-relic .ds { font-size: 10.5px; color: var(--dim); line-height: 1.4; }
.rest-opts { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.rest-opt {
  width: 225px; padding: 24px; text-align: center;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; transition: all .15s;
}
.rest-opt:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(22, 224, 255, .3); }
.rest-opt .ico { font-size: 40px; }
.rest-opt .nm { font-size: 16px; margin: 9px 0 5px; color: var(--cyan); }
.rest-opt .ds { font-size: 12px; color: var(--dim); }
.event-choices { display: flex; flex-direction: column; gap: 9px; }
.event-choices .btn { text-align: left; line-height: 1.5; }
.ready-strip { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ready-strip .who { color: var(--dim); font-size: 12px; }
.end-title { font-size: 42px; letter-spacing: 5px; text-align: center; margin-bottom: 10px; }
.end-title.win { color: var(--green); text-shadow: 0 0 30px rgba(77, 255, 166, .7); }
.end-title.dead { color: var(--red); text-shadow: 0 0 30px rgba(255, 56, 96, .7); }
.stat-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.stat-table th, .stat-table td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.stat-table th { color: var(--dim); font-size: 11px; letter-spacing: 2px; }

/* ---------- feed / chat ---------- */
#feed {
  position: fixed; left: 10px; bottom: 8px; z-index: 22;
  width: 300px; display: flex; flex-direction: column; gap: 5px;
}
#log-lines {
  max-height: 132px; overflow-y: auto; display: flex; flex-direction: column-reverse;
  font-size: 11.5px; line-height: 1.5; text-shadow: 0 1px 3px #000;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%);
  mask-image: linear-gradient(180deg, transparent, #000 30%);
}
#log-lines .ll { color: var(--dim); }
#log-lines .ll.chat { color: var(--text); }
#log-lines .ll.chat b { color: var(--cyan); }
#log-lines .ll.warn { color: var(--gold); }
#chat-row { display: flex; gap: 5px; }
#chat-input { font-size: 12px; padding: 6px 9px; letter-spacing: 0; }

/* ---------- modal / settings ---------- */
#modal-overlay, #settings-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3, 6, 12, .84);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#modal-box {
  background: var(--panel);
  border: 1px solid var(--cyan);
  border-radius: 12px;
  padding: 20px;
  max-width: 880px; width: 100%;
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(22, 224, 255, .25);
}
#settings-overlay #modal-box { max-width: 420px; }
#modal-title { color: var(--cyan); letter-spacing: 2px; font-size: 17px; margin-bottom: 13px; }
#modal-content { overflow-y: auto; flex: 1; }
#modal-close, #settings-close { margin-top: 13px; align-self: center; }
.settings-body { display: flex; flex-direction: column; gap: 16px; padding: 8px 4px; }
.settings-body label { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: 2px; color: var(--dim); }
.settings-body input[type=range] { flex: 1; accent-color: #16e0ff; }
.settings-body .check { cursor: pointer; }

#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #14213c; border: 1px solid var(--gold); color: var(--gold);
  padding: 9px 20px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99;
}
#toast.show { opacity: 1; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }

@media (max-width: 900px) {
  .card { width: 108px; height: 152px; }
  .card .c-desc { font-size: 9.5px; }
  #feed { width: 220px; }
  .pframe { min-width: 120px; }
}
