/* ==========================================================================
   REAL BRAVE (RB) — styles
   ========================================================================== */
:root {
  --gold: #ffb703; --teal: #06d6a0; --red: #ef476f;
  --ink: #0b1020; --panel: rgba(13, 19, 40, .92); --line: #2e3d75;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--ink); font-family: 'Segoe UI', system-ui, sans-serif; color: #eef2ff; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ------------------------ full screens ------------------------ */
.screen {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  background: radial-gradient(ellipse at 50% -10%, #1c2c5e 0%, #0b1020 65%);
  padding: 24px 14px;
}
.menu-card {
  width: 100%; max-width: 460px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 22px; padding: 28px 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6); backdrop-filter: blur(8px);
  margin: auto;
}
.title { font-size: 44px; text-align: center; letter-spacing: 3px; text-shadow: 0 4px 24px rgba(255,183,3,.35); }
.title span { color: var(--gold); }
.subtitle { text-align: center; color: #93a0c4; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; margin: 4px 0 22px; }
.step h3 { margin-bottom: 12px; font-size: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: #93a0c4; font-size: 14px;
}
.tab.active { background: rgba(255,183,3,.14); color: var(--gold); border-color: var(--gold); }
.menu-card input {
  width: 100%; padding: 13px 15px; margin-bottom: 10px; font-size: 16px;
  border-radius: 12px; border: 1px solid var(--line); background: #0d1430; color: #fff; outline: none;
}
.menu-card input:focus { border-color: var(--teal); }
.hint { font-size: 12.5px; color: #93a0c4; margin: 6px 0 14px; line-height: 1.5; }
.err { font-size: 13px; color: var(--red); margin-bottom: 8px; min-height: 16px; }
.big-btn {
  width: 100%; padding: 15px; font-size: 17px; font-weight: 700; border: none;
  border-radius: 14px; background: linear-gradient(135deg, var(--gold), #fb8500);
  color: #1a1200; box-shadow: 0 8px 26px rgba(255,183,3,.35); transition: transform .12s;
}
.big-btn:active { transform: scale(.97); }
.big-btn:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
.credits { text-align: center; font-size: 11.5px; color: #6b7699; margin-top: 18px; }
.credits a { color: var(--teal); text-decoration: none; }

/* character grid */
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.char {
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center;
  background: #0d1430; color: #eef2ff; transition: transform .12s, border-color .12s;
}
.char.active { border-color: var(--gold); transform: scale(1.05); background: rgba(255,183,3,.08); }
.char .swatch { width: 38px; height: 38px; border-radius: 10px; margin: 0 auto 6px; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.char b { display: block; font-size: 13px; }
.char i { font-size: 10px; color: #93a0c4; font-style: normal; }
.char.locked { opacity: .45; }

/* location */
.loc-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.loc-presets button {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: #0d1430; color: #c9d4f5; font-size: 13px;
}
.loc-presets button.active { border-color: var(--teal); color: var(--teal); background: rgba(6,214,160,.1); }
.loc-search { display: flex; gap: 8px; }
.loc-search input { flex: 1; margin-bottom: 0; }
.loc-search button { width: 52px; border-radius: 12px; border: 1px solid var(--line); background: #0d1430; font-size: 18px; }
.loc-preview { display: flex; gap: 14px; margin-top: 14px; align-items: center; }
.loc-preview img { width: 110px; height: 110px; border-radius: 14px; border: 1px solid var(--line); object-fit: cover; }
.loc-preview b { display: block; font-size: 15px; }
.loc-preview span { font-size: 12px; color: #93a0c4; display: block; margin: 4px 0; }
.loc-preview em { font-size: 10px; color: #6b7699; font-style: normal; }
.lobby { margin: 14px 0; }
.lobby .world-row {
  display: flex; justify-content: space-between; padding: 9px 13px; border-radius: 10px;
  background: #0d1430; border: 1px solid var(--line); margin-bottom: 6px; font-size: 13px;
  cursor: pointer;
}
.lobby .world-row:hover { border-color: var(--teal); }
.lobby .world-row span { color: var(--teal); }
.lobby-title { font-size: 12px; color: #93a0c4; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }

/* ------------------------ HUD ------------------------ */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }
.hud-top { display: flex; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 12px 0; gap: 10px; }
.hud-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; font-size: 13px; min-width: 180px;
}
.hud-right { text-align: right; }
.hud-line { margin: 2px 0; white-space: nowrap; }
.hud-line.stage { color: var(--gold); font-size: 11.5px; }
.hp-bar { position: relative; height: 16px; background: #321; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
#hpFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ef476f, #ff8fa3); transition: width .25s; }
#hpText { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; font-weight: 700; }
.xp-bar { height: 5px; background: #1a2348; border-radius: 3px; overflow: hidden; margin-top: 5px; }
#xpFill { height: 100%; width: 0; background: var(--teal); transition: width .3s; }

.hotbar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 7px;
}
.slot {
  width: 52px; height: 52px; font-size: 24px; border-radius: 13px;
  border: 2px solid var(--line); background: var(--panel); color: #fff;
}
.slot.active { border-color: var(--gold); box-shadow: 0 0 16px rgba(255,183,3,.45); }

/* mobile joystick & actions */
#joyZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 55%; pointer-events: auto; display: none; }
#lookZone { position: absolute; right: 0; bottom: 0; width: 55%; height: 70%; pointer-events: auto; display: none; }
#joyBase {
  position: absolute; left: 36px; bottom: 110px; width: 116px; height: 116px;
  border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25);
}
#joyStick {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px;
  border-radius: 50%; background: rgba(255,255,255,.35);
}
.mob-actions { position: absolute; right: 18px; bottom: 110px; display: none; flex-direction: column; gap: 14px; align-items: center; }
.act {
  width: 62px; height: 62px; border-radius: 50%; font-size: 26px;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3); color: #fff;
}
.act.big { width: 84px; height: 84px; font-size: 36px; background: rgba(255,183,3,.25); border-color: var(--gold); }
body.touch #joyZone, body.touch #lookZone { display: block; }
body.touch .mob-actions { display: flex; }
body.touch #crosshair { display: none; }

#crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 22px; color: rgba(255,255,255,.7); text-shadow: 0 1px 4px #000;
}

#chatLog {
  position: absolute; left: 12px; bottom: 84px; max-width: 64vw; font-size: 12.5px;
  display: flex; flex-direction: column; gap: 3px;
}
#chatLog div { background: rgba(0,0,0,.45); padding: 4px 9px; border-radius: 8px; max-width: 100%; }
#chatLog b { color: var(--gold); }
#chatLog .sys { color: var(--teal); }
#chatBox {
  position: absolute; left: 12px; bottom: 84px; display: flex; gap: 6px; pointer-events: auto;
}
#chatBox input { width: min(300px, 60vw); padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: #fff; outline: none; }
#chatBox button { width: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--teal); font-size: 17px; }

#toast {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--gold); color: var(--gold);
  padding: 10px 22px; border-radius: 999px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .3s; white-space: nowrap; max-width: 92vw; text-overflow: ellipsis; overflow: hidden;
}
#toast.show { opacity: 1; }

/* shop */
.shop-card h2 { margin-bottom: 4px; }
.shop-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; margin-bottom: 8px;
  background: #0d1430; border: 1px solid var(--line); border-radius: 13px;
}
.shop-item .ic { font-size: 28px; }
.shop-item .nm { flex: 1; }
.shop-item .nm b { display: block; font-size: 14px; }
.shop-item .nm i { font-size: 11.5px; color: #93a0c4; font-style: normal; }
.shop-item button {
  padding: 8px 14px; border-radius: 10px; border: none; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--gold), #fb8500); color: #1a1200;
}
.shop-item button:disabled { filter: grayscale(1) brightness(.55); }
.shop-item.owned button { background: var(--teal); }

/* help widget */
.help-card { max-width: 520px; }
.help-card h2 { margin-bottom: 12px; }
.help-goal {
  background: rgba(255,183,3,.08); border: 1px solid rgba(255,183,3,.35);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; margin-bottom: 14px;
}
.help-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.help-table th {
  text-align: left; font-size: 11px; color: #93a0c4; text-transform: uppercase;
  letter-spacing: 1px; padding: 8px 10px 4px;
}
.help-table td { padding: 6px 10px; font-size: 13.5px; border-top: 1px solid #1d2a55; }
.help-table td:first-child { white-space: nowrap; }
.key {
  display: inline-block; background: #1b2547; border: 1px solid #34406b; border-bottom-width: 3px;
  border-radius: 7px; padding: 2px 9px; font-size: 12px; font-weight: 700; margin: 1px;
}
.help-tips { font-size: 13px; color: #c9d4f5; margin-bottom: 16px; }
.help-tips ul { margin: 8px 0 0 20px; line-height: 1.7; }
.death-card { text-align: center; }
.death-card h2 { font-size: 30px; margin-bottom: 10px; }
.death-card p { color: #93a0c4; margin-bottom: 20px; }

@media (max-width: 560px) {
  .hud-card { min-width: 0; font-size: 11.5px; padding: 8px 10px; }
  .slot { width: 44px; height: 44px; font-size: 20px; }
  .title { font-size: 36px; }
}
