:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-hover: #fbfaf7;
  --border: #e2dfd7;
  --text: #1d1c1a;
  --text-muted: #6b675f;
  --brand: #c2571a;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.06), 0 12px 32px rgb(0 0 0 / 0.08);
  --radius: 14px;
  --accent: var(--brand);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1c1c1a;
    --surface-hover: #232321;
    --border: #2e2d2a;
    --text: #edebe6;
    --text-muted: #9c988f;
    --brand: #e8834a;
    --focus: #7aa2ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-hover: 0 8px 28px rgb(0 0 0 / 0.45);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
}

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

h1:focus {
  outline: none;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Cabecera y pie ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.lang {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-icon {
  font-size: 0.95rem;
  opacity: 0.7;
}

.lang-select {
  max-width: 10rem;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-select:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.brand-mark {
  color: var(--brand);
}

main.container {
  flex: 1;
  padding-top: 40px;
  padding-bottom: 56px;
}

.site-footer.container {
  padding-top: 24px;
  padding-bottom: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- Encabezado de página ---------- */

.page-head {
  margin-bottom: 32px;
}

.page-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-head h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin-top: 14px;
  border-radius: 2px;
  background: var(--accent);
}

.lead {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.back:hover {
  color: var(--text);
}

.status {
  color: var(--text-muted);
}

.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Rejillas y tarjetas ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grid-tools {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

/* Otras herramientas (portada) */

.other-tools {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.section-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.other-tools .section-lead {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.grid > li {
  display: flex;
}

.card {
  flex: 1;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--surface-hover);
  box-shadow: var(--shadow-hover);
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 20px;
}

.card-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.card-meta,
.card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Juego */

.card-game {
  flex-direction: column;
}

.cover {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 55%, #fff) 0%, transparent 60%),
    linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-initial {
  color: rgb(255 255 255 / 0.92);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 12px rgb(0 0 0 / 0.25);
}

/* Secciones (otras herramientas) */

.section {
  margin-top: 48px;
}

.section-title {
  margin: 0 0 4px;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.section .lead {
  margin-bottom: 20px;
  font-size: 1rem;
}

/* Herramienta */

.card-tool {
  position: relative;
  border-left: 4px solid var(--accent);
}

.card-tool .card-body {
  padding-right: 48px;
}

.card-icon {
  flex: none;
  width: 48px;
  height: 48px;
  margin: 18px 0 0 20px;
  border-radius: 11px;
}

.card-tool.has-icon .card-body {
  padding-left: 14px;
}

.card-arrow {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

a.card-tool:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.tool-icon {
  flex: none;
  width: 40px;
  height: 40px;
  margin: 20px 0 0 18px;
  object-fit: contain;
}

.badge {
  align-self: flex-start;
  margin-top: 8px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.card.is-disabled {
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card-arrow {
    transition: none;
  }

  a.card:hover,
  a.card-tool:hover .card-arrow {
    transform: none;
  }
}
