/* Taquería — taco stand rush. The scene and the pad keep their left-to-right order in Arabic too. */
.tq-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.tq-scene {
  --ink: #3B1230;
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  max-width: 540px;
  margin: 0 auto;
  padding: 0 8px;
  direction: ltr;
}

/* ---------------------------------------------------------------- the street side: awning, flags, lamp, queue */
.tq-street { position: relative; flex: 0 1 40%; min-height: 76px; max-height: 190px; }
.tq-glow {
  position: absolute;
  top: -30%; right: -8%;
  width: 72%; height: 280%;
  background: radial-gradient(closest-side, rgba(255, 200, 90, 0.3), rgba(255, 182, 39, 0) 72%);
  pointer-events: none;
}
.tq-awning {
  position: absolute;
  z-index: 3;
  top: 0; left: -8px; right: -8px;
  height: 12px;
  background:
    radial-gradient(circle at 10px 0, var(--w-pink) 0 9.5px, transparent 10px) 0 0 / 40px 12px repeat-x,
    radial-gradient(circle at 10px 0, var(--w-cream) 0 9.5px, transparent 10px) 20px 0 / 40px 12px repeat-x;
  filter: drop-shadow(0 2px 0 rgba(27, 8, 41, 0.5));
}
/* The three flags are the three lives: one comes down with every customer who leaves hungry. */
.tq-garland {
  position: absolute;
  z-index: 2;
  top: 12px; left: 35%; right: 17%;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 6px;
}
.tq-garland::before {
  content: "";
  position: absolute;
  top: -8px; left: -7%; right: -7%;
  height: 15px;
  border-bottom: 2px solid var(--w-cream);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  opacity: 0.75;
}
.tq-flag { position: relative; width: 25%; max-width: 46px; transform-origin: 50% 0; animation: tq-sway 3.4s ease-in-out infinite alternate; }
.tq-flag:nth-child(2) { margin-top: 4px; animation-delay: -1.2s; }
.tq-flag:nth-child(3) { animation-delay: -2.3s; }
.tq-flag svg { width: 100%; height: auto; filter: drop-shadow(0 2px 0 rgba(27, 8, 41, 0.45)); }
.tq-flag::after {
  content: "";
  position: absolute;
  top: 3%; right: 3%; bottom: 26%; left: 3%;
  border: 1.5px dashed rgba(255, 243, 224, 0.35);
  border-radius: 2px;
  opacity: 0;
}
.tq-flag.is-gone::after { opacity: 1; }
.tq-flag.is-gone svg { animation: tq-flag-fall 0.8s ease-in forwards; }
.tq-lamp { position: absolute; z-index: 2; top: 6px; right: 1%; width: 13%; max-width: 54px; }
.tq-lamp svg { width: 100%; height: auto; }

.tq-queue { position: absolute; top: 14px; right: 0; bottom: 0; left: 0; }
.tq-cust {
  position: absolute;
  bottom: 0; left: 1%;
  width: 30%; height: 100%;
  transition: left 0.42s var(--ease-out), width 0.42s var(--ease-out), height 0.42s var(--ease-out);
}
.tq-cust[data-slot="1"] { left: 36%; width: 20%; height: 64%; }
.tq-cust[data-slot="2"] { left: 58%; width: 20%; height: 64%; }
.tq-body { position: relative; display: flex; flex-direction: column; align-items: center; height: 100%; animation: tq-in 0.4s var(--ease-out) backwards; }
.tq-face { flex: 1 1 auto; width: 100%; min-height: 0; }
.tq-face .fm { display: none; }
.tq-cust[data-mood="happy"] .fm-happy,
.tq-cust[data-mood="ok"] .fm-ok,
.tq-cust[data-mood="worried"] .fm-worried,
.tq-cust[data-mood="joy"] .fm-joy { display: inline; }
.tq-pat {
  flex: none;
  width: 74%; height: 9px;
  margin: 3px 0 4px;
  border-radius: 99px;
  background: var(--lapis-deep);
  box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 3px rgba(255, 243, 224, 0.22);
  overflow: hidden;
}
.tq-pat i { display: block; height: 100%; background: var(--w-lime); transform-origin: 0 50%; }
.tq-cust[data-mood="ok"] .tq-pat i { background: var(--w-marigold); }
.tq-cust[data-mood="worried"] .tq-pat i { background: var(--w-red); }
.tq-cust[data-mood="worried"] .tq-face { animation: tq-fret 0.28s ease-in-out infinite alternate; }
.tq-cust[data-mood="joy"] .tq-pat { visibility: hidden; }
.tq-cust.is-served { z-index: 4; }
.tq-cust.is-served .tq-body { animation: tq-out-happy 0.9s var(--ease-out) forwards; }
.tq-cust.is-left .tq-body { animation: tq-out-sad 0.7s ease-in forwards; }

.tq-say {
  position: absolute;
  z-index: 6;
  top: 2%; left: 72%;
  padding: 3px 9px 4px;
  border-radius: 12px 12px 12px 3px;
  background: var(--w-cream);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(27, 8, 41, 0.4);
  animation: kit-pop 0.25s var(--ease-out);
  pointer-events: none;
}
.tq-say.is-sad { background: var(--w-red); color: var(--w-cream); }
.tq-tip {
  position: absolute;
  z-index: 7;
  top: 26%; left: 36%;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 2px 0 var(--ink), 0 0 14px rgba(255, 182, 39, 0.7);
  white-space: nowrap;
  animation: tq-tip 0.95s var(--ease-out) forwards;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the counter: ticket, combo, taco */
.tq-edge {
  position: relative;
  z-index: 1;
  flex: none;
  height: 7px;
  margin: 0 -8px;
  background: repeating-linear-gradient(90deg, var(--w-turquoise) 0 15px, var(--w-cream) 15px 17px, var(--w-pink) 17px 32px, var(--w-cream) 32px 34px);
  box-shadow: 0 3px 0 rgba(27, 8, 41, 0.5);
}
.tq-board {
  position: relative;
  flex: 1 1 60%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "ticket plate" "combo plate";
  gap: 9px 8px;
  margin: 0 -8px;
  padding: 13px 10px 2px;
  background: linear-gradient(180deg, rgba(64, 24, 91, 0.95), rgba(64, 24, 91, 0) 92%);
}
.tq-ticket {
  grid-area: ticket;
  position: relative;
  align-self: start;
  padding: 3px 6px 6px;
  border-radius: 5px 5px 0 0;
  background: var(--w-cream);
  color: var(--ink);
  transform: rotate(-1.5deg);
  transform-origin: 30% 0;
  filter: drop-shadow(0 3px 0 rgba(27, 8, 41, 0.45));
}
.tq-ticket::before {
  content: "";
  position: absolute;
  top: -7px; left: 18px;
  border: 7px solid transparent;
  border-top: 0;
  border-bottom-color: var(--w-cream);
}
.tq-ticket::after {
  content: "";
  position: absolute;
  top: 100%; left: 0; right: 0;
  height: 5px;
  background:
    linear-gradient(135deg, var(--w-cream) 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(225deg, var(--w-cream) 25%, transparent 25%) -4px 0 / 8px 8px;
}
.tq-ticket.is-new { animation: tq-ticket 0.26s var(--ease-out); }
.tq-ticket.is-empty { opacity: 0.4; }
.tq-no { display: block; font-family: var(--font-display); font-size: 0.6rem; line-height: 1.4; color: var(--w-purple); }
.tq-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; min-height: 24px; }
.tq-it { position: relative; border-radius: 7px; background: rgba(123, 63, 191, 0.13); }
.tq-it svg { width: 100%; height: auto; aspect-ratio: 1; transition: opacity 0.15s linear; }
.tq-it.is-done { background: rgba(126, 196, 30, 0.4); }
.tq-it.is-done svg { opacity: 0.28; }
.tq-it.is-done::after {
  content: "";
  position: absolute;
  top: 44%; left: 50%;
  width: 28%; height: 52%;
  border: solid #2C7A30;
  border-width: 0 3.5px 3.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
  animation: kit-pop 0.2s var(--ease-out);
}

.tq-combo {
  grid-area: combo;
  align-self: start;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--lapis-deep);
  box-shadow: inset 0 0 0 2px var(--gold);
  color: var(--parchment);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transform-origin: 0 50%;
  visibility: hidden;
}
.tq-combo.is-on { visibility: visible; }
.tq-combo b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; color: var(--gold); }
.tq-combo i { padding: 3px 6px; border-radius: 999px; background: var(--w-pink); color: #fff; font-family: var(--font-display); font-size: 0.78rem; font-style: normal; }
.tq-combo i:empty { display: none; }
.tq-combo.is-tick { animation: tq-tick 0.4s var(--ease-out); }

.tq-plate { grid-area: plate; position: relative; min-width: 0; min-height: 0; }
.tq-taco { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; }
.tq-layer { animation: tq-drop 0.22s var(--ease-out); }
.tq-layer.is-off { animation: tq-off 0.23s ease-in forwards; }
.tq-bad, .tq-shine { display: none; }
.tq-plate.is-wrong .tq-bad { display: inline; }
.tq-plate.is-ready .tq-shine { display: inline; animation: tq-twinkle 0.45s ease-in-out infinite alternate; }
.tq-fly { position: absolute; z-index: 8; pointer-events: none; transform-origin: 50% 100%; transition: transform 0.4s cubic-bezier(0.45, 0, 0.3, 1), opacity 0.14s linear 0.3s; }
.tq-fly .tq-dish, .tq-fly .tq-bad, .tq-fly .tq-shine { display: none; }
.tq-fly .tq-layer { animation: none; }

/* ---------------------------------------------------------------- the pad: nine fillings, start over, serve */
.tq-dock { flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 8px 8px; }
.tq-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; width: 100%; max-width: 540px; margin: 0 auto; direction: ltr; }
.tq-ing {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: clamp(56px, 8.4vh, 76px);
  padding: 3px 2px;
  border: 0;
  border-radius: 12px;
  background: var(--w-cream);
  box-shadow: inset 0 -4px 0 rgba(59, 18, 48, 0.2), inset 0 0 0 2px var(--w-marigold);
  color: #3B1230;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s linear, background-color 0.12s linear;
}
.tq-ing svg { flex: 1 1 auto; width: 100%; min-height: 0; }
.tq-es, .tq-tr { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tq-es { flex: none; font-size: 0.72rem; font-weight: 800; line-height: 1.15; }
.tq-tr { flex: none; font-size: 0.64rem; font-weight: 650; line-height: 1.25; color: #6A2FAE; }
html[lang="ar"] .tq-tr { font-size: 0.7rem; line-height: 1.3; }
.tq-ing:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(59, 18, 48, 0.2), inset 0 0 0 2px var(--w-marigold); }
.tq-ing.is-on { background: #E9D8BF; box-shadow: inset 0 2px 0 rgba(59, 18, 48, 0.22), inset 0 0 0 2px #7EC41E; transform: translateY(2px); }
.tq-ing.is-on::after {
  content: "";
  position: absolute;
  top: 5px; right: 9px;
  width: 7px; height: 13px;
  border: solid #2C7A30;
  border-width: 0 3.5px 3.5px 0;
  transform: rotate(45deg);
}
.tq-ing.is-bad { background: #FFD3CB; box-shadow: inset 0 0 0 3px var(--w-red); }
.tq-ing.is-bad::after {
  top: 5px; right: 7px;
  width: 14px; height: 14px;
  border: 0;
  background:
    linear-gradient(45deg, transparent 40%, var(--w-red) 40% 60%, transparent 60%),
    linear-gradient(-45deg, transparent 40%, var(--w-red) 40% 60%, transparent 60%);
  transform: none;
}
.tq-ing.is-hint { animation: tq-hint 0.9s ease-in-out infinite alternate; }
.tq-dock.is-off .tq-ing { filter: saturate(0.7) brightness(0.82); }

.tq-actions { display: flex; gap: 6px; width: 100%; max-width: 540px; margin: 0 auto; }
.tq-act {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 0 10px;
  border: 0;
  border-radius: 14px;
  background: var(--lapis-raise);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--parchment);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s linear, transform 0.08s linear;
}
.tq-act svg { flex: none; width: 20px; height: 20px; }
.tq-act:active { transform: scale(0.97); }
.tq-act[disabled] { opacity: 0.45; cursor: default; }
.tq-serve { flex-grow: 1.5; }
.tq-serve.is-ready { background: var(--gold); color: var(--lapis); box-shadow: 0 0 0 4px rgba(255, 182, 39, 0.3); }
.tq-over.is-hint { background: var(--w-pink); color: #fff; animation: tq-pulse 0.7s ease-in-out infinite alternate; }

@media (hover: hover) and (pointer: fine) {
  .tq-ing::before { content: attr(data-key); position: absolute; top: 4px; left: 8px; font-size: 10px; font-weight: 800; line-height: 1; color: rgba(59, 18, 48, 0.4); }
  .tq-ing:hover { background: #fff; }
  .tq-ing.is-on:hover { background: #E9D8BF; }
}

/* Tall screens: the ticket becomes a strip across the counter and the taco takes the full width. */
@media (min-height: 700px) {
  .tq-board { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ticket combo" "plate plate"; }
  .tq-ticket { justify-self: start; padding: 3px 7px 7px; }
  .tq-items { display: flex; gap: 4px; min-width: 96px; min-height: clamp(38px, 11.4vw, 46px); }
  .tq-it { flex: none; width: clamp(38px, 11.4vw, 46px); }
  .tq-combo { align-self: center; transform-origin: 100% 50%; }
}
/* A phone on its side: the stand on the left, the pad on the right. */
@media (orientation: landscape) and (max-height: 520px) {
  .fa-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 44%); grid-template-rows: auto minmax(0, 1fr); }
  .fa-bar { grid-column: 1 / -1; }
  .tq-dock { min-height: 0; padding-top: 0; }
  .tq-pad { flex: 1 1 auto; grid-auto-rows: minmax(0, 1fr); min-height: 0; }
  .tq-ing { height: auto; min-height: 56px; }
}
@media (max-width: 360px) {
  .fa-bar { gap: 4px; padding: 0 4px; }
  .fa-title { font-size: 0.9rem; }
  .tq-act { font-size: 0.88rem; }
  /* The result panel on the smallest phones: the title on one line, so the whole panel fits without scrolling. */
  .kit-result .fa-panel__title { font-size: 1.5rem; }
  .kit-result .fa-stats dd { font-size: 1.25rem; }
  .kit-result .fa-btn svg { flex: none; }
}
@media (max-height: 620px) {
  .tq-flag { width: 21%; }
}

/* The start panel can be taller than a small phone: keep Play in view while the rules scroll under it. */
.kit-start .fa-panel__actions {
  position: sticky;
  bottom: -8px;
  margin-top: -14px;
  padding-top: 14px;
  background: linear-gradient(180deg, transparent, var(--lapis) 14px);
}
@media (max-height: 720px) { .kit-start .kit-art { max-width: 150px; } }

@keyframes tq-sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes tq-flag-fall { to { transform: translate(-30%, 260%) rotate(-70deg); opacity: 0; } }
@keyframes tq-in { from { transform: translateX(60%); opacity: 0; } }
@keyframes tq-fret { from { transform: translateX(-2%); } to { transform: translateX(2%); } }
@keyframes tq-out-happy {
  0%, 38% { transform: none; opacity: 1; }
  55% { transform: translateY(-9%); opacity: 1; }
  100% { transform: translate(-75%, 0); opacity: 0; }
}
@keyframes tq-out-sad {
  0% { transform: none; }
  20% { transform: translateX(4%); }
  40% { transform: translateX(-4%); }
  100% { transform: translate(-70%, 6%); opacity: 0; }
}
@keyframes tq-tip {
  0% { transform: translate(-50%, 40%) scale(0.5); opacity: 0; }
  25% { transform: translate(-50%, 0) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, -90%) scale(1); opacity: 0; }
}
@keyframes tq-ticket { from { transform: translateY(-14px) rotate(-7deg); opacity: 0; } }
@keyframes tq-tick { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes tq-drop { from { transform: translateY(-22px); opacity: 0; } }
@keyframes tq-off { to { transform: translateY(26px); opacity: 0; } }
@keyframes tq-twinkle { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes tq-pulse { from { box-shadow: 0 0 0 0 rgba(255, 61, 139, 0.9); } to { box-shadow: 0 0 0 5px rgba(255, 61, 139, 0.4); } }
@keyframes tq-hint { from { box-shadow: inset 0 -4px 0 rgba(59, 18, 48, 0.2), inset 0 0 0 2px var(--w-marigold), 0 0 0 0 rgba(255, 61, 139, 0.9); } to { box-shadow: inset 0 -4px 0 rgba(59, 18, 48, 0.2), inset 0 0 0 2px var(--w-pink), 0 0 0 5px rgba(255, 61, 139, 0.55); } }
