html, body { margin: 0; height: 100%; background: #0d0814; overflow: hidden; }
body { color: #fff; -webkit-tap-highlight-color: transparent; }
#wrap { position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; }
#stage { position: absolute; left: 50%; top: 50%; width: 960px; height: 540px; transform-origin: 50% 50%; overflow: hidden; background: #1a0f22; }
#game { position: absolute; left: 0; top: 0; width: 960px; height: 540px; display: block; }
#ui, #modals { position: absolute; inset: 0; pointer-events: none; }
#ui > *, #modals > * { pointer-events: auto; }
#ui .passive, #ui #bhud { pointer-events: none; }
button { font-family: inherit; color: inherit; -webkit-user-select: none; user-select: none; touch-action: manipulation; }

/* ---------- shared ---------- */
.panel {
  background: linear-gradient(160deg, rgba(48, 16, 54, 0.88), rgba(18, 10, 30, 0.88));
  border: 2px solid #ffb238; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}
.btn {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  min-height: 60px; padding: 8px 22px; border-radius: 12px; cursor: pointer;
  border: 3px solid #ffb238; background: linear-gradient(180deg, #4a1a4f, #24102e);
  font-size: 24px; font-weight: 900; letter-spacing: 1px; color: #fff;
  text-shadow: 0 2px 0 #1a0f22; box-shadow: 0 5px 0 #120814; transition: transform .08s, filter .08s;
}
.btn.primary { background: linear-gradient(180deg, #ff8a3c, #e0402c); border-color: #ffe08a; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #120814; }
.focus-on .nav-focus { outline: 4px solid #fff; outline-offset: 3px; filter: brightness(1.15); }
@media (hover: hover) { .btn:hover, .act:hover, .card:hover { filter: brightness(1.15); } }
.bar { position: relative; flex: 1; height: 14px; border-radius: 7px; background: rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.18); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; transition: width .4s; }

/* ---------- raise screen ---------- */
.hud-top { position: absolute; left: 14px; top: 12px; width: 340px; padding: 8px 14px; }
.ht-row { display: flex; align-items: center; gap: 10px; }
.ht-row + .ht-row { margin-top: 6px; }
.ht-week { font-size: 24px; font-weight: 900; color: #ffd23f; text-shadow: 0 2px 0 #000; white-space: nowrap; }
.ht-money { margin-left: auto; font-size: 22px; font-weight: 900; color: #7dffa0; text-shadow: 0 2px 0 #000; white-space: nowrap; }
.ht-lbl { font-size: 20px; font-weight: 700; white-space: nowrap; }
.ht-row b { font-size: 20px; min-width: 40px; text-align: right; }
.bar.stam > i { background: linear-gradient(90deg, #ff5a3c, #ffd23f, #7dffa0); background-size: 300px 100%; }
.statpanel { position: absolute; left: 14px; top: 96px; width: 300px; padding: 10px 14px 12px; }
.rank { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 2px dashed rgba(255, 178, 56, 0.4); }
.rank-lbl { font-size: 20px; font-weight: 700; color: #ffcf9a; white-space: nowrap; }
.rank-val { font-size: 24px; font-weight: 900; color: #ff8a3c; text-shadow: 0 2px 0 #000; white-space: nowrap; transform: skewX(-8deg); padding-right: 6px; }
.srow { display: flex; align-items: center; gap: 10px; height: 38px; }
.sname { width: 92px; font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow b { width: 40px; text-align: right; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 #000; }
.skills-btn { width: 100%; margin-top: 10px; min-height: 56px; font-size: 22px; }
.next-fight { margin-top: 10px; font-size: 18px; font-weight: 700; color: #ff9d8a; text-align: center; }
.acts { position: absolute; right: 14px; top: 96px; width: 262px; display: flex; flex-direction: column; gap: 6px; }
.act {
  --c: #ffb238; position: relative; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 10px 0 8px;
  box-sizing: border-box; border-radius: 10px; cursor: pointer; text-align: left;
  border: 2px solid rgba(255, 255, 255, 0.16); border-left: 7px solid var(--c);
  background: linear-gradient(100deg, rgba(40, 14, 48, 0.92), rgba(18, 10, 30, 0.86));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); transition: transform .1s;
}
.act:active { transform: translateX(-4px) scale(.98); }
.act.nav-focus { border-color: var(--c); border-left-width: 7px; outline: none; transform: translateX(-6px); box-shadow: 0 0 0 3px #fff, 0 3px 0 rgba(0,0,0,.45); }
.act.disabled { opacity: 0.55; }
.act .ico { flex: 0 0 34px; height: 34px; color: var(--c); }
.act .ico svg { width: 34px; height: 34px; fill: currentColor; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)); }
.act-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.act-name { font-size: 20px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 #000; }
.act-sub { display: flex; gap: 6px; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.act-sub em { font-style: normal; }
.act-sub .cost { margin-left: auto; font-style: normal; color: #ffb0a0; }
.act-sub .cost.plus { color: #7dffa0; }
.act-sub .cost.bad { color: #ff4a4a; }
.quip {
  position: absolute; left: 50%; top: 22px; transform: translateX(-30%); max-width: 300px; padding: 10px 16px;
  background: #fff; color: #1a0f22; border-radius: 16px; font-size: 20px; font-weight: 900; text-align: center;
  border: 3px solid #1a0f22; box-shadow: 0 4px 0 rgba(0,0,0,.4); animation: quipIn .35s ease-out;
}
.quip::after { content: ""; position: absolute; left: 34%; bottom: -16px; border: 9px solid transparent; border-top: 12px solid #1a0f22; }
@keyframes quipIn { from { transform: translateX(-30%) scale(0.6); opacity: 0; } to { transform: translateX(-30%) scale(1); opacity: 1; } }

/* ---------- activity ---------- */
.act-banner { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: 620px; padding: 10px 20px 12px; text-align: center; animation: dropIn .4s ease-out; }
.ab-name { font-size: 30px; font-weight: 900; color: #ffd23f; text-shadow: 0 3px 0 #000; transform: skewX(-8deg); }
.ab-fl { font-size: 20px; margin-top: 4px; line-height: 1.35; }
.deltas { position: absolute; right: 20px; top: 132px; width: 240px; padding: 10px 14px; }
.drow { display: flex; justify-content: space-between; font-size: 24px; font-weight: 900; padding: 4px 0; opacity: 0; transform: translateX(40px); transition: opacity .25s, transform .25s; text-shadow: 0 2px 0 #000; }
.drow.show { opacity: 1; transform: none; }
.tired { position: absolute; left: 50%; top: 128px; transform: translateX(-50%) rotate(-3deg); font-size: 24px; font-weight: 900; color: #ff6a5a; text-shadow: 0 3px 0 #000; white-space: nowrap; }
.cont { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: 260px; opacity: 0; transition: opacity .3s; }
.cont.show { opacity: 1; }
.cont:active { transform: translateX(-50%) translateY(3px); }
@keyframes dropIn { from { transform: translate(-50%, -40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- select ---------- */
.sel-title { position: absolute; left: 80px; right: 80px; top: 16px; text-align: center; font-size: 34px; font-weight: 900; color: #ffd23f; text-shadow: 0 3px 0 #1a0f22, 0 0 12px rgba(0,0,0,.6); transform: skewX(-6deg); }
.sel-hint { position: absolute; left: 0; right: 0; top: 64px; text-align: center; font-size: 20px; font-weight: 700; text-shadow: 0 2px 0 #000; padding: 0 100px; }
.card {
  position: absolute; top: 104px; width: 290px; height: 410px; border-radius: 18px; cursor: pointer; padding: 0;
  border: 3px solid rgba(255, 178, 56, 0.7); background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.0) 55%, rgba(26,15,34,0.92) 74%);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5); transition: transform .15s, border-color .15s;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; box-sizing: border-box; padding-bottom: 14px;
}
.card.nav-focus, .card:hover { border-color: #fff; transform: translateY(-6px); outline: none; }
.card-name { font-size: 34px; font-weight: 900; color: #ffd23f; text-shadow: 0 3px 0 #000; }
.card-desc { font-size: 19px; font-weight: 700; padding: 4px 16px 0; text-align: center; line-height: 1.3; }

/* ---------- modal ---------- */
.modal-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10, 4, 18, 0.5); animation: fadeIn .2s; }
.modal { width: 600px; max-width: 92%; padding: 20px 28px 22px; text-align: center; animation: popIn .3s cubic-bezier(.2,1.4,.4,1); }
.modal.wide { width: 900px; padding: 16px 20px 18px; }
.m-title { font-size: 32px; font-weight: 900; color: #ffd23f; text-shadow: 0 3px 0 #000; transform: skewX(-6deg); }
.m-text { font-size: 22px; line-height: 1.45; margin-top: 10px; }
.m-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.chip { --c: #ffb238; font-size: 21px; font-weight: 900; padding: 4px 12px; border-radius: 20px; border: 2px solid var(--c); color: var(--c); background: rgba(0,0,0,.35); }
.m-btns { display: flex; justify-content: center; gap: 16px; margin-top: 18px; }
.m-btns .btn { min-width: 200px; }
.modal.skill { border-color: #ffe08a; background: radial-gradient(circle at 50% 0%, rgba(255, 200, 80, 0.35), rgba(30, 12, 40, 0.92) 70%); }
.m-skillname { font-size: 46px; font-weight: 900; margin-top: 8px; color: #fff; text-shadow: 0 0 18px #ffb238, 0 4px 0 #8a3a00; transform: skewX(-8deg); }
.modal.fight { border-color: #ff5a3c; background: linear-gradient(160deg, rgba(90, 10, 20, 0.95), rgba(20, 6, 16, 0.95)); }
.modal.fight .m-title { color: #ff5a3c; font-size: 38px; }
.skgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.sk { border-radius: 10px; padding: 8px 8px; min-height: 104px; box-sizing: border-box; border: 2px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.35); text-align: left; }
.sk.on { border-color: #ffd23f; background: linear-gradient(160deg, rgba(255, 178, 56, 0.28), rgba(0,0,0,0.35)); }
.sk-n { font-size: 20px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk.on .sk-n { color: #ffd23f; }
.sk-d { font-size: 17px; line-height: 1.25; margin-top: 3px; color: #e8d8f0; }
.sk-r { font-size: 17px; margin-top: 3px; color: #ff9d8a; font-weight: 700; }
.sk.on .sk-r { color: #7dffa0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- battle HUD ---------- */
.bh { position: absolute; top: 10px; width: 370px; padding: 6px 12px 8px; }
.bh-l { left: 14px; }
.bh-r { left: 466px; border-color: #ff5a3c; }
.bh-name { font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpbar { position: relative; height: 22px; margin-top: 4px; border-radius: 6px; background: rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.25); overflow: hidden; }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; }
.hpbar .lag { background: #fff4b0; }
.hpbar .hp { background: linear-gradient(180deg, #7dffa0, #22b35a); }
.hpbar.enemy .hp { background: linear-gradient(180deg, #ff8a6a, #d6302a); }
.hpbar b { position: absolute; right: 8px; top: 0; font-size: 16px; line-height: 22px; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.gbar { position: relative; height: 18px; margin-top: 5px; border-radius: 6px; background: rgba(0,0,0,.6); border: 2px solid rgba(255,178,56,.4); overflow: hidden; }
.gbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ff8a3c, #ffd23f); }
.gbar span { position: absolute; left: 8px; top: 0; font-size: 14px; line-height: 18px; font-weight: 900; text-shadow: 0 1px 2px #000; }
.gbar.full { border-color: #fff; animation: gpulse .5s infinite alternate; }
@keyframes gpulse { from { box-shadow: 0 0 4px #ffb238; } to { box-shadow: 0 0 16px #ffd23f; } }
.bh-flinch { font-size: 16px; color: #e0a8ff; margin-top: 4px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-flinch:empty { display: none; }
.bh-hint { position: absolute; left: 0; right: 0; top: 122px; margin: 0 auto; width: fit-content; max-width: 860px; box-sizing: border-box; text-align: center; font-size: 19px; font-weight: 700; padding: 6px 16px; border-radius: 10px; background: rgba(10, 4, 18, 0.7); text-shadow: 0 2px 0 #000; transition: opacity .5s; line-height: 1.5; }
.bh-hint .kc { display: inline-block; min-width: 18px; padding: 0 7px; margin: 0 3px; border-radius: 6px; background: #ffb238; color: #1a0f22; text-shadow: none; font-weight: 900; line-height: 1.3; box-shadow: 0 2px 0 #7a3a00; }
.bh-hint .gap { display: inline-block; width: 16px; }

/* ---------- ending ---------- */
.end { position: absolute; right: 30px; top: 40px; width: 470px; padding: 18px 24px 20px; text-align: center; animation: popIn .5s; }
.end-lbl { font-size: 20px; font-weight: 700; color: #ffcf9a; letter-spacing: 4px; }
.end-title { font-size: 44px; font-weight: 900; color: #ffd23f; text-shadow: 0 4px 0 #8a3a00, 0 0 20px rgba(255,178,56,.6); transform: skewX(-8deg); margin: 4px 0 8px; }
.end-d { font-size: 20px; line-height: 1.45; margin: 0 0 12px; text-align: left; }
.end-sum { font-size: 20px; font-weight: 700; line-height: 1.6; color: #ffe; }
.end .btn { margin: 14px auto 0; width: 260px; }

/* ---------- overlays ---------- */
#cutscene { position: absolute; inset: 0; display: none; background: #000 url(../assets/title-bg.png) center / cover no-repeat; }
#cutscene.on { display: block; }
#cutscene video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#skipBtn { position: absolute; right: 18px; top: 16px; min-width: 120px; min-height: 60px; padding: 8px 18px; border-radius: 30px; border: 3px solid #ffb238; background: rgba(20, 8, 26, 0.75); font-size: 22px; font-weight: 900; cursor: pointer; }
#subtitle { position: absolute; left: 0; right: 0; bottom: 26px; margin: 0 auto; width: fit-content; max-width: 800px; box-sizing: border-box; padding: 8px 20px; border-radius: 10px; background: rgba(10, 4, 18, 0.78); font-size: 22px; font-weight: 700; text-align: center; opacity: 0; transition: opacity .25s; pointer-events: none; text-shadow: 0 2px 0 #000; }
#subtitle.on { opacity: 1; }
#toast { position: absolute; left: 0; right: 0; top: 200px; margin: 0 auto; width: fit-content; max-width: 700px; box-sizing: border-box; padding: 10px 22px; border-radius: 12px; background: rgba(200, 30, 30, 0.92); font-size: 24px; font-weight: 900; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; border: 2px solid #fff; }
#toast.on { opacity: 1; }
#fade { position: absolute; inset: 0; background: #0d0814; opacity: 0; transition: opacity .25s; pointer-events: none; }
#fade.on { opacity: 1; pointer-events: auto; }
