:root, [data-theme="dark"] {
  --bg: #0b0e12;
  --panel: #121721;
  --panel-border: #1b2636;
  --text: #e7edf7;
  --text-secondary: #c1cbe0;
  --muted: #93a1b3;
  --accent: #f2a65a;
  --accent2: #ffe08a;
  --ok: #9ad06e;
  --warn: #ffcc66;
  --bad: #ff6b6b;
  --ink: #111827;
  --card-bg: linear-gradient(180deg, #111827 0%, #0e1522 100%);
  --input-bg: #0c1320;
  --header-bg: #0e1420ee;
  --tab-bg: #0e1420f5;
  --tab-h: 62px;
  --header-h: 110px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* Tokens ámbar (ruleta / misiones / acentos cálidos) */
  --accent-amber: #f59e0b;
  --accent-amber-2: #fbbf24;
  --accent-deep: #e87d2a;
  /* Tipografía de títulos: serif épica/medieval (sin dependencias) */
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
}

[data-theme="light"] {
  /* Tema claro = pergamino medieval (cálido, sepia) */
  --bg: #efe6d2;
  --panel: #fbf6ea;
  --panel-border: #d8c8a8;
  --text: #3a2e22;
  --text-secondary: #5c4a38;
  --muted: #8a7860;
  --accent: #b5651d;
  --accent2: #d99a3a;
  --ok: #4e7d35;
  --warn: #b8860b;
  --bad: #b1442e;
  --ink: #efe6d2;
  --card-bg: linear-gradient(180deg, #fbf6ea 0%, #f3ead4 100%);
  --input-bg: #f3ead6;
  --header-bg: #f7efddee;
  --tab-bg: #f7efddf5;
}

[data-theme="light"] body {
  background: radial-gradient(1200px 800px at 70% 8%, #f3ead0 0%, #ecdfc4 55%, #e3d4b4 100%) !important;
  color: var(--text);
}
[data-theme="light"] header { background: var(--header-bg); border-bottom-color: var(--panel-border); }
[data-theme="light"] .tab-bar { background: var(--tab-bg); border-top-color: var(--panel-border); }
[data-theme="light"] .card { background: var(--card-bg); border-color: var(--panel-border); }
[data-theme="light"] .card h2 { color: var(--text); border-bottom-color: var(--panel-border); }
[data-theme="light"] button.action { background: linear-gradient(180deg, #f9fafb, #f3f4f6); border-color: var(--panel-border); color: var(--text); }
[data-theme="light"] button.action:active:not(:disabled) { background: linear-gradient(180deg, #e5e7eb, #d1d5db); }
[data-theme="light"] .res { background: var(--input-bg); border-color: var(--panel-border); }
[data-theme="light"] .stat-pill { background: var(--input-bg); border-color: var(--panel-border); color: var(--muted); }
[data-theme="light"] #log { background: var(--input-bg); border-color: var(--panel-border); color: var(--text); }
[data-theme="light"] .mobile-float-stats { background: #ffffffee; border-color: var(--panel-border); color: var(--text); }
[data-theme="light"] .overlay { background: rgba(255,255,255,0.85); }
[data-theme="light"] .overlay .panel { background: var(--card-bg); border-color: var(--panel-border); }
[data-theme="light"] .toast { background: #ffffffee; border-color: var(--accent); color: var(--text); }
[data-theme="light"] .xp-bar-wrap { background: #e5e7eb; border-color: var(--panel-border); }
[data-theme="light"] header h1 { color: var(--text); }
[data-theme="light"] .tab { color: #9ca3af; }
[data-theme="light"] .tab.active { color: var(--accent); }
[data-theme="light"] .region-card { background: var(--input-bg); border-color: var(--panel-border); }
[data-theme="light"] .hp-bar { background: #e5e7eb; border-color: var(--panel-border); }

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body { height: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background:
    radial-gradient(900px 460px at 50% 118%, rgba(242,140,60,0.12), transparent 62%),
    radial-gradient(1200px 800px at 70% 8%, #16203a 0%, #0b0e14 55%, #05070c 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Inter, Arial, sans-serif;
  transition: background 1s ease;
  -webkit-font-smoothing: antialiased;
}

/* Títulos con serif épica/medieval (acorde al tono del juego) */
h1, h2, .card h2, .overlay h2, .start-panel h2 { font-family: var(--font-display); }

/* Viñeta cinematográfica para dar atmósfera (no interactiva) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: radial-gradient(125% 95% at 50% 32%, transparent 55%, rgba(0,0,0,0.5) 100%);
}
[data-theme="light"] body::after { background: radial-gradient(125% 95% at 50% 32%, transparent 62%, rgba(70,48,20,0.16) 100%); }

body.bg-sevilla { background: radial-gradient(1200px 800px at 70% 10%, #1b3a24 0%, #0b0e12 55%, #06080c 100%); }
body.bg-granada { background: radial-gradient(1200px 800px at 70% 10%, #3a1b1b 0%, #0b0e12 55%, #06080c 100%); }
body.bg-cadiz { background: radial-gradient(1200px 800px at 70% 10%, #1b263a 0%, #0b0e12 55%, #06080c 100%); }
body.bg-almeria { background: radial-gradient(1200px 800px at 70% 10%, #3a2e1b 0%, #0b0e12 55%, #06080c 100%); }
body.bg-norte { background: radial-gradient(1200px 800px at 70% 10%, #1b2e3a 0%, #0b0e12 55%, #06080c 100%); }
body.bg-europa { background: radial-gradient(1200px 800px at 70% 10%, #2a1b3a 0%, #0b0e12 55%, #06080c 100%); }

/* Day/Night cycle */
body.time-morning { background: radial-gradient(1200px 800px at 70% 10%, #2a1f0e 0%, #1a1208 55%, #0b0a06 100%); }
body.time-afternoon { background: radial-gradient(1200px 800px at 70% 10%, #2a2210 0%, #1a1508 55%, #0d0b06 100%); }
body.time-sunset { background: radial-gradient(1200px 800px at 70% 10%, #2a1520 0%, #1a0e18 55%, #0b080e 100%); }
body.time-night { background: radial-gradient(1200px 800px at 70% 10%, #0e1528 0%, #080c18 55%, #040610 100%); }

/* Fire glow on header */
header.fire-glow-hot { border-bottom-color: #f2a65a88; box-shadow: 0 4px 20px rgba(242,130,50,0.3); }
header.fire-glow-warm { border-bottom-color: #f2a65a44; box-shadow: 0 4px 20px rgba(242,166,90,0.15); }

/* ===== HEADER ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: calc(10px + var(--safe-top)) 16px 6px;
  background: #0e1420ee;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1c2433;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

header h1 {
  font-size: 1.05rem;
  margin: 0;
  color: #dfe8ff;
  letter-spacing: .5px;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2a65a, #e87d2a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(242,166,90,0.4);
  cursor: default;
  transition: transform .2s, box-shadow .2s;
}

.level-badge:hover { transform: scale(1.1); box-shadow: 0 0 20px rgba(242,166,90,0.6); }

.level-num {
  color: #0b0e12;
  font-weight: 900;
  font-size: 0.85rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #1e2940;
  background: #182338;
  color: #e9f0ff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.icon-btn:active { transform: scale(0.92); }

/* XP Bar */
.xp-bar-wrap {
  height: 16px;
  background: #0d1422;
  border-radius: 99px;
  border: 1px solid #1b2636;
  overflow: hidden;
  position: relative;
  margin-bottom: 6px;
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, #f2a65a, #ffe08a);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(242,166,90,0.3);
}

.xp-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  letter-spacing: .3px;
}

/* Header Stats Pills */
.header-stats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.header-stats::-webkit-scrollbar { display: none; }

.stat-pill {
  flex-shrink: 0;
  background: #0c1424;
  border: 1px solid #1b2636;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 0.72rem;
  white-space: nowrap;
  color: var(--muted);
  transition: all .2s;
}

.stat-pill.hot { border-color: #f2a65a44; color: var(--accent); }

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  padding: 12px;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 60px);
  max-width: 900px;
  margin: 0 auto;
  animation: tabSlideIn .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active { display: block; }

@keyframes tabSlideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.wrap-single {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== BOTTOM TAB BAR ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #0e1420f5;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #1c2433;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: #5a6a80;
  cursor: pointer;
  position: relative;
  transition: color .2s;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.tab-icon { font-size: 1.3rem; line-height: 1; }
.tab-label { font-size: 0.7rem; font-weight: 600; letter-spacing: .3px; }

.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  width: 16px;
  height: 16px;
  background: var(--bad);
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePop .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tab-badge.hidden { display: none; }

@keyframes badgePop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Mobile Floating Stats */
.mobile-float-stats {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  gap: 12px;
  background: #111827ee;
  border: 1px solid #1b2636;
  border-radius: 99px;
  padding: 6px 16px;
  z-index: 150;
  font-size: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .3s, transform .3s;
}

/* ===== CARDS ===== */
.card {
  background: linear-gradient(180deg, #111827 0%, #0e1522 100%);
  border: 1px solid #1b2636;
  border-radius: 16px;
  box-shadow: 0 8px 24px #00000044;
  overflow: hidden;
}

.card h2 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #1b2636;
  border-left: 3px solid var(--accent);
  font-size: .92rem;
  font-weight: 700;
  color: #e6eefc;
  letter-spacing: .4px;
}

.card .body { padding: 12px; }

/* ===== RESOURCES ===== */
.resources {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.res {
  position: relative;
  background: #0c1320;
  border: 1px solid #1b2636;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  transition: border-color .3s, box-shadow .3s;
}

.res.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(242,166,90,0.2);
}

.res b { display: block; font-size: .85rem; }
.res small { color: var(--muted); font-size: .7rem; }

/* ===== ACTIONS ===== */
.actions { display: grid; gap: 8px; }

button.action {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid #1e2940;
  background: linear-gradient(180deg, #182338, #0f1728);
  color: #e9f0ff;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: .2px;
  cursor: pointer;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

button.action:active:not(:disabled) {
  transform: scale(0.97);
  background: linear-gradient(180deg, #1e2d48, #152238);
}

button.action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

button.action.cooldown {
  position: relative;
  overflow: hidden;
}

button.action.cooldown::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f2a65a22, #ffe08a33);
  transform-origin: left center;
  transform: scaleX(var(--cd, 0));
  pointer-events: none;
}

/* Glow button (for CTAs) */
.glow-btn {
  background: linear-gradient(135deg, #f2a65a, #e87d2a) !important;
  border: none !important;
  color: #0b0e12 !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  padding: 16px 24px !important;
  box-shadow: 0 4px 20px rgba(242,166,90,0.4);
  transition: transform .2s, box-shadow .2s !important;
}

.glow-btn:active {
  transform: scale(0.95) !important;
  box-shadow: 0 2px 10px rgba(242,166,90,0.3) !important;
}

/* Danger button */
button.action.danger {
  border-color: #ff6b6b44;
  color: #ff6b6b;
}

/* System buttons */
.sys-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Combat specific buttons */
.combat-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.combat-btn {
  padding: 14px 8px !important;
  font-size: 0.85rem !important;
  text-align: center;
}

.combat-btn.atk { border-color: #ff6b6b55; }
.combat-btn.atk:active { background: #ff6b6b22 !important; }
.combat-btn.def { border-color: #4dabf755; }
.combat-btn.def:active { background: #4dabf722 !important; }
.combat-btn.heal { border-color: #9ad06e55; }
.combat-btn.heal:active { background: #9ad06e22 !important; }

/* ===== INLINE / FLEX ===== */
.inline { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== LOG / DIARY ===== */
#log {
  height: 50vh;
  max-height: 400px;
  overflow: auto;
  padding: 12px;
  font-size: .88rem;
  line-height: 1.4;
  background: #0a0e18;
  border-radius: 12px;
  border: 1px solid #1b2636;
  overscroll-behavior: contain;
}

#log p { margin: 0 0 8px; }
#log .dim { color: var(--muted); }
#log .good { color: var(--ok); }
#log .bad { color: var(--bad); }
#log .warn { color: var(--warn); }

/* ===== FOOTER / TAGS ===== */
.footer {
  padding: 10px 16px;
  color: #90a3bf;
  font-size: .82rem;
  opacity: .8;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0c1424;
  border: 1px solid #1b2636;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
}

.sep { height: 1px; background: #1b2636; margin: 10px 0; }

/* ===== PROGRESS BAR ===== */
.progress {
  height: 8px;
  background: #0d1422;
  border-radius: 999px;
  border: 1px solid #1b2636;
  overflow: hidden;
}

.bar {
  height: 100%;
  background: linear-gradient(90deg, #f2a65a, #ffe08a);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 50px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #111827ee;
  border: 1px solid var(--accent);
  color: #e9f0ff;
  box-shadow: 0 8px 24px #0009;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 300;
  font-size: 0.85rem;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,8,12,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  animation: overlayIn .3s ease-out;
}

.overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay .panel {
  background: linear-gradient(180deg, #111827 0%, #0e1522 100%);
  border: 1px solid #1b2636;
  border-radius: 20px;
  max-width: 440px;
  width: 92%;
  padding: 24px 20px;
  box-shadow: 0 20px 60px #000000aa;
  animation: panelIn .35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes panelIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.overlay h2 { margin: 0 0 8px; font-size: 1.15rem; }
.overlay p { margin: 8px 0; color: #c1cbe0; }
.overlay ul { margin: 8px 0 0 18px; color: #9fb0cd; }

/* Start overlay */
.start-panel { text-align: center; position: relative; overflow: hidden; }
.start-panel::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(242,140,60,0.28), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.start-panel > * { position: relative; z-index: 1; }
.start-icon { font-size: 3.2rem; margin-bottom: 8px; }
.start-subtitle { color: var(--accent) !important; font-size: 0.9rem; font-weight: 600; }
.start-desc { font-size: 0.9rem; line-height: 1.5; }
.start-features {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  text-align: left;
}
.start-features li {
  padding: 8px 0;
  border-bottom: 1px solid #1b2636;
  font-size: 0.88rem;
  color: #c1cbe0;
}
.start-features li:last-child { border: none; }
.start-btn { margin-top: 8px; width: 100%; }

/* Welcome back overlay */
.welcome-panel { text-align: center; }
.welcome-rewards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.welcome-reward-item {
  background: #0c1320;
  border: 1px solid #1b2636;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.welcome-reward-item .reward-icon { font-size: 1.5rem; }
.welcome-reward-item .reward-text {
  font-size: 0.8rem;
  color: var(--ok);
  margin-top: 4px;
  font-weight: 600;
}
.welcome-streak {
  background: linear-gradient(135deg, #f2a65a22, #e87d2a11);
  border: 1px solid #f2a65a44;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}
.welcome-streak .streak-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
}
.welcome-streak .streak-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Level up overlay */
.levelup-panel { text-align: center; }
.levelup-icon {
  font-size: 4rem;
  animation: levelStar 1s ease-in-out infinite alternate;
}
@keyframes levelStar {
  from { transform: scale(1) rotate(-5deg); }
  to { transform: scale(1.15) rotate(5deg); }
}
.levelup-bonus {
  margin: 16px 0;
  padding: 12px;
  background: #0c1320;
  border: 1px solid #1b2636;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--ok);
}

/* Encounter overlay */
.encounter-panel { text-align: center; }
.encounter-icon { font-size: 3.5rem; margin-bottom: 8px; animation: encounterPulse 1.5s ease-in-out infinite; }
@keyframes encounterPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255,107,107,0.3)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(255,107,107,0.6)); }
}
.encounter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.encounter-timer {
  height: 4px;
  background: #1b2636;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
}
.encounter-timer-bar {
  height: 100%;
  background: var(--bad);
  width: 100%;
  transition: width 1s linear;
}

/* ===== ACHIEVEMENTS ===== */
.achs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ach {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1px solid #1b2636;
  border-radius: 12px;
  background: #0c1320;
  color: #e9f0ff;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all .2s;
}

.ach.locked { opacity: .35; filter: grayscale(1); }
.ach:not(.locked):active { transform: scale(0.92); }

/* ===== COMBAT UI ===== */
.combat-ui {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  gap: 20px;
  min-height: 140px;
}

.fighter {
  text-align: center;
  width: 120px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fighter .icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
  transition: transform 0.2s;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.fighter.hit { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
.fighter.hit .icon { filter: brightness(1.5) sepia(1) hue-rotate(-50deg) saturate(3); }
.fighter.hit-hard { animation: shakeHard 0.5s cubic-bezier(.36,.07,.19,.97) both; }
.fighter.attack .icon { transform: scale(1.4) translateY(-10px); }
.fighter.attack-rush { animation: rush 0.3s ease-in-out; }

.hp-bar {
  height: 14px;
  background: #080c14;
  border: 2px solid #1b2636;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4d4d, #ff8787);
  width: 100%;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 8px rgba(255,77,77,0.3);
}

.hp-fill.player {
  background: linear-gradient(90deg, #5c940d, #9ad06e);
  box-shadow: 0 0 8px rgba(154,208,110,0.3);
}

.vs {
  font-size: 1.6rem;
  font-weight: 900;
  color: #3b4252;
  font-style: italic;
  opacity: 0.5;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes shakeHard {
  0% { transform: translate(0,0) rotate(0); }
  10% { transform: translate(-5px,-2px) rotate(-1deg); }
  20% { transform: translate(5px,2px) rotate(1deg); }
  30% { transform: translate(-5px,2px) rotate(-1deg); }
  40% { transform: translate(5px,-2px) rotate(1deg); }
  50% { transform: translate(-3px,1px) rotate(0); }
  100% { transform: translate(0,0) rotate(0); }
}

@keyframes rush {
  0% { transform: scale(1); }
  50% { transform: scale(1.2) translateY(-20px); }
  100% { transform: scale(1); }
}

.dmg-num {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: #ff6b6b;
  font-weight: 900;
  font-size: 1.4rem;
  pointer-events: none;
  animation: floatUp 1s cubic-bezier(0.23,1,0.32,1) forwards;
  text-shadow: 2px 2px 0 #000;
  z-index: 50;
  white-space: nowrap;
}

.dmg-num.crit { font-size: 1.8rem; color: #ffcc00; text-shadow: 2px 2px 0 #b83a00; }
.dmg-num.heal { color: #9ad06e; }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1.0); }
}

/* ===== REGION CARDS (Map) ===== */
.map-svg-wrap {
  margin-bottom: 12px;
}

.region-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
}

.region-card {
  background: #0c1320;
  border: 1px solid #1b2636;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
}

.region-card:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .region-card:hover:not(.locked-card) {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(242,166,90,0.15);
    border-color: var(--accent);
  }
}

.region-card.focused {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245,158,11,0.15);
}

.region-card.exp-active {
  border-color: #228be6;
  box-shadow: 0 0 12px rgba(34,139,230,0.15);
}

.region-card.locked-card {
  cursor: default;
  opacity: 0.6;
  text-align: center;
  padding: 10px;
}

.region-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.region-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #e9f0ff;
}

.region-card-loot {
  font-size: 0.85rem;
  letter-spacing: 2px;
}

.region-status {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.region-status.ready {
  color: var(--ok);
  font-weight: 700;
  animation: badgePop .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.region-progress {
  height: 5px;
  background: #0d1422;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}

.region-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4dabf7, #74c0fc);
  border-radius: 99px;
  transition: width 1s linear;
}

.region-send-btn {
  margin-top: 8px;
  padding: 10px 12px !important;
  font-size: 0.82rem !important;
  width: 100%;
}

/* ===== SPIN WHEEL ===== */
.spin-container {
  background: linear-gradient(135deg, #1a1f35, #0e1522);
  border: 2px solid #f59e0b55;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-bottom: 10px;
  animation: spinGlow 2s ease-in-out infinite alternate;
}

@keyframes spinGlow {
  from { box-shadow: 0 0 8px rgba(245,158,11,0.1); }
  to { box-shadow: 0 0 20px rgba(245,158,11,0.25); }
}

.spin-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 8px;
}

.spin-result {
  font-size: 1.5rem;
  margin: 12px 0;
  min-height: 40px;
}

.spin-btn {
  background: linear-gradient(135deg, #f2a65a, #e87d2a) !important;
  border: none !important;
  color: #0b0e12 !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  padding: 14px 24px !important;
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(242,166,90,0.35);
}

.spin-btn:active { transform: scale(0.95); }

/* ===== COMBO COUNTER ===== */
.combo-indicator {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 12px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #0b0e12;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 99px;
  z-index: 150;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
  animation: comboPop .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: opacity .3s;
}

.combo-indicator.hidden { opacity: 0; transform: scale(0.8); }

@keyframes comboPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== CONFETTI CANVAS ===== */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ===== DESKTOP OVERRIDES ===== */
@media (min-width: 901px) {
  :root { --tab-h: 0px; }

  .tab-bar { display: none; }
  .mobile-float-stats { display: none; }

  .tab-content {
    display: block !important;
    padding-bottom: 40px;
  }

  header { position: relative; }

  .wrap-single {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto;
  }

  .resources { grid-template-columns: repeat(2, 1fr); }

  #log { height: 340px; max-height: none; }

  .achs { grid-template-columns: repeat(6, 1fr); }

  button.action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242,166,90,0.25);
    border-color: var(--accent);
  }
}

/* ===== SMALL MOBILE ===== */
@media (max-width: 400px) {
  .resources { grid-template-columns: repeat(2, 1fr); }
  .achs { grid-template-columns: repeat(4, 1fr); }
  /* Mantener las 6 acciones de combate en 2 filas (no apiladas) */
  .combat-actions { grid-template-columns: repeat(3, 1fr); }
  .combat-btn { padding: 11px 4px !important; font-size: 0.76rem !important; }
  .combat-ui { min-height: 110px; gap: 10px; }
  header h1 { font-size: 0.92rem; }
}

/* ===== UTILITY ===== */
.desktop-only { display: none; }
@media (min-width: 901px) {
  .desktop-only { display: block; }
}

.hidden { display: none !important; }

/* ===== SKILLS SECTION ===== */
.skill-points-badge {
  background: var(--accent);
  color: #0b0e12;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 8px;
  vertical-align: middle;
}

.skills-grid {
  display: grid;
  gap: 8px;
}

.skill-category-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--panel-border, #1b2636);
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--input-bg, #0c1320);
  border: 1px solid var(--panel-border, #1b2636);
  border-radius: 10px;
  transition: all .2s;
}

.skill-item:hover { border-color: var(--accent); }

.skill-icon { font-size: 1.3rem; flex-shrink: 0; }
.skill-info { flex: 1; min-width: 0; }
.skill-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.skill-desc { font-size: 0.72rem; color: var(--muted); }
.skill-level { font-size: 0.7rem; color: var(--accent); font-weight: 600; margin-top: 2px; }

.skill-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .2s;
}
.skill-btn:hover:not(:disabled) { background: var(--accent); color: #0b0e12; }
.skill-btn:disabled { opacity: 0.3; cursor: not-allowed; border-color: var(--muted); color: var(--muted); }

/* ===== MARKET SECTION ===== */
.market-grid {
  display: grid;
  gap: 8px;
}

.market-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--input-bg, #0c1320);
  border: 1px solid var(--panel-border, #1b2636);
  border-radius: 10px;
}

.market-resource { flex: 1; font-size: 0.85rem; font-weight: 600; }
.market-price { font-size: 0.78rem; color: var(--muted); min-width: 60px; text-align: center; }
.market-price.up { color: var(--bad); }
.market-price.down { color: var(--ok); }

.market-actions { display: flex; gap: 4px; }
.market-btn {
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--panel-border, #1b2636);
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.market-btn.buy { border-color: var(--ok); color: var(--ok); }
.market-btn.sell { border-color: var(--bad); color: var(--bad); }
.market-btn:hover:not(:disabled) { transform: scale(1.05); }
.market-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== CRAFTING EXPANDED ===== */
.craft-grid { display: grid; gap: 8px; }
.craft-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--input-bg, #0c1320);
  border: 1px solid var(--panel-border, #1b2636);
  border-radius: 10px;
}
.craft-icon { font-size: 1.3rem; flex-shrink: 0; }
.craft-info { flex: 1; }
.craft-name { font-size: 0.85rem; font-weight: 700; }
.craft-cost { font-size: 0.72rem; color: var(--muted); }
.craft-desc { font-size: 0.7rem; color: var(--accent2, #ffe08a); font-style: italic; margin-top: 2px; }

/* ===== COMBAT SECONDARY ACTIONS ===== */
.combat-secondary { margin-top: 6px; }
.combat-btn.dodge { border-color: #c084fc55; }
.combat-btn.dodge:active { background: #c084fc22 !important; }

.combat-difficulty {
  text-align: center;
  padding: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.difficulty-easy { color: var(--ok); }
.difficulty-medium { color: var(--warn); }
.difficulty-hard { color: var(--bad); }
.difficulty-extreme { color: #c084fc; }

/* ===== WAVE MODE ===== */
.wave-info {
  text-align: center;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== CONTEXTUAL TOOLTIPS ===== */
.context-tip {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 50px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #0b0e12;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 350;
  max-width: 85%;
  text-align: center;
  box-shadow: 0 4px 20px rgba(242,166,90,0.4);
  animation: tipSlideUp .4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.context-tip::after {
  content: ' ✕';
  opacity: 0.6;
  font-size: 0.75rem;
}
@keyframes tipSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard nav */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* High contrast mode adjustments */
@media (forced-colors: active) {
  .card, .res, button.action { border: 2px solid ButtonText; }
  .xp-bar { background: Highlight; }
}

/* Location Overlay Panel */
.location-panel {
  max-width: 500px;
  width: 95%;
}

.location-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.location-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.location-header .icon-btn {
  margin-left: auto;
  background: none;
  border: 1px solid #1b2636;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.location-header .icon-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.location-desc {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 4px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ===== FLOATING XP GAIN ===== */
.level-badge { position: relative; }
.xp-float {
  position: absolute;
  top: -2px;
  right: 0;
  color: var(--accent2, #ffe08a);
  font-weight: 900;
  font-size: 0.78rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.75);
  pointer-events: none;
  white-space: nowrap;
  animation: xpFloatUp 1s cubic-bezier(0.22,1,0.36,1) forwards;
  z-index: 120;
}
@keyframes xpFloatUp {
  0%   { opacity: 0; transform: translateY(6px) scale(0.8); }
  25%  { opacity: 1; transform: translateY(-8px) scale(1.12); }
  100% { opacity: 0; transform: translateY(-34px) scale(1); }
}

/* ===== POLISH: active tab icon lift ===== */
.tab.active .tab-icon { transform: translateY(-1px) scale(1.12); transition: transform .2s cubic-bezier(0.175,0.885,0.32,1.275); }
.tab-icon { transition: transform .2s; }

/* ===== POLISH: CTA glow-btn breathing ===== */
@keyframes ctaBreathe {
  0%, 100% { box-shadow: 0 4px 16px rgba(242,166,90,0.35); }
  50% { box-shadow: 0 6px 26px rgba(242,166,90,0.6); }
}
.glow-btn { animation: ctaBreathe 2.6s ease-in-out infinite; }
.glow-btn:active { animation: none; }

/* ===== POLISH: resource number emphasis ===== */
.res b { font-variant-numeric: tabular-nums; }
.res:active { transform: scale(0.97); transition: transform .1s; }

/* ===== ONBOARDING / GUIDANCE HINTS ===== */
.empty-hint { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; text-align: center; padding: 12px 8px; line-height: 1.45; }
.empty-hint b { color: var(--text); }
.strip-hint { margin: 0 0 8px; font-size: .8rem; color: var(--accent); font-weight: 700; }
.s3-btn.locked { flex-wrap: wrap; height: auto; align-content: center; }
.s3-req { flex-basis: 100%; font-size: .62rem; color: var(--muted); font-weight: 500; margin-top: 2px; line-height: 1.2; }

/* Chip "siguiente paso": pulsa para guiar al jugador */
.s3-btn.next-step { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); animation: pulse 1.4s infinite; }

/* Mini-tira de cambio rápido dentro del overlay de localización */
.mini-strip { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--panel-border, #1b2636); }
.s3-btn.mini { padding: 6px 10px; min-height: 38px; }
.s3-btn.mini .s3-btn-icon { font-size: 1.15rem; }

/* ===== COMBAT CLOSE (escape garantizado) ===== */
.overlay .panel { position: relative; }   /* ancla el botón X de combate */
.fight-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  background: #182338;
  border: 1px solid #283449;
}

/* ===== COMBO: tiers + barra de urgencia ===== */
.combo-indicator {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 80px;
  text-align: center;
  transition: transform .2s, background .2s, box-shadow .2s;
}
.combo-label { display: block; }
.combo-drain { display: block; height: 3px; width: 100%; background: #fff; border-radius: 99px; transform-origin: left center; }
@keyframes comboDrain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.combo-indicator.combo-hot { transform: scale(1.06); background: linear-gradient(135deg, #f97316, #ef4444); }
.combo-indicator.combo-mega { transform: scale(1.16); background: linear-gradient(135deg, #ef4444, #a855f7); box-shadow: 0 6px 22px rgba(168,85,247,0.6); }

/* Cuadrícula de recompensas welcome-back (envoltorio para que el subtítulo no entre en grid) */
.welcome-rewards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

/* ===== BARRA DE BOSS PERSISTENTE ===== */
.boss-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 24px);
  max-width: 900px;
  margin: 8px auto 0;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #ff6b6b, #e03636);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 16px rgba(224,54,54,0.4);
  animation: bossBarPulse 1.6s ease-in-out infinite;
}
.boss-bar.hidden { display: none; }
.boss-bar:active { transform: scale(0.99); }
.boss-bar-icon { font-size: 1.2rem; }
.boss-bar-time { font-variant-numeric: tabular-nums; opacity: .95; margin-left: 4px; }
.boss-bar-cta { margin-left: auto; background: rgba(0,0,0,0.28); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
@keyframes bossBarPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(224,54,54,0.4); }
  50% { box-shadow: 0 4px 26px rgba(224,54,54,0.75); }
}

/* ===== BALIZA DE PRÓXIMO DESBLOQUEO ===== */
.unlock-beacon {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #1a1f35, #0e1522);
  border: 1px solid var(--panel-border, #1b2636);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
}
.unlock-beacon.hidden { display: none; }
.beacon-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-secondary, #c1cbe0); margin-bottom: 6px; }
.beacon-row b { color: var(--accent); }
.beacon-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.76rem; }
.beacon-bar { height: 6px; background: #0d1422; border-radius: 99px; overflow: hidden; }
.beacon-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .5s cubic-bezier(0.4,0,0.2,1); }

/* ===== PISTA "MÁS" BLOQUEADO ===== */
.mas-locked-hint {
  background: var(--card-bg);
  border: 1px dashed var(--panel-border, #1b2636);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
}
.mas-locked-hint b { color: var(--accent); }

/* ===== NEXT OBJECTIVE (¿qué hacer ahora?) ===== */
.next-objective {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, rgba(242,166,90,0.18), rgba(232,125,42,0.06));
  color: var(--text); font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(242,166,90,0.14);
  animation: ctaBreathe 2.8s ease-in-out infinite;
}
.next-objective.hidden { display: none; }
.next-objective:active { transform: scale(0.99); }
.next-objective .no-icon { font-size: 1.4rem; line-height: 1; }
.next-objective .no-text { flex: 1; }
.next-objective .no-cta { color: var(--accent); font-weight: 800; white-space: nowrap; font-size: 0.82rem; }

/* ===== OBJETIVOS DIARIOS (pantalla principal) ===== */
.dg-count { font-size: 0.75rem; color: var(--accent); font-weight: 800; margin-left: 6px; }
.daily-goals-card .body { display: grid; gap: 10px; cursor: pointer; }
.dg-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dg-name { font-size: 0.82rem; font-weight: 600; }
.dg-num { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dg-bar { height: 6px; background: #0d1422; border-radius: 99px; overflow: hidden; }
.dg-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent-amber), var(--accent-amber-2)); border-radius: 99px; transition: width .4s; }
[data-theme="light"] .dg-bar { background: #e5e7eb; }

/* ===== BARRA DE VIDA POR % (combate) ===== */
.hp-fill.hp-mid { background: linear-gradient(90deg, #f59e0b, #fbbf24) !important; box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.hp-fill.hp-low { background: linear-gradient(90deg, #ff4d4d, #ff8787) !important; box-shadow: 0 0 8px rgba(255,77,77,0.5); }

/* ===== TRANSICIÓN AL CAMBIAR DE PESTAÑA ===== */
.tab-content.active { animation: tabSlideIn .28s cubic-bezier(0.4, 0, 0.2, 1); }

/* ===== AJUSTES ===== */
.settings-panel { max-width: 420px; }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.settings-header h2 { margin: 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--panel-border, #1b2636); }
.settings-row input[type=range] { flex: 1; max-width: 55%; accent-color: var(--accent); }
.toggle-btn { width: auto; min-width: 118px; padding: 8px 14px; min-height: 40px; }

/* ===== SENDA LUZ / SOMBRA ===== */
.align-intro { font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; text-align: center; }
.align-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.align-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border-radius: 14px; border: 1px solid var(--panel-border, #1b2636); background: var(--input-bg, #0c1320); color: var(--text); cursor: pointer; transition: all .2s; }
.align-btn b { font-size: 1rem; }
.align-btn small { font-size: 0.7rem; color: var(--muted); text-align: center; line-height: 1.3; }
.align-icon { font-size: 2rem; }
.align-btn.luz:active { border-color: #ffd166; box-shadow: 0 0 16px rgba(255,209,102,0.35); }
.align-btn.sombra:active { border-color: #9b8cff; box-shadow: 0 0 16px rgba(155,140,255,0.35); }
@media (hover:hover) and (pointer:fine) {
  .align-btn.luz:hover { border-color: #ffd166; box-shadow: 0 0 16px rgba(255,209,102,0.3); transform: translateY(-2px); }
  .align-btn.sombra:hover { border-color: #9b8cff; box-shadow: 0 0 16px rgba(155,140,255,0.3); transform: translateY(-2px); }
}
.align-header { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.respec-btn { margin-top: 12px; color: var(--muted); border-color: var(--panel-border, #1b2636); }

/* ===== LEGADO / PRESTIGIO ===== */
.legacy-card h2 { border-left-color: #a855f7; }
.legacy-badge { background: linear-gradient(135deg, #a855f7, #6d28d9); color: #fff; border-radius: 99px; padding: 2px 10px; font-size: 0.7rem; font-weight: 800; margin-left: 8px; }
.legacy-head { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 10px; }
.legacy-head b { color: #c084fc; }
.legacy-note { font-size: 0.72rem; color: var(--muted); margin: 8px 0 12px; text-align: center; }
.legacy-grid { display: grid; gap: 8px; }
.legacy-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--input-bg, #0c1320); border: 1px solid var(--panel-border, #1b2636); border-radius: 10px; }
.legacy-icon { font-size: 1.3rem; flex-shrink: 0; }
.legacy-info { flex: 1; min-width: 0; }
.legacy-name { font-size: 0.85rem; font-weight: 700; }
.legacy-desc { font-size: 0.72rem; color: var(--muted); }
.legacy-lvl { font-size: 0.7rem; color: #c084fc; font-weight: 600; margin-top: 2px; }

/* ===== REDUCE-MOTION MANUAL (Ajustes) ===== */
[data-reduce-motion="1"] *, [data-reduce-motion="1"] *::before, [data-reduce-motion="1"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ===== LIGHT THEME: nuevos componentes ===== */
[data-theme="light"] .fight-close { background: #f3f4f6; border-color: var(--panel-border); color: var(--text); }
[data-theme="light"] .s3-btn { background: var(--input-bg); border-color: var(--panel-border); color: var(--text); }
[data-theme="light"] .s3-btn.active { background: #fde9c8; border-color: var(--accent); }
[data-theme="light"] .strip-hint { color: var(--accent); }
[data-theme="light"] .unlock-beacon { background: var(--card-bg); }
[data-theme="light"] .beacon-bar { background: #e5e7eb; }
