:root {
  --bg: #0b1020;
  --card: #141a2e;
  --card2: #1d2540;
  --text: #eef1fa;
  --muted: #94a0c0;
  --accent: #37c8ab;
  --accent2: #ffb020;
  --danger: #e5484d;
  --gold: #ffd166;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
[data-theme="light"] {
  --bg: #eef1f7;
  --card: #ffffff;
  --card2: #e6eaf4;
  --text: #141a2e;
  --muted: #5a6484;
  --shadow: 0 6px 16px rgba(20, 30, 70, .12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; transition: background .25s, color .25s;
}
#app, main { max-width: 560px; margin: 0 auto; padding: 0 12px 30px; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 8px; max-width: 560px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 30px; }
.brand h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.iconbtn {
  border: 0; background: var(--card2); color: var(--text); font-size: 18px;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer; box-shadow: var(--shadow);
}

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin: 10px 0; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h2 { font-size: 17px; margin: 16px 0 8px; }

/* progreso */
.dex-line { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 18px; }
.bar { height: 14px; border-radius: 999px; background: var(--card2); margin: 8px 0 6px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s ease; }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tabs button {
  flex: 1; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px;
  padding: 10px 4px; border-radius: 12px; background: var(--card2); color: var(--muted);
}
.tabs button.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }

/* especies */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dex-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px; cursor: pointer; border: 1px solid transparent; position: relative;
  transition: transform .1s;
}
.dex-card:active { transform: scale(.98); }
.dex-card .num { font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: 1px; }
.dex-card .art {
  height: 74px; display: flex; align-items: center; justify-content: center; font-size: 44px; margin: 2px 0;
}
.dex-card.undis .art { filter: brightness(0); opacity: .9; }
.dex-card .nm { font-weight: 800; font-size: 14px; line-height: 1.15; }
.dex-card .sc { font-size: 11px; color: var(--muted); font-style: italic; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dex-card .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .3px;
}
.chip.hab { background: var(--card2); color: var(--text); }
.chip.origin { color: #0b1020; }
.chip.aut { background: #7ed957; }
.chip.int { background: #ffb020; }
.chip.mig { background: #6ab7ff; }
.chip.oca { background: #c792ff; }
.rarity { font-size: 11px; color: var(--muted); }
.dex-card .me { position: absolute; top: 8px; right: 8px; }

/* listas / capturas */
.list { display: flex; flex-direction: column; gap: 8px; }
.catch {
  display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow);
}
.catch .emo { font-size: 26px; }
.catch .inf { flex: 1; min-width: 0; }
.catch .t { font-weight: 700; }
.catch .s { font-size: 12px; color: var(--muted); }
.catch .del { border: 0; background: var(--card2); color: var(--danger); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }
.photo-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }

/* récords */
.records { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rec { background: var(--card2); border-radius: 12px; padding: 8px 10px; }
.rec .k { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.rec .v { font-weight: 800; }

/* logros */
.achievements { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ach {
  background: var(--card); border-radius: 12px; padding: 10px; box-shadow: var(--shadow);
  display: flex; gap: 8px; align-items: center; border: 1px solid transparent;
}
.ach .e { font-size: 22px; }
.ach .n { font-weight: 700; font-size: 13px; }
.ach .d { font-size: 11px; color: var(--muted); }
.ach.locked { opacity: .45; filter: grayscale(1); }
.ach.unlocked { border-color: var(--accent); }

/* mapa */
.mapwrap svg { width: 100%; height: auto; }
.place-dot { cursor: pointer; }
.place-dot circle.halo { fill: none; stroke: var(--accent); stroke-width: 1; }

/* botones */
.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 12px 16px; border-radius: 14px; color: var(--text); background: var(--card2);
  box-shadow: var(--shadow); transition: filter .15s, transform .08s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #062018; flex: 1; }
.btn.ghost { background: var(--card2); flex: 1; }
.btn.danger { background: var(--danger); color: #fff; flex: 1; }
.btn.big { font-size: 16px; width: 100%; margin: 8px 0; }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 20px; padding: 18px; max-width: 430px; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-box h3 { margin: 0 0 8px; }
.modal-btns { display: flex; gap: 10px; margin-top: 14px; }
.sp-header { display: flex; gap: 14px; align-items: center; }
.sp-header .art { font-size: 64px; }
.sp-header h2 { margin: 0; font-size: 22px; }
.sp-body { margin-top: 10px; }
.sp-body .row { display: flex; gap: 14px; flex-wrap: wrap; }
.sp-body .lbl { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.sp-caps { margin-top: 10px; }

/* formulario */
form label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 2px; }
form input, form select, form textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--card2);
  border: 1px solid transparent; border-radius: 10px; padding: 10px; outline: none;
}
form input:focus, form select:focus, form textarea:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* celebración */
.celebration {
  position: fixed; inset: 0; z-index: 90; background: rgba(6, 20, 16, .92);
  display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center;
}
.celebration[hidden] { display: none; }
.celeb-box h2 { font-size: 28px; margin: 0 0 10px; color: var(--gold); }
.celeb-box .btn { margin-top: 16px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: var(--card2); color: var(--text);
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow);
  font-weight: 700; z-index: 80; max-width: 92vw; text-align: center;
  border: 1px solid var(--accent);
}
.toast[hidden] { display: none; }
