/* ============================================
   Dreamy Scoops — Ice Cream Shop Game
   Theme: Soft Pink Pastel
   ============================================ */

:root {
  --pink-bg:      #fff0f4;
  --pink-soft:    #ffd6e3;
  --pink-mid:     #ffb3cc;
  --pink-hot:     #ff6b9d;
  --pink-deep:    #d63384;
  --pink-card:    #fff8fa;
  --pink-border:  #ffc2d8;
  --pink-shadow:  rgba(255, 107, 157, 0.18);

  --white:        #ffffff;
  --text-dark:    #3d1a26;
  --text-mid:     #7a3050;
  --text-light:   #b06080;

  --success:      #5cb85c;
  --danger:       #e74c3c;
  --warn:         #f0ad4e;

  --radius-sm:    10px;
  --radius-md:    18px;
  --radius-lg:    28px;
  --radius-xl:    40px;

  --shadow-card:  0 6px 28px var(--pink-shadow);
  --shadow-btn:   0 4px 16px rgba(255,107,157,.35);
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--pink-bg);
  color: var(--text-dark);
  overflow-x: hidden;
}

/* ─── SCREENS ─── */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active { display: flex; flex-direction: column; }

/* ─── ════════════════════════════
       START SCREEN
   ════════════════════════════ ─── */

#screen-start {
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, #ffe0ee 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, #ffd6e3 0%, transparent 60%),
    var(--pink-bg);
}

.start-bg-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.deco-float {
  position: absolute;
  font-size: 2.2rem;
  animation: floatDeco 4s ease-in-out infinite;
  opacity: .55;
  user-select: none;
}
@keyframes floatDeco {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-16px) rotate(5deg); }
}

.start-card {
  position: relative;
  z-index: 1;
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-xl);
  padding: 44px 40px 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-card), 0 0 0 8px rgba(255,183,213,.2);
  animation: popIn .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.shop-sign {
  display: inline-block;
  background: linear-gradient(135deg, var(--pink-hot), var(--pink-deep));
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 800;
  padding: 5px 22px;
  border-radius: 999px;
  letter-spacing: .08em;
  margin-bottom: 16px;
  box-shadow: var(--shadow-btn);
}

.shop-mascot {
  font-size: 5.5rem;
  line-height: 1;
  margin-bottom: 8px;
  animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1.06); }
}

.start-title {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  font-weight: 800;
  color: var(--pink-deep);
  margin-bottom: 8px;
}

.start-desc {
  font-size: .98rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 22px;
}

.start-stats-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.stat-chip {
  background: var(--pink-soft);
  border: 1.5px solid var(--pink-border);
  color: var(--text-mid);
  font-size: .82rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
}

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-block;
  padding: 14px 44px;
  background: linear-gradient(135deg, var(--pink-hot), var(--pink-deep));
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform .18s, box-shadow .18s;
  letter-spacing: .04em;
}
.btn-primary:hover  { transform: translateY(-3px) scale(1.04); box-shadow: 0 8px 24px rgba(255,107,157,.45); }
.btn-primary:active { transform: scale(.97); }

/* ─── ════════════════════════════
       GAME SCREEN
   ════════════════════════════ ─── */

#screen-game {
  min-height: 100svh;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0px,
      transparent 28px,
      rgba(255,183,213,.08) 28px,
      rgba(255,183,213,.08) 56px
    ),
    var(--pink-bg);
}

/* ── HUD ── */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 2px solid var(--pink-border);
  box-shadow: 0 2px 12px var(--pink-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.hud-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}
.hud-right { align-items: flex-end; }

.hud-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.hud-value {
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--pink-deep);
  line-height: 1.1;
}

.hud-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.shop-name-small {
  font-family: 'Baloo 2', cursive;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-light);
}

.timer-bar-wrap {
  width: 100%;
  max-width: 160px;
  height: 7px;
  background: var(--pink-soft);
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--pink-hot), var(--pink-deep));
  border-radius: 999px;
  transition: width .25s linear, background-color .3s;
}
.timer-bar.warn  { background: linear-gradient(90deg, var(--warn), #e67e22); }
.timer-bar.danger{ background: linear-gradient(90deg, var(--danger), #c0392b); }

.hud-timer {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 800;
  color: var(--pink-deep);
}
.hud-timer.warn   { color: var(--warn); }
.hud-timer.danger { color: var(--danger); }

/* ── GAME MAIN ── */
.game-main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .game-main {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* Customer area */
.customer-area {
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
  animation: slideInLeft .4s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.customer-bubble {
  background: white;
  border: 2px solid var(--pink-border);
  border-radius: 14px 14px 14px 4px;
  padding: 10px 14px;
  font-size: .88rem;
  color: var(--text-mid);
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  min-height: 52px;
  width: 100%;
  position: relative;
  box-shadow: 0 2px 8px var(--pink-shadow);
}

.customer-char {
  font-size: 3.6rem;
  line-height: 1;
  animation: customerBounce .5s cubic-bezier(.34,1.56,.64,1) both;
  filter: drop-shadow(0 4px 8px var(--pink-shadow));
}
@keyframes customerBounce {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}

.customer-name {
  font-family: 'Baloo 2', cursive;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-light);
}

/* Order panel */
.order-panel {
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
  animation: slideInUp .4s .05s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.order-label, .tray-label, .menu-label {
  font-family: 'Baloo 2', cursive;
  font-size: .85rem;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 10px;
}

.order-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 80px;
  align-items: center;
}

.order-item {
  background: white;
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 1.6rem;
  text-align: center;
  min-width: 52px;
  position: relative;
  box-shadow: 0 2px 8px var(--pink-shadow);
  transition: all .2s;
}

.order-item.matched {
  background: #e8fce8;
  border-color: #5cb85c;
  filter: brightness(1.05);
}
.order-item.matched::after {
  content: '✓';
  position: absolute;
  bottom: -4px; right: -4px;
  background: var(--success);
  color: white;
  font-size: .6rem;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.order-item-label {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

/* Tray */
.tray-area {
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
  animation: slideInRight .4s .08s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 80px;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px dashed var(--pink-border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.tray-item {
  font-size: 1.6rem;
  background: var(--pink-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: transform .15s;
  border: 1.5px solid var(--pink-border);
  animation: popIn .2s cubic-bezier(.34,1.56,.64,1) both;
}
.tray-item:hover { transform: scale(1.15) rotate(-5deg); }

.btn-serve {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #5cb85c, #3d9b3d);
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(92,184,92,.35);
  transition: transform .18s, box-shadow .18s, opacity .18s;
  letter-spacing: .04em;
}
.btn-serve:hover:not(:disabled)  { transform: translateY(-2px) scale(1.03); }
.btn-serve:active:not(:disabled) { transform: scale(.97); }
.btn-serve:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.btn-serve.ready {
  animation: pulseServe 1.2s ease-in-out infinite;
}
@keyframes pulseServe {
  0%,100% { box-shadow: 0 4px 14px rgba(92,184,92,.35); }
  50%      { box-shadow: 0 4px 28px rgba(92,184,92,.7); }
}

/* ── MENU SCROLL ── */
.menu-section {
  padding: 0 0 32px;
  max-width: 100%;
  position: relative;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 10px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.menu-arrows {
  display: flex;
  gap: 8px;
}

.arrow-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--pink-border);
  background: white;
  color: var(--pink-deep);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px var(--pink-shadow);
  transition: background .15s, transform .15s, box-shadow .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.arrow-btn:hover {
  background: var(--pink-soft);
  transform: scale(1.1);
  box-shadow: 0 4px 14px var(--pink-shadow);
}
.arrow-btn:active { transform: scale(.92); }
.arrow-btn:disabled { opacity: .3; cursor: not-allowed; }

/* iPad: show arrows always; mobile: show always too */
@media (hover: none) {
  .arrow-btn { background: var(--pink-soft); }
}

.menu-scroll-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;        /* smooth iOS scroll */
  scroll-snap-type: x mandatory;
  scrollbar-width: none;                    /* Firefox */
  cursor: grab;
  padding: 8px 16px 12px;
}
.menu-scroll-wrap::-webkit-scrollbar { display: none; }
.menu-scroll-wrap.grabbing { cursor: grabbing; }

/* fade edges */
.menu-scroll-wrap {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 20px,
    black calc(100% - 20px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 20px,
    black calc(100% - 20px),
    transparent 100%
  );
}

.menu-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;
  padding: 4px 8px;
}

.menu-btn {
  background: white;
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-md);
  padding: 14px 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 1.8rem;
  transition: transform .15s, box-shadow .15s, background .15s;
  box-shadow: 0 2px 8px var(--pink-shadow);
  scroll-snap-align: start;
  flex-shrink: 0;

  /* Sizes per device */
  width: 82px;
  -webkit-tap-highlight-color: transparent;
}

/* iPad (768–1024px) */
@media (min-width: 768px) and (max-width: 1180px) {
  .menu-btn { width: 96px; font-size: 2rem; padding: 16px 12px 14px; }
}

/* Desktop */
@media (min-width: 1181px) {
  .menu-btn { width: 90px; }
}

.menu-btn:hover {
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 8px 20px var(--pink-shadow);
  background: var(--pink-soft);
}
.menu-btn:active { transform: scale(.92); }

.menu-btn-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--pink-deep);
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(214,51,132,.4);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
  z-index: 200;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { background: #27ae60; }
.toast.error   { background: var(--danger); }
.toast.warn    { background: #e67e22; }

/* ─── ════════════════════════════
       WIN SCREEN
   ════════════════════════════ ─── */

#screen-win {
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, #ffd6e3 0%, transparent 60%),
    var(--pink-bg);
}

.win-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.win-card {
  position: relative;
  z-index: 1;
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px 40px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-card), 0 0 0 10px rgba(255,183,213,.2);
  animation: popIn .6s cubic-bezier(.34,1.56,.64,1) both;
}

.win-icon {
  font-size: 5rem;
  margin-bottom: 10px;
  animation: spinPop .6s .2s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes spinPop {
  from { opacity: 0; transform: scale(.3) rotate(-180deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.win-title {
  font-family: 'Baloo 2', cursive;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--pink-deep);
  margin-bottom: 6px;
}

.win-sub {
  font-size: 1rem;
  color: var(--text-mid);
  margin-bottom: 20px;
}

.win-score-box {
  background: linear-gradient(135deg, var(--pink-hot), var(--pink-deep));
  border-radius: var(--radius-lg);
  padding: 18px 28px;
  margin: 0 0 18px;
  color: white;
}
.win-score-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  opacity: .85;
  margin-bottom: 4px;
}
.win-score-num {
  display: block;
  font-family: 'Baloo 2', cursive;
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}

.win-redirect-msg {
  font-size: .92rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.win-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.win-dots span {
  width: 10px; height: 10px;
  background: var(--pink-mid);
  border-radius: 50%;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.win-dots span:nth-child(2) { animation-delay: .2s; }
.win-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse {
  0%,100% { transform: scale(1); opacity: .5; }
  50%      { transform: scale(1.4); opacity: 1; background: var(--pink-hot); }
}

/* ─── ════════════════════════════
       GAME OVER SCREEN
   ════════════════════════════ ─── */

#screen-over {
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  background: var(--pink-bg);
}

.over-card {
  background: var(--pink-card);
  border: 2px solid var(--pink-border);
  border-radius: var(--radius-xl);
  padding: 44px 40px 40px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: popIn .5s cubic-bezier(.34,1.56,.64,1) both;
}

.over-icon { font-size: 4.5rem; margin-bottom: 10px; animation: wobble 1s ease both; }
@keyframes wobble {
  0%,100% { transform: rotate(0); }
  25%      { transform: rotate(-12deg); }
  75%      { transform: rotate(12deg); }
}

.over-title {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 6px;
}

.over-sub {
  font-size: .95rem;
  color: var(--text-mid);
  margin-bottom: 18px;
}

.over-score-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--pink-soft);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}
.over-score-box span:nth-child(2) {
  font-size: 2rem;
  color: var(--pink-deep);
}

/* ─── CONFETTI BURST ─── */
.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  pointer-events: none;
  z-index: 0;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── CUSTOMER PROGRESS DOTS ─── */
.progress-bar-wrap {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: 6px;
  background: var(--pink-soft);
  z-index: 50;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink-hot), var(--pink-deep));
  transition: width .4s ease;
  border-radius: 0 3px 3px 0;
}

/* ─── MISC ─── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}
