:root {
  --paper: #f3ecdf;
  --paper-2: #fffaf3;
  --ink: #241c16;
  --ink-soft: #5e534a;
  --line: #e3d5c4;
  --terracotta: #b84324;
  --terracotta-deep: #8c3018;
  --olive: #2f4634;
  --olive-soft: #e5efe3;
  --easy: #2f4634;
  --medium: #8a5a12;
  --hard: #8c3018;
  --sombra: 0 16px 40px rgba(36, 28, 22, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, #f8e1d0 0%, transparent 60%),
    var(--paper);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.barra {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(243, 236, 223, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}

.marca {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-decoration: none;
}

main {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 4.5rem;
}

.hero { padding: 1.6rem 0 0.4rem; }

.eyebrow {
  margin: 0;
  color: var(--terracotta-deep);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0.2rem 0 1rem;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.modos {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.modos button,
.chip,
.boton.secundario {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
}

.modos button {
  padding: 0.35rem 0.85rem;
}

.modos button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.campo {
  display: flex;
  gap: 0.55rem;
}

.campo input,
#url-video {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.9rem 1.15rem;
  box-shadow: var(--sombra);
}

#url-video { border-radius: 14px; box-shadow: none; }

.campo input { flex: 1; min-width: 0; }

.boton {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  background: var(--terracotta);
  color: white;
  font-weight: 600;
  white-space: nowrap;
}

.boton:disabled { opacity: 0.65; cursor: wait; }

.acciones-barra {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.boton-anadir .corto,
.boton-propia .corto,
.boton-favoritas .corto { display: none; }

#abrir-favoritas[aria-pressed="true"] {
  background: var(--olive);
  color: white;
  border-color: var(--olive);
}

.boton.secundario {
  background: var(--paper-2);
  color: var(--ink);
}

.etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.chip {
  padding: 0.28rem 0.7rem;
  color: var(--ink-soft);
}

.chip[aria-pressed="true"] {
  background: var(--olive);
  color: white;
  border-color: var(--olive);
}

.estado {
  min-height: 1.4rem;
  margin: 0.9rem 0 0.2rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.estado-error { color: var(--terracotta-deep); }

.respuesta {
  margin: 0.6rem 0 1.2rem;
  padding: 1.15rem 1.25rem 1.2rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.respuesta h2 {
  margin: 0 0 0.45rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
}

.respuesta p { margin: 0; white-space: pre-wrap; }

.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
  margin-top: 0.8rem;
}

.tarjeta {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--sombra);
}

.favorita {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.94);
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1;
}

.tarjeta .favorita {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1;
}

.favorita[aria-pressed="true"] {
  background: var(--terracotta);
  color: white;
}

.favorita-detalle {
  width: auto;
  height: auto;
  margin-top: 0.85rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.cabecera-receta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.cabecera-receta h1 { flex: 1; min-width: 0; }

.tarjeta-enlace {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.portada,
.portada-vacia {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #1b1612;
}

.portada-vacia {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #3d4f3a, #241c16);
  color: #f3ecdf;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.15rem;
}

.tarjeta h2 {
  margin: 0.9rem 1rem 0.3rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: center;
  margin: 0 1rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.etiquetas-tarjeta { margin: 0 0.8rem 0.9rem; }

.pill {
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  background: var(--olive-soft);
  color: var(--easy);
}

.pill.media { background: #f6ead2; color: var(--medium); }
.pill.dificil { background: #f6e1d8; color: var(--hard); }

.mas { margin: 1.4rem auto 0; }

.volver {
  display: inline-flex;
  align-items: center;
  margin-top: 1.2rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.volver-final { margin-bottom: 2rem; }

.pie-receta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.pie-receta .volver-final { margin: 0; }

.boton.texto {
  background: transparent;
  color: var(--terracotta-deep);
  padding-inline: 0.2rem;
}

.notas {
  margin-top: 1.3rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-2);
}

.notas h2,
.notas label {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notas textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.acciones-nota {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.notas-leidas {
  padding-bottom: 0.85rem;
}

.nota-texto {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notas-leidas .boton.texto {
  margin-top: 0.7rem;
  padding-left: 0;
}

.nota-estado {
  min-height: 1.3rem;
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.detalle h1 {
  margin: 0.75rem 0 0.45rem;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
}

.detalle .meta,
.detalle .etiquetas-tarjeta {
  margin-left: 0;
  margin-right: 0;
}

.reproductor {
  margin-top: 1rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #1b1612;
}

.reproductor iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.reproductor-enlace {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.8rem;
  padding: 1.5rem;
  text-align: center;
  color: #f3ecdf;
  background: linear-gradient(160deg, #3d4f3a, #241c16);
}

.reproductor-enlace p { margin: 0; }

.reproductor-enlace a {
  color: #f3ecdf;
  border: 1px solid rgba(243, 236, 223, 0.55);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.enlace-video {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--terracotta-deep);
  font-weight: 600;
}

.layout-receta {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.3rem;
}

.panel,
.columna {
  border-radius: 18px;
  padding: 1rem 1rem 0.4rem;
}

.panel { background: var(--olive-soft); }

.columna { background: var(--paper-2); border: 1px solid var(--line); }

.panel h2,
.columna h2 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pista {
  margin: 0 0 0.6rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.casillas {
  list-style: none;
  margin: 0;
  padding: 0 0 0.6rem;
}

.casilla {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.7rem 0.65rem;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.casilla[aria-pressed="true"] { background: rgba(255, 250, 243, 0.8); }

.casilla[aria-pressed="true"] .numero,
.casilla[aria-pressed="true"] .punto {
  background: var(--olive);
  color: white;
}

.casilla[aria-pressed="true"] .texto {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.numero,
.punto {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--olive);
  font-size: 0.85rem;
  font-weight: 600;
}

.columna .numero { background: var(--olive-soft); }

.cantidad {
  margin-right: 0.4rem;
  color: var(--ink-soft);
}

#propia {
  width: min(40rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}

.formulario label {
  display: block;
  margin: 0.75rem 0 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.formulario input,
.formulario select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: var(--paper);
}

.fila-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.formulario fieldset {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0 0;
  border: 0;
}

.formulario legend {
  padding: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.linea-form {
  display: flex;
  gap: 0.4rem;
  margin: 0.4rem 0;
}

.linea-form input { flex: 1; min-width: 0; }

.linea-form .cantidad-input { flex: 0 0 7.5rem; }

.formulario fieldset .boton { margin-top: 0.2rem; }

dialog {
  width: min(32rem, calc(100% - 2rem));
  padding: 1.4rem 1.3rem 1.2rem;
  border: 0;
  border-radius: 20px;
  background: var(--paper-2);
  box-shadow: 0 24px 80px rgba(36, 28, 22, 0.22);
}

dialog h2 {
  margin: 0 0 0.4rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.8rem;
}

dialog p { margin: 0 0 0.9rem; color: var(--ink-soft); }

dialog::backdrop { background: rgba(36, 28, 22, 0.46); }

.acciones {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

@media (min-width: 860px) {
  .layout-receta {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }
}

@media (hover: hover) {
  .tarjeta { transition: transform 0.18s ease; }
  .tarjeta:hover { transform: translateY(-3px); }
}

@media (max-width: 560px) {
  .barra { padding-inline: 0.75rem; }
  .boton-anadir .largo,
  .boton-propia .largo,
  .boton-favoritas .largo { display: none; }
  .boton-anadir .corto,
  .boton-propia .corto,
  .boton-favoritas .corto { display: inline; }
  .fila-form { grid-template-columns: 1fr; }
  .boton-favoritas { padding-inline: 0.85rem; }
  .cabecera-receta { flex-direction: column; }
  .favorita-detalle { margin-top: 0; }
  .campo { flex-direction: column; }
  .campo .boton { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tarjeta { transition: none; }
}
