/* ============================================================
   LU4 Quest Guide — tema visual
   Paleta: fondo azul-noche profundo + dorado L2 + acentos fríos
   Tipografía: Cinzel (títulos, aire medieval) / Inter (cuerpo)
   ============================================================ */

:root {
  --bg: #0f0f17;
  --bg-elev: #14141f;
  --bg-panel: #171724;
  --bg-card: #1d1d2c;
  --bg-card-hover: #23233530;
  --bg-inset: #0c0c14;
  --border: #2c2c40;
  --border-soft: rgba(255, 255, 255, 0.07);
  --text: #eceaf4;
  --text-dim: #9d9ab2;
  --accent: #d8b25f;
  --accent-bright: #ecd39a;
  --accent-soft: #8a743c;
  --accent-glow: rgba(216, 178, 95, 0.15);
  --gold-grad: linear-gradient(135deg, #ecd39a 0%, #d8b25f 45%, #a87f35 100%);
  --good: #6fcf8f;
  --warn: #e08a5e;
  --bad: #c05c78;
  --link: #92b9e6;
  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --font-display: "Cinzel", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
  background: var(--bg);
  padding-bottom: calc(3rem + env(safe-area-inset-bottom));
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Partículas ambientales (js/particles.js): capa fija sobre el contenido,
   sin capturar clicks. Las motas son tan tenues que no molestan al leer. */
#ambientParticles {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Tinte de ambiente fijo, dibujado una sola vez (mucho más liviano que
   background-attachment: fixed, que además falla en navegadores móviles) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(216, 178, 95, 0.05), transparent 60%),
    radial-gradient(900px 600px at -10% 0%, rgba(92, 110, 200, 0.06), transparent 55%);
}

input, select, button, a, label {
  touch-action: manipulation;
  font-family: inherit;
}

a {
  color: var(--link);
  text-decoration-color: rgba(146, 185, 230, 0.35);
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover {
  color: #b8d4f4;
  text-decoration-color: currentColor;
}

/* Scrollbar oscura a juego */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: #2b2b3e;
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #3c3c55; }

/* ---------- Checkboxes custom (todas las casillas de la app) ---------- */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border: 1.5px solid #45455e;
  border-radius: 6px;
  background: var(--bg-inset);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
input[type="checkbox"]:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input[type="checkbox"]:active { transform: scale(0.92); }
input[type="checkbox"]:checked {
  background: var(--gold-grad);
  border-color: transparent;
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: 28%;
  height: 52%;
  border: solid #171208;
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -56%) rotate(45deg);
}

/* ---------- Barra superior ---------- */
.topbar {
  position: relative;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.5rem 0.9rem;
  background:
    radial-gradient(600px 140px at 20% 0%, rgba(216, 178, 95, 0.07), transparent 70%),
    linear-gradient(180deg, #191926, var(--bg-elev));
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(216, 178, 95, 0.55), transparent 95%);
  pointer-events: none;
}

.topbar h1 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar .sub {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--text-dim);
}

.topbar .source {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ---------- Panel de personaje ---------- */
.character-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: flex-end;
  padding: 1.1rem 1.5rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
}

select, input[type="number"], input[type="text"] {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 16px;
  min-height: 2.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:hover, input[type="number"]:hover, input[type="text"]:hover {
  border-color: #3d3d58;
}
select:focus, input[type="number"]:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="number"] { width: 6rem; }

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(192, 92, 120, 0.55);
  color: var(--bad);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 2.5rem;
  height: fit-content;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-secondary:hover {
  background: rgba(192, 92, 120, 0.12);
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgba(192, 92, 120, 0.12);
}

.btn-secondary.btn-neutral {
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-secondary.btn-neutral:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: #3d3d58;
  color: var(--text);
  box-shadow: none;
}

/* ---------- Títulos de sección ---------- */
.recommend-panel, .class-panel, .sync-panel {
  padding: 1.15rem 1.5rem;
}
.recommend-panel h2, .class-panel h2, .sync-panel h2 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.recommend-panel h2::after, .class-panel h2::after, .sync-panel h2::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(216, 178, 95, 0.35), transparent);
}

/* ---------- Sync ---------- */
.sync-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.sync-help {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.sync-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sync-row #syncCode {
  flex: 1;
  min-width: 200px;
}

/* Acciones de sync: doradas (no destructivas) */
.sync-row .btn-secondary {
  border-color: rgba(216, 178, 95, 0.45);
  color: var(--accent);
}
.sync-row .btn-secondary:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.sync-status {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.sync-status.sync-ok { color: var(--good); }
.sync-status.sync-warn { color: var(--warn); }

/* ---------- Cambio de clase ---------- */
.class-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.7rem;
}

.class-stage {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 45%), var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease;
}
.class-stage:hover { border-color: rgba(255, 255, 255, 0.12); }
.class-stage.done {
  opacity: 0.6;
  border-color: rgba(111, 207, 143, 0.25);
}

.class-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.class-stage-header .quest-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.class-quest-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.class-quest-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.class-quest-link.done a { text-decoration: line-through; color: var(--text-dim); }
.class-quest-link a { padding: 0.15rem 0; }

/* ---------- Recomendado ahora ---------- */
.recommend-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.recommend-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 50%), var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.recommend-card:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 178, 95, 0.3);
  border-left-color: var(--accent-bright);
  box-shadow: var(--shadow-pop);
}

.recommend-card.class-recommend {
  border-color: rgba(146, 185, 230, 0.3);
  border-left-color: var(--link);
  background:
    radial-gradient(400px 80px at 0% 0%, rgba(146, 185, 230, 0.07), transparent 70%),
    var(--bg-card);
}
.recommend-card.class-recommend:hover { border-left-color: #b8d4f4; }
.recommend-card.class-recommend .rq-meta a { margin-right: 0.4rem; }

.recommend-card .rq-name { font-weight: 600; }
.recommend-card .rq-meta { font-size: 0.8rem; color: var(--text-dim); }

.recommend-card .rq-body { flex: 1; min-width: 0; }

.recommend-card > input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
}

.empty-msg {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-style: italic;
}

.unlock-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  background: rgba(216, 178, 95, 0.05);
  border: 1px dashed rgba(216, 178, 95, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
}
.unlock-hint strong { color: var(--accent-bright); font-weight: 600; }

/* ---------- Controles / búsqueda ---------- */
.controls {
  padding: 0 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#searchBox { flex: 1; min-width: 200px; max-width: 400px; }

.toggle-completed {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.toggle-completed:hover { color: var(--text); }

.stats {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

/* ---------- Zonas ---------- */
main {
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.zone-block {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease;
}
.zone-block:hover { border-color: rgba(255, 255, 255, 0.12); }

.zone-header {
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--bg-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  user-select: none;
  min-height: 2.75rem;
  transition: background 0.15s ease;
}
.zone-header:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent), var(--bg-card); }

.zone-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.zone-header-row > span:first-child {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* Chevron indicador de abierto/cerrado */
.zone-header-row::after {
  content: '';
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}
.zone-block:has(.zone-body.open) .zone-header-row::after {
  transform: rotate(225deg) translateY(-2px);
}

.zone-note {
  cursor: help;
  color: var(--accent);
  font-size: 0.8rem;
}

.zone-header .zone-progress {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.zone-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.zone-bar-fill {
  height: 100%;
  background: var(--gold-grad);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(216, 178, 95, 0.45);
  transition: width 0.3s ease;
}
.zone-bar-fill.full {
  background: linear-gradient(135deg, #a9ecc0, #6fcf8f 60%, #4da26c);
  box-shadow: 0 0 8px rgba(111, 207, 143, 0.45);
}

.zone-body {
  display: none;
  padding: 0.5rem 1rem 0.9rem;
}
.zone-body.open {
  display: block;
  animation: zone-fade 0.2s ease;
}
@keyframes zone-fade {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Tarjetas de quest ---------- */
.quest-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.75rem 0.55rem;
  margin: 0 -0.35rem;
  border-radius: 8px;
  display: flex;
  gap: 0.7rem;
  transition: background 0.15s ease;
}
.quest-card:last-child { border-bottom: none; }
.quest-card:hover { background: rgba(255, 255, 255, 0.025); }

.quest-card.done { opacity: 0.48; }
.quest-card.done .quest-name {
  text-decoration: line-through;
  text-decoration-color: rgba(236, 234, 244, 0.45);
}
.quest-card.locked { opacity: 0.55; }
.quest-card.other-race { display: none; }
.quest-card.other-race.show-other { display: flex; }

.quest-card input[type="checkbox"] {
  margin-top: 0.12rem;
  width: 1.35rem;
  height: 1.35rem;
}

.quest-body { flex: 1; min-width: 0; }

.quest-title-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.quest-name { font-weight: 600; }

.quest-level {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--accent-bright);
  background: rgba(216, 178, 95, 0.09);
  border: 1px solid rgba(216, 178, 95, 0.3);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}

.badge {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.08rem 0.55rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge.repeatable {
  background: rgba(74, 122, 176, 0.14);
  border-color: rgba(146, 185, 230, 0.35);
  color: #9cc3ee;
}
.badge.onetime {
  background: rgba(111, 207, 143, 0.1);
  border-color: rgba(111, 207, 143, 0.35);
  color: #93dcab;
}
.badge.race {
  background: rgba(224, 138, 94, 0.1);
  border-color: rgba(224, 138, 94, 0.4);
  color: var(--warn);
}
.badge.locked {
  background: rgba(192, 92, 120, 0.1);
  border-color: rgba(192, 92, 120, 0.45);
  color: #d98aa2;
}

.quest-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.22rem;
}

.quest-toggle {
  font-size: 0.8rem;
  color: var(--link);
  cursor: pointer;
  margin-top: 0.3rem;
  padding: 0.3rem 0;
  display: inline-block;
  transition: color 0.15s ease;
}
.quest-toggle:hover { color: #b8d4f4; }

.quest-details {
  display: none;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg-inset);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}
.quest-details.open {
  display: block;
  animation: zone-fade 0.18s ease;
}
.quest-details div { padding: 0.05rem 0; }

/* ---------- NPC / recompensas ---------- */
.npc-inline, .npc-name, .npc-title {
  display: inline-flex;
  align-items: center;
}
.npc-inline { gap: 0.3rem; }
.npc-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  vertical-align: middle;
  object-fit: cover;
}
.npc-title { color: var(--good); font-size: 0.85em; }

.reward-block {
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reward-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.reward-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 0.08rem 0.45rem 0.08rem 0.08rem;
}

.reward-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  object-fit: contain;
  flex-shrink: 0;
}

.reward-name { color: var(--text); }

.reward-text {
  color: var(--text-dim);
  font-style: italic;
}

.grade-badge {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0 0.32rem;
  line-height: 1.4;
}
.grade-badge.grade-NG { background: #3a3a4a; color: #b8b6c8; }
.grade-badge.grade-D  { background: #2f5c3a; color: #8fe0a3; }
.grade-badge.grade-C  { background: #2f4a6a; color: #8dc3f0; }
.grade-badge.grade-B  { background: #4a2f6a; color: #c79df0; }
.grade-badge.grade-A  { background: #6a5a2f; color: #f0d99d; }
.grade-badge.grade-S  { background: #6a2f2f; color: #f09d9d; }

/* ---------- Botón de ubicación (pin) junto al NPC ---------- */
.npc-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid rgba(216, 178, 95, 0.45);
  border-radius: 50%;
  background: rgba(216, 178, 95, 0.08);
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.npc-pin-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.npc-pin-btn:active { transform: scale(0.92); }

/* ---------- Modal de mapa del mundo ---------- */
.map-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 6, 12, 0.88);
  align-items: center;
  justify-content: center;
  padding: max(0.8rem, env(safe-area-inset-top)) 0.8rem max(0.8rem, env(safe-area-inset-bottom));
}
.map-overlay.open {
  display: flex;
  animation: zone-fade 0.18s ease;
}

.map-dialog {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: min(680px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}

.map-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-card);
}
.map-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-bright);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-wiki-link {
  font-size: 0.8rem;
  white-space: nowrap;
}
.map-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.map-close:hover {
  color: var(--text);
  border-color: #3d3d58;
  background: rgba(255, 255, 255, 0.045);
}

.map-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #0a0a12;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.map-viewport.dragging { cursor: grabbing; }

.map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  --pin-inv: 1;
}
.map-img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%) scale(var(--pin-inv));
  border-radius: 50%;
  background: #e8474f;
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(232, 71, 79, 0.35), 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.map-pin::after {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid rgba(232, 71, 79, 0.65);
  animation: pin-pulse 1.6s ease-out infinite;
}
@keyframes pin-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.map-zoom {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 5;
}
.map-zoom button {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.map-zoom button:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-soft);
}

/* ---------- Guía "Cómo realizarla" (pasos de la wiki) ---------- */
.guide-block {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(216, 178, 95, 0.3);
}
.guide-header strong {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.guide-desc {
  margin: 0.35rem 0 0.2rem;
  font-style: italic;
  color: var(--text-dim);
}
.guide-step {
  position: relative;
  margin-top: 0.55rem;
  padding-left: 0.85rem;
  border-left: 2px solid rgba(216, 178, 95, 0.35);
}
.guide-step-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.guide-step-body { color: var(--text-dim); }
.guide-step-body p { margin: 0.25rem 0; }
.guide-step-body ul, .guide-step-body ol { margin: 0.25rem 0; padding-left: 1.2rem; }
.guide-step-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.4rem 0;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
}
.guide-step-body h2, .guide-step-body h3, .guide-step-body h4 {
  margin: 0.6rem 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text);
}
.guide-step-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0.4rem 0;
  font-size: 0.8rem;
  max-width: 100%;
}
.guide-step-body th, .guide-step-body td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.guide-step-body th { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.guide-step-body .npc-pin-btn {
  width: 1.25rem;
  height: 1.25rem;
  vertical-align: text-bottom;
}
.guide-src {
  margin-top: 0.55rem;
  font-size: 0.8rem;
}

/* ---------- Items con link a la wiki ---------- */
a.reward-item-link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
a.reward-item-link:hover {
  border-color: rgba(216, 178, 95, 0.5);
  background: rgba(216, 178, 95, 0.07);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
a.reward-item-link:hover .reward-name { color: var(--accent-bright); }

/* ---------- Footer ---------- */
footer {
  padding: 2rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
  opacity: 0.8;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  :root { font-size: 14px; }

  .topbar, .character-panel, .recommend-panel, .class-panel, .sync-panel, .controls, main, footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .character-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
  }

  .character-panel .field { width: 100%; }
  .character-panel select,
  .character-panel input[type="number"] {
    width: 100%;
  }

  .btn-secondary { width: 100%; text-align: center; }

  #searchBox { max-width: none; }

  .controls { flex-direction: column; align-items: stretch; }
  .toggle-completed { justify-content: flex-start; }

  .recommend-card, .quest-title-row {
    align-items: flex-start;
  }

  .quest-level, .badge { font-size: 0.72rem; }
}

@media (hover: none) {
  .btn-secondary:active { background: rgba(192, 92, 120, 0.18); }
  .sync-row .btn-secondary:active { background: var(--accent-glow); }
  .zone-header:active { background: var(--bg-panel); }
  .recommend-card:hover { transform: none; }
}

/* Menos animaciones si el usuario lo pide a nivel sistema */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
