/* Grocery Run */
.gr-wrap { width: 100%; height: 100%; max-width: 560px; margin: 0 auto; padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 7px; box-sizing: border-box; direction: ltr; }
.gr-wrap svg { display: block; width: 100%; height: 100%; }

/* the shopping list: a strip of notepaper */
.gr-list { flex: none; display: flex; justify-content: center; gap: 5px; padding: 6px 8px; border-radius: 6px 6px 12px 12px; background: var(--w-cream); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), inset 0 4px 0 var(--w-tomato); }
.gr-note { position: relative; flex: 0 1 44px; min-width: 0; aspect-ratio: 1; max-height: 44px; border-radius: 9px; background: #F3E3C3; box-shadow: inset 0 0 0 2px rgba(217, 160, 91, 0.55); transition: transform 0.25s, opacity 0.25s; }
.gr-note > svg { padding: 3px; box-sizing: border-box; }
.gr-tick { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.25s cubic-bezier(.3, 1.6, .5, 1); }
.gr-tick svg { width: 70%; height: 70%; padding: 3px; border-radius: 50%; background: #3F8F3A; box-sizing: border-box; }
.gr-note.is-got { transform: scale(0.92); }
.gr-note.is-got > svg { opacity: 0.35; }
.gr-note.is-got .gr-tick { opacity: 1; transform: none; }
.gr-list.is-done .gr-note { animation: gr-jump 0.5s ease-out; }
.gr-list.is-done .gr-note:nth-child(2) { animation-delay: 0.05s; }
.gr-list.is-done .gr-note:nth-child(3) { animation-delay: 0.1s; }
.gr-list.is-done .gr-note:nth-child(4) { animation-delay: 0.15s; }
.gr-list.is-done .gr-note:nth-child(5) { animation-delay: 0.2s; }
.gr-list.is-done .gr-note:nth-child(6) { animation-delay: 0.25s; }
.gr-list.is-done .gr-note:nth-child(7) { animation-delay: 0.3s; }

/* trip tag and timer bar */
.gr-time { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 26px; }
.gr-tag { flex: none; display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px 0 7px; border-radius: 999px; background: var(--w-crust); color: var(--w-pan); font: 400 15px/1 var(--font-display); }
.gr-tag svg { width: 18px; height: 18px; }
.gr-bar { flex: 1 1 auto; height: 14px; border-radius: 999px; background: var(--lapis-deep); box-shadow: inset 0 0 0 2px var(--hairline); overflow: hidden; }
.gr-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(180deg, var(--gold-soft), var(--w-butter)); transform-origin: left center; transition: transform 0.1s linear; }
.gr-bar.is-low i { background: linear-gradient(180deg, #FF8A78, var(--w-tomato)); }
.gr-bar.is-low { animation: gr-throb 0.5s ease-in-out infinite alternate; }
.gr-minus { position: absolute; right: 6px; top: -4px; color: var(--w-tomato); font: 400 18px/1 var(--font-display); opacity: 0; pointer-events: none; }
.gr-minus.is-on { animation: gr-float 0.8s ease-out; }

/* the shelves */
.gr-store { flex: 1 1 auto; min-height: 0; padding: 6px 6px 0; border-radius: 14px; background: linear-gradient(180deg, #3A4630, #2C3524); box-shadow: inset 0 0 0 3px #4A5A3A, 0 4px 0 rgba(0, 0, 0, 0.3); box-sizing: border-box; overflow: hidden; }
.gr-store.is-in .gr-row { animation: gr-slide 0.42s cubic-bezier(.2, .9, .3, 1.15) backwards; }
.gr-store.is-in .gr-row:nth-child(2) { animation-delay: 0.05s; }
.gr-store.is-in .gr-row:nth-child(3) { animation-delay: 0.1s; }
.gr-store.is-in .gr-row:nth-child(4) { animation-delay: 0.15s; }
.gr-store.is-in .gr-row:nth-child(5) { animation-delay: 0.2s; }
.gr-shelves { height: 100%; display: grid; grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr)); }
.gr-row { position: relative; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); align-items: end; padding: 0 2px 11px; }
.gr-row::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: 0; height: 11px; background: linear-gradient(180deg, #E4B26E 0 40%, var(--w-crust) 40% 75%, #9E642A 75%); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); }
.gr-item { position: relative; display: flex; align-items: flex-end; justify-content: center; min-width: 0; min-height: 40px; height: 100%; padding: 2px 1px 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.gr-item > span { display: block; width: 100%; max-width: 112px; aspect-ratio: 1; max-height: 100%; transform-origin: 50% 100%; transition: transform 0.12s; }
.gr-item:active > span { filter: brightness(1.15); }
.gr-item:focus-visible { outline: 3px solid var(--w-butter); outline-offset: -3px; border-radius: 10px; }
.gr-item.is-gone > span { visibility: hidden; }
.gr-item.is-no { animation: gr-no 0.4s ease-in-out; }
.gr-item.is-no::before { content: ""; position: absolute; left: 50%; bottom: 0; width: min(100%, 100px); aspect-ratio: 1; max-height: 100%; transform: translateX(-50%); border-radius: 50%; background: rgba(240, 82, 61, 0.35); animation: gr-fade 0.5s ease-out forwards; }
.gr-item.is-here::before { content: ""; position: absolute; left: 50%; bottom: 0; width: min(96%, 108px); aspect-ratio: 1; max-height: 100%; transform: translateX(-50%); border-radius: 50%; box-shadow: 0 0 0 4px var(--w-butter), 0 0 16px 4px rgba(255, 212, 92, 0.7); animation: gr-throb 0.45s ease-in-out infinite alternate; }

/* the basket */
.gr-foot { flex: none; display: flex; align-items: center; gap: 10px; height: 68px; }
.gr-basket { position: relative; flex: none; width: 96px; height: 68px; }
.gr-handle, .gr-basket__front { position: absolute; inset: 0; }
.gr-handle { z-index: 0; }
.gr-basket__front { z-index: 2; }
.gr-bin { position: absolute; z-index: 1; left: 10%; right: 10%; top: 0; height: 42%; }
.gr-in { position: absolute; bottom: -6px; width: 34px; height: 34px; animation: gr-land 0.3s ease-out; }
.gr-basket.is-bump { animation: gr-bump 0.3s ease-out; }
.gr-status { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--w-butter); font: 400 19px/1.15 var(--font-display); text-align: center; direction: auto; }
html[dir="rtl"] .gr-status { direction: rtl; }

/* an item hopping into the basket */
.gr-fly { position: fixed; z-index: 30; pointer-events: none; animation: gr-hopx 0.46s linear forwards; }
.gr-fly svg { display: block; width: 100%; height: 100%; animation: gr-hopy 0.46s cubic-bezier(.3, 0, .7, 1) forwards; }
@keyframes gr-hopx { to { transform: translateX(var(--dx)); } }
@keyframes gr-hopy { 40% { transform: translateY(var(--up)) scale(1.1) rotate(-10deg); } 100% { transform: translateY(var(--dy)) scale(0.6) rotate(25deg); } }

/* the receipt on the result panel */
.gr-receipt { margin: 2px auto 0; max-width: 280px; padding: 8px 12px 12px; background: var(--w-cream); color: var(--w-pan); border-radius: 4px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); -webkit-mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 50% 100% / 12px 100% repeat-x; mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 50% 100% / 12px 100% repeat-x; font-family: ui-monospace, "Courier New", monospace; }
.gr-receipt__head { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 6px; padding-bottom: 5px; border-bottom: 2px dashed rgba(23, 28, 18, 0.35); font: 400 15px/1 var(--font-display); }
.gr-receipt__head svg { width: 18px; height: 18px; }
.gr-receipt__grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 6px; direction: ltr; }
.gr-line { display: flex; align-items: center; gap: 1px; }
.gr-line svg { width: 26px; height: 26px; display: block; }
.gr-line b { font-size: 12px; }
.gr-receipt__total { display: flex; justify-content: space-between; margin: 6px 0 0; padding-top: 5px; border-top: 2px dashed rgba(23, 28, 18, 0.35); font-size: 14px; font-weight: 700; }

@keyframes gr-jump { 40% { transform: translateY(-7px) scale(1.05); } }
@keyframes gr-throb { to { opacity: 0.6; } }
@keyframes gr-float { 0% { opacity: 1; transform: translateY(6px); } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes gr-slide { from { transform: translateX(-30px); opacity: 0; } }
@keyframes gr-no { 20% { transform: translateX(-5px) rotate(-6deg); } 50% { transform: translateX(5px) rotate(6deg); } 80% { transform: translateX(-3px); } }
@keyframes gr-fade { to { opacity: 0; } }
@keyframes gr-land { from { transform: translateX(-50%) translateY(-20px); } }
@keyframes gr-bump { 40% { transform: scale(1.08, 0.92); } 70% { transform: scale(0.97, 1.04); } }
@media (max-height: 600px) {
  .gr-wrap { gap: 5px; padding-top: 4px; }
  .gr-note { max-height: 38px; flex-basis: 38px; }
  .gr-foot { height: 54px; }
  .gr-basket { width: 76px; height: 54px; }
  .gr-in { width: 28px; height: 28px; }
}
@media (max-height: 760px) {
  .gr-receipt { padding: 6px 10px 10px; }
  .gr-receipt__head { margin-bottom: 4px; padding-bottom: 3px; font-size: 13px; }
  .gr-receipt__grid { gap: 0 5px; }
  .gr-line svg { width: 20px; height: 20px; }
  .gr-line b { font-size: 11px; }
  .gr-receipt__total { margin-top: 4px; padding-top: 3px; font-size: 12px; }
}
@media (max-height: 620px) {
  .gr-receipt { padding: 4px 8px 9px; }
  .gr-receipt__head { font-size: 12px; }
  .gr-receipt__head svg { width: 14px; height: 14px; }
  .gr-line svg { width: 15px; height: 15px; }
  .gr-line b { font-size: 10px; }
  .gr-receipt__total { display: none; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .gr-wrap { max-width: 920px; display: grid; grid-template-columns: minmax(170px, 34%) 1fr; grid-template-rows: auto auto 1fr; gap: 6px 12px; }
  .gr-list { grid-column: 1; grid-row: 1; flex-wrap: wrap; }
  .gr-note { flex-basis: 36px; max-height: 36px; }
  .gr-time { grid-column: 1; grid-row: 2; }
  .gr-foot { grid-column: 1; grid-row: 3; align-self: end; }
  .gr-store { grid-column: 2; grid-row: 1 / 4; }
}
@media (prefers-reduced-motion: reduce) {
  .gr-store.is-in .gr-row, .gr-list.is-done .gr-note, .gr-bar.is-low, .gr-item.is-here::before { animation: none; }
}
