/* RPG — High-Fantasy-Wald. Mobile-first, Hochkant, ein Daumen. */
:root {
  --bg: #1c3326;
  --ink: #eaf5ec;
  --muted: #9fc4a8;
  --gold: #ffd24d;
  --heal: #5fe08a;
  --danger: #ff5468;
  --panel: rgba(10, 24, 16, 0.82);
  --warrior: #5b8fd6;
  --ranger: #57c26a;
  --mage: #9b7bff;
  --healer: #ffd27a;
  --boss: #ffbe3d;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: 'Rajdhani', system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ── HUD ────────────────────────────────────────────────────────────────── */
.hud { position: fixed; top: 0; left: 0; right: 0; padding: env(safe-area-inset-top) 10px 0; pointer-events: none; z-index: 10; }
.party {
  display: flex; gap: 6px; justify-content: center; margin-top: 8px;
  pointer-events: auto;
}
.portrait {
  position: relative; width: 68px; max-width: 22vw;
  background: var(--panel); border-radius: 12px; padding: 5px 5px 6px;
  border: 2px solid transparent; transition: border-color .12s, transform .12s;
  cursor: pointer;
}
.portrait.active { border-color: var(--pc); transform: translateY(2px) scale(1.04); box-shadow: 0 0 16px -2px var(--pc); }
.portrait.down { opacity: 0.45; filter: grayscale(0.7); }
.portrait .p-icon {
  height: 26px; display: grid; place-items: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; color: var(--pc);
}
.portrait .p-hp { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.14); overflow: hidden; margin-top: 2px; }
.portrait .p-hp-fill { height: 100%; width: 100%; background: var(--heal); transition: width .12s; }
.portrait .p-hp-fill.mid { background: var(--gold); }
.portrait .p-hp-fill.low { background: var(--danger); }
.portrait .p-name { font-size: 10px; text-align: center; color: var(--muted); margin-top: 2px; letter-spacing: .5px; text-transform: uppercase; }
.portrait .p-down { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--danger); }

.clear-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.clear-bar { width: min(72vw, 320px); height: 8px; border-radius: 6px; background: rgba(0,0,0,0.35); overflow: hidden; border: 1px solid rgba(255,255,255,0.08); }
.clear-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #57c26a, #9be36f); transition: width .3s ease; }
.clear-fill.boss { background: linear-gradient(90deg, #ff5468, #ffbe3d); }
.clear-label { font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: 1px; text-transform: uppercase; }

/* ── Run-Events (§0.2 M10) ──────────────────────────────────────────────── */
.event-hud { margin-top: 4px; }
.event-compass {
  position: fixed; z-index: 12; width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--ec, var(--gold)); color: var(--ec, var(--gold));
  display: grid; place-items: center; font-size: 16px; pointer-events: none;
  box-shadow: 0 0 16px -2px var(--ec, var(--gold)); animation: compassPulse 1s ease-in-out infinite;
}
@keyframes compassPulse { 0%,100% { opacity: 0.8; } 50% { opacity: 1; } }

/* ── Steuer-Dreieck ─────────────────────────────────────────────────────── */
.controls { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.joy {
  position: absolute; width: 118px; height: 118px; margin: -59px 0 0 -59px;
  border-radius: 50%; background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.16); pointer-events: none;
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(234,245,236,0.55);
  border: 2px solid rgba(255,255,255,0.5); box-shadow: 0 0 16px -2px rgba(255,255,255,0.4);
}
.skill-btn {
  position: absolute; bottom: calc(env(safe-area-inset-bottom) + 22px);
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--sc, #789);
  color: var(--ink); font-family: 'Rajdhani', sans-serif; font-weight: 700;
  pointer-events: auto; overflow: hidden; display: grid; place-items: center;
  box-shadow: 0 0 18px -6px var(--sc, #789);
}
.skill-btn:disabled { opacity: 0.5; }
.skill-btn.ready { box-shadow: 0 0 20px -2px var(--sc); }
.skill-l { left: 20px; }
.skill-r { right: 20px; }
.skill-name { font-size: 12px; text-align: center; line-height: 1.05; z-index: 2; padding: 0 4px; }
.skill-cd { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: rgba(0,0,0,0.55); z-index: 1; }

/* ── Pop (zentrale Feier) ───────────────────────────────────────────────── */
.pop {
  position: fixed; top: 34%; left: 50%; transform: translate(-50%,-50%) scale(0.6);
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 34px;
  color: var(--gold); text-shadow: 0 2px 24px rgba(0,0,0,0.6); opacity: 0;
  pointer-events: none; z-index: 30; text-align: center; white-space: nowrap;
}
.pop.show { animation: popShow 1.1s ease forwards; }
@keyframes popShow {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(0.6); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%,-60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-78%) scale(1); }
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(28,51,38,0.72), rgba(10,20,14,0.94));
  padding: 24px;
}
.card {
  width: min(92vw, 400px); text-align: center;
  background: var(--panel); border: 1px solid rgba(95,224,138,0.18);
  border-radius: 20px; padding: 30px 24px; backdrop-filter: blur(6px);
}
.logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 58px; letter-spacing: 2px; color: var(--ranger); text-shadow: 0 0 30px rgba(87,194,106,0.5); }
.tagline { font-size: 18px; color: var(--ink); margin-top: 6px; font-weight: 700; }
.how { font-size: 13px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.tap-hint { margin-top: 22px; font-size: 15px; color: var(--gold); font-weight: 700; letter-spacing: 1px; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

.win-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 34px; color: var(--gold); }
.win-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.win-stat, .go-stat { font-size: 17px; margin-top: 12px; color: var(--ink); }
.win-stat strong, .go-stat strong { color: var(--gold); font-size: 22px; }
.go-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 32px; color: var(--danger); }
.go-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.share-btn {
  margin-top: 18px; padding: 11px 26px; border: none; border-radius: 12px;
  background: var(--ranger); color: #06110a; font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 15px; letter-spacing: 1px; cursor: pointer;
}

/* ── Reg-Panel (geteilte Logik, Akzent = Ranger-Grün) ───────────────────── */
.reg-panel { margin-top: 18px; }
.reg-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.reg-input {
  width: 100%; padding: 11px 13px; margin-bottom: 8px; border-radius: 10px;
  border: 1px solid rgba(87,194,106,0.3); background: rgba(0,0,0,0.3);
  color: var(--ink); font-family: 'Rajdhani', sans-serif; font-size: 15px;
}
.reg-error { font-size: 12px; color: var(--danger); margin-bottom: 8px; }
.reg-btns { display: flex; gap: 8px; }
.reg-submit-btn, .reg-skip-btn {
  flex: 1; padding: 10px; border: none; border-radius: 10px; font-weight: 700;
  font-family: 'Rajdhani', sans-serif; font-size: 14px; cursor: pointer;
}
.reg-submit-btn { background: var(--ranger); color: #06110a; }
.reg-skip-btn { background: rgba(255,255,255,0.12); color: var(--ink); }
.reg-saved { font-size: 15px; color: var(--heal); font-weight: 700; }

/* ── Loot-Toast ─────────────────────────────────────────────────────────── */
.loot-toast {
  position: fixed; top: calc(env(safe-area-inset-top) + 92px); left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 25; padding: 7px 16px; border-radius: 20px; background: var(--panel);
  font-weight: 700; font-size: 14px; letter-spacing: .5px; opacity: 0; pointer-events: none;
  border: 1px solid rgba(255,255,255,0.12); transition: opacity .2s, transform .2s; white-space: nowrap;
}
.loot-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Camp (§0.2 M9) ─────────────────────────────────────────────────────── */
.camp-overlay { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.camp-goldbox {
  position: absolute; top: calc(env(safe-area-inset-top) + 14px); left: 50%; transform: translateX(-50%);
  font-size: 14px; color: var(--muted); background: var(--panel); border-radius: 20px;
  padding: 6px 16px; border: 1px solid rgba(255,255,255,0.12);
}
.camp-goldbox strong { color: var(--gold); font-size: 16px; }
.interact-btn {
  position: absolute; transform: translate(-50%, -100%);
  padding: 8px 16px; border-radius: 12px; border: 1px solid var(--ranger);
  background: var(--panel); color: var(--ink); font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 13px; letter-spacing: .3px; pointer-events: auto;
  box-shadow: 0 0 16px -4px var(--ranger); animation: interactPulse 1.4s ease-in-out infinite;
}
.interact-btn::before { content: 'Tap · '; color: var(--gold); }
@keyframes interactPulse { 0%,100% { opacity: 0.85; } 50% { opacity: 1; } }
.station-close {
  margin-top: 14px; width: 100%; padding: 10px; border: none; border-radius: 10px;
  background: rgba(255,255,255,0.1); color: var(--ink); font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 14px; letter-spacing: .5px; cursor: pointer;
}

/* ── Hub ────────────────────────────────────────────────────────────────── */
.hub {
  width: min(94vw, 460px); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid rgba(95,224,138,0.18); border-radius: 20px;
  padding: 16px; backdrop-filter: blur(6px);
}
.hub-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hub-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; color: var(--ranger); }
.hub-goldbox { font-size: 15px; color: var(--muted); }
.hub-goldbox strong { color: var(--gold); font-size: 18px; }
.hub-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.hub-tabs button {
  flex: 1; padding: 9px 4px; border: none; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.07); color: var(--muted);
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.hub-tabs button.on { background: var(--ranger); color: #06110a; }
.hub-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 2px; }
/* Region-Auswahl (§0.1 M8 — freigeschaltet wählbar, gesperrt grau) */
.hub-regions { display: flex; gap: 6px; margin-top: 12px; }
.hub-region {
  flex: 1; padding: 8px 4px; border: 2px solid transparent; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.06); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: 'Rajdhani', sans-serif;
}
.hub-region .hr-name { font-weight: 700; font-size: 14px; letter-spacing: .3px; }
.hub-region .hr-sub { font-size: 10px; color: var(--muted); font-weight: 700; }
.hub-region.on { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px -4px var(--gold); }
.hub-region.locked { opacity: 0.45; cursor: not-allowed; }

/* Karten-Auswahl (§0.1 M7 — 4 Karten, alle sofort offen) */
.hub-cards { display: flex; gap: 6px; margin-top: 8px; }
.hub-card {
  flex: 1; padding: 10px 4px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--ranger); color: #06110a; font-family: 'Rajdhani', sans-serif;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.hub-card .hc-num { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 19px; }
.hub-card .hc-desc { font-size: 10px; font-weight: 700; letter-spacing: .3px; opacity: .85; }
.hub-card:last-child { background: var(--boss); }
.hub-hint { font-size: 12px; color: var(--muted); margin: 8px 0; line-height: 1.4; }

/* Party-Tab */
.hub-heroes { display: flex; gap: 6px; margin-bottom: 8px; }
.hub-hero {
  flex: 1; padding: 8px 4px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; background: rgba(255,255,255,0.06); color: var(--ink);
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 13px;
}
.hub-hero.on { border-color: var(--pc); color: var(--pc); box-shadow: 0 0 12px -4px var(--pc); }
.hub-level { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hub-level .lv { font-weight: 700; font-size: 14px; color: var(--gold); white-space: nowrap; }
.xp-bar { flex: 1; height: 7px; border-radius: 5px; background: rgba(0,0,0,0.35); overflow: hidden; }
.xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffd24d, #ffe89a); transition: width .2s; }
.hub-level .xp-num { font-size: 11px; color: var(--muted); white-space: nowrap; }
.hub-attrs { display: flex; gap: 6px; margin-bottom: 6px; }
.attr {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,0.05); border-radius: 8px; padding: 6px 4px;
}
.attr-l { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.attr-v { font-weight: 700; font-size: 15px; color: var(--ink); }
.attr-add {
  width: 24px; height: 24px; border-radius: 7px; border: none; cursor: pointer;
  background: var(--gold); color: #1a1400; font-weight: 700; font-size: 15px; line-height: 1;
}
.pts-hint { font-size: 12px; color: var(--gold); margin-bottom: 8px; font-weight: 700; }

/* Talents-Tab */
.talent-list { display: flex; flex-direction: column; gap: 6px; }
.talent-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,0.05);
  border-left: 4px solid var(--ranger);
}
.talent-row.maxed { border-left-color: var(--gold); opacity: 0.9; }
.talent-info { display: flex; flex-direction: column; gap: 2px; }
.talent-name { font-weight: 700; font-size: 14px; }
.talent-desc { font-size: 11px; color: var(--muted); }
.talent-add {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer; flex: none;
  background: var(--gold); color: #1a1400; font-weight: 700; font-size: 17px; line-height: 1;
}
.talent-rank { font-size: 12px; color: var(--muted); font-weight: 700; flex: none; }
.hub-stats { font-size: 13px; color: var(--ink); background: rgba(0,0,0,0.25); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.hub-slots { display: flex; flex-direction: column; gap: 6px; }
.hub-slot {
  position: relative; display: grid; grid-template-columns: 70px 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: 8px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid transparent; cursor: pointer;
}
.hub-slot.filled { border-left: 4px solid var(--rc); }
.hub-slot.sel { border-color: var(--ranger); background: rgba(87,194,106,0.1); }
.hub-slot .hs-slot { grid-row: 1 / 3; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.hub-slot .hs-name { font-weight: 700; font-size: 14px; }
.hub-slot .hs-stat { font-size: 11px; color: var(--muted); grid-column: 2; }
.hub-slot.empty .hs-name { color: rgba(255,255,255,0.3); font-weight: 500; }
.hs-unequip {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255,84,104,0.2); color: var(--danger); font-size: 14px; font-weight: 700;
}
.hub-stash-head, .shop-sec { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 6px; }
.hub-stash, .hub-shop { display: flex; flex-direction: column; gap: 6px; }
.stash-item, .shop-item {
  position: relative; text-align: left; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: none; border-left: 4px solid var(--rc); color: var(--ink);
  display: flex; flex-direction: column; gap: 2px; font-family: 'Rajdhani', sans-serif;
}
.stash-item .si-name, .shop-item .si-name { font-weight: 700; font-size: 14px; }
.stash-item .si-stat, .shop-item .si-stat { font-size: 11px; color: var(--muted); }
.shop-item .si-price { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--gold); font-weight: 700; font-size: 14px; }
.shop-item.cant { opacity: 0.5; }
.stash-empty { font-size: 13px; color: rgba(255,255,255,0.35); padding: 8px 2px; }

/* Hire-Tab */
.hub-hire { display: flex; flex-direction: column; gap: 8px; }
.hire-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px;
  padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.05); border-left: 4px solid var(--pc);
}
.hire-name { font-weight: 700; font-size: 15px; color: var(--pc); }
.hire-desc { grid-column: 1; font-size: 12px; color: var(--muted); }
.hire-btn {
  grid-row: 1 / 3; padding: 9px 14px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--gold); color: #1a1400; font-weight: 700; font-family: 'Rajdhani', sans-serif; font-size: 14px;
}
.hire-btn.cant { opacity: 0.5; }
.hire-tag { grid-row: 1 / 3; font-size: 12px; color: var(--muted); font-weight: 700; }
.hire-tag.in { color: var(--heal); }
