/* Explicit sizing prevents generic card image rules from stretching inline icons. */
html {
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-wrap: anywhere;
}
header {
  background: #fffaf4;
  backdrop-filter: none;
}
header strong {
  flex: 1;
  font-size: clamp(15px, 4.2vw, 19px);
}
header > .row {
  flex-shrink: 0;
  gap: 8px;
}
header small {
  white-space: nowrap;
}
main,
.panel,
.card,
.row > *,
form {
  min-width: 0;
}
input,
select,
textarea {
  max-width: 100%;
  min-width: 0;
}
.consumer .card h2 {
  white-space: normal;
  overflow-wrap: anywhere;
}
.consumer .card h2 .inline-icon {
  width: 48px;
  height: 48px;
  max-width: 48px;
  flex: 0 0 48px;
  margin: 0;
  object-fit: contain;
}
.consumer[data-screen="home"] main > .grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.consumer[data-screen="home"] .card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-height: 162px;
}
.consumer[data-screen="home"] .card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(16px, 4.5vw, 21px);
  line-height: 1.3;
}
.consumer[data-screen="home"] .card .hero-art {
  float: none;
  width: 54px;
  height: 54px;
  margin: 0 0 12px;
  max-width: 100%;
}
.consumer[data-screen="home"] .card .hero-art img {
  width: 54px;
  height: 54px;
}
.consumer[data-screen="home"] .card .gift-sprite {
  transform: scale(0.64);
  transform-origin: top left;
}
.consumer[data-screen="home"] .card p {
  font-size: 14px;
  margin: 4px 0 0;
}
.home-carousel {
  margin: 0 0 18px;
  border-radius: 22px;
  overflow: hidden;
  background: #ffead4;
  box-shadow: 0 8px 22px #ad613514;
}
.carousel-window {
  overflow: hidden;
  touch-action: pan-y;
}
.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  min-height: 210px;
  padding: 20px 14px 18px 20px;
  background: radial-gradient(at 80% 25%, #fff9e9, #ffdfbb);
}
.carousel-slide.slide-1 {
  background: linear-gradient(135deg, #fff0f1, #ffe5bf);
}
.carousel-slide.slide-2 {
  background: linear-gradient(135deg, #f1e8ff, #e0f3ff);
}
.carousel-copy {
  position: relative;
  z-index: 1;
}
.carousel-copy small {
  font-size: 12px;
  color: #9b5433;
}
.carousel-copy h1 {
  font-size: clamp(24px, 7vw, 34px);
  margin: 8px 0;
  letter-spacing: -1px;
}
.carousel-copy p {
  font-size: 12px;
  color: #795842;
  line-height: 1.6;
}
.carousel-copy span {
  display: inline-block;
  border-radius: 999px;
  background: #ff653e;
  color: white;
  font-size: 13px;
  padding: 9px 14px;
}
.carousel-slide .carousel-art {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px #9f663a22);
}
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 12px 8px;
}
.carousel-controls button {
  min-height: 32px;
  min-width: 32px;
  padding: 3px;
  background: transparent;
  color: #98512e;
}
.carousel-dots {
  display: flex;
  gap: 4px;
}
.carousel-dots button {
  position: relative;
}
.carousel-dots button::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 8px;
  background: #c8a892;
  margin: auto;
  transition: width 0.2s;
}
.carousel-dots button[aria-current="true"]::after {
  width: 21px;
  background: #ff653e;
}
.game-audio {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.game-audio button {
  font-size: 12px;
  padding: 5px 10px;
  min-height: 36px;
}
.game-board .shelf {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  padding: 12px;
}
.game-board .tile {
  min-width: 0;
  touch-action: manipulation;
}
.game-board .tray {
  position: relative;
  flex-wrap: nowrap;
  gap: 4px;
}
.game-board .tray span {
  flex: 0 1 34px;
  min-width: 0;
}
.game-board .tray span img {
  max-width: 100%;
  height: 32px;
  object-fit: contain;
}
.game-board .actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.game-board .original-tool {
  min-width: 0;
  padding: 6px 2px;
}
.game-board .original-tool span {
  font-size: 11px;
  white-space: normal;
}
.game-result {
  position: relative;
  overflow: hidden;
  padding: 24px 10px;
  background: radial-gradient(ellipse at top, #fff0bd, transparent 70%);
  border-radius: 22px;
}
.game-result h1 {
  color: #b75e20;
}
.result-stars {
  font-size: 38px;
  letter-spacing: 7px;
  color: #ffc537;
  text-shadow: 0 3px 0 #dc9218;
}
.game-result.won .result-stars {
  animation: stars-arrive 0.75s cubic-bezier(0.2, 0.8, 0.3, 1.3) both;
}
.game-result.won {
  animation: result-arrive 0.45s ease-out both;
}
.game-result.lost .result-stars {
  display: none;
}
.game-result > button {
  display: block;
  margin: 12px auto;
  width: min(100%, 280px);
}
.next-cost {
  display: block;
  font-size: 12px;
}
.flying-good {
  position: fixed;
  pointer-events: none;
  z-index: 80;
  display: grid;
  place-items: center;
}
.flying-good img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.game-combo {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: -15px;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg, #ff9850, #f44a70);
  padding: 6px 15px;
  border-radius: 999px;
  box-shadow: 0 5px 20px #f67b5555;
  animation: combo-pop 1s ease-out both;
}
@keyframes combo-pop {
  0% {
    transform: translate(-50%, 12px) scale(0.7);
    opacity: 0;
  }
  25% {
    transform: translate(-50%, -8px) scale(1.1);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -30px);
    opacity: 0;
  }
}
@keyframes stars-arrive {
  from {
    transform: scale(0.2) rotate(-20deg);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes result-arrive {
  from {
    transform: translateY(15px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.nav {
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.consumer main {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
@media (max-width: 360px) {
  header {
    padding: 10px;
    gap: 6px;
  }
  header button {
    padding: 6px 8px;
  }
  header small {
    font-size: 11px;
  }
  .consumer[data-screen="home"] .card {
    padding: 12px;
  }
  .consumer[data-screen="home"] .card h2 {
    flex-wrap: wrap;
  }
  .carousel-slide {
    padding: 16px 12px;
    min-height: 190px;
  }
  .carousel-slide .carousel-art {
    height: 125px;
  }
  .game-board {
    padding: 12px;
  }
  .game-board .shelf {
    padding: 8px;
    gap: 5px;
    border-width: 4px;
  }
  .game-board .tile {
    min-height: 42px;
    padding: 3px;
  }
  .home-shortcuts .image-shortcut img {
    width: 42px;
    height: 42px;
  }
  .image-shortcut span {
    font-size: 11px;
  }
}
@media (min-width: 768px) {
  body.consumer,
  .consumer main,
  .consumer header,
  .consumer .nav {
    max-width: 760px;
  }
  .consumer[data-screen="home"] main > .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .carousel-slide {
    min-height: 240px;
    padding: 24px 38px;
  }
  .carousel-slide .carousel-art {
    height: 210px;
  }
  .carousel-copy h1 {
    font-size: 38px;
  }
  .game-board {
    max-width: 600px;
    margin-inline: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    transition: none;
  }
  .game-result,
  .result-stars,
  .game-combo {
    animation: none !important;
  }
  .game-combo {
    transform: translateX(-50%);
  }
}

@media (max-width: 360px) {
  .game-board .tile .goods-art {
    transform: scale(0.72);
    margin: -7px -5px;
  }
  .game-board .tray .goods-art {
    transform: scale(0.75);
    margin: -7px -4px;
  }
}

.game-result .result-art {
  font-size: 0 !important;
  line-height: 1;
  margin: 8px 0;
}
.game-result .result-mascot {
  width: 90px;
  height: 100px;
}
.game-result .result-stars {
  font-size: 32px;
}
.game-result {
  padding: 18px 8px;
}
.game-board .original-tool {
  flex-direction: column;
}
.game-board .original-tool .tool-art {
  flex-shrink: 0;
}

/* Visible capacity and confirmed tool results. */
.tray-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 16px 0 7px;
}
.tray-heading small {
  font-size: 12px;
}
.game-board .slotted-tray {
  display: grid;
  grid-template-columns: repeat(var(--slot-count), minmax(0, 1fr));
  gap: 4px;
  padding: 8px 6px;
  margin: 0 0 10px;
  min-height: 74px;
  overflow: visible;
}
.tray-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 60px;
  border: 2px solid #dcad6a;
  border-radius: 8px;
  background: #fffbec;
  box-shadow: inset 0 2px 5px #b87a2a18;
}
.tray-cell.filled {
  background: #fff0ba;
  border-color: #d29340;
}
.tray-cell.extended {
  border-color: #39a67d;
  background: #e8fff1;
}
.slot-number {
  position: absolute;
  top: 1px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 9px;
  line-height: 12px;
  color: #a9824d;
}
.extended .slot-number {
  color: #187b57;
  font-weight: 700;
}
.slot-empty {
  font-style: normal;
  font-size: 20px;
  color: #dec9a6;
  align-self: center;
  margin-top: 8px;
}
.extended .slot-empty {
  color: #69b894;
}
.game-board .tray-cell .goods-art {
  transform: scale(0.75);
  margin: 4px -5px -8px;
  flex-shrink: 0;
}
.game-action-feedback {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff0cf;
  border: 1px solid #edd5a7;
  color: #835127;
  font-size: 13px;
  line-height: 1.6;
  min-height: 44px;
  margin: 0 0 12px;
}
.tool-slot .game-action-feedback {
  background: #e2faeb;
  color: #14754b;
  border-color: #7dcb9b;
}
.tool-bomb .game-action-feedback {
  background: #ffe7dd;
  color: #a14420;
}
.tool-undo .game-action-feedback {
  background: #e9f1ff;
  color: #385e9d;
}
.tool-shuffle .game-action-feedback {
  background: #f1e9ff;
  color: #74549b;
}
.game-board .original-tool {
  gap: 3px;
}
.game-board .original-tool > span {
  font-size: 12px;
  font-weight: 700;
}
.tool-remaining {
  color: #b36b22;
  font-size: 11px;
  background: #ffebc9;
  border-radius: 7px;
  padding: 1px 6px;
}
.tool-hint {
  font-size: 9px;
  line-height: 1.3;
  color: #997c62;
}
.game-board .original-tool:disabled {
  opacity: 0.55;
  cursor: default;
}
.tool-shuffle .shelf {
  animation: shelf-reorder 0.55s ease-out;
}
.tool-bomb .shelf {
  animation: shelf-clear 0.4s ease-out;
}
@keyframes shelf-reorder {
  0% {
    box-shadow: 0 0 0 0 #b386ef80;
  }
  50% {
    box-shadow: 0 0 0 7px #b386ef40;
  }
  100% {
    box-shadow: none;
  }
}
@keyframes shelf-clear {
  50% {
    filter: brightness(1.3);
  }
}
@media (max-width: 360px) {
  .game-board .slotted-tray {
    gap: 3px;
    padding: 6px 4px;
  }
  .tray-cell {
    height: 54px;
    border-width: 1px;
  }
  .game-board .tray-cell .goods-art {
    transform: scale(0.65);
    margin: 0 -6px -7px;
  }
  .tray-heading small {
    font-size: 10px;
  }
  .tool-hint {
    font-size: 8px;
  }
  .game-board .original-tool {
    padding: 6px 1px;
  }
}

.undo-tool-symbol {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 10px;
  background: linear-gradient(#e2f3ff, #a9cff5);
  color: #346bae;
  font-size: 31px;
  font-style: normal;
  line-height: 1;
  box-shadow:
    inset 0 1px 2px #fff,
    0 2px 0 #87add3;
}
