:root {
  --bg-primary: #F5EBDD;
  --bg-surface: #EFE0CB;
  --text-primary: #5C3A21;
  --accent-primary: #2E5A44;
  --cinnamon-red: #B8332A;
  --crust-border: #C9AD88;
  --sticky-yellow: #FFF8DC;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.62;
  overflow-x: clip;
}

#bakery-steam-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

h1, h2, h3, h4, .stamp-title {
  font-family: 'Fraunces', Georgia, serif;
  margin-top: 0;
}

/* Estructura de libro abierto con pestañas laterales */
.recipebook-shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 255px 1fr;
  gap: 1.6rem;
  padding: clamp(1rem, 2.5vw, 2rem);
  align-items: start;
}

.bookmark-rail {
  position: sticky;
  top: 1.2rem;
  background: var(--bg-surface);
  border: 2px solid var(--crust-border);
  border-radius: 14px;
  padding: 1.15rem;
  box-shadow: 0 10px 26px rgba(92, 58, 33, 0.1);
}

.bakery-stamp {
  border-bottom: 2px dashed var(--crust-border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
}

.stamp-small {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cinnamon-red);
  letter-spacing: 0.09em;
}

.stamp-title {
  font-size: 1.35rem;
}

.bookmark-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tab-separator {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  background: var(--sticky-yellow);
  border-left: 5px solid var(--accent-primary);
  border-radius: 0 10px 10px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  box-shadow: 2px 3px 8px rgba(92, 58, 33, 0.08);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.tab-separator:hover,
.tab-separator:focus-visible {
  transform: translateX(5px);
  border-left-color: var(--cinnamon-red);
}

.mobile-tab-btn {
  display: none;
}

.oven-btn {
  appearance: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.68rem 1.1rem;
  min-height: 45px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s;
}

.oven-btn:hover {
  transform: translateY(-2px);
}

.oven-btn:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

.btn-sage {
  background: var(--accent-primary);
  color: #FFFFFF;
}

.btn-cinnamon {
  background: var(--cinnamon-red);
  color: #FFFFFF;
}

.btn-crust {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--crust-border);
}

.open-book-pages {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.parchment-spread {
  background: linear-gradient(90deg, #FBF5EC 0%, #F7ECDC 49.6%, #DFC9AC 50%, #FBF5EC 50.5%, #F8EFE1 100%);
  border: 2px solid var(--crust-border);
  border-radius: 16px;
  padding: clamp(1.25rem, 3vw, 2.2rem);
  box-shadow: 0 14px 32px rgba(92, 58, 33, 0.11);
}

[data-reveal] {
  opacity: 0;
  transform: perspective(900px) rotateX(4deg) translateY(18px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: perspective(900px) rotateX(0deg) translateY(0);
}

.spread-two-pages {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.8rem;
  align-items: center;
}

.kanban-tag {
  display: inline-block;
  background: rgba(46, 90, 68, 0.13);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
}

.bakery-lead {
  font-size: 1.04rem;
  margin-bottom: 1.1rem;
}

.kanban-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.top-gap {
  margin-top: 0.9rem;
}

.sticky-kpi {
  background: var(--sticky-yellow);
  border: 1px solid var(--crust-border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.sticky-kpi span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cinnamon-red);
}

.bakery-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.recipe-illustration {
  margin: 0;
  background: var(--bg-surface);
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--crust-border);
}

.recipe-illustration img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.recipe-illustration figcaption {
  font-size: 0.83rem;
  padding-top: 0.45rem;
  text-align: center;
}

/* Teoría */
.sheet-title-row {
  border-bottom: 2px dashed var(--crust-border);
  padding-bottom: 0.65rem;
  margin-bottom: 1.1rem;
}

.jit-question {
  color: var(--cinnamon-red);
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  margin-bottom: 0.55rem;
}

.jit-exact-p {
  background: var(--sticky-yellow);
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--accent-primary);
  border-radius: 8px;
}

.kanban-notes-duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
  margin: 1.15rem 0;
}

.sticky-note-panel {
  background: var(--sticky-yellow);
  border: 1px solid var(--crust-border);
  border-radius: 10px;
  padding: 1.05rem;
  box-shadow: 0 6px 16px rgba(92, 58, 33, 0.07);
}

.sticky-note-panel.note-green {
  background: #EDF5F0;
}

.recipe-bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.recipe-bullet-list li {
  background: rgba(255, 255, 255, 0.68);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.93rem;
}

.chapter-check-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: #EDF5F0;
  border: 1px solid var(--accent-primary);
  padding: 0.85rem 1.05rem;
  border-radius: 10px;
}

/* Notas adhesivas Kanban de los 4 juegos */
.kanban-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.35rem;
}

.kanban-game-note {
  position: relative;
  background: var(--sticky-yellow);
  border: 1px solid var(--crust-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 8px 20px rgba(92, 58, 33, 0.09);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cinnamon-red);
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.oven-display {
  background: var(--text-primary);
  color: #FFF8DC;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.oven-display.kanban-active {
  background: var(--accent-primary);
  color: #FFFFFF;
}

.note-status {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cinnamon-red);
  margin: 0;
}

.closing-batch-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.closing-batch-controls input {
  width: 90px;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--crust-border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}

/* Cámara PC horizontal / Móvil vertical */
.bakery-cam-box {
  width: 100%;
  max-width: 860px;
  margin: 0.85rem auto 0;
  aspect-ratio: 16 / 9;
  background: #3B2313;
  border: 3px solid var(--accent-primary);
  border-radius: 14px;
  overflow: hidden;
}

.bakery-cam-box.portrait-cam {
  max-width: 420px;
  aspect-ratio: 3 / 4;
}

#jcam-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.jit-stamps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.25rem;
}

.jit-stamp-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--sticky-yellow);
  border: 1px solid var(--crust-border);
  font-weight: 700;
  font-size: 0.85rem;
}

.jit-stamp-pill.done {
  background: var(--accent-primary);
  color: #FFFFFF;
}

.bakery-footer {
  text-align: center;
  padding: 1.5rem 1rem 2.2rem;
  background: var(--bg-surface);
  border-top: 2px solid var(--crust-border);
  font-size: 0.92rem;
}

.bakery-dialog {
  max-width: 590px;
  width: calc(100% - 2rem);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 3px solid var(--accent-primary);
  border-radius: 14px;
  padding: 1.5rem;
}

.bakery-dialog::backdrop {
  background: rgba(59, 35, 19, 0.7);
}

@media (max-width: 980px) {
  .recipebook-shell {
    grid-template-columns: 1fr;
  }
  .bookmark-rail {
    position: static;
  }
  .spread-two-pages {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .mobile-tab-btn {
    display: inline-flex;
    width: 100%;
    margin-bottom: 0.55rem;
  }
  .bookmark-nav {
    display: none;
  }
  .bookmark-nav.open {
    display: flex;
  }
  .bakery-cam-box {
    max-width: 410px;
    aspect-ratio: 3 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
