/* Chikan CrossWay (u9849) — Storybook Tudor Cobblestone Village
 * Warm Cream Storybook Parchment, Stitched Leather & Botanical Emerald Wax-Seal UI
 */
:root {
  --meadow-canopy: #18321f;
  --parchment-ivory: #FBF4E2;
  --parchment-aged: #EFE1BF;
  --parchment-edge: #C9A56A;
  --walnut-ink: #2B1E14;
  --walnut-soft: #63442B;
  --oak-bark: #4B2E19;
  --oak-stitch: #D8AD65;
  --wax-crimson-hi: #D84339;
  --wax-crimson-lo: #8E1F18;
  --wax-emerald-hi: #39B96A;
  --wax-emerald-lo: #186837;
  --gather-gold-hi: #FFE074;
  --gather-gold-lo: #D48817;
  --botanical-top: #44C874;
  --botanical-mid: #28964F;
  --botanical-deep: #15592D;
}

*, *::before, *::after {
  box-sizing: border-box;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: var(--meadow-canopy);
  font-family: "Quicksand", "Avenir Next Rounded", system-ui, sans-serif;
  font-weight: 700;
  color: var(--walnut-ink);
  touch-action: manipulation;
}

.tabular-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.hidden {
  display: none !important;
}

#dioramaStage {
  position: relative;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#meadowCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* =========================================================================
   TOP STORYBOOK PARCHMENT SCROLL & WAX-SEAL MEDALLION RIBBON
   ========================================================================= */
#storybookHeader {
  position: relative;
  z-index: 12;
  width: 100%;
  max-width: 500px;
  margin-inline: auto;
  padding: 0 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.parchment-scroll-card {
  pointer-events: auto;
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 6px 10px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.75), transparent 70%),
    linear-gradient(180deg, var(--parchment-ivory) 0%, var(--parchment-aged) 100%);
  border: 2.5px solid #7C4F28;
  outline: 1.5px dashed rgba(124, 79, 40, 0.42);
  outline-offset: -5px;
  box-shadow:
    0 4px 0 #4B2E19,
    0 8px 18px rgba(17, 31, 19, 0.36),
    inset 0 1px 0 #FFFFFF;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.brass-pin {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF3B8 0%, #D7982A 65%, #6B420E 100%);
  border: 1px solid #4B2E19;
  pointer-events: none;
}
.pin-tl { top: 5px; left: 6px; }
.pin-tr { top: 5px; right: 6px; }
.pin-bl { bottom: 5px; left: 6px; }
.pin-br { bottom: 5px; right: 6px; }

/* Left: Acorn Purse */
.acorn-purse-box {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 4px;
  overflow: hidden;
}

.acorn-emblem {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(213, 146, 54, 0.22);
  border: 1.5px solid rgba(123, 75, 34, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.purse-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.purse-caption {
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--walnut-soft);
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

#totalScoreReadout {
  font-family: "Quicksand", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--walnut-ink);
  line-height: 1.08;
  white-space: nowrap;
}

/* Center: Round Crimson / Botanical Emerald Wax-Seal Medallion */
.wax-seal-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block: -10px;
  z-index: 3;
}

.wax-seal-medallion {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #F06458 0%, var(--wax-crimson-hi) 42%, var(--wax-crimson-lo) 100%);
  border: 3px solid #F9E3A6;
  box-shadow:
    0 3px 0 #56120D,
    0 6px 12px rgba(43, 30, 20, 0.42),
    inset 0 2px 4px rgba(255, 226, 208, 0.55),
    inset 0 -3px 5px rgba(58, 8, 5, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: transform 0.18s cubic-bezier(0.22, 1.4, 0.5, 1), background 0.2s ease;
}

.wax-seal-medallion::after {
  content: "";
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 240, 204, 0.62);
  pointer-events: none;
}

.wax-seal-medallion.active-run {
  background: radial-gradient(circle at 35% 28%, #63E592 0%, var(--wax-emerald-hi) 45%, var(--wax-emerald-lo) 100%);
  border-color: #FFF4C2;
  box-shadow:
    0 3px 0 #0E4221,
    0 0 14px rgba(68, 200, 116, 0.65),
    inset 0 2px 4px rgba(226, 255, 236, 0.6);
  transform: scale(1.06);
}

.wax-seal-text {
  font-family: "Berkshire Swash", Georgia, serif;
  font-weight: 400;
  font-size: 16px;
  color: #FFFDF7;
  text-shadow: 0 1.5px 2px rgba(28, 8, 4, 0.68);
  white-space: nowrap;
  line-height: 1;
}

/* Right: COOP Cottage + SFX Bell Pills */
.cottage-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding-right: 2px;
}

.parchment-pill-btn {
  height: 36px;
  padding: 0 8px;
  border-radius: 12px;
  border: 2px solid #7C4F28;
  background: linear-gradient(180deg, #FFFDF7 0%, #EAD6AE 100%);
  box-shadow: 0 2px 0 #5C3819;
  color: var(--walnut-ink);
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.parchment-pill-btn.muted {
  opacity: 0.68;
  background: linear-gradient(180deg, #E5D9C3 0%, #CBB99B 100%);
}

.parchment-pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #5C3819;
}

.btn-svg-icon {
  flex: 0 0 auto;
}

/* Dainty Stepping-Stone Multiplier Trail Bar */
.stepping-stone-trail {
  pointer-events: auto;
  width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(251, 244, 226, 0.88);
  border: 2px solid rgba(124, 79, 40, 0.72);
  box-shadow: 0 3px 10px rgba(18, 34, 21, 0.28);
  overflow: hidden;
}

.signpost-track {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.signpost-track::-webkit-scrollbar {
  display: none;
}

.sign-chip {
  flex: 0 0 auto;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #E7D7B7;
  border: 1.5px solid #9E7747;
  color: var(--walnut-ink);
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.14s ease;
}

.sign-chip.cleared {
  background: linear-gradient(180deg, #49C477 0%, #248044 100%);
  border-color: #16542B;
  color: #FFFFFF;
}

.sign-chip.current {
  background: linear-gradient(180deg, #FFE175 0%, #DF921A 100%);
  border-color: #7B4806;
  color: #2B1E14;
  box-shadow: 0 0 8px rgba(223, 146, 26, 0.55);
}

.sign-chip.egg-goal {
  background: linear-gradient(180deg, #FFE88D 0%, #D98612 100%);
  border-color: #7A4605;
  color: #2B1E14;
}

/* =========================================================================
   BOTTOM COTTAGE GARDEN DOCK (Warm Parchment & Stitched Oak Card)
   ========================================================================= */
#cottageGardenDock {
  position: relative;
  z-index: 12;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  margin-top: auto;
  padding: 4px 10px max(8px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.cottage-dock-card {
  pointer-events: auto;
  width: 100%;
  padding: 8px 9px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, #FBF4E2 0%, #EAD8B1 100%);
  border: 3px solid var(--oak-bark);
  outline: 1.5px dashed rgba(124, 79, 40, 0.45);
  outline-offset: -6px;
  box-shadow:
    0 5px 0 #2D1A0C,
    0 -6px 20px rgba(12, 25, 15, 0.42),
    inset 0 1px 0 #FFFFFF;
  display: grid;
  grid-template-columns: minmax(96px, 1.05fr) auto minmax(110px, 1.22fr);
  align-items: center;
  gap: 7px;
}

/* Left Column: Stroll Pace Pill + Purse Stepper */
.stroll-purse-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: opacity 0.16s ease;
}

.stroll-purse-col.locked {
  opacity: 0.48;
  pointer-events: none;
}

.stroll-pace-pill {
  width: 100%;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1.8px solid #6E4423;
  background: linear-gradient(180deg, #6E4526 0%, #4A2C16 100%);
  color: #FDF5E4;
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 0 #2B180B;
}

.stroll-pace-pill:active {
  transform: translateY(1px);
}

.purse-stepper {
  width: 100%;
  height: 30px;
  border-radius: 999px;
  border: 2px solid #8A5A32;
  background: #FFFDF7;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(43, 30, 20, 0.14);
}

.stepper-nudge-btn {
  height: 100%;
  border: none;
  background: #E8D4AC;
  color: var(--walnut-ink);
  font-family: "Quicksand", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.stepper-nudge-btn:active {
  background: #D6BC8B;
}

.purse-step-val {
  text-align: center;
  font-family: "Quicksand", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--walnut-ink);
  white-space: nowrap;
}

/* Center Pair: Knight Helm Ward Round Button + Warm Gold GATHER Button */
.ward-gather-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.helm-ward-btn {
  width: 54px;
  height: 62px;
  padding: 3px 3px 4px;
  border-radius: 18px;
  border: 2px solid #1C6B66;
  background: radial-gradient(circle at 50% 30%, #6CE4DC 0%, #248A83 100%);
  box-shadow: 0 4px 0 #114744, inset 0 1px 0 rgba(255, 255, 255, 0.65);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.helm-ward-btn.armed {
  background: radial-gradient(circle at 50% 30%, #98FFF7 0%, #1BA89E 100%);
  border-color: #FFFFFF;
  box-shadow: 0 0 14px rgba(72, 236, 224, 0.9), 0 4px 0 #114744;
}

.helm-ward-btn:disabled {
  opacity: 0.52;
  filter: saturate(0.6);
  cursor: default;
}

.helm-ward-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #114744;
}

.helm-mini-art {
  width: 28px;
  height: 28px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.helm-sub-tag {
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(8, 42, 40, 0.75);
  white-space: nowrap;
}

.warm-gather-btn {
  width: 78px;
  height: 62px;
  padding: 4px 6px;
  border-radius: 18px;
  border: 2px solid #965B08;
  background: linear-gradient(180deg, var(--gather-gold-hi) 0%, var(--gather-gold-lo) 100%);
  box-shadow: 0 4px 0 #6D4004, inset 0 1px 0 #FFF9DE;
  color: var(--walnut-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.warm-gather-btn.ready-glow {
  animation: gatherPulse 1.1s ease-in-out infinite alternate;
}

@keyframes gatherPulse {
  0% { box-shadow: 0 4px 0 #6D4004, 0 0 6px rgba(255, 214, 74, 0.45); }
  100% { box-shadow: 0 4px 0 #6D4004, 0 0 16px rgba(255, 220, 92, 0.95); }
}

.warm-gather-btn.disabled,
.warm-gather-btn:disabled {
  opacity: 0.46;
  filter: saturate(0.65);
  cursor: default;
  animation: none;
}

.warm-gather-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #6D4004;
}

.gather-title {
  font-family: "Quicksand", sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.05;
  color: #2B1E14;
}

.gather-sub {
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
  color: #4E2F10;
}

/* Right: Lush Botanical Emerald HOP STONE Pillow Button */
.emerald-hop-pillow {
  width: 100%;
  height: 62px;
  padding: 5px 8px;
  border-radius: 20px;
  border: 2.5px solid #B7FFD1;
  background:
    radial-gradient(circle at 50% 15%, rgba(162, 255, 196, 0.45), transparent 60%),
    linear-gradient(180deg, var(--botanical-top) 0%, var(--botanical-mid) 62%, var(--botanical-deep) 100%);
  box-shadow:
    0 5px 0 #0F401F,
    0 6px 14px rgba(15, 64, 31, 0.42),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.65);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.emerald-hop-pillow:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #0F401F;
}

.emerald-hop-pillow:disabled {
  opacity: 0.62;
  cursor: default;
}

.hop-swash-title {
  font-family: "Berkshire Swash", Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.06;
  letter-spacing: 0.01em;
  color: #FFFDF7;
  text-shadow: 0 2px 2px rgba(10, 44, 21, 0.6);
}

.hop-quicksand-sub {
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
  color: #E6FFEF;
}

/* Narrow 320px iPhone SE adaptation */
@media (max-width: 365px) {
  .parchment-scroll-card {
    padding: 5px 7px;
    gap: 4px;
  }
  .cottage-header-actions {
    gap: 4px;
    padding-right: 0;
  }
  .parchment-pill-btn {
    height: 32px;
    padding: 0 5px;
    gap: 2px;
    border-radius: 10px;
  }
  .parchment-pill-btn .btn-svg-icon {
    width: 11px;
    height: 11px;
  }
  .cottage-dock-card {
    padding: 6px 6px;
    gap: 4px;
    grid-template-columns: minmax(98px, 1.08fr) auto minmax(92px, 1.12fr);
  }
  .stroll-pace-pill {
    padding: 0 4px;
  }
  .helm-ward-btn {
    width: 44px;
    height: 58px;
  }
  .warm-gather-btn {
    width: 66px;
    height: 58px;
  }
  .emerald-hop-pillow {
    height: 58px;
  }
  .wax-seal-medallion {
    width: 48px;
    height: 48px;
  }
  .wax-seal-medallion::after {
    width: 38px;
    height: 38px;
  }
  .acorn-emblem {
    display: none;
  }
}

/* =========================================================================
   COOP COTTAGE MODAL & OUTCOME PLAQUE
   ========================================================================= */
.storybook-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 34, 21, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.storybook-modal-card {
  width: min(410px, 100%);
  max-height: 84%;
  background: linear-gradient(180deg, #FBF4E2 0%, #EAD6AE 100%);
  border: 3.5px solid #5C3819;
  border-radius: 24px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.58);
  color: var(--walnut-ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header-oak {
  padding: 11px 15px;
  background: linear-gradient(180deg, #6B4223 0%, #482A13 100%);
  color: #FBF4E2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-header-oak h2 {
  margin: 0;
  font-family: "Berkshire Swash", Georgia, serif;
  font-weight: 400;
  font-size: 20px;
  white-space: nowrap;
}

.wax-close-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid #F9DF9E;
  background: linear-gradient(180deg, var(--wax-crimson-hi) 0%, var(--wax-crimson-lo) 100%);
  color: #FFFFFF;
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.modal-purse-strip {
  padding: 8px 15px;
  background: #E5CFA3;
  border-bottom: 2px solid #C8AA74;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}

.shop-items-grid {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-card {
  padding: 9px 11px;
  border-radius: 15px;
  background: #FFFDF7;
  border: 2px solid #CCA870;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shop-info {
  flex: 1;
  overflow: hidden;
}

.shop-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--walnut-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-desc {
  font-size: 12px;
  font-weight: 600;
  color: var(--walnut-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-buy-btn {
  flex: 0 0 auto;
  height: 34px;
  min-width: 84px;
  padding: 0 10px;
  border-radius: 999px;
  border: 2px solid #1B6835;
  background: linear-gradient(180deg, #44C874 0%, #248044 100%);
  color: #FFFFFF;
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.shop-buy-btn.equipped {
  background: linear-gradient(180deg, #FFE074 0%, #CF8314 100%);
  border-color: #7D4C06;
  color: var(--walnut-ink);
}

/* Round Outcome Toast Plaque */
.outcome-toast {
  position: fixed;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  pointer-events: none;
}

.outcome-plaque {
  min-width: 220px;
  max-width: calc(100vw - 28px);
  padding: 14px 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, #FBF4E2 0%, #E8D1A2 100%);
  border: 3px solid #6E421F;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.52);
  text-align: center;
  color: var(--walnut-ink);
  animation: popParchment 0.22s cubic-bezier(0.22, 1.35, 0.5, 1);
}

.outcome-plaque.hazard-hit {
  background: linear-gradient(180deg, #FFF0EB 0%, #F2C3B3 100%);
  border-color: #96271C;
}

.outcome-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--wax-crimson-hi);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.outcome-plaque h3 {
  margin: 6px 0 2px;
  font-family: "Berkshire Swash", Georgia, serif;
  font-weight: 400;
  font-size: 24px;
  white-space: nowrap;
}

.outcome-plaque p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--walnut-soft);
  white-space: nowrap;
}

@keyframes popParchment {
  0% { transform: scale(0.74); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
