/* RS-style interface: dark stone-brown panels with bevelled edges, yellow/orange text, black text shadows */
:root {
    --panel: #3e3529; --panel2: #2b241b; --edge: #5a4d3a; --edge-dark: #1a140e;
    --y: #ffff00; --o: #ff981f; --g: #0dc10d; --r: #ff3030; --c: #00ffff; --text: #f0e6c8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font: 13px/1.35 Arial, Helvetica, sans-serif; user-select: none; }
.hidden { display: none !important; }
.y { color: var(--y); } .o { color: var(--o); } .g { color: var(--g); } .r { color: var(--r); } .c { color: var(--c); }
.dim { color: #a89c80; } .small { font-size: 12px; } .big { font-size: 18px; }
h2, h3 { font-family: Cinzel, serif; color: var(--o); text-shadow: 1px 1px #000; margin: 4px 0 8px; }
h2 { font-size: 22px; } h3 { font-size: 16px; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font: 22px Cinzel, serif; color: var(--o); background: #120e09; z-index: 50; }

.rspanel {
    background: linear-gradient(var(--panel), var(--panel2));
    border: 3px solid var(--edge); outline: 2px solid var(--edge-dark); box-shadow: inset 0 0 0 1px #000, 0 6px 20px #000a;
    border-radius: 3px; padding: 10px;
}
.rsbtn {
    font: bold 13px Arial, sans-serif; color: var(--o); text-shadow: 1px 1px #000; cursor: pointer;
    background: linear-gradient(#5b4c38, #3a2f22); border: 2px solid #1c150d; box-shadow: inset 1px 1px #7a6a50, inset -1px -1px #241b12;
    padding: 6px 12px; border-radius: 2px; margin: 2px;
}
.rsbtn:hover:not(:disabled) { color: var(--y); background: linear-gradient(#6b5a42, #46392a); }
.rsbtn:disabled { color: #6a604c; cursor: default; }
.rsbtn.red { color: #ffb0a0; background: linear-gradient(#7a2a1a, #4a160e); }
.rsbtn.red:hover:not(:disabled) { color: #fff; }
.rsbtn.big { font-size: 18px; padding: 10px 26px; min-width: 260px; font-family: Cinzel, serif; }
.rsbtn.on { color: var(--y); }

/* ---- title */
#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6vh 0 8vh; pointer-events: none; }
#title > * { pointer-events: auto; }
.logo { text-align: center; font: 800 56px Cinzel, serif; color: #ffb000; text-shadow: 0 3px 0 #5a2a00, 0 0 30px #000, 3px 3px 2px #000; line-height: 1.05; }
.logo small { display: block; font-size: 16px; color: #e8d8a8; letter-spacing: 6px; text-transform: uppercase; }
.logo em { display: block; font: italic 16px Arial; color: #e8d8a8; margin-top: 10px; text-shadow: 1px 1px #000; }
.tbtns { display: flex; flex-direction: column; gap: 6px; }

/* ---- map */
#map { position: fixed; inset: 0; background: #12100c; }
#map-top { position: absolute; left: 0; right: 340px; top: 0; height: 46px; padding: 6px 12px; display: flex; align-items: center; gap: 10px; font-size: 15px; }
#map-top .rsbtn:first-of-type { margin-left: auto; }
#map-canvas { position: absolute; left: 0; right: 340px; top: 46px; bottom: 0; }
#map-canvas canvas { cursor: pointer; }
#side { position: absolute; right: 0; top: 0; bottom: 0; width: 340px; overflow-y: auto; }
.kpanel { border-bottom: 2px solid var(--edge); padding-bottom: 8px; margin-bottom: 8px; }
.kbtns { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.minis { display: flex; flex-wrap: wrap; gap: 2px; }
img.mini { width: 40px; height: 40px; background: #0004; border: 1px solid #000; vertical-align: middle; border-radius: 2px; }
img.mini.legend { border-color: gold; box-shadow: 0 0 6px gold; }
.roster { display: flex; flex-direction: column; gap: 4px; }
.roster.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: 52vh; overflow-y: auto; }
.mcard { display: flex; gap: 6px; padding: 4px; background: #0003; border: 1px solid #000; cursor: pointer; border-radius: 2px; }
.mcard:hover { background: #fff1; }
.mcard.sel { outline: 2px solid var(--y); background: #ffff0014; }
.mcard.tired { opacity: 0.5; }
.mcard img { width: 56px; height: 56px; background: #0005; }
.mcard .mc { flex: 1; }
.mcard b { color: var(--o); }
.lvl { color: var(--y); float: right; font-weight: bold; }
.xpb { height: 4px; background: #000; margin-top: 4px; } .xpb i { display: block; height: 100%; background: #3a8aff; }
.tbadge { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px 0 2px; border-radius: 8px; font-size: 11px; font-weight: bold; color: #000; background: var(--c); border: 1px solid #000; text-shadow: none; vertical-align: middle; line-height: 16px; }
.tbadge img { width: 14px !important; height: 14px !important; background: none !important; border: 0 !important; }
.foe { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }

/* ---- modal */
#modal-bg { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 20; }
#modal { max-width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; text-align: center; }
#modal.wide { max-width: min(1100px, 96vw); width: min(1100px, 96vw); }
#modal.tall { height: 90vh; }
#modal p { margin: 6px 0; }
.tips { text-align: left; max-width: 520px; }
.tips li { margin: 4px 0; }
.starters { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.starter { width: 200px; padding: 8px; background: #0004; border: 2px solid #000; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.starter:hover { border-color: var(--y); background: #ffff0010; }
.starter img { width: 128px; height: 128px; }
.starter b { color: var(--o); font-size: 15px; }
.minfo { display: flex; gap: 12px; text-align: left; align-items: center; }
.minfo img { width: 128px; height: 128px; background: #0005; border: 1px solid #000; }
.mvbox { margin: 8px 0; padding: 8px; background: #0003; border: 1px solid #000; }
.shape { display: inline-grid; grid-template-columns: repeat(7, 14px); gap: 1px; margin: 6px auto 0; padding: 2px; background: #000; }
.shape i { width: 14px; height: 14px; background: #3a3226; }
.shape i.me { background: #3a8aff; } .shape i.r { background: #a02818; } .shape i.o { background: #ff9a1f; } .shape i.p { background: #6a5a8a; }
.chain { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.chain div { display: flex; flex-direction: column; align-items: center; font-size: 12px; opacity: 0.7; }
.chain div.cur { opacity: 1; color: var(--y); }
.chain img { width: 64px; height: 64px; }
.guide { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.gline { display: flex; align-items: stretch; gap: 4px; background: #0003; padding: 4px; border: 1px solid #000; }
.gmon { width: 220px; display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.gmon.legend { background: #ffd70014; outline: 1px solid #a08000; }
.gmon img { width: 64px; height: 64px; }
.gmon b { color: var(--o); }
.arrow { align-self: center; text-align: center; color: var(--y); font-size: 11px; }
.gbranch { display: flex; flex-direction: column; gap: 4px; }
.gsub { display: flex; align-items: stretch; gap: 4px; border-left: 2px solid #ffff0030; }
.chain { align-items: center; flex-wrap: wrap; }
.chain .ar { color: var(--y); }
.chain .opts { display: flex; gap: 8px; padding: 4px; border: 1px dashed #ffff0050; opacity: 1; flex-direction: row; }
.tabs { position: sticky; top: -10px; background: var(--panel); padding: 4px; z-index: 1; }
table.chart { border-collapse: collapse; margin: 8px auto; font-size: 12px; }
.chart th, .chart td { border: 1px solid #000; padding: 3px 5px; min-width: 34px; text-align: center; }
.chart td.x2 { background: #1a6a1a; color: #fff; font-weight: bold; } .chart td.x05 { background: #6a1a1a; color: #ddd; }
.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shapes > div { display: flex; flex-direction: column; align-items: center; background: #0003; padding: 6px; }
#modal.evo { min-width: 400px; }
#ev-view canvas { background: radial-gradient(#4a3a28, #1a140e); border: 2px solid #000; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #000c; color: var(--y); padding: 8px 18px; border: 1px solid var(--edge); z-index: 30; font-weight: bold; }

/* ---- battle */
#battle-ui { position: fixed; inset: 0; pointer-events: none; }
#battle-ui > * { pointer-events: auto; }
#b-labels, #b-fx { position: absolute; inset: 0; pointer-events: none !important; overflow: hidden; }
#b-top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: #000a; border: 2px solid var(--edge); padding: 4px 6px 4px 14px; font: bold 16px Cinzel, serif; }
#b-turn { color: var(--y); }
#b-phase.player { color: #6cf; } #b-phase.enemy { color: #f64; }
#b-info { position: absolute; left: 10px; top: 10px; width: 260px; }
#b-info .ih b { color: var(--o); font-size: 15px; }
#b-info .hpline { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
#b-info .mv { margin-top: 6px; }
#b-info .prev { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--edge); }
.hpb { width: 40px; height: 5px; background: #300; border: 1px solid #000; }
.hpb i { display: block; height: 100%; background: #0c0; }
.hpb.big { flex: 1; height: 8px; }
#b-menu { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; min-width: 200px; }
#b-menu .rsbtn { text-align: left; }
.chatbox { position: absolute; left: 10px; bottom: 10px; width: 470px; height: 140px; overflow-y: auto; background: #d8c9a0e8; border: 3px solid var(--edge); outline: 2px solid #000; color: #000; padding: 4px 8px; font: 13px Arial; }
.chatbox .y { color: #0000ff; } .chatbox .o { color: #9a3c00; } .chatbox .r { color: #b00000; } .chatbox .c { color: #00508a; font-weight: bold; } .chatbox .g { color: #006000; font-weight: bold; } .chatbox .dim { color: #5a4a30; }
#b-help { position: absolute; bottom: 160px; left: 12px; font-size: 11px; color: #fffa; text-shadow: 1px 1px #000; pointer-events: none !important; }
.ulabel { position: absolute; left: -24px; top: -16px; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.ulabel .lv { font: bold 12px Arial; color: #fff; text-shadow: 1px 1px #000, -1px -1px #000; }
.ulabel.mine .lv { color: #8cf; } .ulabel.foe .lv { color: #f86; } .ulabel.wild .lv { color: #fe6; }
.ulabel.done { opacity: 0.45; }
.ulabel .st { font-size: 9px; margin-left: 3px; padding: 0 2px; color: #fff; }
.st.burn { background: #c40; } .st.poison { background: #70a; } .st.freeze { background: #28a; }
.hitsplat { position: absolute; left: -12px; top: -12px; width: 25px; height: 25px; background: url(../assets/sprites/hitmarks.png) -25px 0; display: grid; place-items: center; color: #fff; font: bold 12px Arial; text-shadow: 1px 1px #000; }
.hitsplat.green { background-position: -50px 0; }
.hitsplat.heal { background: none; width: auto; color: #5f5; font-size: 15px; text-shadow: 1px 1px #000, -1px -1px #000; }
.ftext { position: absolute; transform: translateX(-50%); white-space: nowrap; font: bold 16px Arial; text-shadow: 1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000; margin-left: -40px; }
.ftext.weak { color: #ff0; font-size: 19px; } .ftext.res { color: #ccc; } .ftext.crit { color: #f90; }
.ftext.burn { color: #f60; } .ftext.poison { color: #c6f; } .ftext.freeze { color: #8ef; }
.pbanner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font: 800 44px Cinzel, serif; color: #fff; text-shadow: 3px 3px 0 #000, 0 0 20px #000; pointer-events: none !important; animation: pb 1.3s ease-out forwards; background: linear-gradient(90deg, transparent, #000a 30%, #000a 70%, transparent); padding: 10px 0; }
.pbanner.player { color: #8cf; } .pbanner.enemy { color: #f86; }
.pbanner.big { animation: none; font-size: 56px; color: var(--y); }
.pbanner small { display: block; font: 18px Arial; color: #fff; }
@keyframes pb { 0% { opacity: 0; transform: scaleX(0.6); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.ab { color: #c8e0ff; } .ab b { color: #9cf; }
#b-info .ab { display: block; margin-top: 4px; }
.skills { display: flex; flex-direction: column; gap: 6px; }
.skillpick { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 8px 14px; }
.skillpick b { font-size: 15px; } .skillpick span { color: #e8dcc0; font-weight: normal; font-size: 12px; }

.x2c { color: #6f6; font-weight: bold; }
.x05c { color: #f66; font-weight: bold; }

/* ---- the 3D world map */
#map-canvas { overflow: hidden; }
#map-canvas canvas { display: block; cursor: grab; }
.wlabels { position: absolute; inset: 0; pointer-events: none; }
.wlabel { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; text-align: center; white-space: nowrap;
  padding: 2px 7px 3px; border: 1px solid #00000090; border-radius: 3px; background: #1b150ecc; color: #ffef9a; font: 600 13px Cinzel, serif;
  text-shadow: 1px 1px 0 #000; box-shadow: 0 2px 6px #0008; }
.wlabel b { display: block; font-weight: 800; }
.wlabel span { display: block; font: 11px sans-serif; color: #d8ccb0; }
.wlabel img { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }
.wlabel i { color: #ffd030; font-style: normal; }
.wlabel.mine { background: #0e2240dd; color: #9cd0ff; border-color: #3a8aff; }
.wlabel.atk { border-color: #ff3020; box-shadow: 0 0 8px #ff3020a0; }
.wlabel.sel { outline: 2px solid #ffe030; }
#b-tip { position: absolute; top: 58px; right: 12px; max-width: 290px; padding: 6px 10px; pointer-events: none; }

.legends > div { display: flex; align-items: center; gap: 5px; margin: 2px 0; font-size: 12px; }
.legends > div.got { opacity: 0.6; }
