:root {
  color-scheme: light;
  --ink: #071d35;
  --navy: #0b2c48;
  --teal: #087f83;
  --teal-dark: #07636b;
  --coral: #ff4c58;
  --coral-dark: #d92f43;
  --mustard: #f7bd38;
  --cream: #fff8df;
  --paper: #fffdf2;
  --wood: #dc872f;
  --good: #21ad69;
  --bad: #e33e4d;
  --outline: 3px solid var(--ink);
  --shadow: 0 5px 0 var(--ink);
}

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

html {
  min-width: 320px;
  background: #061a28;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 15%, #15556c 0, #082c3b 42%, #04131f 100%);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--ink);
}

button:disabled {
  cursor: not-allowed;
}

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

.game-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  overflow: visible;
  isolation: isolate;
  background-color: #f3c56e;
  background-image: url("../assets/ui/bg_counter.png");
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 38px rgb(0 0 0 / 48%);
}

.game-shell::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgb(255 250 224 / 6%), rgb(5 31 47 / 16%));
  content: "";
  pointer-events: none;
}

.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}

.is-hidden {
  display: none !important;
}

.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;
}

/* Title */
.title-screen {
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgb(255 255 255 / 8%), rgb(6 37 54 / 40%)),
    radial-gradient(circle at 50% 39%, rgb(255 249 211 / 4%) 0 45%, transparent 46%);
}

.title-card {
  position: relative;
  width: 100%;
  padding: 16px 16px 18px;
  overflow: hidden;
  border: var(--outline);
  border-radius: 30px;
  background:
    radial-gradient(circle at 15% 12%, rgb(255 255 255 / 85%) 0 4px, transparent 5px),
    linear-gradient(160deg, rgb(255 253 238 / 96%), rgb(255 235 171 / 96%));
  box-shadow: 0 9px 0 var(--ink), 0 18px 34px rgb(0 0 0 / 26%);
  text-align: center;
}

.title-card::before,
.title-card::after {
  position: absolute;
  width: 90px;
  height: 90px;
  border: 18px solid rgb(255 76 88 / 13%);
  border-radius: 50%;
  content: "";
}

.title-card::before {
  top: -54px;
  left: -34px;
}

.title-card::after {
  right: -40px;
  bottom: 82px;
}

.title-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  margin: -4px auto -24px;
  filter: drop-shadow(0 5px 0 rgb(255 255 255 / 72%));
}

.title-copy {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 2px 0 18px;
  padding: 7px 14px;
  transform: rotate(-1deg);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  box-shadow: 0 3px 0 var(--ink);
  font-size: clamp(15px, 4.2vw, 19px);
  letter-spacing: 0.03em;
}

.how-to-play {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 0;
  margin: 0 0 20px;
  list-style: none;
}

.how-to-play li {
  display: grid;
  grid-template-rows: 34px auto;
  place-items: center;
  min-width: 0;
  min-height: 78px;
  padding: 7px 3px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: rgb(255 255 255 / 74%);
  box-shadow: 0 3px 0 var(--ink);
  font-size: clamp(11px, 3.2vw, 14px);
  line-height: 1.25;
}

.how-to-play li span {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-size: 16px;
}

.primary-button {
  position: relative;
  z-index: 1;
  width: min(88%, 330px);
  min-height: 64px;
  padding: 10px 22px;
  border: var(--outline);
  border-radius: 18px;
  background: linear-gradient(180deg, #ff6870, var(--coral));
  box-shadow: var(--shadow), inset 0 3px 0 rgb(255 255 255 / 35%);
  color: white;
  font-size: clamp(22px, 6vw, 28px);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 var(--coral-dark);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary-button::after {
  margin-left: 7px;
  content: "▶";
  font-size: 0.7em;
}

.primary-button:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--ink), inset 0 3px 0 rgb(255 255 255 / 35%);
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

.title-note {
  position: relative;
  z-index: 1;
  margin: 13px 0 0;
  color: #65421e;
  font-size: 12px;
}

/* Game HUD */
.game-screen {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(196px, 1fr) auto auto;
  align-content: stretch;
  padding-top: max(7px, env(safe-area-inset-top));
}

.game-screen > * {
  min-width: 0;
}

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.1fr;
  min-height: 58px;
  margin: 0 8px 8px;
  border: var(--outline);
  border-radius: 15px;
  background: rgb(255 253 239 / 96%);
  box-shadow: var(--shadow);
}

.hud-stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 3px 7px;
  border-right: 2px dashed rgb(7 29 53 / 22%);
  line-height: 1;
}

.hud-stat:last-of-type {
  border-right: 0;
}

.hud-label {
  margin-bottom: 5px;
  color: #9a5b26;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.hud strong {
  font-size: clamp(17px, 5vw, 22px);
  font-variant-numeric: tabular-nums;
}

.hud-combo strong {
  color: var(--teal-dark);
  transition: transform 160ms ease, color 160ms ease;
}

.hud-combo strong.is-hot {
  color: var(--coral-dark);
  transform: scale(1.08) rotate(-2deg);
}

.hearts {
  overflow: hidden;
  color: var(--coral);
  font-size: clamp(17px, 5.4vw, 23px);
  letter-spacing: 1px;
  white-space: nowrap;
  -webkit-text-stroke: 1px var(--coral-dark);
}

.served-badge {
  position: absolute;
  right: 7px;
  bottom: -12px;
  min-width: 60px;
  padding: 3px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  box-shadow: 0 2px 0 var(--ink);
  font-size: 12px;
  text-align: center;
}

/* Customer */
.customer-stage {
  position: relative;
  min-height: 196px;
  margin: 0 8px 8px;
  overflow: hidden;
  border: var(--outline);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgb(255 250 220 / 36%), rgb(255 227 161 / 58%)),
    radial-gradient(circle at 38% 60%, rgb(255 255 255 / 70%), transparent 42%);
  box-shadow: var(--shadow);
}

.customer-stage::after {
  position: absolute;
  right: -10%;
  bottom: 0;
  left: -10%;
  height: 22%;
  border-top: 3px solid var(--ink);
  background: linear-gradient(180deg, #eda74e, #bd6728);
  content: "";
}

.customer-image {
  position: absolute;
  z-index: 2;
  bottom: 7%;
  left: -2%;
  width: min(58%, 230px);
  max-height: 91%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 3px 0 rgb(7 29 53 / 28%));
  transition: transform 280ms cubic-bezier(0.2, 0.9, 0.3, 1), opacity 200ms ease;
}

.customer-stage.is-entering .customer-image {
  opacity: 0;
  transform: translateX(-40px);
}

.order-balloon {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  display: grid;
  width: 43%;
  min-height: 132px;
  place-items: center;
  padding: 23px 8px 5px;
  border: var(--outline);
  border-radius: 48% 48% 45% 45% / 42% 42% 54% 54%;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
  transform: rotate(1.5deg);
}

.order-balloon::after {
  position: absolute;
  bottom: 4px;
  left: -12px;
  width: 28px;
  height: 28px;
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
  clip-path: polygon(100% 0, 8% 88%, 100% 66%);
  content: "";
}

.balloon-label {
  position: absolute;
  top: 6px;
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  color: var(--coral-dark);
  font-size: clamp(9px, 2.8vw, 12px);
  white-space: nowrap;
}

.order-balloon img {
  width: clamp(78px, 25vw, 108px);
  height: clamp(78px, 25vw, 108px);
  object-fit: contain;
}

.timer-wrap {
  position: absolute;
  z-index: 4;
  right: 9px;
  bottom: 8px;
  width: 43%;
  padding: 5px 7px 7px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgb(255 253 239 / 96%);
  box-shadow: 0 3px 0 var(--ink);
}

.timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  font-size: clamp(8px, 2.4vw, 10px);
}

.timer-head strong {
  color: var(--coral-dark);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.timer-track {
  height: 10px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #dfd8c8;
}

.timer-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left;
  background: linear-gradient(90deg, #39bc79, #a9d84b);
  transition: background-color 180ms ease;
}

.timer-fill.is-warning {
  background: var(--mustard);
}

.timer-fill.is-danger {
  background: var(--bad);
  animation: timer-pulse 380ms ease-in-out infinite alternate;
}

.feedback-badge {
  position: absolute;
  z-index: 8;
  top: 46%;
  left: 52%;
  padding: 8px 14px;
  border: var(--outline);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: white;
  font-size: clamp(20px, 6vw, 27px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.6) rotate(-7deg);
}

.feedback-badge.is-visible {
  opacity: 1;
  animation: badge-pop 620ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.feedback-badge.is-good {
  background: var(--good);
}

.feedback-badge.is-bad {
  background: var(--bad);
}

.score-popup {
  position: absolute;
  z-index: 7;
  top: 18%;
  left: 33%;
  color: #f8a900;
  font-size: 29px;
  opacity: 0;
  pointer-events: none;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
}

.score-popup.is-visible {
  animation: score-float 800ms ease-out both;
}

.customer-stage.is-success .customer-image {
  animation: customer-happy 500ms ease-in-out both;
}

.customer-stage.is-failure {
  animation: stage-shake 360ms ease-in-out both;
}

/* Board */
.board-zone {
  position: relative;
  z-index: 2;
  height: 112px;
  margin: 0 8px 8px;
  overflow: hidden;
  border: var(--outline);
  border-radius: 17px;
  background:
    repeating-linear-gradient(97deg, transparent 0 44px, rgb(116 63 22 / 10%) 45px 47px),
    linear-gradient(180deg, #f7c879, #d99344);
  box-shadow: var(--shadow), inset 0 3px 0 rgb(255 255 255 / 28%);
}

.board-heading {
  position: absolute;
  z-index: 3;
  top: 7px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  font-size: 10px;
}

.board-pin {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
}

.crafted-sushi {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.board-placeholder {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgb(76 45 22 / 62%);
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
}

.placeholder-icon {
  display: grid;
  width: 40px;
  height: 30px;
  place-items: center;
  border: 2px dashed rgb(76 45 22 / 50%);
  border-radius: 50%;
  color: transparent;
}

.crafted-image {
  width: 112px;
  height: 106px;
  object-fit: contain;
  filter: drop-shadow(0 5px 2px rgb(77 40 11 / 25%));
}

.crafted-sushi.pop-in .crafted-image,
.crafted-sushi.pop-in .unusual-sushi {
  animation: sushi-pop 340ms cubic-bezier(0.2, 1.35, 0.45, 1) both;
}

.unusual-sushi {
  position: relative;
  width: 108px;
  height: 102px;
  filter: drop-shadow(0 5px 2px rgb(77 40 11 / 25%));
}

.unusual-sushi img {
  position: absolute;
  left: 50%;
  width: 84px;
  height: 84px;
  object-fit: contain;
  transform: translateX(-50%);
}

.unusual-base {
  bottom: -2px;
}

.unusual-topping {
  top: -18px;
  z-index: 2;
  transform: translateX(-50%) rotate(-7deg) !important;
}

.unusual-sushi span {
  position: absolute;
  z-index: 3;
  top: 0;
  right: -3px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mustard);
  color: var(--ink);
  font-size: 14px;
}

/* Controls */
.control-panel {
  position: relative;
  z-index: 6;
  padding: 9px 8px max(10px, env(safe-area-inset-bottom));
  border-top: var(--outline);
  background:
    radial-gradient(circle at 7px 7px, rgb(7 29 53 / 6%) 0 1px, transparent 1.5px) 0 0 / 15px 15px,
    rgb(255 253 239 / 98%);
  box-shadow: 0 -5px 0 rgb(7 29 53 / 16%);
}

.selector-group + .selector-group {
  margin-top: 7px;
}

.selector-title {
  display: flex;
  height: 22px;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--navy);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.selector-title small {
  margin-left: auto;
  color: #8f7358;
  font-size: 9px;
}

.selector-number {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mustard);
  font-size: 11px;
}

.neta-selector {
  display: flex;
  gap: 7px;
  padding: 2px 2px 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 2px;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--teal) transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.neta-selector::-webkit-scrollbar {
  height: 4px;
}

.neta-selector::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--teal);
}

.neta-button {
  display: grid;
  width: 64px;
  min-width: 64px;
  height: 72px;
  grid-template-rows: 48px auto;
  place-items: center;
  flex: 0 0 64px;
  padding: 3px 3px 4px;
  scroll-snap-align: start;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: white;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 10px;
  transition: transform 120ms ease, background-color 120ms ease;
}

.neta-image-wrap {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 9px;
  background: #fff7df;
}

.neta-button img {
  width: 43px;
  height: 43px;
  object-fit: contain;
}

.neta-button.is-selected {
  background: var(--mustard);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--ink);
}

.neta-button.is-selected .neta-image-wrap {
  background: white;
}

.style-selector {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.style-button {
  display: flex;
  min-width: 0;
  height: 57px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 6px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: white;
  box-shadow: 0 3px 0 var(--ink);
  font-size: clamp(11px, 3.4vw, 14px);
  transition: transform 120ms ease, background-color 120ms ease;
}

.style-button img {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  object-fit: contain;
}

.style-button.is-selected {
  background: #72d8d1;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--ink);
}

.topping-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.topping-button {
  position: relative;
  display: grid;
  min-width: 0;
  height: 64px;
  grid-template-rows: 43px auto;
  place-items: center;
  padding: 2px 3px 4px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff9e8;
  box-shadow: 0 3px 0 var(--ink);
  font-size: clamp(8px, 2.6vw, 11px);
  line-height: 1;
  touch-action: none;
  user-select: none;
}

.topping-image-wrap {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.topping-button img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
}

.topping-button.is-locked {
  cursor: not-allowed;
  filter: grayscale(0.72);
  opacity: 0.72;
}

.topping-button small {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 1px 3px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 5px;
  font-weight: 900;
  line-height: 1.2;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 11px;
}

.action-button {
  display: flex;
  min-height: 60px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: var(--outline);
  border-radius: 15px;
  box-shadow: var(--shadow), inset 0 3px 0 rgb(255 255 255 / 28%);
  color: white;
  font-size: clamp(19px, 5.4vw, 24px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 rgb(0 0 0 / 25%);
  transition: transform 100ms ease, box-shadow 100ms ease, filter 100ms ease;
}

.button-kicker {
  margin-bottom: 3px;
  font-size: 8px;
  letter-spacing: 0.18em;
}

.make-button {
  background: linear-gradient(180deg, #12aaa2, var(--teal));
}

.serve-button {
  background: linear-gradient(180deg, #ff6670, var(--coral));
}

.action-button:not(:disabled):hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.action-button:not(:disabled):active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

.action-button:disabled {
  background: #a8aaa4;
  box-shadow: 0 2px 0 var(--ink);
  color: #e6e6df;
  filter: saturate(0.25);
  transform: translateY(3px);
}

/* Game over */
.modal-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgb(3 19 31 / 76%);
  backdrop-filter: blur(5px);
  animation: fade-in 220ms ease both;
}

.game-over-card {
  position: fixed;
  top: var(--game-over-center-y, 50vh);
  left: var(--game-over-center-x, 50vw);
  width: calc(100vw - 40px);
  max-width: 440px;
  padding: 44px 20px 22px;
  transform: translate(-50%, -50%);
  border: var(--outline);
  border-radius: 25px;
  background:
    radial-gradient(circle at 9px 9px, rgb(255 76 88 / 9%) 0 3px, transparent 3.5px) 0 0 / 22px 22px,
    var(--cream);
  box-shadow: 0 9px 0 var(--ink), 0 20px 45px rgb(0 0 0 / 38%);
  text-align: center;
  animation: modal-pop 360ms cubic-bezier(0.2, 1.3, 0.35, 1) both;
}

.game-over-stamp {
  position: absolute;
  top: -26px;
  left: 50%;
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  transform: translateX(-50%) rotate(-8deg);
  border: 4px double white;
  border-radius: 50%;
  outline: 3px solid var(--ink);
  background: var(--coral);
  box-shadow: 0 4px 0 var(--ink);
  color: white;
  font-size: 19px;
}

.game-over-card h2 {
  margin: 9px 0 3px;
  color: var(--navy);
  font-size: clamp(26px, 8vw, 34px);
}

.game-over-card > p {
  margin: 0 0 14px;
  color: #8a6648;
  font-size: 12px;
}

.final-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.final-stats div {
  display: flex;
  min-height: 84px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: white;
  box-shadow: 0 3px 0 var(--ink);
}

.final-stats > div > span {
  color: #9a6c43;
  font-size: 11px;
}

.final-stats strong {
  margin-top: 4px;
  color: var(--coral-dark);
  font-size: 25px;
}

#final-served {
  color: inherit;
  font-size: inherit;
}

.retry-button {
  min-height: 57px;
  font-size: 21px;
}

@keyframes timer-pulse {
  to { filter: brightness(1.25); }
}

@keyframes badge-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.45) rotate(-10deg); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(1.13) rotate(3deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
}

@keyframes score-float {
  0% { opacity: 0; transform: translateY(18px) scale(0.7); }
  25% { opacity: 1; transform: translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateY(-38px) scale(1); }
}

@keyframes customer-happy {
  0%, 100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-9px) rotate(-2deg); }
  70% { transform: translateY(-4px) rotate(2deg); }
}

@keyframes stage-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@keyframes sushi-pop {
  0% { opacity: 0; transform: translateY(-20px) scale(0.65) rotate(-8deg); }
  70% { opacity: 1; transform: translateY(2px) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 22px)) scale(0.88); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 374px) {
  .hud { margin-inline: 5px; }
  .customer-stage,
  .board-zone { margin-inline: 5px; }
  .control-panel { padding-inline: 6px; }
  .style-button { padding-inline: 2px; }
  .style-button img { width: 38px; height: 38px; flex-basis: 38px; }
}

@media (max-width: 480px) {
  .game-shell {
    box-shadow: none;
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  .topping-selector {
    gap: 5px;
  }

  .topping-button {
    height: 47px;
    grid-template-rows: 31px auto;
    padding: 1px 2px 2px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--ink);
    font-size: 8px;
  }

  .topping-image-wrap,
  .topping-button img {
    width: 30px;
    height: 30px;
  }
}

@media (max-height: 700px) {
  .game-screen {
    grid-template-rows: auto minmax(180px, 1fr) auto auto;
  }

  .customer-stage {
    min-height: 180px;
  }

  .board-zone {
    height: 98px;
  }

  .crafted-image,
  .unusual-sushi {
    height: 93px;
  }

  .neta-button {
    height: 66px;
    grid-template-rows: 43px auto;
  }

  .neta-image-wrap,
  .neta-button img {
    width: 41px;
    height: 41px;
  }

  .style-button {
    height: 52px;
  }

  .style-button img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .action-button {
    min-height: 55px;
  }
}

/* Short mobile viewports (iPhone SE landscape bars / compact Android browsers). */
@media (max-width: 480px) and (max-height: 700px) {
  .game-screen {
    grid-template-rows: auto minmax(142px, 1fr) auto auto;
    padding-top: max(4px, env(safe-area-inset-top));
  }

  .hud {
    min-height: 50px;
    margin-bottom: 5px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--ink);
  }

  .hud-stat {
    padding-block: 3px 5px;
  }

  .hud-label {
    margin-bottom: 3px;
    font-size: 8px;
  }

  .served-badge {
    bottom: -10px;
    padding-block: 2px;
  }

  .customer-stage {
    min-height: 142px;
    margin-bottom: 5px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--ink);
  }

  .customer-image {
    width: min(53%, 170px);
  }

  .order-balloon {
    top: 5px;
    right: 6px;
    width: 42%;
    min-height: 92px;
    padding: 19px 5px 3px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--ink);
  }

  .order-balloon img {
    width: 62px;
    height: 62px;
  }

  .balloon-label {
    top: 4px;
  }

  .timer-wrap {
    right: 6px;
    bottom: 5px;
    width: 44%;
    padding: 3px 5px 5px;
    box-shadow: 0 2px 0 var(--ink);
  }

  .timer-head {
    margin-bottom: 1px;
  }

  .timer-track {
    height: 8px;
  }

  .board-zone {
    height: 78px;
    margin-bottom: 5px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 28%);
  }

  .board-heading {
    top: 4px;
    left: 5px;
    padding-block: 2px;
    font-size: 8px;
  }

  .crafted-image {
    width: 84px;
    height: 74px;
  }

  .unusual-sushi {
    width: 82px;
    height: 72px;
  }

  .unusual-sushi img {
    width: 65px;
    height: 65px;
  }

  .unusual-topping {
    top: -2px;
  }

  .board-placeholder {
    font-size: 10px;
  }

  .placeholder-icon {
    width: 34px;
    height: 25px;
  }

  .control-panel {
    padding-top: 6px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
    border-top-width: 2px;
  }

  .selector-group + .selector-group {
    margin-top: 4px;
  }

  .selector-title {
    height: 18px;
    margin-bottom: 3px;
    font-size: 11px;
  }

  .selector-number {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  .neta-selector {
    gap: 5px;
    padding: 1px 1px 5px;
  }

  .neta-button {
    width: 58px;
    min-width: 58px;
    height: 54px;
    grid-template-rows: 35px auto;
    flex-basis: 58px;
    padding: 2px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--ink);
    font-size: 9px;
  }

  .neta-image-wrap,
  .neta-button img {
    width: 34px;
    height: 34px;
  }

  .style-selector {
    gap: 5px;
  }

  .style-button {
    height: 45px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--ink);
    font-size: 11px;
  }

  .style-button img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .action-row {
    gap: 7px;
    margin-top: 7px;
  }

  .action-button {
    min-height: 52px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 28%);
    font-size: 19px;
  }

  .button-kicker {
    margin-bottom: 1px;
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Multi-customer swipe workflow */
.game-screen {
  grid-template-rows: auto minmax(185px, 205px) 102px minmax(0, 1fr);
}

.multi-customer-stage {
  min-height: 185px;
  padding: 24px 5px 6px;
}

.multi-customer-stage::after {
  display: none;
}

.serve-hint {
  position: absolute;
  z-index: 6;
  top: 3px;
  left: 50%;
  width: max-content;
  padding: 2px 9px;
  transform: translateX(-50%);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  box-shadow: 0 2px 0 var(--ink);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.customer-lane {
  display: grid;
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.customer-card {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 13px;
  outline: 0 solid transparent;
  background:
    radial-gradient(circle at 50% 32%, rgb(255 255 255 / 82%), transparent 50%),
    linear-gradient(180deg, #fff9df, #f4c66f);
  box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgb(255 255 255 / 55%);
  transition: transform 130ms ease, outline-width 130ms ease, filter 130ms ease;
}

.customer-card:focus-visible {
  outline: 3px solid white;
  outline-offset: -5px;
}

.customer-card.is-entering {
  animation: customer-card-enter 260ms cubic-bezier(0.2, 1.25, 0.35, 1) both;
}

.customer-card.is-drop-target {
  z-index: 5;
  outline: 4px solid var(--coral);
  outline-offset: -4px;
  filter: brightness(1.08);
  transform: translateY(-4px) scale(1.025);
}

.customer-card.is-drop-target::after {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(255 255 255 / 23%);
  color: var(--coral-dark);
  content: "ここ！";
  font-size: 16px;
  text-shadow: 0 2px 0 white;
}

.customer-card.is-waiting.is-time-critical::before {
  position: absolute;
  z-index: 4;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 11px 4px rgb(255 63 71 / 48%),
    inset 0 0 26px 8px rgb(255 72 78 / 22%);
  content: "";
  pointer-events: none;
  animation: customer-critical-glow 880ms ease-in-out infinite;
}

.customer-card.is-success .customer-avatar {
  animation: customer-happy 500ms ease-in-out both;
}

.customer-card.is-failure,
.customer-card.is-rejected {
  animation: stage-shake 320ms ease-in-out both;
}

.customer-number {
  position: absolute;
  z-index: 5;
  top: 4px;
  left: 4px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-size: 10px;
}

.customer-order-count {
  position: absolute;
  z-index: 9;
  top: 29px;
  left: 3px;
  display: grid;
  width: 43px;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding: 2px 3px 3px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--mustard);
  box-shadow: 0 2px 0 var(--ink);
  line-height: 1;
  pointer-events: none;
}

.customer-order-count span {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  font-size: 6px;
  letter-spacing: 0.08em;
}

.customer-order-count strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.customer-order-count small {
  padding-bottom: 1px;
  font-size: 6px;
}

.customer-card.is-pending .customer-order-count {
  display: none;
}

.customer-card.is-next-order .customer-order,
.customer-card.is-next-order .customer-order-count {
  animation: next-order-pop 320ms cubic-bezier(0.2, 1.35, 0.4, 1) both;
}

.customer-avatar {
  position: absolute;
  z-index: 2;
  bottom: 13px;
  left: -9%;
  width: 76%;
  height: 79%;
  object-fit: contain;
  object-position: bottom left;
  filter: drop-shadow(0 2px 0 rgb(7 29 53 / 22%));
  pointer-events: none;
}

.customer-order {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 2px;
  display: grid;
  width: 57%;
  aspect-ratio: 1;
  place-items: center;
  padding: 13px 2px 1px;
  border: 2px solid var(--ink);
  border-radius: 45% 48% 44% 48%;
  background: white;
  box-shadow: 0 2px 0 var(--ink);
  transform: rotate(2deg);
  pointer-events: none;
}

.customer-order > span {
  position: absolute;
  top: 2px;
  color: var(--coral-dark);
  font-size: clamp(7px, 2vw, 9px);
}

.customer-order-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.customer-order .customer-wasabi-badge {
  position: absolute;
  z-index: 6;
  top: auto;
  right: -4px;
  bottom: -6px;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 1px 4px 1px 2px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #efffcf;
  box-shadow: 0 2px 0 var(--ink);
  color: var(--teal-dark);
  font-size: 10px;
  line-height: 1;
}

.customer-wasabi-badge img {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.customer-wasabi-badge b {
  font-size: 11px;
}

.customer-mini-timer {
  position: absolute;
  z-index: 8;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 10px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #d8d2c5;
}

.customer-mini-timer strong {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  color: var(--ink);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.customer-timer-fill {
  position: absolute;
  inset: 0;
  transform: scaleX(1);
  transform-origin: left;
  background: linear-gradient(90deg, #36ba78, #a7d94d);
}

.customer-timer-fill.is-warning {
  background: var(--mustard);
}

.customer-timer-fill.is-danger {
  background: var(--bad);
  animation: timer-pulse 380ms ease-in-out infinite alternate;
}

.customer-feedback {
  position: absolute;
  z-index: 10;
  top: 48%;
  left: 50%;
  display: none;
  width: 92%;
  padding: 7px 3px;
  transform: translate(-50%, -50%) rotate(-4deg);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  color: white;
  font-size: clamp(11px, 3.2vw, 15px);
  line-height: 1.15;
  text-align: center;
  white-space: pre-line;
}

.customer-feedback.is-visible {
  display: block;
  animation: badge-pop 500ms cubic-bezier(0.2, 1.35, 0.4, 1) both;
}

.customer-feedback.is-good {
  background: var(--good);
}

.customer-feedback.is-bad {
  background: var(--bad);
}

.customer-card.is-pending {
  border-style: dashed;
  background: rgb(255 250 226 / 58%);
  box-shadow: none;
}

.customer-card.is-pending .customer-avatar,
.customer-card.is-pending .customer-order,
.customer-card.is-pending .customer-mini-timer {
  opacity: 0.16;
  filter: grayscale(1);
}

.customer-feedback.is-pending {
  display: block;
  border-style: dashed;
  background: rgb(255 253 239 / 92%);
  box-shadow: none;
  color: #8a6b4f;
  font-size: 10px;
  animation: timer-pulse 900ms ease-in-out infinite alternate;
}

.board-zone {
  height: 102px;
}

.board-heading {
  gap: 4px;
}

.board-heading strong {
  margin-left: 2px;
  color: var(--coral-dark);
  font-size: 9px;
}

.inventory-tray {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  padding: 29px 5px 5px;
}

.inventory-tray .board-placeholder {
  position: absolute;
  inset: 25px 0 0;
  justify-content: center;
}

.swipe-demo {
  display: inline-block;
  color: var(--coral-dark);
  font-size: 27px;
  animation: swipe-demo 900ms ease-in-out infinite alternate;
}

.inventory-item {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  height: 66px;
  max-height: 66px;
  place-items: center;
  padding: 1px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: rgb(255 253 239 / 90%);
  box-shadow: 0 3px 0 var(--ink);
  touch-action: none;
  user-select: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.inventory-item.pop-in {
  animation: inventory-pop 300ms cubic-bezier(0.2, 1.35, 0.4, 1) both;
}

.inventory-item.is-dragging {
  opacity: 0.3;
  transform: scale(0.9);
}

.inventory-item.is-leaving {
  opacity: 0;
  transform: translateY(-25px) scale(0.7);
}

.inventory-item.is-keyboard-picked,
.neta-button.is-keyboard-picked,
.style-button.wasabi-button.is-keyboard-picked,
.topping-button.is-keyboard-picked {
  outline: 4px solid var(--coral);
  outline-offset: -3px;
}

.inventory-item.is-base {
  border-style: dashed;
  background: #e7fbf6;
  box-shadow: 0 3px 0 var(--teal-dark);
}

.inventory-item.is-base.has-wasabi {
  border-style: solid;
  background: #efffcf;
}

.inventory-item.is-partial {
  border-style: dashed;
  border-color: var(--coral-dark);
  background: #fff4d9;
  box-shadow: 0 3px 0 var(--coral-dark);
}

.inventory-item.is-base.is-drop-target,
.inventory-item.can-add-topping.is-drop-target,
.inventory-item.can-add-garnish.is-drop-target,
.inventory-item.can-add-wasabi.is-drop-target {
  z-index: 4;
  border-style: solid;
  outline: 4px solid var(--coral);
  outline-offset: -4px;
  background: var(--mustard);
  transform: translateY(-4px) scale(1.06);
}

.inventory-base-image {
  width: 88%;
  height: 88%;
  object-fit: contain;
  pointer-events: none;
}

.inventory-item.is-base small {
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 1px 3px;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font-size: 6px;
  pointer-events: none;
}

.add-topping-badge,
.garnish-badge {
  position: absolute;
  z-index: 5;
  right: 2px;
  bottom: 1px;
  padding: 1px 3px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 6px;
  line-height: 1.2;
  pointer-events: none;
}

.garnish-badge {
  background: #dff6b8;
  font-size: 5px;
}

.wasabi-added-badge,
.base-wasabi-badge {
  position: absolute;
  z-index: 5;
  left: 1px;
  bottom: 1px;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 1px 3px 1px 1px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #efffcf;
  color: var(--teal-dark);
  font-size: 5px;
  line-height: 1.1;
  pointer-events: none;
}

.wasabi-added-badge img,
.base-wasabi-badge img {
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.inventory-tray.is-drop-target {
  border-radius: 13px;
  background: rgb(247 189 56 / 34%);
  box-shadow: inset 0 0 0 4px var(--coral);
}

.inventory-sushi-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.inventory-item .inventory-sushi-image {
  position: absolute;
  inset: 4px 4px 7px;
  width: calc(100% - 8px);
  height: calc(100% - 11px);
  max-width: none;
  object-position: center;
}

.inventory-unusual {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.inventory-unusual img {
  position: absolute;
  left: 50%;
  width: 86%;
  height: 86%;
  object-fit: contain;
  transform: translateX(-50%);
}

.inventory-unusual-base {
  bottom: -8%;
}

.inventory-unusual-topping {
  top: -15%;
  z-index: 2;
  transform: translateX(-50%) rotate(-7deg) !important;
}

.inventory-unusual b {
  position: absolute;
  z-index: 3;
  top: 1px;
  right: 1px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--mustard);
  font-size: 9px;
}

.board-zone.is-full {
  animation: board-full 430ms ease-in-out both;
}

.neta-button {
  touch-action: pan-x;
  user-select: none;
}

.wasabi-button,
.wasabi-button .neta-image-wrap {
  background: #efffcf;
}

.wasabi-button.is-locked {
  background: #e1ded3;
  color: #7e776d;
  filter: grayscale(0.8);
  opacity: 0.72;
}

.wasabi-button.is-locked small {
  color: #6f675f;
  font-weight: 900;
}

.style-selector .wasabi-button img {
  padding: 2px;
}

.drag-source,
.drag-source img {
  -webkit-user-drag: none;
}

.neta-button img,
.style-button img {
  pointer-events: none;
  user-select: none;
}

.neta-button.is-dragging {
  opacity: 0.35;
}

.style-button {
  position: relative;
  border-style: solid;
  background: white;
  touch-action: none;
  user-select: none;
}

.style-button small {
  position: absolute;
  right: 4px;
  bottom: 2px;
  color: var(--teal-dark);
  font-size: 6px;
  letter-spacing: 0.1em;
}

.style-button.is-dragging {
  opacity: 0.35;
  transform: scale(0.94);
}

.gesture-tip {
  margin: 9px 0 0;
  color: #705338;
  font-size: 10px;
  text-align: center;
}

.gesture-tip span {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 5px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 8px;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  padding: 3px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: rgb(255 253 239 / 94%);
  box-shadow: 0 8px 0 rgb(7 29 53 / 70%), 0 14px 25px rgb(0 0 0 / 28%);
  pointer-events: none;
  will-change: transform;
}

.drag-ghost > img,
.drag-ghost .inventory-sushi-image {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.drag-ghost .inventory-unusual {
  width: 66px;
  height: 66px;
}

.is-gesture-dragging,
.is-gesture-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.game-screen.is-locked .customer-card,
.game-screen.is-locked .inventory-tray {
  pointer-events: none;
}

@keyframes customer-card-enter {
  from { opacity: 0; transform: translateY(-18px) scale(0.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes customer-critical-glow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes next-order-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.72) rotate(-4deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes inventory-pop {
  from { opacity: 0; transform: translateY(18px) scale(0.55) rotate(-8deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes swipe-demo {
  from { transform: translateY(4px) rotate(-6deg); }
  to { transform: translateY(-3px) rotate(5deg); }
}

@keyframes board-full {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); filter: saturate(1.4); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (max-width: 480px) and (max-height: 700px) {
  .game-screen {
    grid-template-rows: auto minmax(140px, 160px) 76px minmax(0, 1fr);
  }

  .multi-customer-stage {
    min-height: 140px;
    padding: 19px 4px 4px;
  }

  .serve-hint {
    top: 1px;
    padding-block: 1px;
    font-size: 8px;
  }

  .customer-lane {
    gap: 3px;
  }

  .customer-number {
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    font-size: 8px;
  }

  .customer-order-count {
    top: 23px;
    left: 2px;
    width: 38px;
    padding: 1px 2px 2px;
  }

  .customer-order-count strong {
    font-size: 11px;
  }

  .customer-avatar {
    bottom: 10px;
    width: 72%;
    height: 77%;
  }

  .customer-order {
    top: 3px;
    width: 54%;
    padding-top: 11px;
  }

  .customer-mini-timer {
    right: 2px;
    bottom: 2px;
    left: 2px;
    height: 9px;
  }

  .board-zone {
    height: 76px;
  }

  .inventory-tray {
    gap: 3px;
    padding: 23px 3px 3px;
  }

  .inventory-tray .board-placeholder {
    inset-block-start: 19px;
  }

  .inventory-item {
    min-height: 45px;
    height: 48px;
    border-radius: 8px;
    box-shadow: 0 2px 0 var(--ink);
  }

  .swipe-demo {
    font-size: 21px;
  }

  .gesture-tip {
    margin-top: 6px;
    font-size: 9px;
  }
}

@media (max-width: 359px) {
  .customer-lane {
    gap: 2px;
  }

  .customer-card {
    border-radius: 10px;
  }

  .customer-order {
    right: 1px;
    width: 52%;
  }

  .customer-avatar {
    left: -12%;
    width: 78%;
  }

  .customer-feedback {
    font-size: 10px;
  }
}

/* Keep active gameplay inside the visible mobile viewport. */
@media (max-width: 480px) {
  body.is-game-active {
    width: 100%;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.is-game-active .game-shell {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.is-game-active .game-screen {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    grid-template-rows: auto minmax(0, 1fr) clamp(112px, 16svh, 120px) auto;
    overflow: hidden;
  }

  body.is-game-active .multi-customer-stage {
    height: auto;
    min-height: 0;
  }

  body.is-game-active .board-zone {
    height: auto;
    min-height: 0;
  }

  body.is-game-active .inventory-tray {
    padding-bottom: 8px;
  }

  .style-selector .style-button {
    padding-inline: 3px;
    font-size: clamp(9px, 2.7vw, 12px);
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  body.is-game-active .game-screen {
    grid-template-rows: auto minmax(110px, 1fr) 94px auto;
  }

  body.is-game-active .multi-customer-stage {
    min-height: 110px;
  }

  body.is-game-active .inventory-item {
    height: 52px;
  }

  .gesture-tip {
    display: none;
  }
}

@media (max-width: 374px) {
  .style-selector .style-button img {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
}

.studio-credit {
  position: fixed;
  z-index: 20;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
}

.studio-credit a {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 7px 11px 7px 8px;
  border: 1px solid rgb(255 255 255 / 26%);
  border-radius: 999px;
  background: rgb(4 25 39 / 76%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: background-color 160ms ease, transform 160ms ease;
}

.studio-credit a:hover,
.studio-credit a:focus-visible {
  background: rgb(4 25 39 / 92%);
  transform: translateY(-2px);
}

.studio-credit img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

body.is-game-active .studio-credit {
  display: none;
}

@media (max-width: 720px) {
  .studio-credit {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .studio-credit a {
    width: 34px;
    height: 34px;
    padding: 5px;
  }

  .studio-credit img {
    width: 24px;
    height: 24px;
  }

  .studio-credit span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
