/* Tokens tomados del archivo de Figma (Pokédex — 3 pantallas) */
:root {
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --surface: #f4f4f4;
  --white: #ffffff;
  --red: #e3350d;
  --red-hover: #c92e0b;
  --coral: #f2927f;
  --sky: #acd8ec;
  --chip-text: #555555;
  --radius-card: 12px;
  --radius-small: 8px;
  --shadow-frame: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 4px 4px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #e8e8e8;
  -webkit-font-smoothing: antialiased;
}

/* Lienzo tipo móvil, centrado en pantallas grandes */
#app {
  width: 100%;
  max-width: 390px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--white);
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
dt {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Estructura común */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px 20px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.header__title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.header__subtitle {
  font-size: 13px;
  color: var(--muted);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section__title {
  font-size: 16px;
  font-weight: 600;
}

/* Vista 1: Índice */
.panel--indice {
  background: var(--surface);
}

.daily {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.daily__top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.daily__sprite {
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: var(--radius-small);
  background: var(--surface);
  object-fit: contain;
  image-rendering: pixelated;
}

.daily__texts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily__name {
  font-size: 18px;
  font-weight: 700;
}

.daily__meta {
  font-size: 12px;
  color: var(--muted);
}

.btn {
  border-radius: var(--radius-small);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
}

.btn--primary {
  background: var(--red);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--red-hover);
}

.btn--ghost {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status--error {
  color: var(--red);
}

.status--on-color {
  color: var(--ink);
}

.gen-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gen-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.gen-item:hover {
  background: #fafafa;
}

.gen-item__texts {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gen-item__title {
  font-size: 15px;
  font-weight: 600;
}

.gen-item__meta {
  font-size: 12px;
  color: var(--muted);
}

.gen-item__chevron {
  font-size: 20px;
  color: var(--muted);
}

/* Vista 2: Catálogo */
.panel--catalogo {
  background: var(--white);
}

.header--row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px 16px;
}

.header--row .header__title {
  font-size: 20px;
}

.header__texts {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.btn-back {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 26px;
  line-height: 1;
}

.content--grid {
  gap: 12px;
  padding: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px 10px 12px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.card:hover {
  background: #fafafa;
}

.card__sprite {
  display: grid;
  place-items: center;
  height: 100px;
  border-radius: var(--radius-small);
  background: var(--surface);
}

.card__sprite img {
  height: 96px;
  width: auto;
  image-rendering: pixelated;
}

.card__number {
  font-size: 11px;
  color: var(--muted);
}

.card__name {
  font-size: 15px;
  font-weight: 600;
}

.chip {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 500;
  color: var(--chip-text);
}

/* Vista 3: Pokémon */
.panel--pokemon {
  gap: 20px;
  margin: 12px;
  padding: 24px;
  min-height: calc(100dvh - 24px);
  background: var(--coral);
  border-radius: 24px;
  box-shadow: var(--shadow-frame);
}

.detail-header {
  display: flex;
}

.btn-back--floating {
  width: 64px;
  height: 64px;
  font-size: 26px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.hero {
  position: relative;
  height: 240px;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: var(--sky);
  box-shadow: var(--shadow-inner);
}

.hero__lienzo {
  position: absolute;
  inset: 0;
}

.hero__lienzo canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 24px;
  background: var(--white);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-inner);
}

.sheet__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet__name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.sheet__number {
  font-size: 14px;
  color: var(--muted);
}

.types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.facts__row {
  display: flex;
  gap: 12px;
}

.fact {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
}

.fact__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.fact__value {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.description {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.description__title {
  font-size: 14px;
  font-weight: 600;
}

.description__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
