/* styles.css: how the menus, windows and HUD look. Bright, bold and readable,
   laid over the 3D world without hiding most of it. */

:root {
  --ink: #fff8ea; --dim: #b9c6d6; --panel: rgba(10, 26, 44, 0.86); --panel2: rgba(18, 44, 70, 0.92);
  --edge: #f0c060; --edge2: #6fb7e8; --bad: #ff5a4a; --good: #6be08a; --gold: #ffd257; --sea: #0d3a5c;
  --hp: #ff4d5e; --en: #4fb3ff; --st: #ffd257; --xp: #b77bff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b2238; color: var(--ink); font-family: Nunito, system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; font-weight: 900; color: var(--ink); background: linear-gradient(#2a6da0, #174a72); border: 2px solid var(--edge2); border-radius: 10px; padding: 8px 14px; cursor: pointer; text-shadow: 0 1px 0 #0008; }
button:hover { filter: brightness(1.15); }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
button.big { background: linear-gradient(#ffb64a, #e07a1c); border-color: #ffe0a0; font-size: 1.1em; }
button.danger { background: linear-gradient(#c84040, #8a2020); border-color: #ff9a9a; }
button.on { outline: 3px solid var(--gold); }
kbd { font: 700 0.75em Nunito; background: #0006; border-radius: 4px; padding: 0 4px; margin-left: 4px; color: var(--dim); }
a { color: var(--gold); }
.small { font-size: 0.85em; } .dim { color: var(--dim); } .good { color: var(--good); } .bad { color: var(--bad); } .gold { color: var(--gold); }
.logo { font-family: Bangers, Impact, sans-serif; letter-spacing: 3px; font-size: clamp(42px, 9vw, 86px); margin: 0; color: #ffd257; text-shadow: 0 4px 0 #b4561a, 0 8px 0 #4a1e08, 0 10px 24px #000a; transform: rotate(-2deg); }
h2, h3 { font-family: Bangers, Impact, sans-serif; letter-spacing: 1.5px; font-weight: 400; margin: 0 0 8px; }

/* Loading and menus */
#loading, .screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 30; }
#loading { background: radial-gradient(circle at 50% 30%, #1f6a9a, #0a2a44 70%); }
.loadbar { width: min(420px, 80vw); height: 14px; border-radius: 8px; background: #0008; border: 2px solid var(--edge); margin: 24px 0 8px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd257, #ff8a3a); transition: width 0.2s; }
.tip { max-width: 520px; text-align: center; color: var(--dim); padding: 0 16px; }
.error { color: var(--bad); max-width: 560px; text-align: center; padding: 0 16px; font-weight: 700; }
.screen { background: linear-gradient(#0006, #000a); }
.menu-card, .create-card { background: var(--panel); border: 3px solid var(--edge); border-radius: 20px; padding: 24px 28px; text-align: center; box-shadow: 0 10px 40px #000a; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; }
.menu-card .sub { color: var(--dim); margin: 14px 0 18px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: min(280px, 80vw); margin: 0 auto; }
.links { margin-top: 16px; }
.create-card { width: min(980px, calc(100vw - 32px)); text-align: left; }
.create-grid { display: grid; grid-template-columns: 1fr 260px 1fr; gap: 14px; }
#create-preview { min-height: 320px; border-radius: 14px; background: radial-gradient(#2f7ab0, #0d3a5c); position: relative; border: 2px solid var(--edge2); }
#create-preview canvas { width: 100%; height: 100%; display: block; border-radius: 12px; }
#create-preview p { position: absolute; bottom: 4px; width: 100%; text-align: center; margin: 0; }
.create-foot { display: flex; justify-content: space-between; margin-top: 14px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-weight: 900; margin-bottom: 4px; color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; font-size: 0.9em; border-radius: 20px; background: #ffffff14; border: 2px solid #ffffff30; }
.chip.sel { border-color: var(--gold); background: #ffd25733; }
.chip.locked { opacity: 0.45; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 3px solid #fff4; }
.swatch.sel { border-color: var(--gold); transform: scale(1.12); }
.namebox { display: flex; gap: 8px; align-items: center; font-size: 1.2em; font-weight: 900; }
.desc { background: #0004; border-radius: 10px; padding: 8px 10px; color: var(--dim); font-size: 0.9em; min-height: 3em; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud .clickable { pointer-events: auto; }
#hud-tl { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; align-items: flex-start; }
#lvl { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(#ffd257, #d0801a); border: 3px solid #fff3; display: flex; align-items: center; justify-content: center; font: 900 20px Nunito; color: #3a1a00; text-shadow: none; box-shadow: 0 2px 8px #0008; }
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar { position: relative; width: min(260px, 42vw); height: 15px; border-radius: 8px; background: #000a; border: 2px solid #ffffff30; overflow: hidden; }
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; transition: transform 0.12s; }
.bar span { position: absolute; inset: 0; font: 700 11px Nunito; line-height: 11px; text-align: center; text-shadow: 0 1px 2px #000; }
.bar.hp i { background: linear-gradient(#ff7a85, var(--hp)); } .bar.en i { background: linear-gradient(#8fd0ff, var(--en)); } .bar.st i { background: linear-gradient(#ffe68a, var(--st)); }
.bar.xp { height: 8px; } .bar.xp i { background: var(--xp); } .bar.xp span { display: none; }
.bar.st { height: 10px; } .bar.st span { display: none; }
#hud-tr { position: absolute; right: 172px; top: 12px; text-align: right; text-shadow: 0 2px 3px #000; }
#crowns { font: 900 22px Nunito; display: flex; align-items: center; gap: 6px; justify-content: flex-end; color: var(--gold); }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2a0, #e0a020); border: 2px solid #8a5a10; display: inline-block; }
#score { font-weight: 700; color: var(--dim); font-size: 0.9em; }
#clock { font-size: 0.8em; color: var(--dim); }
#minimap { position: absolute; right: 12px; top: 12px; width: 150px; height: 150px; border-radius: 50%; border: 3px solid var(--edge); background: #0d3a5c; box-shadow: 0 2px 10px #0008; }
#tracker { position: absolute; right: 12px; top: 176px; width: 260px; max-width: 46vw; background: var(--panel); border-left: 4px solid var(--gold); border-radius: 8px; padding: 8px 10px; font-size: 0.88em; }
#tracker:empty { display: none; }
#tracker b { color: var(--gold); display: block; }
#tracker .step { color: var(--ink); }
#tracker .day { color: var(--dim); font-size: 0.85em; margin-top: 4px; }
#compass { position: absolute; left: 50%; top: 14px; width: 44px; height: 44px; margin-left: -22px; }
#compass i { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 26px solid var(--gold); margin: -16px 0 0 -10px; filter: drop-shadow(0 2px 2px #000); transform-origin: 50% 62%; }
#will-ind { position: absolute; left: 12px; top: 84px; display: flex; gap: 6px; }
#will-ind span { padding: 2px 8px; border-radius: 10px; font-size: 0.75em; font-weight: 900; background: #0008; border: 2px solid #fff3; }
#will-ind span.on { border-color: var(--gold); background: #ffd25740; }
#hotbar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#slots { display: flex; gap: 6px; }
.slot { pointer-events: auto; padding: 4px 10px; border-radius: 10px; background: var(--panel); border: 2px solid #fff3; font-size: 0.8em; font-weight: 900; }
.slot.sel { border-color: var(--gold); background: #4a3a10e0; }
#skills { display: flex; gap: 6px; }
.skill { position: relative; width: 62px; height: 62px; border-radius: 12px; background: var(--panel); border: 2px solid var(--edge2); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; font-size: 10px; text-align: center; line-height: 1.05; padding: 2px; }
.skill b { position: absolute; left: 4px; top: 2px; font: 900 14px Nunito; color: var(--gold); }
.skill .cd { position: absolute; left: 0; right: 0; bottom: 0; background: #000b; }
.skill .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 18px Nunito; }
.skill.locked { opacity: 0.4; }
.skill.ult { border-color: #ff70c0; }
.skill em { font-style: normal; position: relative; z-index: 1; text-shadow: 0 1px 2px #000; }
#hud-buttons { position: absolute; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
#hud-buttons button { font-size: 0.78em; padding: 4px 8px; text-align: left; position: relative; }
.dot { position: absolute; right: -4px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
#shipbar { position: absolute; bottom: 112px; left: 50%; transform: translateX(-50%); text-align: center; font-weight: 900; text-shadow: 0 1px 2px #000; }
#shipbar .bar.ship i { background: linear-gradient(#e0b070, #a07030); }
#shipbar em { display: block; font-style: normal; font-size: 0.8em; color: var(--dim); }
#bossbar { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); text-align: center; width: min(560px, 70vw); }
#bossname { font-family: Bangers, Impact; font-size: 24px; letter-spacing: 2px; color: #ffb0b0; text-shadow: 0 2px 2px #000; }
#bossbar .bar { width: 100%; height: 18px; border-color: #ff9090; }
#bossbar .bar i { background: linear-gradient(#ff6060, #b01020); }
#prompt { position: absolute; left: 50%; bottom: 196px; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--gold); border-radius: 10px; padding: 6px 14px; font-weight: 900; }
#warn { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); background: #a01818d8; border: 2px solid #ffb0b0; border-radius: 10px; padding: 6px 14px; font-weight: 900; text-align: center; animation: pulse 0.8s infinite alternate; }
@keyframes pulse { from { opacity: 0.75; } to { opacity: 1; } }
#area { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; font-family: Bangers, Impact; font-size: 46px; letter-spacing: 3px; color: #fff; text-shadow: 0 3px 0 #0a3050, 0 6px 16px #000; animation: fadeio 4s forwards; }
#area small { display: block; font: 700 16px Nunito; letter-spacing: 0; color: var(--gold); }
@keyframes fadeio { 0% { opacity: 0; } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
#banner { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); background: linear-gradient(#1c4a74f0, #0d2a44f0); border: 3px solid var(--gold); border-radius: 14px; padding: 10px 22px; text-align: center; max-width: min(620px, 90vw); animation: pop 0.25s; }
#banner h3 { font-size: 30px; color: var(--gold); margin: 0; }
#banner p { margin: 4px 0 0; color: var(--ink); }
@keyframes pop { from { transform: translateX(-50%) scale(0.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#toasts { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
.toast { background: var(--panel); border-radius: 8px; padding: 4px 12px; font-weight: 700; font-size: 0.9em; animation: fadeio 3.2s forwards; text-align: center; max-width: 80vw; }
#plates .plate { position: absolute; left: 0; top: 0; text-align: center; font: 700 11px Nunito; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.plate i { display: block; width: 70px; height: 6px; margin: 2px auto 0; background: #000a; border-radius: 3px; overflow: hidden; }
.plate b { display: block; height: 100%; background: var(--hp); }
.plate.danger span { color: #ff8080; } .plate.weak span { color: #b0b0b0; } .plate.elite span { color: #ffb050; } .plate.target i { outline: 2px solid var(--gold); }
#numbers .num { position: absolute; left: 0; top: 0; font: 900 18px Nunito; text-shadow: 0 2px 2px #000, 0 0 4px #000; pointer-events: none; white-space: nowrap; }
.num.crit { color: #ffd257; font-size: 24px; } .num.hurt { color: #ff6060; } .num.heal { color: #6be08a; } .num.info { color: #bfe8ff; font-size: 15px; } .num.xp { color: #ffd257; font-size: 14px; } .num.dot { color: #ffa070; font-size: 14px; }
#fps { position: absolute; left: 50%; bottom: 2px; font-size: 11px; color: var(--dim); }

/* Windows */
#window { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: #0006; }
.win-card { width: min(920px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px)); background: var(--panel); border: 3px solid var(--edge); border-radius: 18px; display: flex; flex-direction: column; box-shadow: 0 10px 40px #000c; }
.win-card header { display: flex; align-items: center; gap: 10px; padding: 10px 14px 6px; border-bottom: 2px solid #ffffff20; flex-wrap: wrap; }
.win-card header h2 { margin: 0; font-size: 28px; color: var(--gold); }
#win-tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
#win-tabs button { padding: 4px 10px; font-size: 0.85em; background: #ffffff10; border-color: #ffffff30; }
#win-tabs button.sel { border-color: var(--gold); background: #ffd25730; }
#win-close { padding: 4px 10px; background: #a03030; border-color: #ff9a9a; }
#win-body { flex: 1; overflow: auto; padding: 12px 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.card { background: var(--panel2); border: 2px solid #ffffff20; border-radius: 12px; padding: 8px; position: relative; }
.card.sel { border-color: var(--gold); }
.card.unknown { opacity: 0.5; }
.card h4 { margin: 0 0 2px; font-size: 0.95em; }
.card p { margin: 2px 0; font-size: 0.8em; color: var(--dim); }
.card img { width: 48px; height: 48px; float: right; margin-left: 4px; image-rendering: auto; }
.card .row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; clear: both; }
.card .row button { font-size: 0.75em; padding: 3px 8px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail { background: #0004; border-radius: 12px; padding: 10px; }
.detail h3 { color: var(--gold); font-size: 24px; }
.detail ul { margin: 4px 0; padding-left: 18px; }
.detail li { margin: 3px 0; font-size: 0.9em; }
.detail li.locked { color: #8a96a6; }
table.stats { width: 100%; border-collapse: collapse; }
table.stats td { padding: 5px 6px; border-bottom: 1px solid #ffffff15; }
table.stats td:last-child { text-align: right; }
.r-Common { color: #c8c8c8; } .r-Uncommon { color: #7ce07c; } .r-Rare { color: #5aa8ff; } .r-Epic { color: #c070ff; } .r-Legendary { color: #ffb030; } .r-Mythic { color: #ff5070; } .r-Transcendent { color: #fff; text-shadow: 0 0 6px #a0a0ff, 0 0 12px #ff3040; }
.c-beast { color: #8fd06a; } .c-shaper { color: #6ab4ff; } .c-elemental { color: #ffa040; } .c-primal { color: #d07850; } .c-mythic { color: #ff60c0; }
.dialog { display: flex; gap: 14px; }
.dialog .who { font-family: Bangers; font-size: 26px; color: var(--gold); letter-spacing: 1px; }
.dialog .line { font-size: 1.05em; background: #0004; padding: 10px 12px; border-radius: 12px; }
.opts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.opts button { text-align: left; }
.opts button small { display: block; font-weight: 400; color: var(--dim); }
.quest { border-left: 4px solid var(--edge2); padding: 6px 10px; margin-bottom: 8px; background: #0003; border-radius: 6px; }
.quest.main { border-color: var(--gold); }
.quest .steps { margin: 4px 0 0; padding-left: 18px; font-size: 0.88em; }
.quest .steps li.done { color: var(--good); text-decoration: line-through; }
.quest .steps li.now { color: var(--ink); font-weight: 700; }
.quest .steps li.later { color: #8a96a6; }
#mapcanvas { width: 100%; height: 100%; min-height: 380px; background: #0d3a5c; border-radius: 12px; display: block; }
.mapwrap { position: relative; height: 100%; }
.maplist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 14px; }
.keys div { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid #ffffff10; }
.keys button { font-size: 0.8em; padding: 2px 8px; min-width: 70px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #ffffff15; }
.set-row input[type=range] { width: 200px; }
.poster { width: 220px; background: #e8d8b0; color: #3a2210; border-radius: 6px; padding: 12px; text-align: center; font-family: Bangers; letter-spacing: 1px; box-shadow: 0 4px 12px #0008; }
.poster h3 { font-size: 34px; margin: 0; color: #3a2210; }
.poster canvas { width: 140px; height: 160px; background: #d8c8a0; border: 3px solid #3a2210; margin: 6px auto; display: block; }
.poster .bounty { font-size: 22px; }

#confirm { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: #0008; }
.confirm-card { background: var(--panel); border: 3px solid var(--edge); border-radius: 16px; padding: 18px 22px; max-width: min(420px, calc(100vw - 32px)); text-align: center; }
.confirm-card div { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
#death { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(#5a0a0a80, #000c); text-align: center; }
#death h2 { font-size: 64px; color: #ff6a6a; }

/* Touch controls */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#touch button, #touch #stick-zone, #touch #look-zone { pointer-events: auto; }
#look-zone { position: absolute; right: 0; top: 0; width: 60%; height: 100%; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 40%; height: 60%; }
#stick { position: absolute; left: 40px; bottom: 40px; width: 120px; height: 120px; border-radius: 50%; background: #ffffff18; border: 2px solid #ffffff40; pointer-events: none; display: none; }
#stick.on { display: block; }
#stick-knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: #ffffff50; }
#tbuttons { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(3, 58px); gap: 6px; }
.tb { width: 58px; height: 58px; border-radius: 50%; padding: 0; font-size: 12px; background: #1a4a72c0; }
.tb.big { background: #e07a1cd0; }
.tb.on { filter: brightness(1.5); }
#tskills { position: absolute; right: 12px; bottom: 140px; display: flex; gap: 6px; }
.tb.sk { width: 48px; height: 48px; }
#tslots { position: absolute; left: 50%; transform: translateX(-50%); top: 76px; display: flex; gap: 4px; }
.tb.sm { width: 40px; height: 34px; border-radius: 8px; font-size: 11px; }
body.touch #hud-buttons { bottom: auto; top: 120px; }
body.touch #hotbar { bottom: 200px; transform: translateX(-50%) scale(0.8); }
body.touch #skills { display: none; }

@media (max-width: 760px) {
  .create-grid { grid-template-columns: 1fr; }
  #create-preview { min-height: 200px; height: 220px; }
  .split { grid-template-columns: 1fr; }
  #minimap { width: 100px; height: 100px; }
  #hud-tr { right: 120px; }
  #tracker { top: 120px; width: 200px; font-size: 0.78em; }
  .skill { width: 50px; height: 50px; font-size: 9px; }
  #hud-buttons button kbd { display: none; }
  #area { font-size: 32px; }
}

/* Window extras */
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gold { color: var(--gold); } .good { color: var(--good); } .bad { color: #ff7a6a; }
img.inl { width: 24px; height: 24px; vertical-align: middle; }
.detail img.big { width: 72px; height: 72px; float: right; }
.opts.narrow { max-width: 360px; margin: 0 auto; }
.bar.mini { height: 12px; }
.card[data-act] { cursor: pointer; }
.fruitinfo { margin-bottom: 12px; }
