/* Englishbuds Shopping Mission */
:root {
  --shop-ink: #24334a;
  --shop-muted: #69758a;
  --shop-cream: #fff7e8;
  --shop-yellow: #ffc83d;
  --shop-orange: #ff8a42;
  --shop-green: #64ad3b;
  --shop-blue: #5ab7e8;
  --shop-red: #e84f5b;
  --shop-shadow: 0 12px 30px rgba(53, 66, 91, 0.12);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--shop-ink);
  background:
    radial-gradient(circle at 7% 11%, rgba(255, 200, 61, .22) 0 70px, transparent 72px),
    radial-gradient(circle at 96% 88%, rgba(90, 183, 232, .18) 0 120px, transparent 122px),
    var(--shop-cream);
}

button { color: inherit; }

.shopping-app {
  width: min(1540px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: 14px clamp(14px, 2vw, 30px) 18px;
  display: flex;
  flex-direction: column;
}

.game-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px 12px;
}

.brand-block { display: flex; align-items: center; min-width: 0; }
.game-logo { width: clamp(132px, 13vw, 190px); display: block; }
.title-divider { width: 2px; height: 34px; margin: 0 16px; background: #dfe5d3; }
.eyebrow, .panel-kicker { margin: 0; color: var(--shop-orange); font-size: .69rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.brand-block h1 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.8rem); line-height: 1.1; white-space: nowrap; }

.new-mission-button {
  min-height: 44px;
  padding: 9px 18px;
  border: 2px solid #ffcf70;
  border-radius: 15px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #f1d18e;
  transition: transform .15s ease, box-shadow .15s ease;
}
.new-mission-button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #f1d18e; }
.new-mission-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #f1d18e; }

.setup-screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(4px, 2vh, 18px) 4px 20px;
}

.setup-card {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px);
}

.setup-heading { text-align: center; }
.setup-heading h2 { margin: 4px 0 5px; font-size: clamp(1.55rem, 3.2vw, 2.3rem); line-height: 1.15; }
.setup-heading > p:last-child { margin: 0; color: var(--shop-muted); font-family: Arial, sans-serif; }

.mission-picker { margin: 24px 0 0; padding: 0; border: 0; }
.mission-picker legend, .budget-picker h3 { margin: 0 0 10px; color: var(--shop-ink); font-size: .82rem; font-weight: 900; letter-spacing: .09em; text-align: center; text-transform: uppercase; }
.mission-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mission-option {
  min-height: 104px;
  padding: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 2px solid #e8ece2;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(47, 59, 78, .06);
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.mission-option span { font-size: 2.25rem; line-height: 1; }
.mission-option strong { font-size: .91rem; letter-spacing: .04em; text-transform: uppercase; }
.mission-option:hover { transform: translateY(-2px); border-color: #ffc95b; }
.mission-option.selected { border-color: var(--shop-orange); background: #fff4df; box-shadow: 0 0 0 3px rgba(255, 138, 66, .14); }

.budget-picker { margin: 22px auto 0; text-align: center; }
.budget-stepper { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 4vw, 34px); }
.budget-stepper button { width: 54px; height: 54px; border: 0; border-radius: 17px; background: #edf2f6; color: #526477; font-size: 1.8rem; font-weight: 900; cursor: pointer; }
.budget-stepper button:hover:not(:disabled) { background: #dfeaf2; transform: translateY(-1px); }
.budget-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.budget-stepper output { min-width: 118px; color: #bd641f; font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 900; }
.budget-picker > p { margin: 5px 0 0; color: var(--shop-muted); font-family: Arial, sans-serif; font-size: .78rem; }

.setup-actions { margin-top: 22px; display: grid; justify-items: center; }
.start-shopping-button { width: min(360px, 100%); min-height: 58px; border: 0; border-radius: 18px; background: linear-gradient(135deg, #76bb43, #55a72f); color: #fff; font-size: 1.05rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; box-shadow: 0 6px 0 #3f8025; }
.start-shopping-button:disabled { opacity: .42; cursor: not-allowed; box-shadow: 0 4px 0 #91a388; }
.start-shopping-button:not(:disabled):hover { transform: translateY(-2px); }
.start-shopping-button:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 #3f8025; }
.new-prices-button { margin-top: 16px; min-height: 38px; padding: 7px 15px; border: 1px solid #dce3ea; border-radius: 12px; background: #fff; color: #627083; font-size: .75rem; font-weight: 900; cursor: pointer; }
.new-prices-button:hover { border-color: var(--shop-blue); color: #287fae; }
.price-status { min-height: 18px; margin: 5px 0 0; color: var(--shop-muted); font-family: Arial, sans-serif; font-size: .73rem; }

.game-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(215px, .82fr) minmax(500px, 2.25fr) minmax(270px, 1fr);
  gap: clamp(12px, 1.3vw, 20px);
}

.panel {
  min-height: 0;
  border: 1px solid rgba(82, 101, 71, .14);
  border-radius: 25px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shop-shadow);
}

.mission-panel, .cart-panel { padding: clamp(16px, 1.5vw, 24px); }
.mission-panel { align-self: start; display: flex; flex-direction: column; }
.mission-heading, .cart-heading, .shop-heading { display: flex; align-items: center; gap: 12px; }
.mission-icon { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 18px; background: #fff1b7; font-size: 2rem; }
.mission-heading h2, .cart-heading h2, .shop-heading h2 { margin: 2px 0 0; font-size: clamp(1.25rem, 1.8vw, 1.65rem); line-height: 1.1; }
.mission-description { margin: 18px 0 13px; color: var(--shop-muted); font-weight: 700; line-height: 1.35; }
.mission-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.mission-list li { display: flex; align-items: center; gap: 9px; font-size: .91rem; font-weight: 800; line-height: 1.25; }
.mission-check { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid #cbd4df; border-radius: 8px; background: #fff; color: #fff; font-size: .85rem; }
.mission-list li.complete { color: #397d27; }
.mission-list li.complete .mission-check { border-color: var(--shop-green); background: var(--shop-green); }
.bonus-wish { margin: 13px 0 0; color: #90641e; font-size: .86rem; font-weight: 900; }

.budget-card {
  margin: 18px 0 0;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid #ffd467;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff9d5, #fff0ad);
}
.budget-card span { font-size: .8rem; font-weight: 900; letter-spacing: .04em; }
.budget-card strong { color: #bd641f; font-size: clamp(1.45rem, 2.3vw, 2rem); }

.shop-panel { display: flex; flex-direction: column; padding: clamp(14px, 1.4vw, 22px); overflow: hidden; }
.shop-heading { justify-content: space-between; padding: 1px 2px 13px; }
.product-count { padding: 5px 10px; border-radius: 999px; background: #edf7e8; color: #4e7d38; font-size: .73rem; font-weight: 900; }
.filter-bar { display: flex; gap: 7px; padding: 0 2px 13px; overflow-x: auto; scrollbar-width: thin; }
.filter-button { min-height: 36px; padding: 7px 13px; flex: 0 0 auto; border: 1px solid #dfe5eb; border-radius: 12px; background: #fff; color: #667286; font-size: .75rem; font-weight: 900; text-transform: uppercase; cursor: pointer; }
.filter-button:hover { border-color: var(--shop-blue); color: #277ca8; }
.filter-button.active { border-color: #55aee0; background: #55aee0; color: #fff; }
.filter-button:focus-visible, button:focus-visible { outline: 3px solid rgba(44, 147, 204, .35); outline-offset: 2px; }

.shop-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 3px 5px 8px 2px; scrollbar-color: #c9d9b8 transparent; scrollbar-width: thin; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 11px; }
.product-card {
  position: relative;
  min-height: 146px;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #eef0e8;
  border-radius: 19px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(47, 59, 78, .06);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.product-card:hover { transform: translateY(-3px); border-color: #ffcb58; box-shadow: 0 8px 16px rgba(72, 80, 45, .12); }
.product-card:active { transform: scale(.97); }
.product-card.in-cart::after { content: attr(data-cart-quantity); position: absolute; top: 7px; right: 7px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--shop-green); color: #fff; font-size: .72rem; font-weight: 900; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.product-emoji { display: block; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 2.65rem; line-height: 1.1; filter: drop-shadow(0 3px 2px rgba(0,0,0,.08)); }
.product-name { margin-top: 8px; font-size: .79rem; font-weight: 900; line-height: 1.12; text-align: center; text-transform: uppercase; }
.product-price { margin-top: 5px; color: #ca5c2b; font-size: 1rem; font-weight: 900; }
.product-card.card-bounce { animation: card-bounce .35s ease; }
@keyframes card-bounce { 40% { transform: translateY(-8px) scale(1.04); } }

.cart-panel { display: flex; flex-direction: column; }
.cart-heading { position: relative; padding-bottom: 14px; border-bottom: 1px solid #e7ebef; }
.cart-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: #edf8e9; font-size: 1.75rem; }
.cart-heading .panel-kicker { color: var(--shop-green); }
.cart-badge { margin-left: auto; min-width: 31px; height: 31px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; background: var(--shop-red); color: #fff; font-size: .78rem; font-weight: 900; }
.cart-panel.cart-bounce { animation: cart-bounce .4s ease; }
@keyframes cart-bounce { 45% { transform: scale(1.018); } }
.cart-items { min-height: 100px; flex: 1; overflow-y: auto; padding: 10px 3px 8px 0; scrollbar-width: thin; }
.empty-cart { height: 100%; min-height: 150px; display: grid; align-content: center; justify-items: center; text-align: center; color: #99a2ae; }
.empty-cart span { font-size: 2.4rem; opacity: .65; }
.empty-cart p { margin: 5px 0 0; font-weight: 900; }
.empty-cart small { font-family: Arial, sans-serif; }
.cart-item { padding: 10px 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; align-items: center; border-bottom: 1px dashed #e2e7eb; }
.cart-item-emoji { font-size: 1.65rem; text-align: center; }
.cart-item-info { min-width: 0; }
.cart-item-name { overflow: hidden; font-size: .8rem; font-weight: 900; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-subtotal { color: #ca5c2b; font-size: .77rem; font-weight: 900; }
.quantity-controls { display: flex; align-items: center; gap: 4px; }
.quantity-button, .remove-button { border: 0; cursor: pointer; }
.quantity-button { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: #edf2f6; font-weight: 900; }
.quantity-number { min-width: 18px; text-align: center; font-size: .8rem; font-weight: 900; }
.remove-button { grid-column: 2 / 4; justify-self: end; margin-top: -4px; padding: 1px 2px; background: transparent; color: #a56a6a; font-family: Arial, sans-serif; font-size: .7rem; text-decoration: underline; }
.cart-summary { padding: 12px 0 10px; border-top: 2px solid #e8ecdf; }
.cart-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-transform: uppercase; }
.cart-summary > div span { color: var(--shop-muted); font-size: .75rem; font-weight: 900; letter-spacing: .06em; }
.cart-summary > div strong { font-size: 1.35rem; }
.cart-summary > div + div { margin-top: 4px; }
#money-row strong { color: var(--shop-green); }
#money-row.over strong { color: var(--shop-red); }
.over-budget-message { margin: 8px 0 0; padding: 8px; border-radius: 10px; background: #fff0f1; color: #c73442; font-size: .78rem; font-weight: 900; text-align: center; }
.checkout-button, .result-new-button, .back-to-cart-button { min-height: 52px; border: 0; border-radius: 16px; background: linear-gradient(135deg, #76bb43, #55a72f); color: #fff; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; box-shadow: 0 5px 0 #3f8025; }
.checkout-button { width: 100%; display: flex; justify-content: center; align-items: center; gap: 12px; }
.checkout-button:hover, .result-new-button:hover, .back-to-cart-button:hover { filter: brightness(1.04); transform: translateY(-1px); }
.checkout-button:active, .result-new-button:active, .back-to-cart-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #3f8025; }
.checkout-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.flying-product { position: fixed; z-index: 1000; pointer-events: none; font-size: 2.5rem; line-height: 1; animation: fly-to-cart .62s cubic-bezier(.2,.7,.25,1) forwards; }
@keyframes fly-to-cart { to { transform: translate(var(--fly-x), var(--fly-y)) scale(.35) rotate(12deg); opacity: .4; } }

.modal-overlay { position: fixed; inset: 0; z-index: 2000; padding: 18px; display: grid; place-items: center; background: rgba(33, 45, 60, .55); backdrop-filter: blur(4px); }
.result-modal, .budget-modal { position: relative; width: min(520px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; padding: 26px clamp(20px, 5vw, 38px) 30px; border: 3px solid #fff; border-radius: 28px; background: #fffdf8; box-shadow: 0 24px 80px rgba(0,0,0,.25); text-align: center; animation: modal-in .28s ease both; }
@keyframes modal-in { from { transform: translateY(18px) scale(.96); opacity: 0; } }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f0f2f2; color: #65717c; font-size: 1.5rem; cursor: pointer; }
.result-mascot { width: 96px; height: 96px; object-fit: contain; }
.result-kicker { margin: 3px 0 4px; color: #d26a2f; font-size: .85rem; font-weight: 900; letter-spacing: .07em; }
.result-modal h2, .budget-modal h2 { margin: 0; font-size: clamp(1.55rem, 5vw, 2.15rem); }
.result-list-title { margin: 17px 0 7px; color: var(--shop-muted); font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.result-list { max-height: 170px; margin: 0; padding: 11px 14px; overflow-y: auto; border-radius: 16px; background: #f5f8f1; list-style: none; text-align: left; }
.result-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: .88rem; font-weight: 800; }
.result-totals { margin: 16px 0 19px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-total { padding: 11px 8px; border-radius: 15px; background: #fff1bc; }
.result-total:last-child { background: #e5f5df; }
.result-total span { display: block; color: var(--shop-muted); font-size: .68rem; font-weight: 900; letter-spacing: .07em; }
.result-total strong { display: block; margin-top: 1px; font-size: 1.5rem; }
.result-actions { display: grid; gap: 12px; }
.result-new-button, .result-setup-button, .back-to-cart-button { width: 100%; }
.result-setup-button { min-height: 48px; border: 2px solid #8dbd70; border-radius: 16px; background: #fff; color: #497d30; font-weight: 900; text-transform: uppercase; cursor: pointer; }
.result-setup-button:hover { background: #f1f9ed; }
.budget-modal { max-width: 420px; }
.oops-icon { display: block; font-size: 3rem; }
.budget-modal .panel-kicker { margin-top: 8px; }
.budget-modal > p:not(.panel-kicker) { margin: 10px 0; color: var(--shop-muted); font-family: Arial, sans-serif; font-size: 1.08rem; }
.budget-modal .budget-question { color: var(--shop-ink) !important; font-weight: 900; }
.back-to-cart-button { margin-top: 12px; }

.confetti-layer { position: fixed; inset: 0; z-index: 2100; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -20px; width: 10px; height: 17px; border-radius: 2px; animation: confetti-fall var(--fall-time) linear var(--delay) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin)); } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1080px) {
  body { overflow: hidden; }
  .shopping-app { height: 100vh; min-height: 0; }
  .game-layout { grid-template-columns: minmax(170px, .8fr) minmax(300px, 1.8fr) minmax(210px, 1fr); }
  .cart-panel { grid-column: auto; min-height: 0; }
  .cart-items, .shop-scroll { max-height: none; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .shopping-app { padding: 10px; }
  .shopping-app { height: auto; min-height: 100vh; }
  .game-header { align-items: flex-start; }
  .title-divider, .brand-block .eyebrow { display: none; }
  .brand-block { align-items: flex-start; flex-direction: column; gap: 3px; }
  .game-logo { width: 132px; }
  .brand-block h1 { font-size: 1.15rem; }
  .new-mission-button { padding: 8px 10px; font-size: .76rem; }
  .setup-screen { padding-top: 0; }
  .setup-card { padding: 18px 14px 22px; }
  .mission-options { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .mission-option { min-height: 91px; }
  .mission-option span { font-size: 2rem; }
  .game-layout { display: grid; grid-template-columns: 1fr; }
  .mission-panel, .shop-panel, .cart-panel { grid-column: auto; }
  .filter-bar { flex-wrap: wrap; overflow-x: visible; }
  .shop-scroll { max-height: min(65vh, 620px); overflow-y: auto; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-card { min-height: 132px; padding-inline: 5px; }
  .cart-items { max-height: none; }
}

@media (max-width: 440px) {
  .game-header { gap: 8px; }
  .game-logo { width: 112px; }
  .brand-block h1 { font-size: .98rem; }
  .new-mission-button { min-height: 40px; max-width: 104px; line-height: 1.05; }
  .mission-option { min-height: 84px; padding: 9px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { min-height: 142px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .flying-product, .confetti-piece { display: none !important; }
}
