:root {
  --bg-primary: #FAF6F0;
  --bg-surface: #F1E6D6;
  --text-primary: #3D2310;
  --accent-primary: #9E3F1C;
  --honey-gold: #D9822B;
  --toasted-almond: #A66E38;
  --azulejo-border: #C89F72;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

#honey-canvas-p18 {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.22;
  margin-top: 0;
  color: var(--text-primary);
}

/* CABECERA Y MENÚ DE DEGUSTACIÓN */
.obrador-header {
  position: relative;
  z-index: 2;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--azulejo-border);
}

.brand-medallion {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.season-pulse {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--honey-gold);
  box-shadow: 0 0 0 0 rgba(217, 130, 43, 0.7);
  animation: pulseSeason 2.2s infinite;
  flex-shrink: 0;
}

@keyframes pulseSeason {
  0% { box-shadow: 0 0 0 0 rgba(217, 130, 43, 0.65); }
  70% { box-shadow: 0 0 0 12px rgba(217, 130, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 130, 43, 0); }
}

.eyebrow-tag,
.tile-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-primary);
}

.brand-title {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  margin: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.campaign-pill {
  background: var(--bg-surface);
  border: 1.5px solid var(--azulejo-border);
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
}

.tasting-menu-nav {
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(250, 246, 240, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 3px double var(--azulejo-border);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
}

.menu-tab {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.42rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.menu-tab:hover,
.menu-tab:focus-visible {
  background: var(--bg-surface);
  border-color: var(--toasted-almond);
}

/* CONTENEDOR PRINCIPAL Y MARCOS AZULEJO */
.obrador-main {
  position: relative;
  z-index: 2;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.75rem 1.4rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.azulejo-frame {
  background: rgba(241, 230, 214, 0.88);
  border: 2px solid var(--azulejo-border);
  border-radius: 18px;
  padding: clamp(1.35rem, 3vw, 2.3rem);
  box-shadow: 0 12px 28px rgba(61, 35, 16, 0.08);
  position: relative;
}

.azulejo-frame::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(158, 63, 28, 0.35);
  border-radius: 13px;
  pointer-events: none;
}

/* HERO */
.hero-obrador {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 2rem;
  align-items: center;
}

.hero-copy-col h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.55rem);
  margin-bottom: 0.85rem;
}

.hero-lead {
  font-size: 1.04rem;
  margin-bottom: 1.35rem;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.season-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.season-metrics div {
  background: var(--bg-primary);
  border: 1px solid var(--azulejo-border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.season-metrics dt {
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--accent-primary);
  font-weight: 700;
}

.season-metrics dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
  font-size: 0.94rem;
}

.obrador-illustration {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
}

/* BOTONES */
.btn-terracotta-solid,
.btn-wood-secondary,
.btn-terracotta-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-terracotta-solid {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border: 2px solid var(--accent-primary);
}

.btn-wood-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--toasted-almond);
}

.btn-terracotta-outline {
  background: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
}

.btn-terracotta-solid:hover,
.btn-wood-secondary:hover,
.btn-terracotta-outline:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* TEORÍA OBLIGATORIA */
.theory-parchment {
  background: var(--bg-primary);
}

.ceramic-seal {
  display: inline-block;
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
}

.theory-intro-literal {
  font-size: 1.06rem;
  background: var(--bg-surface);
  padding: 1rem 1.25rem;
  border-left: 5px solid var(--accent-primary);
  border-radius: 8px;
  margin-bottom: 1.4rem;
}

.theory-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
  margin-bottom: 1.4rem;
}

.wood-crate-box {
  background: var(--bg-surface);
  border: 2px solid var(--azulejo-border);
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
}

.literal-bullet-list,
.literal-step-list {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.theory-diagram-wrap {
  margin: 0;
  text-align: center;
}

.theory-diagram-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* FRANJA DE ESTADO */
.campaign-status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.status-item {
  background: var(--bg-surface);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.status-item.is-done {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

/* 4 JUEGOS CAJONES DE TURRÓN */
.section-banner-head {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 1.5rem;
}

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

.turron-crate-card {
  background: var(--bg-surface);
  border: 3px solid var(--toasted-almond);
  border-radius: 16px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: inset 0 0 0 3px rgba(250, 246, 240, 0.7), 0 8px 20px rgba(61, 35, 16, 0.07);
}

.crate-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crate-number {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
}

.crate-badge {
  background: var(--bg-primary);
  border: 1px solid var(--azulejo-border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.crate-desc {
  margin: 0;
  font-size: 0.94rem;
}

/* Juego 1 */
.months-shift-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.month-row {
  background: var(--bg-primary);
  border: 1px solid var(--azulejo-border);
  border-radius: 9px;
  padding: 0.45rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.month-info {
  display: flex;
  flex-direction: column;
  font-size: 0.86rem;
}

.shift-btn-group {
  display: flex;
  gap: 0.35rem;
}

.shift-btn {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 7px;
  padding: 0.32rem 0.65rem;
  font-weight: 700;
  cursor: pointer;
}

.shift-btn.is-selected {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

/* Juego 2 */
.shared-machines-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.machine-box {
  background: var(--bg-primary);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 10px;
  padding: 0.7rem;
  text-align: center;
}

.machine-title {
  display: block;
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 700;
}

.machine-state {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.g2-counters {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.88rem;
  background: var(--bg-primary);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

/* Juego 3 */
.changeover-stage-box {
  background: var(--bg-primary);
  border: 1px solid var(--azulejo-border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.stage-current-label {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.changeover-progress-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.87rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.changeover-progress-list li.step-ok {
  color: var(--accent-primary);
  font-weight: 700;
}

/* Juego 4 */
.capacity-meter-bar {
  height: 16px;
  background: var(--bg-primary);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 999px;
  overflow: hidden;
}

.capacity-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--honey-gold), var(--accent-primary));
  transition: width 0.25s ease;
}

.capacity-numbers {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.orders-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.order-chip-btn {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 9px;
  padding: 0.55rem 0.65rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.order-chip-btn.is-picked {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.crate-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.feedback-line {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-primary);
}

/* CÁMARA ADAPTATIVA PC (16:9) Y MÓVIL (3:4) */
.camera-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.camera-score-card {
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  border-radius: 14px;
  padding: 0.75rem 1.15rem;
  text-align: center;
  min-width: 170px;
}

.camera-score-card span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 700;
}

.camera-score-card strong {
  display: block;
  font-size: 1.65rem;
  color: var(--accent-primary);
}

.camera-toolbar-p18 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.camera-stage-outer {
  width: 100%;
  max-width: 880px;
  margin: 0 auto 0.9rem;
  aspect-ratio: 16 / 9;
  background: #2b190c;
  border: 3px solid var(--toasted-almond);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

#camera-canvas-p18 {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

.hidden-source-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* RESUMEN FINAL Y FOOTER */
.summary-celebration-box {
  text-align: center;
}

.summary-badges-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.1rem 0 1.3rem;
}

.summary-chip {
  background: var(--bg-primary);
  border: 1.5px solid var(--azulejo-border);
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.summary-chip.done {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.obrador-footer {
  text-align: center;
  padding: 1.5rem 1rem 2.2rem;
  font-size: 0.88rem;
  border-top: 2px solid var(--azulejo-border);
}

.obrador-dialog {
  border: 3px solid var(--accent-primary);
  border-radius: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  max-width: 520px;
  padding: 0;
}

.obrador-dialog::backdrop {
  background: rgba(61, 35, 16, 0.55);
}

.dialog-inner {
  padding: 1.5rem;
}

/* RESPONSIVO */
@media (max-width: 920px) {
  .hero-obrador,
  .theory-two-columns,
  .crates-grid {
    grid-template-columns: 1fr;
  }

  .campaign-status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .camera-stage-outer {
    max-width: 440px;
    aspect-ratio: 3 / 4;
  }

  .season-metrics,
  .orders-toggle-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .season-pulse {
    animation: none;
  }
}
