/* Fuente del juego: Born Again si está instalada en el equipo; si no, Caveat Brush (incluida, licencia OFL). */
@font-face {
  font-family: "GameFont";
  src: local("Born Again"), local("BornAgain"), local("Born Again Regular"),
       url("../assets/fonts/caveat-brush-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  font-display: swap;
}
@font-face {
  font-family: "GameFont";
  src: local("Born Again"), local("BornAgain"), url("../assets/fonts/caveat-brush-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  font-display: swap;
}
:root {
  /* Colores: piedra oscura y oro, como los paneles del cliente de Tibia */
  --bg: #0f0d0b;
  --bg-2: #1b1713;
  --panel: #2a241e;
  --panel-2: #342c24;
  --panel-border: #5a4a36;
  --panel-border-light: #8a7350;
  --text: #ece3d0;
  --muted: #a89a82;
  --gold: #f5c542;
  --gold-dark: #b8860b;
  --accent: #e8a33d;
  --danger: #d9534f;
  --good: #5dd16a;
  --hp: #d93a3a;
  --xp: #3fa9f5;
  --boss: #c0392b;
  --portal: #c77dff;

  --common: #cfd6e4;
  --uncommon: #5dd16a;
  --rare: #4ea3ff;
  --epic: #c77dff;

  --font: "GameFont", "Born Again", "Caveat Brush", "Comic Sans MS", cursive;
  --radius: 0.5rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --shadow: 0 0.25rem 0 rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

button { font: inherit; color: inherit; }
img { image-rendering: pixelated; object-fit: contain; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
code { background: var(--bg-2); padding: 0 0.3em; border-radius: 0.25rem; }

#game { position: fixed; inset: 0; }
#game canvas { display: block; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > #hud, #ui > #toasts { pointer-events: none; }
#ui > #modal:empty, #ui > #screen:empty { display: none; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.empty { color: var(--muted); padding: var(--space-6) var(--space-4); text-align: center; }

.coin {
  display: inline-block;
  width: 0.9em; height: 0.9em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b0 0 15%, var(--gold) 16% 60%, var(--gold-dark) 61%);
  vertical-align: -0.1em;
  margin-right: 0.25em;
}

.rarity-text-common { color: var(--common); }
.rarity-text-uncommon { color: var(--uncommon); }
.rarity-text-rare { color: var(--rare); }
.rarity-text-epic { color: var(--epic); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* El atributo hidden debe ganar a los display de componentes */
#ui [hidden] { display: none; }
