:root {
  --ink: #342f25;
  --muted: #736956;
  --paper: #f7f0de;
  --line: #cec1a7;
  --green: #344c40;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #eae0c9;
  color: var(--ink);
  font:
    16px/1.5 system-ui,
    sans-serif;
  background-image: radial-gradient(
    ellipse at 35% 30%,
    #faf5e9,
    transparent 70%
  );
}
button,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f2e5;
  padding: 12px 17px;
  min-height: 46px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #e4dbc6;
}
button:active {
  transform: translateY(1px);
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid #996b32;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.primary:hover {
  background: #466450;
}
[hidden] {
  display: none !important;
}
header {
  height: 76px;
  padding: 15px 4vw;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}
.brand span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.7px;
  font-weight: 400;
  color: var(--muted);
}
h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  line-height: 1.05;
}
h1 {
  font-size: clamp(48px, 6.8vw, 98px);
  margin: 20px 0;
}
h1 em {
  color: var(--green);
}
.eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 2px;
  color: var(--muted);
}
#welcome {
  max-width: 1150px;
  margin: auto;
  min-height: calc(100svh - 76px);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  padding: 30px;
  gap: 40px;
}
.intro > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
}
.intro .primary {
  margin: 15px 0;
}
.intro small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.cover {
  height: min(72svh, 680px);
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 180px 180px 5px 5px;
  background: #f7efda;
  box-shadow: 12px 15px 35px #5b493015;
  padding: 20px;
  overflow: hidden;
}
.cover img {
  height: calc(100% - 40px);
  max-width: 100%;
  object-fit: contain;
}
.cover span {
  font-size: 9px;
  letter-spacing: 2px;
  padding: 16px 0;
}
#game {
  max-width: 1250px;
  margin: auto;
  height: calc(100svh - 76px);
  padding: 20px 35px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 55px;
  align-items: center;
}
.workbench {
  height: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
}
.book {
  height: 100%;
  max-height: 900px;
  aspect-ratio: 0.68;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 6px 8px 25px #55452e1a;
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.book-top,
.book-bottom {
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 8px;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.book-bottom {
  justify-content: center;
}
#parts {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: 28fr 34fr 38fr;
}
.part {
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
}
.part + .part {
  border-top: 1px dashed #c7b99b;
}
.part canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  width: 42px;
  height: 44px;
  min-height: 44px;
  background: #f7f0dedb;
  font: 30px Georgia;
  border: 1px solid #cbbd9f;
  z-index: 1;
}
.arrow:active {
  transform: translateY(-50%);
}
.prev {
  left: 5px;
}
.next {
  right: 5px;
}
aside h2 {
  font-size: clamp(30px, 4vw, 54px);
  overflow-wrap: anywhere;
  margin: 16px 0;
}
.instruction {
  color: var(--muted);
  font-size: 14px;
  max-width: 320px;
}
#ingredients {
  border-top: 1px solid var(--line);
  margin: 23px 0;
}
#ingredients p {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
#ingredients span {
  color: var(--muted);
}
.actions {
  display: grid;
  gap: 9px;
}
.choose {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 19px;
}
.choose select {
  display: block;
  width: 100%;
  margin-top: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}
.back {
  margin-top: 14px;
  border: 0;
  background: none;
  padding-left: 0;
  font-size: 12px;
}
#status {
  font-size: 12px;
  color: var(--green);
  min-height: 18px;
  margin: 5px 0;
}
@media (max-width: 650px) and (orientation: portrait) {
  header {
    height: 63px;
    padding: 10px 16px;
  }
  header button {
    padding: 5px 12px;
  }
  header button span {
    display: none;
  }
  .brand {
    font-size: 11px;
  }
  .brand span {
    font-size: 9px;
  }
  #welcome {
    min-height: calc(100svh - 63px);
    gap: 20px;
    padding: 25px 22px;
    grid-template-columns: 1fr;
  }
  .cover {
    display: none;
  }
  #game {
    height: auto;
    min-height: calc(100svh - 63px);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
  }
  .workbench {
    height: min(58svh, 580px);
    width: 100%;
    flex-shrink: 0;
  }
  .book {
    aspect-ratio: 0.72;
  }
  aside {
    width: 100%;
    max-width: 440px;
    text-align: center;
  }
  aside .eyebrow,
  .instruction,
  #ingredients,
  .choose,
  .back {
    display: none;
  }
  aside h2 {
    font-size: 29px;
    margin: 0 0 12px;
  }
  .actions {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .actions button {
    font-size: 12px;
    padding: 9px;
  }
  .actions .primary {
    grid-column: 1/-1;
  }
  .book-top,
  .book-bottom {
    height: 23px;
    font-size: 7px;
  }
  #status {
    margin: 4px;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  header {
    height: 48px;
    padding: 5px 20px;
  }
  .brand span {
    display: none;
  }
  header button {
    min-height: 34px;
    padding: 4px 12px;
  }
  #game {
    height: calc(100svh - 48px);
    padding: 8px 20px;
    gap: 25px;
    grid-template-columns: 1fr 1fr;
  }
  .eyebrow,
  .instruction,
  #ingredients,
  .choose,
  .back {
    display: none;
  }
  aside h2 {
    font-size: 28px;
    margin: 0 0 13px;
  }
  .actions {
    gap: 6px;
  }
  .actions button {
    padding: 6px;
    min-height: 37px;
    font-size: 12px;
  }
  .book-top,
  .book-bottom {
    height: 19px;
    font-size: 6px;
  }
  #welcome {
    min-height: calc(100svh - 48px);
    padding: 15px 35px;
  }
  .cover {
    height: 70svh;
  }
  h1 {
    font-size: 43px;
    margin: 10px 0;
  }
  .intro > p:not(.eyebrow) {
    font-size: 14px;
  }
  .intro small {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* Conserva la proporción del lienzo incluso al cambiar la orientación. */
.part canvas {
  object-fit: contain;
}
@media (max-width: 650px) and (orientation: portrait) {
  .choose {
    display: block;
    margin-top: 10px;
  }
  .choose select {
    padding: 6px;
    text-align: center;
  }
  .workbench {
    height: min(60svh, 620px);
  }
}

/* v1.1: una imagen continua, recortada en tercios exactos. */
#parts {
  grid-template-rows: repeat(3, minmax(0, 1fr));
}
.part + .part {
  border-top: 0;
}
.part + .part::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-top: 1px dashed #c7b99b;
  pointer-events: none;
}
.part .slice {
  position: absolute;
  height: 300%;
  width: auto;
  max-width: none;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  user-select: none;
  pointer-events: none;
}
.book {
  aspect-ratio: 0.74;
}
@media (max-width: 650px) and (orientation: portrait) {
  .book {
    aspect-ratio: 0.74;
  }
}

/* Edición Expo Rural: identidad del stand y controles siempre accesibles. */
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.header-actions button {
  font-size: 13px;
}
.event-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  border-left: 3px solid #9c783d;
  padding: 6px 13px;
  color: #7a5b2c;
  font-size: 10px;
  letter-spacing: 2px;
}
.event-badge span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}
.intro-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.intro-brand .eyebrow {
  margin: 0 0 7px;
}
.welcome-logo {
  width: 108px;
  height: 68px;
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid #ded5c1;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 5px 6px 18px #55452e17;
}
.stand-note {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.stand-note strong {
  font-family: Georgia, serif;
  font-size: 18px;
  color: var(--green);
  font-weight: 400;
}
.mobile-specimens {
  display: none;
}
#idleNotice {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 12px 20px;
  background: #344c40;
  color: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px #0003;
  font-size: 14px;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}
#idleSeconds {
  white-space: nowrap;
  font-weight: bold;
}
@media (max-width: 650px) and (orientation: portrait) {
  #welcome {
    padding: 22px;
    align-items: center;
  }
  #welcome h1 {
    font-size: clamp(44px, 12vw, 66px);
    margin: 15px 0;
  }
  .intro > p:not(.eyebrow) {
    font-size: 15px;
  }
  .mobile-specimens {
    display: flex;
    height: 135px;
    gap: 26px;
    justify-content: center;
    margin: 20px 0 12px;
  }
  .mobile-specimens img {
    height: 100%;
    width: auto;
    max-width: 28%;
    object-fit: contain;
  }
  .stand-note {
    margin-top: 12px;
  }
  .event-badge {
    font-size: 9px;
  }
  .event-badge span {
    font-size: 11px;
  }
  .intro-brand {
    justify-content: center;
    gap: 11px;
    margin-bottom: 8px;
  }
  .welcome-logo {
    width: 88px;
    height: 56px;
    border-radius: 9px;
    padding: 5px;
  }
  .intro .eyebrow {
    font-size: 9px;
    letter-spacing: 1.4px;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions button {
    font-size: 11px;
    padding: 5px 10px;
  }
  .brand {
    letter-spacing: 1px;
  }
  #idleNotice {
    font-size: 12px;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  .event-badge {
    padding: 2px 10px;
    font-size: 8px;
  }
  .event-badge span {
    font-size: 9px;
  }
  .intro-brand {
    gap: 10px;
    margin-bottom: 4px;
  }
  .welcome-logo {
    width: 76px;
    height: 48px;
    padding: 4px;
  }
  .stand-note {
    margin-top: 8px;
    padding-top: 6px;
    font-size: 9px;
    gap: 1px;
  }
  .stand-note strong {
    font-size: 14px;
  }
  .intro .primary {
    margin: 5px 0;
  }
  #welcome {
    gap: 25px;
  }
  .mobile-specimens {
    display: none;
  }
}
