:root {
  --ivory: #F6E8CE;
  --cream: #F6E8CE;
  --oat: #E9D2A7;
  --oak: #E9D2A7;
  --navy: #243A5A;
  --sage: #8FA37A;
  --terra: #D67B63;
  --brass: #C4A46A;
  --gold: #C4A46A;
  --butter: #E9B94E;
  --peri: #95A9D6;
  --ink: #243A5A;
  --paper: #F6E8CE;
  --paper-edge: #3A2A18;
  --shadow: rgba(36, 58, 90, 0.18);
  --lift-shadow: rgba(36, 58, 90, 0.28);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --hud-h: 4.4rem;
  --hint-h: 3.4rem;
  --item-min: 64px;
  --card-w: 70px;
  --card-h: 100px;
  --card-radius: 11px;
  --card-peek: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--ivory);
  color: var(--navy);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

img {
  display: block;
  max-width: 100%;
}

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

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

.app {
  position: relative;
  width: min(100vw, 430px);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ivory);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding:
    calc(var(--safe-t) + 0.75rem)
    calc(var(--safe-r) + 1rem)
    calc(var(--safe-b) + 1rem)
    calc(var(--safe-l) + 1rem);
}

.screen[hidden],
.overlay[hidden],
.landscape-notice[hidden],
.coach-layer[hidden],
.hold-dock[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage);
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.2rem, 9vw, 2.8rem);
}

h2 {
  font-size: clamp(1.45rem, 6vw, 1.85rem);
}

.tagline,
.intro-copy,
.sheet-copy,
.result-detail,
.board-hint {
  line-height: 1.45;
}

.tagline {
  margin: 0.7rem 0 0;
  font-size: 1.02rem;
  color: rgba(36, 58, 90, 0.78);
}

.batch-line {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  color: rgba(36, 58, 90, 0.68);
}

.chapter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
}

.chapter-chip {
  display: inline-block;
  margin: 0;
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(196, 164, 106, 0.55);
  border-radius: 999px;
  color: var(--brass);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn-primary {
  background: var(--navy);
  color: var(--ivory);
  box-shadow: 0 8px 18px var(--shadow);
}

.btn-secondary {
  background: rgba(205, 174, 131, 0.38);
  color: var(--navy);
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(36, 58, 90, 0.18);
}

.btn:active {
  transform: translateY(1px);
}

.text-link {
  margin-top: 0.85rem;
  min-height: 44px;
  padding: 0.4rem;
  color: rgba(23, 36, 58, 0.62);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  font-size: 0.9rem;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.45rem;
  border-radius: 12px;
  background: rgba(246, 232, 206, 0.86);
  box-shadow: inset 0 0 0 1px rgba(36, 58, 90, 0.08);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.screen-title,
.screen-intro,
.screen-result {
  align-items: stretch;
  justify-content: flex-end;
  background:
    linear-gradient(180deg, rgba(246, 232, 206, 0.08) 0%, rgba(246, 232, 206, 0.42) 58%, #F6E8CE 100%),
    url("../art/production/backgrounds/bg_01_pantry_softcards.png") center / cover no-repeat,
    var(--ivory);
}

.screen-intro.is-weekend,
.screen-result.is-weekend {
  background:
    linear-gradient(180deg, rgba(246, 232, 206, 0.06) 0%, rgba(246, 232, 206, 0.38) 58%, #F6E8CE 100%),
    url("../art/production/backgrounds/bg_02_weekend_softcards.png") center / cover no-repeat,
    var(--ivory);
}

.title-plate,
.intro-plate,
.result-plate {
  background: rgba(246, 232, 206, 0.9);
  border: 1px solid rgba(196, 164, 106, 0.42);
  border-radius: 22px;
  padding: 1.35rem 1.2rem 1.2rem;
  box-shadow: 0 16px 40px rgba(36, 58, 90, 0.1);
}

.title-actions,
.result-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.3rem;
}

.intro-copy {
  margin: 0.85rem 0 0;
  font-size: 1.02rem;
}

.intro-copy.quiet {
  color: rgba(23, 36, 58, 0.7);
}

.intro-plate .btn {
  margin-top: 1.4rem;
}

.screen-select {
  background:
    linear-gradient(180deg, rgba(246, 232, 206, 0.72), #F6E8CE),
    var(--ivory);
}

.select-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.level-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
  overflow: auto;
  display: grid;
  gap: 0.7rem;
}

.chapter-head {
  margin: 0.35rem 0 0;
  padding: 0.15rem 0.15rem 0;
}

.chapter-head:first-child {
  margin-top: 0;
}

.chapter-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.level-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  min-height: 76px;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: rgba(246, 232, 206, 0.94);
  box-shadow: inset 0 0 0 1.5px rgba(196, 164, 106, 0.5);
}

.level-card.is-locked {
  opacity: 0.55;
}

.level-id {
  width: 2.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--brass);
}

.level-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.level-card p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: rgba(23, 36, 58, 0.62);
}

.star-row {
  display: flex;
  gap: 0.28rem;
  align-items: center;
}

.star {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 2px;
  transform: rotate(45deg);
  background: rgba(36, 58, 90, 0.12);
}

.star.is-on {
  background: var(--brass);
  box-shadow: 0 0 0 1px rgba(196, 164, 106, 0.25);
}

.result-plate .star {
  width: 1.05rem;
  height: 1.05rem;
}

.screen-play {
  padding:
    calc(var(--safe-t) + 0.45rem)
    calc(var(--safe-r) + 0.55rem)
    calc(var(--safe-b) + 0.45rem)
    calc(var(--safe-l) + 0.55rem);
  background: var(--cream);
}

.screen-play.is-weekend {
  background: #edf0f6;
}

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.4rem;
  align-items: center;
  min-height: var(--hud-h);
  padding: 0.15rem 0.2rem 0.45rem;
}

.hud-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(23, 36, 58, 0.62);
}

.hud-progress,
.hud-moves {
  margin: 0.1rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.hud-moves {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(246, 232, 206, 0.82);
}

.hud-tools {
  display: flex;
  gap: 0.3rem;
}

.playfield {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(36, 58, 90, 0.06);
  transform-origin: 50% 42%;
  transition: transform 700ms ease;
  touch-action: none;
}

.playfield.is-cleared {
  transform: scale(1.025);
}

.playfield::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("../art/production/backgrounds/bg_01_pantry_softcards.png") center / cover no-repeat;
}

.playfield::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(246, 232, 206, 0.1) 0%, rgba(246, 232, 206, 0.04) 32%, rgba(246, 232, 206, 0.16) 100%);
  pointer-events: none;
}

.playfield.is-weekend::before {
  background-image: url("../art/production/backgrounds/bg_02_weekend_softcards.png");
}

.playfield.is-weekend::after {
  background:
    linear-gradient(180deg, rgba(237, 240, 246, 0.1) 0%, rgba(246, 232, 206, 0.04) 36%, rgba(246, 232, 206, 0.14) 100%);
}

.no-bg .playfield::before {
  background: linear-gradient(180deg, #f3d7b4, #f6e8ce 42%, #ead6b0);
}

.no-bg .playfield.is-weekend::before {
  background: linear-gradient(180deg, #c9d4ea, #f6e8ce 44%, #dce4f2);
}

.destinations,
.staging,
.particles,
.coach-layer {
  position: relative;
  z-index: 1;
}

.destinations {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(0.4rem, 2vw, 0.75rem);
  height: 31%;
  min-height: 132px;
  padding: 0.7rem 0.55rem 0.2rem;
}

.destination {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  max-width: 100%;
  min-width: 0;
  min-height: 120px;
  box-sizing: border-box;
  padding: 0.32rem 0.32rem 0.38rem;
  border-radius: 18px;
  background: rgba(246, 232, 206, 0.62);
  box-shadow:
    inset 0 0 0 1.5px rgba(196, 164, 106, 0.55),
    inset 0 0 0 3px rgba(246, 232, 206, 0.7),
    0 2px 0 rgba(58, 42, 24, 0.16),
    0 6px 12px rgba(36, 58, 90, 0.08);
  touch-action: none;
}

.destination.is-hot.valid {
  box-shadow:
    inset 0 0 0 2px var(--rim, var(--sage)),
    inset 0 0 0 3.5px rgba(246, 232, 206, 0.75),
    0 0 0 4px rgba(143, 163, 122, 0.22);
}

.destination.is-complete .dest-body {
  box-shadow:
    inset 0 0 16px rgba(246, 232, 206, 0.45),
    0 4px 10px var(--shadow);
}

.destinations.count-2 .destination {
  max-width: 46%;
}

.dest-body {
  display: block;
  position: relative;
  flex: 1;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 86px;
  box-sizing: border-box;
  border-radius: 13px;
  overflow: hidden;
  background: rgba(255, 250, 240, 0.22);
}

.dest-art {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  align-self: stretch;
  width: auto;
  max-width: none;
  min-width: 0;
  height: auto;
  box-sizing: border-box;
  background-repeat: no-repeat;
}

.dest-art.is-atlas {
  background-size: 400% 400%;
}

.dest-art.has-photo {
  background-color: transparent;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.dest-image {
  display: block;
  position: absolute;
  inset: 0;
  align-self: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  opacity: 0;
}

.dest-art.is-loaded .dest-image,
.dest-art[data-art-state="loaded"] .dest-image {
  opacity: 1;
}

.dest-art.shelf {
  background:
    linear-gradient(#f3e4c4, #f3e4c4) top / 100% 58% no-repeat,
    linear-gradient(180deg, #e9b94e, #c4a46a);
}

.dest-slots {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 8%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.16rem;
  pointer-events: none;
}

.placed-item {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: clamp(28px, 7.4vw, 36px);
  height: clamp(40px, 10.6vw, 52px);
  padding: 2px 2px 0;
  border-radius: 5px;
  background: var(--cream);
  box-shadow:
    inset 0 0 0 1.25px var(--gold),
    inset 0 0 0 2.25px var(--cream),
    0 1px 0 var(--paper-edge),
    0 2px 4px var(--shadow);
  overflow: hidden;
  transition: transform 200ms ease;
}

.placed-item::after {
  content: "";
  flex: 0 0 6px;
  margin: 1px 1px 2px;
  border-radius: 2px;
  background: var(--navy);
}

.placed-art {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 3px 3px 0 0;
  background-color: var(--cream);
  background-repeat: no-repeat;
  background-size: 400% 400%;
}

.placed-item.is-fallback,
.placed-art.is-fallback,
.item-art.is-fallback {
  background-size: cover;
}

.dest-name {
  position: relative;
  z-index: 1;
  margin-top: 0.28rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--navy);
}

.destination[data-id="dest_pantry_shelf"] {
  --rim: var(--oak);
}

.destination[data-id="dest_fridge_drawer"] {
  --rim: var(--sage);
}

.destination[data-id="dest_picnic_basket"] {
  --rim: var(--terra);
}

.destination[data-id="dest_pantry_shelf"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--oak), 0 0 0 4px rgba(233, 210, 167, 0.42);
}

.destination[data-id="dest_fridge_drawer"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--sage), 0 0 0 4px rgba(143, 163, 122, 0.34);
}

.destination[data-id="dest_picnic_basket"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--terra), 0 0 0 4px rgba(214, 123, 99, 0.3);
}

.destination[data-id="dest_weekender_bag"] {
  --rim: var(--terra);
}

.destination[data-id="dest_toiletry_pouch"] {
  --rim: var(--sage);
}

.destination[data-id="dest_shoe_compartment"] {
  --rim: var(--navy);
}

.destination[data-id="dest_weekender_bag"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--terra), 0 0 0 4px rgba(214, 123, 99, 0.3);
}

.destination[data-id="dest_toiletry_pouch"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--sage), 0 0 0 4px rgba(143, 163, 122, 0.34);
}

.destination[data-id="dest_shoe_compartment"].is-hot.valid {
  box-shadow: inset 0 0 0 2px var(--navy), 0 0 0 4px rgba(36, 58, 90, 0.18);
}

.dest-art.fridge {
  background:
    linear-gradient(180deg, #c5d4ea 0 16%, #95a9d6 16% 22%, #edf0f6 22% 86%, #243a5a 86% 100%);
}

.dest-art.basket {
  background:
    radial-gradient(ellipse at 50% 80%, #d67b63 0 40%, transparent 42%),
    linear-gradient(180deg, #f6e8ce 0 38%, #e9b94e 38% 100%);
}

.dest-art.weekender {
  background:
    radial-gradient(ellipse at 50% 78%, #243a5a 0 38%, transparent 40%),
    linear-gradient(180deg, #dce4f2 0 42%, #95a9d6 42% 100%);
}

.dest-art.pouch {
  background:
    linear-gradient(180deg, #8fa37a 0 18%, #f6e8ce 18% 82%, #8fa37a 82% 100%);
}

.dest-art.shoe-bin {
  background:
    linear-gradient(180deg, #243a5a 0 22%, #e9d2a7 22% 78%, #243a5a 78% 100%);
}

.hold-dock {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  min-height: 118px;
  margin: 0.05rem 0.5rem 0.15rem;
  padding: 0.28rem 0.4rem;
  border-radius: 16px;
  background: rgba(246, 232, 206, 0.7);
  box-shadow: inset 0 0 0 1.5px rgba(196, 164, 106, 0.42);
}

.hold-dock.is-hot {
  box-shadow:
    inset 0 0 0 2px var(--sage),
    0 0 0 4px rgba(143, 163, 122, 0.22);
}

.hold-dock.is-hot.is-full {
  box-shadow:
    inset 0 0 0 2px var(--terra),
    0 0 0 4px rgba(214, 123, 99, 0.2);
}

.hold-btn {
  min-width: 56px;
  min-height: 44px;
  padding: 0.3rem 0.45rem;
  border-radius: 12px;
  background: rgba(36, 58, 90, 0.08);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hold-btn:not(:disabled) {
  background: var(--navy);
  color: var(--ivory);
}

.hold-tray {
  min-width: 0;
}

.hold-label {
  margin: 0 0 0.12rem;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(23, 36, 58, 0.62);
}

.hold-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--card-h);
  min-width: var(--card-w);
}

.hold-slot.is-empty {
  width: var(--card-w);
  min-height: var(--card-h);
  margin: 0 auto;
  border-radius: var(--card-radius);
  box-shadow:
    inset 0 0 0 1.5px rgba(196, 164, 106, 0.55),
    0 2px 0 rgba(58, 42, 24, 0.12);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(36, 58, 90, 0.04) 0 8px,
      rgba(143, 163, 122, 0.08) 8px 16px
    );
}

.hold-empty-copy {
  margin: 0;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  color: rgba(36, 58, 90, 0.58);
  text-align: center;
}

.hold-slot .item {
  margin-top: 0;
  width: var(--card-w);
  height: var(--card-h);
}

.staging {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0.45rem, 2.6vw, 1rem);
  padding: 0.4rem 0.45rem 1.1rem;
  min-height: 0;
}

.stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--card-w);
  min-height: calc(var(--card-h) + var(--card-peek) * 2);
}

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--card-w);
  min-width: var(--item-min);
  height: var(--card-h);
  margin-top: calc(var(--card-peek) - var(--card-h));
  padding: 0;
  border-radius: var(--card-radius);
  background: var(--cream);
  box-shadow:
    0 2px 0 var(--paper-edge),
    0 5px 8px var(--shadow);
  touch-action: none;
  transition: box-shadow 160ms ease, transform 180ms ease;
  perspective: 800px;
}

.item-shell {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 380ms cubic-bezier(0.4, 0, 0.2, 1);
}

.item.is-facedown .item-shell {
  transform: rotateY(180deg);
}

.item-front,
.item-back {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.item-front {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  box-shadow:
    inset 0 0 0 2px var(--gold),
    inset 0 0 0 3.5px var(--cream),
    inset 0 0 0 5px var(--gold);
}

.item-back {
  transform: rotateY(180deg);
  background-color: var(--navy);
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(246, 232, 206, 0.07) 0 1px,
      transparent 1px 7px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(196, 164, 106, 0.1) 0 1px,
      transparent 1px 7px
    );
  box-shadow:
    inset 0 0 0 2px var(--gold),
    inset 0 0 0 3.5px var(--navy),
    inset 0 0 0 5px var(--gold);
}

.item-seal {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 4px var(--navy),
    inset 0 0 0 5.5px var(--gold);
}

.stack .item:first-child {
  margin-top: 0;
}

.item.is-buried {
  pointer-events: none;
}

.item.is-top {
  z-index: 3;
}

.item.is-lifted,
.item.is-selected {
  z-index: 20;
  transform: translateY(-6px) scale(1.03);
  box-shadow:
    0 3px 0 var(--paper-edge),
    0 14px 20px var(--lift-shadow);
}

.item.is-dragging {
  z-index: 40;
  opacity: 0.98;
  box-shadow:
    0 3px 0 var(--paper-edge),
    0 18px 26px var(--lift-shadow);
  transition: none;
}

.item.is-placing {
  transform: scale(0.97, 1.03);
}

.item.is-wrong {
  animation: item-shake 220ms ease;
}

.item-art {
  display: block;
  flex: 1 1 auto;
  min-width: var(--item-min);
  min-height: var(--item-min);
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 9px 9px 0 0;
  background-repeat: no-repeat;
  background-size: 400% 400%;
  background-color: var(--cream);
}

.item-name {
  display: block;
  flex: 0 0 1.15rem;
  height: 1.15rem;
  margin: 0 6px 6px;
  padding: 0 0.2rem;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.15rem;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cream);
  background: var(--navy);
}

.item.is-fallback .item-art,
.placed-item.is-fallback .placed-art,
.placed-art.is-fallback {
  background-image: none;
  background:
    radial-gradient(circle at 30% 25%, rgba(246, 232, 206, 0.7), transparent 46%),
    var(--tone, #e9d2a7);
}

.item[data-home="dest_pantry_shelf"],
.placed-item[data-home="dest_pantry_shelf"] { --tone: #e9d2a7; }
.item[data-home="dest_fridge_drawer"],
.placed-item[data-home="dest_fridge_drawer"] { --tone: #8fa37a; }
.item[data-home="dest_picnic_basket"],
.placed-item[data-home="dest_picnic_basket"] { --tone: #d67b63; }
.item[data-home="dest_weekender_bag"],
.placed-item[data-home="dest_weekender_bag"] { --tone: #95a9d6; }
.item[data-home="dest_toiletry_pouch"],
.placed-item[data-home="dest_toiletry_pouch"] { --tone: #8fa37a; }
.item[data-home="dest_shoe_compartment"],
.placed-item[data-home="dest_shoe_compartment"] { --tone: #243a5a; }

.board-hint {
  min-height: var(--hint-h);
  margin: 0.35rem 0.2rem 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.92rem;
  color: var(--navy);
}

.coach-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.coach-arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.coach-arc path {
  fill: none;
  stroke: rgba(36, 58, 90, 0.45);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 5 6;
}

.coach-finger {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: rgba(36, 58, 90, 0.78);
  box-shadow: 0 0 0 8px rgba(36, 58, 90, 0.12);
  animation: finger-pulse 1.3s ease-in-out infinite;
}

.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: hidden;
}

.mote {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--ivory);
  opacity: 0;
  animation: mote 420ms ease-out forwards;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding:
    calc(var(--safe-t) + 1rem)
    calc(var(--safe-r) + 1rem)
    calc(var(--safe-b) + 1rem)
    calc(var(--safe-l) + 1rem);
  background: rgba(36, 58, 90, 0.32);
}

.sheet {
  width: min(100%, 430px);
  padding: 1.3rem 1.15rem 1.1rem;
  border-radius: 22px 22px 18px 18px;
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(36, 58, 90, 0.18);
}

.sheet .btn + .btn,
.sheet .text-link {
  margin-top: 0.6rem;
}

.sheet .text-link {
  width: 100%;
}

.landscape-notice {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--ivory);
  text-align: center;
  font-size: 1.1rem;
}

@keyframes item-shake {
  20% { transform: translateX(-4px) rotate(-10deg); }
  55% { transform: translateX(4px) rotate(8deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes finger-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.12); opacity: 1; }
}

@keyframes mote {
  0% { opacity: 0.85; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); }
}

@media (min-width: 390px) {
  :root {
    --card-w: 74px;
    --card-h: 106px;
  }
}

@media (min-width: 430px) {
  :root {
    --card-w: 78px;
    --card-h: 111px;
  }

  .app {
    box-shadow: 0 0 0 1px rgba(36, 58, 90, 0.06);
  }
}

@media (max-width: 360px) {
  :root {
    --card-w: 70px;
    --card-h: 100px;
  }

  .hud {
    grid-template-columns: 1fr auto;
  }

  .hud-moves {
    justify-self: end;
  }

  .hud-tools {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .hold-btn {
    min-width: 52px;
    font-size: 0.68rem;
  }

  .dest-name,
  .item-name {
    font-size: 0.55rem;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .landscape-notice,
  .landscape-notice[hidden] {
    display: flex !important;
  }

  .app,
  .overlay {
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .item.is-lifted,
  .item.is-selected {
    transform: none;
  }

  .playfield.is-cleared {
    transform: none;
  }
}
