:root {
  --paper: #fff7df;
  --cream: #fffdf6;
  --ink: #2d2320;
  --cocoa: #65413b;
  --berry: #c83f5f;
  --tomato: #f06449;
  --teal: #2f9f93;
  --mint: #d7f0df;
  --gold: #ffcf4a;
  --blue: #4977b8;
  --stage: #163f4d;
  --stage-deep: #0c2632;
  --shadow: 0 16px 42px rgba(68, 43, 35, .16);
  --tight-shadow: 0 7px 18px rgba(68, 43, 35, .15);
  --radius: 8px;
  --outline: 3px solid var(--ink);
  --recipe-drawer-width: 352px;
  --drawer-transition-duration: 705ms;
  --floating-utility-offset: 72px;
  --drawer-stage-gap: 8px;
  --drawer-collapsed-peek: 34px;
  --drawer-collapsed-stage-padding: 62px;
  --drawer-handle-left: -18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(47, 159, 147, .2) 0 18%, transparent 18% 100%),
    repeating-linear-gradient(-7deg, rgba(255, 207, 74, .16) 0 12px, transparent 12px 34px),
    var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
}

button,
a,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.spoon-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 76px;
  height: 76px;
  pointer-events: none;
  opacity: 0;
  background: center / contain no-repeat url("assets/cursors/rolling-pin-cursor.svg");
  transform:
    translate3d(calc(var(--cursor-x, -120px) - 12px), calc(var(--cursor-y, -120px) - 14px), 0)
    rotate(2deg)
    scale(1);
  transform-origin: 14px 14px;
  transition: opacity .14s ease;
}

@media (pointer: fine) and (hover: hover) {
  body.has-spoon-cursor:not(.cursor-system-active),
  body.has-spoon-cursor:not(.cursor-system-active) button,
  body.has-spoon-cursor:not(.cursor-system-active) a,
  body.has-spoon-cursor:not(.cursor-system-active) label,
  body.has-spoon-cursor:not(.cursor-system-active) .chip,
  body.has-spoon-cursor:not(.cursor-system-active) .world-location,
  body.has-spoon-cursor:not(.cursor-system-active) .eve-launcher,
  body.has-spoon-cursor:not(.cursor-system-active) .step-arrow,
  body.has-spoon-cursor:not(.cursor-system-active) .drawer-handle-label {
    cursor: none !important;
  }

  body.has-spoon-cursor.cursor-visible .spoon-cursor {
    opacity: 1;
  }

  body.has-spoon-cursor.cursor-clicking .spoon-cursor {
    animation: spoon-wave .24s ease-out;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.has-spoon-cursor.cursor-clicking .spoon-cursor {
    animation: none;
    transform:
      translate3d(calc(var(--cursor-x, -120px) - 12px), calc(var(--cursor-y, -120px) - 14px), 0)
      rotate(8deg)
      scale(.97);
  }

  .world-map-visitor,
  .world-map-visitor.character-is-dancing {
    animation: none;
  }
}

@keyframes spoon-wave {
  0% {
    transform:
      translate3d(calc(var(--cursor-x, -120px) - 12px), calc(var(--cursor-y, -120px) - 14px), 0)
      rotate(2deg)
      scale(1);
  }
  35% {
    transform:
      translate3d(calc(var(--cursor-x, -120px) - 10px), calc(var(--cursor-y, -120px) - 16px), 0)
      rotate(18deg)
      scale(.95);
  }
  68% {
    transform:
      translate3d(calc(var(--cursor-x, -120px) - 13px), calc(var(--cursor-y, -120px) - 13px), 0)
      rotate(9deg)
      scale(1.02);
  }
  100% {
    transform:
      translate3d(calc(var(--cursor-x, -120px) - 12px), calc(var(--cursor-y, -120px) - 14px), 0)
      rotate(2deg)
      scale(1);
  }
}

.app-shell {
  --effective-recipe-drawer-width: var(--recipe-drawer-width);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns .22s ease, grid-template-rows .22s ease;
}

.left-rail,
.stage-panel,
.right-panel {
  min-width: 0;
  min-height: 0;
}

.left-rail,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.left-rail {
  display: none;
}

.app-shell.is-map-view {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.is-recipe-drawer-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.is-map-view .left-rail {
  display: none;
}

.app-shell.is-map-view .right-panel {
  display: flex;
}

.stage-panel {
  position: relative;
  overflow: hidden;
  padding-right: 0;
  transition: padding-right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.app-shell.has-recipe-drawer .stage-panel {
  padding-right: calc(var(--effective-recipe-drawer-width) + var(--drawer-stage-gap));
}

.app-shell.is-recipe-drawer-collapsed .stage-panel {
  padding-right: var(--drawer-collapsed-stage-padding);
}

.floating-map-button,
.floating-timer-button,
.floating-settings-button,
.floating-library-button {
  position: absolute;
  top: 14px;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.floating-map-button {
  left: 14px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.floating-utility-buttons {
  position: absolute;
  right: var(--floating-utility-offset);
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: start;
  gap: 10px;
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.floating-settings-button {
  position: static;
  width: 62px;
  height: 62px;
  border-radius: 18px;
}

.floating-library-button {
  position: static;
  width: 62px;
  height: 62px;
  border-radius: 18px;
}

.floating-timer-button {
  position: static;
  width: 64px;
  height: 62px;
  padding: 0 10px 0 0;
  border-radius: 999px;
  grid-auto-flow: column;
  justify-content: start;
  gap: 6px;
  transition: width .22s ease, padding .22s ease, background .22s ease;
  overflow: hidden;
}

.floating-timer-button.is-active {
  width: 142px;
}

.floating-timer-button.is-ringing {
  animation: floating-icon-ring 1s ease-in-out infinite;
}

.floating-timer-remaining {
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--cream);
  text-shadow: 0 2px 6px rgba(7, 23, 30, .65);
}

.floating-button-icon {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(7, 23, 30, .38));
  transition: transform .18s ease, filter .18s ease;
}

.floating-button-icon--map {
  width: 56px;
  height: 56px;
}

.floating-button-icon--timer {
  width: 52px;
  height: 52px;
}

.floating-map-button::after,
.floating-timer-button::after,
.floating-settings-button::after,
.floating-library-button::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, -4px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid rgba(255, 253, 246, .46);
  background: rgba(8, 24, 32, .92);
  color: var(--cream);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-shadow: 0 2px 4px rgba(7, 23, 30, .5);
  box-shadow: 0 8px 18px rgba(7, 23, 30, .32);
  transition: opacity .16s ease, transform .16s ease;
}

.floating-map-button:hover .floating-button-icon,
.floating-map-button:focus-visible .floating-button-icon,
.floating-timer-button:hover .floating-button-icon,
.floating-timer-button:focus-visible .floating-button-icon,
.floating-settings-button:hover .floating-button-icon,
.floating-settings-button:focus-visible .floating-button-icon,
.floating-library-button:hover .floating-button-icon,
.floating-library-button:focus-visible .floating-button-icon {
  transform: translateY(-1px) scale(1.04);
  filter: drop-shadow(0 9px 16px rgba(7, 23, 30, .44));
}

.floating-map-button:hover::after,
.floating-map-button:focus-visible::after,
.floating-timer-button:hover::after,
.floating-timer-button:focus-visible::after,
.floating-settings-button:hover::after,
.floating-settings-button:focus-visible::after,
.floating-library-button:hover::after,
.floating-library-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.floating-map-button:focus-visible,
.floating-timer-button:focus-visible,
.floating-settings-button:focus-visible,
.floating-library-button:focus-visible {
  outline: 2px solid rgba(255, 253, 246, .88);
  outline-offset: 4px;
}

.utility-timer-drawer {
  position: absolute;
  top: 68px;
  right: var(--floating-utility-offset);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, calc(100% - var(--floating-utility-offset) - 14px));
  max-height: calc(100% - 82px);
  overflow: auto;
  border: var(--outline);
  border-radius: var(--radius);
  background: rgba(255, 253, 246, .98);
  box-shadow: var(--shadow);
  padding: 14px;
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.utility-timer-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.utility-timer-status {
  margin: 0;
  line-height: 1.35;
  font-weight: 800;
}

.utility-timer-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.utility-timer-picker label {
  display: grid;
  gap: 6px;
  font-weight: 900;
}

.utility-timer-picker span {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.utility-timer-picker select {
  min-width: 0;
}

.utility-timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-drawer {
  position: absolute;
  top: 68px;
  right: var(--floating-utility-offset);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(340px, calc(100% - var(--floating-utility-offset) - 14px));
  max-height: calc(100% - 82px);
  overflow: auto;
  border: var(--outline);
  border-radius: var(--radius);
  background: rgba(255, 253, 246, .98);
  box-shadow: var(--shadow);
  padding: 14px;
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.library-drawer {
  position: absolute;
  top: 68px;
  right: var(--floating-utility-offset);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(420px, calc(100% - var(--floating-utility-offset) - 14px));
  max-height: calc(100% - 82px);
  overflow: auto;
  border: var(--outline);
  border-radius: 18px 18px 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0)),
    linear-gradient(90deg, #7c4d29 0 18px, #e0bb8e 18px 28px, #fff3da 28px 100%);
  box-shadow: var(--shadow);
  padding: 16px 16px 16px 38px;
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.settings-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.library-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.brand-name,
h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

h1 {
  font-size: clamp(1.85rem, 3.5vw, 3.5rem);
  line-height: .98;
}

h2 {
  font-size: 1.42rem;
}

h3 {
  font-size: 1.12rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--berry);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.console-heading {
  flex: 0 0 auto;
}

.rail-card,
.map-console,
.right-panel,
.guide-stage {
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rail-card,
.map-console,
.right-panel {
  background: rgba(255, 253, 246, .9);
}

.progress-console {
  flex: 0 0 auto;
  padding: 12px;
}

.nav-console,
.selected-recipe-console {
  padding: 12px;
}

.selected-recipe-console {
  display: grid;
  gap: 12px;
}

.selected-recipe-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.selected-recipe-copy p {
  margin: 6px 0 0;
  color: rgba(45, 35, 32, .78);
  line-height: 1.35;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.stat-row span {
  min-width: 0;
  border: 2px solid var(--ink);
  background: var(--mint);
  padding: 8px 6px;
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 rgba(45, 35, 32, .86);
  text-align: center;
  font-size: .72rem;
  font-weight: 900;
}

.stat-row strong {
  display: block;
  font-size: 1.2rem;
}

.map-console {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  overflow: auto;
  border: 2px dashed rgba(45, 35, 32, .35);
  background:
    linear-gradient(135deg, rgba(73, 119, 184, .1) 0 25%, transparent 25% 100%),
    linear-gradient(45deg, rgba(255, 207, 74, .15), rgba(215, 240, 223, .7));
  border-radius: var(--radius);
}

.map-path {
  position: absolute;
  inset: 34px 28px;
  border-left: 8px dotted rgba(45, 35, 32, .24);
}

.map-nodes {
  position: relative;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.map-node {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 70px;
  border: var(--outline);
  background: var(--cream);
  color: var(--ink);
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 rgba(45, 35, 32, .9);
  text-align: left;
}

.map-node.is-complete {
  background: var(--mint);
}

.map-node.is-active {
  outline: 4px solid var(--gold);
}

.map-node strong,
.map-node span:last-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-node strong {
  line-height: 1.05;
}

.map-node span:last-child {
  margin-top: 3px;
  color: rgba(45, 35, 32, .68);
  font-size: .75rem;
  font-weight: 800;
}

.map-node .treat-icon,
.recipe-card .treat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: var(--outline);
  background: var(--gold);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
}

.chip,
.text-button,
.secondary-button,
.primary-button,
.icon-button {
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--cream);
  padding: 8px 11px;
  box-shadow: 3px 3px 0 rgba(45, 35, 32, .9);
  font-weight: 900;
}

.chip.is-active,
.primary-button {
  background: var(--tomato);
  color: var(--cream);
}

.text-button {
  width: 100%;
  background: #ffe2a8;
}

.map-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.world-map-board {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 253, 246, .05), rgba(255, 253, 246, .05)),
    #8fd5e2;
}

.world-map-background {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 253, 246, .05), rgba(255, 253, 246, .05)),
    url("assets/generated/bakery-realm-background.png") center / cover no-repeat;
}

.world-map-grid {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 253, 246, .12) 0 1px, transparent 1px 60px),
    repeating-linear-gradient(90deg, rgba(255, 253, 246, .12) 0 1px, transparent 1px 84px);
  opacity: .18;
}

.continent {
  display: none;
}

.trail-front-logo {
  position: absolute;
  top: clamp(18px, 2.4vw, 34px);
  left: clamp(18px, 2.6vw, 42px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 16px);
  width: min(420px, 38vw);
  pointer-events: none;
  filter: drop-shadow(7px 9px 0 rgba(45, 35, 32, .28)) drop-shadow(0 16px 22px rgba(45, 35, 32, .2));
}

.trail-front-logo img {
  display: block;
  width: clamp(124px, 13vw, 190px);
  aspect-ratio: 1;
  object-fit: contain;
}

.trail-front-logo span {
  display: grid;
  gap: 2px;
  color: var(--cream);
  text-shadow:
    3px 3px 0 var(--ink),
    -2px 2px 0 var(--ink),
    2px -2px 0 var(--ink),
    0 7px 14px rgba(45, 35, 32, .42);
}

.trail-front-logo strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 4.4vw, 4.8rem);
  line-height: .88;
}

.trail-front-logo small {
  color: var(--gold);
  font-size: clamp(.92rem, 1.3vw, 1.25rem);
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.world-map-visitors {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.world-map-visitor {
  position: absolute;
  left: var(--visitor-x);
  top: var(--visitor-y);
  display: block;
  width: clamp(74px, 6vw, 112px);
  aspect-ratio: 1;
  transform: translate(-50%, -100%) scale(var(--visitor-scale, 1));
  transform-origin: 50% 96%;
  filter: drop-shadow(0 10px 14px rgba(45, 35, 32, .28));
}

.world-map-visitor img {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
}

.world-map-visitor img.character-is-dancing {
  animation: character-dance-flip var(--character-dance-interval, 1s) steps(2, end) infinite;
  transform-origin: var(--character-dance-origin-x, 50%) 96%;
}

.world-map-buildings {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.world-location {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 160px;
  transform: translate(-50%, -78%);
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  text-align: center;
  transition: transform .18s ease;
}

.world-location:hover,
.world-location:focus-visible,
.world-location.is-active {
  transform: translate(-50%, -82%);
}

.world-location-sprite {
  position: relative;
  display: block;
  width: 116px;
  height: 116px;
  filter: drop-shadow(0 12px 18px rgba(45, 35, 32, .24));
}

.world-location-sprite img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.world-location-label {
  display: block;
  min-width: 0;
  border: var(--outline);
  background: rgba(255, 253, 246, .95);
  padding: 8px 10px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 rgba(45, 35, 32, .9);
}

.world-location-label strong,
.world-location-label span {
  display: block;
}

.world-location-label strong {
  font-size: .92rem;
  line-height: 1.08;
}

.world-location-label span {
  margin-top: 4px;
  color: rgba(45, 35, 32, .72);
  font-size: .72rem;
  font-weight: 900;
}

.world-location::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 196px;
  height: 132px;
  transform: translateX(-50%);
  border: 3px solid var(--ink);
  border-radius: 14px;
  background:
    linear-gradient(rgba(255, 253, 246, .08), rgba(255, 253, 246, .08)),
    var(--scene-preview) center / cover no-repeat;
  box-shadow: 8px 8px 0 rgba(45, 35, 32, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  transform-origin: bottom center;
}

.world-location:hover::after,
.world-location:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-132px);
}

.world-location.is-complete .world-location-label {
  background: var(--mint);
}

.world-location.is-active .world-location-label {
  outline: 4px solid var(--gold);
}

.map-quest-log {
  display: none;
}

.map-log-topline h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.map-log-topline p {
  margin: 6px 0 0;
  color: rgba(45, 35, 32, .72);
  font-weight: 900;
}

.map-selected-card {
  margin-top: 12px;
  border: 2px solid rgba(45, 35, 32, .22);
  background: rgba(255, 247, 223, .8);
  padding: 12px;
  border-radius: var(--radius);
}

.map-selected-card h2 {
  font-size: 1.24rem;
}

.map-selected-card p {
  margin: 8px 0 0;
  line-height: 1.35;
}

.map-recipe-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.map-recipe-options > span {
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(45, 35, 32, .7);
}

.map-recipe-option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-recipe-option {
  border: 2px solid rgba(45, 35, 32, .24);
  background: rgba(255, 253, 246, .96);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 rgba(45, 35, 32, .22);
}

.map-recipe-option.is-active {
  border-color: var(--tomato);
  background: rgba(240, 100, 73, .16);
  box-shadow: 2px 2px 0 rgba(240, 100, 73, .24);
}

.eve-launcher {
  position: absolute;
  right: var(--floating-utility-offset);
  bottom: 18px;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 120px;
  border: var(--outline);
  background: rgba(255, 253, 246, .96);
  padding: 10px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.eve-launcher img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  object-position: center bottom;
}

.character-is-dancing {
  animation: character-dance-flip var(--character-dance-interval, 1s) steps(2, end) infinite;
  transform-origin: var(--character-dance-origin-x, 50%) 88%;
}

.eve-launcher span {
  font-weight: 900;
}

.map-chat-popout {
  position: absolute;
  right: var(--floating-utility-offset);
  bottom: 152px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100% - 36px));
  max-height: min(58dvh, 500px);
  border: var(--outline);
  background: rgba(22, 63, 77, .98);
  color: var(--cream);
  padding: 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: right var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.map-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.map-chat-header .eyebrow {
  color: var(--gold);
}

.map-chat-status {
  margin: 0;
  color: rgba(255, 253, 246, .82);
  font-size: .9rem;
  line-height: 1.35;
}

.map-chat-log {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-chat-log li,
.map-chat-empty {
  display: grid;
  gap: 3px;
  border: 2px solid rgba(255, 253, 246, .25);
  background: rgba(255, 253, 246, .07);
  padding: 9px 10px;
  border-radius: var(--radius);
}

.map-chat-log strong {
  color: var(--gold);
  font-size: .82rem;
}

.map-chat-log .is-user {
  background: rgba(73, 119, 184, .18);
}

.map-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.map-chat-form input {
  min-height: 42px;
  border: 2px solid var(--cream);
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 11px;
  font: inherit;
}

.guide-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--stage);
  isolation: isolate;
}

.guide-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(8, 24, 32, .2), rgba(8, 24, 32, .52)),
    var(--guide-scene-image) center / cover no-repeat;
}

.guide-stage > * {
  position: relative;
  z-index: 1;
}

.portrait-rail {
  display: none;
}

.companion-token {
  border: var(--outline);
  background: var(--gold);
  padding: 8px 10px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  text-align: center;
  font-weight: 900;
}

.dialog-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: clamp(14px, 2vw, 24px);
  color: var(--cream);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(7, 23, 30, .42), rgba(7, 23, 30, .72));
}

.dialog-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  flex: 0 0 auto;
  margin-bottom: 14px;
}

.guide-stage .dialog-topline > div:first-child {
  padding-left: 54px;
}

.dialog-topline .eyebrow {
  color: var(--gold);
}

.story-mode {
  display: grid;
  grid-template-rows: auto minmax(72px, 1fr) auto auto;
  flex: 1 1 auto;
  min-height: 0;
  gap: 16px;
  overflow: hidden;
}

.story-top {
  --story-dialog-columns: minmax(150px, 180px) minmax(0, 1fr);
  display: grid;
  grid-template-columns: var(--story-dialog-columns);
  column-gap: 14px;
  row-gap: 9px;
  min-height: 0;
}

.story-top:has(.dialog-shell.has-companion) {
  --story-dialog-columns: minmax(150px, 180px) minmax(0, 1fr) minmax(230px, 310px);
}

.dialog-shell {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--story-dialog-columns);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}

.dialog-shell.has-companion {
  grid-template-columns: var(--story-dialog-columns);
}

.speaker-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  justify-items: center;
  gap: 10px;
  min-height: clamp(170px, 30vh, 290px);
  padding: 12px;
}

.speaker-card img {
  display: block;
  width: 100%;
  max-width: 168px;
  max-height: min(240px, 24vh);
  object-fit: contain;
  object-position: center bottom;
}

.story-bottom {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.companion-moment {
  display: grid;
  align-items: end;
  justify-items: center;
  min-height: clamp(170px, 30vh, 290px);
  overflow: visible;
  pointer-events: none;
}

.companion-moment[hidden] {
  display: none;
}

.companion-moment-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(4px, 0.8vw, 10px);
  width: min(320px, 27vw);
  max-height: 100%;
  margin-left: -24px;
  animation: companion-bounce 3.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}

.companion-moment-card img {
  width: min(210px, 16vw);
  max-height: min(240px, 23vh);
  object-fit: contain;
  filter: drop-shadow(6px 10px 0 rgba(7, 23, 30, .38));
  animation: companion-wiggle 1.9s ease-in-out infinite;
}

.companion-moment-card img.character-is-dancing {
  animation: character-dance-flip var(--character-dance-interval, 1s) steps(2, end) infinite;
}

.companion-moment-card:has(img.character-is-dancing) {
  animation: none;
  transform: none;
}

.companion-callout {
  position: relative;
  flex: 0 1 min(190px, 16vw);
  margin-right: -18px;
  border: 3px solid var(--ink);
  border-radius: 18px 18px 18px 6px;
  background: var(--cream);
  color: var(--ink);
  padding: 9px 12px;
  box-shadow: 4px 4px 0 rgba(7, 23, 30, .58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(.92rem, 1.25vw, 1.15rem);
  font-weight: 900;
  line-height: 1.12;
  animation: callout-pop 4.8s cubic-bezier(.2, .9, .2, 1) infinite;
}

.companion-callout::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 50%;
  width: 18px;
  height: 18px;
  border-top: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
  background: var(--cream);
  transform: translateY(-50%) rotate(45deg);
}

.companion-moment-card--left .companion-callout::after {
  right: auto;
  left: -12px;
  border-top: 0;
  border-right: 0;
  border-bottom: 3px solid var(--ink);
  border-left: 3px solid var(--ink);
}

.companion-moment-card--dialog-right {
  align-self: end;
}

.step-ingredients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}

.step-ingredients strong {
  color: var(--gold);
  font-size: .82rem;
  text-transform: uppercase;
}

.step-asset-group {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.step-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
  min-height: 0;
}

.step-asset-grid--ingredient {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.step-asset-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  align-content: stretch;
  justify-items: center;
  color: var(--cream);
  padding: clamp(10px, 1.4vw, 18px);
  min-height: clamp(96px, 14vh, 150px);
}

.step-asset-card.is-missing {
  opacity: .5;
}

.step-asset-figure {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.step-asset-card img {
  width: min(100%, clamp(90px, 16vw, 220px));
  height: min(100%, clamp(90px, 22vh, 220px));
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(7, 23, 30, .42));
}

.step-asset-card--tool {
  grid-template-rows: auto auto;
  align-content: center;
  gap: 4px;
}

.step-asset-card--ingredient {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.step-asset-card--ingredient .step-asset-figure {
  min-height: clamp(76px, 13vh, 168px);
}

.step-asset-card--ingredient .step-asset-label {
  display: none;
}

.step-asset-label,
.step-asset-amount {
  align-self: start;
  justify-self: center;
  max-width: 18ch;
  border: 2px solid rgba(255, 253, 246, .48);
  border-radius: 14px;
  background: rgba(8, 24, 32, .46);
  color: var(--cream);
  padding: 8px 10px;
  font-size: clamp(.78rem, 1.05vw, .95rem);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 2px 6px rgba(7, 23, 30, .55);
}

.step-asset-empty {
  display: block;
  margin: 0;
  color: rgba(255, 253, 246, .84);
  min-height: 0;
  padding: 2px 0 0;
  font-weight: 700;
  text-align: left;
}

@keyframes companion-bounce {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  42% {
    transform: translateY(-13px) rotate(1.5deg);
  }

  56% {
    transform: translateY(-9px) rotate(-1deg);
  }
}

@keyframes floating-icon-ring {
  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(-6deg);
  }

  75% {
    transform: rotate(6deg);
  }
}

@media (max-width: 1200px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
    height: auto;
    padding: 14px;
    overflow: auto;
  }

  .left-rail {
    display: none;
  }

  .app-shell.is-map-view .stage-panel {
    min-height: min(100dvh - 28px, 980px);
    border-radius: 28px;
  }

  .map-stage {
    height: 100%;
    min-height: inherit;
    padding: 18px;
  }

  .world-map-board {
    min-height: inherit;
  }

  .world-map-buildings {
    inset: 16px;
  }

  .world-location {
    max-width: min(220px, 28vw);
    padding: 10px 14px;
  }

  .world-location-label {
    gap: 2px;
  }

  .world-location-label strong {
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    line-height: 1.04;
  }

  .world-location-label span:last-child {
    display: none;
  }

  .floating-utility-buttons {
    top: 18px;
    right: 18px;
    gap: 10px;
  }

  .floating-utility-buttons .utility-button,
  .floating-utility-buttons .utility-pill {
    min-width: 54px;
    min-height: 54px;
    padding: 0 14px;
    border-width: 5px;
  }

  .eve-launcher {
    width: 104px;
    right: 16px;
    bottom: 16px;
    padding: 8px;
  }

  .eve-launcher img {
    width: 76px;
    height: 76px;
  }

  .map-chat-popout {
    right: 16px;
    bottom: 132px;
    width: min(340px, calc(100% - 32px));
  }
}

@media (max-width: 900px) {
  .app-shell.is-map-view .stage-panel {
    min-height: auto;
    height: auto;
  }

  .map-stage {
    min-height: calc(100dvh - 28px);
    padding: 14px;
  }

  .world-map-board {
    min-height: calc(100dvh - 56px);
  }

  .trail-front-logo {
    display: none;
  }

  .world-map-visitors {
    display: none;
  }

  .world-map-buildings {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 0;
    padding: 82px 0 118px;
  }

  .world-location {
    position: relative;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    max-width: none;
    width: 100%;
    min-height: 96px;
    justify-content: center;
  }

  .world-location img,
  .world-location .world-location-art {
    max-width: 96px;
    max-height: 96px;
  }

  .world-location-label {
    text-align: center;
  }

  .floating-utility-buttons {
    top: 14px;
    right: 14px;
  }

  .floating-utility-buttons .utility-button,
  .floating-utility-buttons .utility-pill {
    min-width: 48px;
    min-height: 48px;
    border-width: 4px;
  }

  .eve-launcher {
    width: 94px;
  }

  .eve-launcher span {
    font-size: .95rem;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .app-shell.is-map-view .stage-panel {
    border-radius: 22px;
    min-height: calc(100dvh - 20px);
  }

  .map-stage {
    padding: 10px;
  }

  .world-map-board {
    min-height: calc(100dvh - 20px);
  }

  .world-map-buildings {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 70px;
  }

  .world-location {
    min-height: 84px;
    padding: 10px 12px;
  }

  .world-location img,
  .world-location .world-location-art {
    max-width: 80px;
    max-height: 80px;
  }

  .world-location-label strong {
    font-size: 1.05rem;
  }

  .floating-utility-buttons {
    top: 10px;
    right: 10px;
    gap: 8px;
  }

  .floating-utility-buttons .utility-button,
  .floating-utility-buttons .utility-pill {
    min-width: 42px;
    min-height: 42px;
    padding: 0 10px;
  }

  .eve-launcher {
    width: 86px;
    bottom: 10px;
    right: 10px;
    gap: 4px;
  }

  .eve-launcher img {
    width: 64px;
    height: 64px;
  }

  .eve-launcher span {
    font-size: .88rem;
  }

  .map-chat-popout {
    right: 10px;
    bottom: 112px;
    width: min(320px, calc(100% - 20px));
  }
}

@keyframes companion-wiggle {
  0%,
  100% {
    rotate: -1.5deg;
  }

  50% {
    rotate: 2deg;
  }
}

@keyframes character-dance-flip {
  0%,
  49.99% {
    transform: scaleX(1);
  }

  50%,
  100% {
    transform: scaleX(-1);
  }
}

@keyframes callout-pop {
  0%,
  8% {
    opacity: 0;
    transform: translateY(8px) scale(.88);
  }

  18%,
  78% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  92%,
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(.96);
  }
}

.step-meta {
  grid-column: 2 / 3;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: rgba(255, 253, 246, .78);
  font-size: .85rem;
  font-weight: 800;
}

.step-meta-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--cream);
  border-radius: 999px;
  background: rgba(255, 253, 246, .08);
  color: var(--cream);
  box-shadow: 3px 3px 0 rgba(12, 38, 50, .55);
  font-size: 1rem;
  font-weight: 900;
}

.step-arrow:disabled {
  opacity: .45;
  cursor: default;
}

.dialog-box {
  flex: 0 0 auto;
  min-height: clamp(170px, 30vh, 290px);
  border: 3px solid var(--cream);
  background:
    linear-gradient(180deg, rgba(255, 253, 246, .08), rgba(255, 253, 246, .02)),
    var(--stage-deep);
  padding: clamp(16px, 2.4vw, 26px);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 4px rgba(255, 207, 74, .14);
}

.speaker {
  display: inline-block;
  margin-bottom: 10px;
  background: var(--gold);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-weight: 900;
}

#dialogText {
  min-height: 96px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.45vw, 2.2rem);
  line-height: 1.24;
}

.dialog-step-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.dialog-back-button,
.dialog-next-button {
  min-width: 84px;
}

.dialog-back-button {
  border: 2px solid rgba(255, 253, 246, .78);
  background: rgba(255, 253, 246, .12);
  color: var(--cream);
}

.dialog-back-button:disabled {
  opacity: .45;
  cursor: default;
}

.chat-log {
  display: grid;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 0;
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-log li {
  display: grid;
  gap: 3px;
  border: 2px solid rgba(255, 253, 246, .25);
  background: rgba(255, 253, 246, .07);
  padding: 9px 10px;
  border-radius: var(--radius);
}

.chat-log strong {
  color: var(--gold);
  font-size: .82rem;
}

.chat-log span {
  line-height: 1.35;
}

.chat-log .is-user {
  background: rgba(73, 119, 184, .18);
}

.timer-panel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  border: 2px solid var(--cream);
  background: rgba(255, 253, 246, .1);
  padding: 10px;
  border-radius: var(--radius);
}

.timer-panel strong {
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
}

.checklist {
  display: grid;
  gap: 9px;
  flex: 0 1 auto;
  max-height: none;
  overflow: visible;
  align-content: end;
}

.check-item {
  display: flex;
  align-items: start;
  gap: 12px;
  border: 2px solid rgba(255, 253, 246, .45);
  background: rgba(255, 253, 246, .08);
  min-height: 48px;
  padding: 12px;
  border-radius: var(--radius);
  font-size: 1.02rem;
  font-weight: 800;
}

.check-item input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--gold);
}

.ask-eve-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  flex: 0 0 auto;
}

.ask-eve-form input,
.settings-grid input,
.settings-grid select {
  min-height: 42px;
  border: 2px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 11px;
  font: inherit;
}

.ask-eve-form input {
  border-color: var(--cream);
  box-shadow: inset 0 0 0 2px rgba(255, 207, 74, .18);
}

.action-row {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.primary-button {
  min-width: 96px;
}

.right-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: var(--effective-recipe-drawer-width);
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  padding: 14px 14px 14px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)),
    linear-gradient(90deg, #caa06a 0, #e7c08d 12px, #f6d7a9 24px, #f7e3c0 100%);
  overflow: visible;
  transform: translateX(0);
  transition:
    transform var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1),
    padding var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.app-shell.is-drawer-resizing,
.app-shell.is-drawer-resizing * {
  cursor: col-resize !important;
}

.app-shell.is-drawer-resizing .right-panel,
.app-shell.is-drawer-resizing .drawer-content {
  transition: none;
}

.right-panel::before {
  content: "";
  position: absolute;
  inset: 10px 10px 10px 18px;
  border: 3px solid rgba(101, 65, 59, .42);
  border-radius: 20px 10px 10px 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 253, 246, .5);
  pointer-events: none;
}

.right-panel.is-collapsed {
  padding-inline: 8px;
  transform: translateX(calc(100% - var(--drawer-collapsed-peek)));
}

.drawer-handle {
  position: absolute;
  top: 50%;
  left: var(--drawer-handle-left);
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 44px;
  padding: 14px 6px;
  border: 3px solid var(--cocoa);
  border-radius: 16px;
  background: linear-gradient(180deg, #a76b3a, #7d4e2b);
  color: var(--cream);
  box-shadow: 4px 4px 0 rgba(45, 35, 32, .45);
  transform: translateY(-50%);
  touch-action: none;
}

.drawer-resize-grip {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: -14px;
  z-index: 3;
  width: 28px;
  cursor: col-resize;
  touch-action: none;
}

.drawer-resize-grip::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 132px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(101, 65, 59, .18), rgba(101, 65, 59, .75), rgba(101, 65, 59, .18));
  transform: translate(-50%, -50%);
}

.drawer-handle-pull {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid #4e2f24;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe4a8, #c88b39);
  box-shadow: inset 0 0 0 2px rgba(255, 253, 246, .26);
}

.drawer-handle-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.drawer-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-left: 28px;
  transition:
    opacity var(--drawer-transition-duration) ease,
    transform var(--drawer-transition-duration) cubic-bezier(.22, .82, .24, 1);
}

.right-panel.is-collapsed .drawer-content {
  opacity: 0;
  pointer-events: none;
  transform: translateX(22px);
}

.right-panel.is-collapsed .drawer-resize-grip {
  opacity: 0;
  pointer-events: none;
}

.panel-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 3px;
}

#recipePanel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recipe-facts {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.recipe-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(45, 35, 32, .18);
  padding-bottom: 8px;
}

.recipe-facts dt {
  color: rgba(45, 35, 32, .64);
  font-weight: 800;
}

.recipe-facts dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

.badge-box {
  border: var(--outline);
  background: var(--mint);
  padding: 13px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}

.badge-title {
  display: block;
  margin-bottom: 6px;
  color: var(--berry);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card-shell {
  margin-top: 16px;
}

.card-mode {
  overflow: auto;
  border: 3px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  line-height: 1.5;
}

.compact-card {
  max-height: 48dvh;
  font-size: .9rem;
}

.card-shell--ingredients {
  flex: 0 0 auto;
}

.card-shell--steps {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.compact-card--ingredients {
  max-height: 24dvh;
  overflow: auto;
}

.compact-card--steps {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.compact-card--ingredients ul,
.compact-card--steps ol {
  margin-bottom: 0;
}

.card-mode h3 {
  margin: 0 0 9px;
  color: var(--berry);
  font-size: 1.08rem;
}

.card-mode p {
  margin: 0 0 12px;
}

.card-mode ul,
.card-mode ol {
  margin: 0 0 14px;
  padding-left: 20px;
}

.card-mode li + li {
  margin-top: 6px;
}

.method-notes {
  margin: 0 0 12px;
  border: 2px dashed rgba(185, 76, 88, .55);
  border-radius: 12px;
  background: rgba(255, 247, 210, .78);
  padding: 9px 11px;
  font-size: .86rem;
}

.method-notes strong {
  display: block;
  margin-bottom: 5px;
  color: var(--berry);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.method-notes ul {
  margin-bottom: 0;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.recipe-search {
  flex: 1 1 220px;
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff8e6;
  color: var(--ink);
  padding: 8px 11px;
  box-shadow: 3px 3px 0 rgba(45, 35, 32, .9);
  font: inherit;
  font-weight: 800;
}

.recipe-grid {
  display: grid;
  gap: 10px;
}

.recipe-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  align-items: start;
  border: var(--outline);
  background: var(--cream);
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 rgba(45, 35, 32, .86);
}

.recipe-card h3 {
  font-size: 1.05rem;
}

.recipe-card p {
  margin: 7px 0 10px;
  line-height: 1.35;
}

.recipe-card--component {
  background: linear-gradient(135deg, rgba(255, 248, 230, .96), rgba(236, 249, 239, .92));
}

.component-preview {
  font-size: .86rem;
}

.linked-component-card {
  margin: 10px 0;
  padding: 10px;
  border: 2px dashed rgba(45, 35, 32, .45);
  border-radius: 14px;
  background: rgba(255, 248, 230, .78);
}

.linked-component-card h4 {
  margin: 0 0 4px;
  font-size: .98rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.meta-pills span {
  border: 1px solid rgba(45, 35, 32, .24);
  background: rgba(215, 240, 223, .58);
  padding: 5px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  gap: 12px;
  align-items: end;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  font-weight: 900;
}

.settings-grid [hidden] {
  display: none;
}

.settings-grid label span {
  color: rgba(45, 35, 32, .7);
  font-size: .78rem;
  text-transform: uppercase;
}

.settings-grid label.settings-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
}

.settings-grid label.settings-toggle input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  accent-color: var(--tomato);
}

.settings-grid label.settings-toggle small {
  grid-column: 2;
  color: rgba(45, 35, 32, .64);
  font-size: .82rem;
  line-height: 1.3;
}

.settings-message {
  min-height: 24px;
  margin: 0;
  font-weight: 800;
}

.character-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.character-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  border: var(--outline);
  background: var(--paper);
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 rgba(45, 35, 32, .86);
}

.character-card.is-current {
  outline: 4px solid var(--gold);
}

.character-card img {
  width: 74px;
  height: 86px;
  object-fit: contain;
  object-position: center bottom;
}

.character-card p {
  margin: 5px 0 0;
  line-height: 1.35;
}

.character-card small {
  display: block;
  color: rgba(45, 35, 32, .68);
  font-weight: 900;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .app-shell {
    --effective-recipe-drawer-width: min(var(--recipe-drawer-width), 272px);
    gap: 10px;
    padding: 10px;
  }

  .app-shell.is-map-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.is-recipe-drawer-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .right-panel {
    top: 10px;
    right: 10px;
    bottom: 10px;
  }

  .dialog-box {
    min-height: 138px;
  }

  #dialogText {
    font-size: clamp(1.02rem, 1.9vw, 1.55rem);
  }

  .world-location {
    width: 148px;
  }
}

@media (max-height: 980px) {
  .app-shell {
    --effective-recipe-drawer-width: min(var(--recipe-drawer-width), 272px);
  }

  .dialog-panel {
    padding: 14px;
  }

  .dialog-topline {
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(1.85rem, 3vw, 2.7rem);
  }

  .story-mode {
    gap: 12px;
  }

  .dialog-box {
    min-height: clamp(104px, 17vh, 124px);
    padding: 14px 16px;
  }

  .companion-moment {
    min-height: 0;
  }

  .step-asset-grid {
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 8px;
  }

  .step-asset-grid--ingredient {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-asset-card {
    min-height: clamp(82px, 13vh, 108px);
    padding: clamp(8px, 1.1vw, 12px);
  }

  .step-asset-empty {
    min-height: clamp(82px, 13vh, 108px);
    padding: clamp(8px, 1.1vw, 12px);
  }

  .step-asset-card img {
    width: min(100%, clamp(62px, 10vw, 112px));
    height: min(100%, clamp(62px, 14vh, 112px));
  }

  .step-asset-card--ingredient {
    grid-template-columns: minmax(58px, 1fr) minmax(74px, auto);
  }

  .step-asset-card--ingredient .step-asset-figure {
    min-height: clamp(58px, 11vh, 104px);
  }

  .step-asset-label,
  .step-asset-amount {
    padding: 7px 8px;
    font-size: .78rem;
  }

  #dialogText {
    min-height: 40px;
    font-size: 1rem;
  }

  .chat-log {
    max-height: 84px;
  }
}

@media (max-height: 860px) {
  .app-shell {
    --effective-recipe-drawer-width: min(var(--recipe-drawer-width), 248px);
  }

  .dialog-panel {
    padding: 12px;
  }

  .dialog-topline {
    margin-bottom: 8px;
  }

  h1 {
    font-size: clamp(1.6rem, 2.7vw, 2.3rem);
  }

  .story-mode {
    grid-template-rows: auto minmax(48px, 1fr) auto auto;
    gap: 8px;
  }

  .dialog-box {
    min-height: clamp(84px, 16vh, 102px);
    padding: 10px 12px;
  }

  .companion-moment {
    min-height: 0;
  }

  .step-ingredients {
    gap: 8px;
  }

  .step-asset-card {
    min-height: clamp(68px, 12vh, 96px);
    padding: clamp(7px, 1vw, 10px);
  }

  .step-asset-empty {
    min-height: clamp(68px, 12vh, 96px);
    padding: clamp(7px, 1vw, 10px);
  }

  .step-asset-card img {
    width: min(100%, clamp(54px, 9vw, 92px));
    height: min(100%, clamp(54px, 12vh, 92px));
  }

  .step-asset-card--ingredient {
    grid-template-columns: minmax(52px, 1fr) minmax(66px, auto);
  }

  .step-asset-card--ingredient .step-asset-figure {
    min-height: clamp(52px, 10vh, 88px);
  }

  .step-asset-label,
  .step-asset-amount {
    max-width: 12ch;
    padding: 6px 7px;
    font-size: .72rem;
  }

  #dialogText {
    min-height: 34px;
    font-size: .94rem;
  }

  .ask-eve-form input,
  .ask-eve-form button,
  .timer-panel,
  .check-item {
    min-height: 36px;
  }
}

@media (max-width: 860px) {
  .guide-stage {
    grid-template-columns: 1fr;
  }

  .dialog-shell {
    grid-template-columns: 1fr;
  }

  .speaker-card {
    grid-template-columns: minmax(84px, 118px) minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
    justify-items: stretch;
    min-height: 0;
    padding: 10px 12px;
  }

  .speaker-card img {
    max-width: 108px;
    max-height: 108px;
  }

  .dialog-shell.has-companion {
    grid-template-columns: 1fr;
  }

  .companion-moment {
    min-height: 118px;
    justify-items: center;
  }

  .companion-moment-card {
    width: min(320px, 100%);
    justify-content: center;
  }

  .companion-moment-card img {
    width: min(132px, 28vw);
    max-height: 132px;
  }

  .dialog-panel {
    padding: 14px;
  }

  .dialog-topline {
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(1.7rem, 3vw, 2.6rem);
  }

  .story-mode {
    gap: 12px;
  }

  .dialog-box {
    min-height: 110px;
    padding: 14px 16px;
  }

  .companion-moment {
    min-height: 118px;
  }

  .step-asset-grid {
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  }

  .step-asset-card {
    min-height: 110px;
  }

  .step-asset-card img {
    width: min(100%, 112px);
    height: min(100%, 112px);
  }

  #dialogText {
    min-height: 42px;
    font-size: 1rem;
  }

  .ask-eve-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .selected-recipe-console {
    min-height: 0;
  }

  .selected-recipe-copy p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .map-quest-log {
    width: min(300px, calc(100% - 28px));
  }

  .world-location {
    width: 138px;
  }

  .world-location-sprite {
    width: 96px;
    height: 96px;
  }

  .world-location-label {
    padding: 7px 8px;
  }

  .guide-stage {
    grid-template-columns: 1fr;
  }

  .story-top {
    grid-template-columns: 1fr;
    column-gap: 10px;
  }

  .dialog-shell {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .guide-stage .dialog-topline > div:first-child {
    padding-left: 42px;
  }

  .floating-map-button {
    width: 56px;
    height: 56px;
  }

  .floating-settings-button,
  .floating-library-button,
  .floating-timer-button {
    width: 56px;
    height: 56px;
  }

  .floating-button-icon {
    width: 44px;
    height: 44px;
  }

  .floating-button-icon--map,
  .floating-button-icon--timer {
    width: 48px;
    height: 48px;
  }

  .dialog-shell.has-companion {
    grid-template-columns: 1fr;
  }

  .step-meta {
    grid-column: 1 / -1;
  }

  .speaker-card {
    grid-template-columns: minmax(76px, 104px) minmax(0, 1fr);
    grid-template-rows: 1fr;
    min-height: 0;
    padding: 8px 10px;
  }

  .speaker-card img {
    max-width: 96px;
    max-height: 96px;
  }

  .companion-moment-card {
    justify-content: center;
    width: min(340px, 100%);
    gap: 6px;
    margin-left: 0;
  }

  .companion-moment-card img {
    width: min(150px, 30vw);
    max-height: 150px;
  }

  .settings-drawer {
    width: min(320px, calc(100% - 28px));
  }

  .right-panel {
    min-height: 0;
    width: min(240px, calc(100vw - 24px));
  }

  .app-shell.has-recipe-drawer .stage-panel,
  .app-shell.is-recipe-drawer-collapsed .stage-panel {
    padding-right: 0;
  }

  .right-panel.is-collapsed .drawer-content {
    transform: translateY(18px);
  }

  .dialog-panel {
    padding: 12px;
  }

  .dialog-topline {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.85rem;
  }

  .step-meta {
    margin-bottom: 7px;
  }

  .dialog-box {
    min-height: 114px;
    padding: 12px 14px;
  }

  .companion-moment {
    min-height: 128px;
    justify-items: center;
  }

  .companion-moment-card {
    gap: 7px;
    width: min(300px, 100%);
    justify-content: center;
  }

  .companion-moment-card img {
    width: min(126px, 32vw);
    max-height: 150px;
  }

  .companion-callout {
    font-size: .82rem;
    padding: 7px 9px;
    max-width: 150px;
  }

  .companion-callout::after,
  .companion-moment-card--left .companion-callout::after {
    left: 18px;
    right: auto;
    top: auto;
    bottom: -12px;
    border-top: 0;
    border-right: 3px solid var(--ink);
    border-bottom: 3px solid var(--ink);
    border-left: 0;
    transform: rotate(45deg);
  }

  .step-ingredients {
    padding: 8px;
  }

  .step-asset-grid {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
  }

  .step-asset-grid--ingredient {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-asset-card {
    min-height: 128px;
    padding: 10px;
  }

  .step-asset-empty {
    min-height: 128px;
    padding: 10px;
  }

  .step-asset-card img {
    width: min(100%, 128px);
    height: min(100%, 128px);
  }

  .step-asset-card--ingredient {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    text-align: center;
  }

  .step-asset-card--ingredient .step-asset-figure {
    min-height: 82px;
  }

  .step-asset-label,
  .step-asset-amount {
    justify-self: center;
    max-width: 18ch;
    text-align: center;
  }

  #dialogText {
    min-height: 48px;
    font-size: 1.08rem;
  }

  .speaker {
    margin-bottom: 7px;
    padding: 5px 8px;
  }

  .ask-eve-form {
    margin-top: 8px;
  }

  .panel-view {
    padding-right: 0;
  }

  .compact-card {
    max-height: 132px;
  }

  .map-chat-popout {
    bottom: 132px;
  }
}

@media (max-width: 1200px) {
  .app-shell:not(.is-map-view) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: 10px;
  }

  .app-shell:not(.is-map-view) .stage-panel,
  .app-shell:not(.is-map-view) .guide-stage,
  .app-shell:not(.is-map-view) .dialog-panel {
    min-height: 0;
  }

  .app-shell:not(.is-map-view) .stage-panel,
  .app-shell:not(.is-map-view) .guide-stage {
    height: 100%;
  }

  .app-shell:not(.is-map-view) .right-panel {
    top: 10px;
    right: 10px;
    bottom: 10px;
    max-height: calc(100dvh - 20px);
  }

  .app-shell:not(.is-map-view) .story-mode {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .app-shell:not(.is-map-view) .step-ingredients {
    overflow: auto;
    align-content: start;
    scrollbar-gutter: stable;
  }

  .app-shell:not(.is-map-view) .story-bottom {
    overflow: hidden;
  }

  .app-shell:not(.is-map-view) .checklist {
    height: 100%;
    max-height: none;
    overflow: auto;
    align-content: start;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1200px) and (max-height: 850px) {
  .app-shell:not(.is-map-view) .dialog-panel {
    padding: 10px;
  }

  .app-shell:not(.is-map-view) .dialog-topline {
    margin-bottom: 6px;
  }

  .app-shell:not(.is-map-view) .story-mode {
    gap: 7px;
  }

  .app-shell:not(.is-map-view) .story-top {
    row-gap: 5px;
  }

  .app-shell:not(.is-map-view) .dialog-shell {
    gap: 10px;
  }

  .app-shell:not(.is-map-view) .speaker-card {
    min-height: clamp(108px, 19dvh, 150px);
    padding: 8px;
  }

  .app-shell:not(.is-map-view) .speaker-card img {
    max-height: min(132px, 18dvh);
  }

  .app-shell:not(.is-map-view) .dialog-box {
    min-height: clamp(86px, 16dvh, 116px);
  }

  .app-shell:not(.is-map-view) .companion-moment {
    min-height: clamp(108px, 19dvh, 150px);
  }

  .app-shell:not(.is-map-view) .step-asset-card,
  .app-shell:not(.is-map-view) .step-asset-empty {
    min-height: clamp(64px, 10dvh, 88px);
  }

  .app-shell:not(.is-map-view) .step-asset-card img {
    width: min(100%, clamp(52px, 8vw, 84px));
    height: min(100%, clamp(52px, 10dvh, 84px));
  }

  .app-shell:not(.is-map-view) .checklist {
    max-height: clamp(96px, 18dvh, 150px);
  }
}

@media (max-width: 620px) {
  .app-shell {
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .dialog-panel {
    padding: 12px;
  }

  .dialog-topline {
    margin-bottom: 10px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .dialog-box {
    min-height: 104px;
    padding: 14px;
  }

  #dialogText {
    min-height: 46px;
    font-size: 1rem;
  }

  .chat-log {
    max-height: 96px;
  }

  .ask-eve-form {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .recipe-card,
  .character-card {
    grid-template-columns: 1fr;
  }

  .character-card img {
    width: 100%;
    height: 82px;
  }

  .floating-map-button,
  .floating-settings-button,
  .floating-timer-button {
    top: 10px;
    width: 42px;
    height: 42px;
  }

  .floating-map-button {
    left: 10px;
  }

  .floating-utility-buttons {
    right: 10px;
    top: 10px;
    gap: 8px;
    transition: none;
  }

  .floating-settings-button {
    width: 42px;
    height: 42px;
  }

  .floating-library-button {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.05rem;
  }

  .floating-timer-button {
    width: 42px;
    padding: 0;
    border-radius: 50%;
    gap: 0;
  }

  .floating-timer-button.is-active {
    width: 108px;
    padding: 0 10px;
    border-radius: 999px;
    gap: 6px;
  }

  .utility-timer-drawer {
    top: 58px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100% - 66px);
    transition: none;
  }

  .settings-drawer {
    top: 58px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100% - 66px);
    transition: none;
  }

  .library-drawer {
    top: 58px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100% - 66px);
    padding-left: 34px;
    transition: none;
  }

  .map-quest-log {
    top: auto;
    bottom: 14px;
    width: calc(100% - 28px);
  }

  .map-chat-popout {
    right: 8px;
    left: 8px;
    bottom: 128px;
    width: auto;
    max-height: 52dvh;
    transition: none;
  }

  .eve-launcher {
    right: 12px;
    bottom: 12px;
    width: 92px;
    padding: 8px;
    transition: none;
  }

  .eve-launcher img {
    width: 62px;
    height: 62px;
  }

  .world-location {
    width: 118px;
    transform: translate(-50%, -74%);
  }

  .world-location:hover,
  .world-location:focus-visible,
  .world-location.is-active {
    transform: translate(-50%, -78%);
  }

  .world-location-label strong {
    font-size: .82rem;
  }

  .world-location-label span {
    font-size: .68rem;
  }

  .drawer-handle {
    top: 8px;
    left: 50%;
    width: 120px;
    padding: 8px 12px;
    transform: translateX(-50%);
  }

  .drawer-handle-label {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .drawer-content {
    margin-left: 0;
    margin-top: 46px;
  }

  .right-panel.is-collapsed {
    transform: none;
  }

  .app-shell.has-recipe-drawer .stage-panel,
  .app-shell.is-recipe-drawer-collapsed .stage-panel {
    padding-right: 0;
  }

  .right-panel::before {
    inset: 18px 10px 10px;
    border-radius: 18px;
  }

  .drawer-resize-grip {
    display: none;
  }
}
