/* ═══════════════════════════════════════════════════════
   styles.css — Harry's McDonald's Tesla Run
   ═══════════════════════════════════════════════════════

   Color palette:
     Gold  #FFC72C   McDonald's yellow
     Red   #DA291C   McDonald's red
     Dark  #27251F   Near-black
     Sky   #87CEEB   Drive scene sky
     Green #27AE60   "Go" button / positive

   Fonts: Fredoka One (Google Fonts) → Arial Black fallback
═══════════════════════════════════════════════════════ */

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

html, body {
  height: 100%;
  overflow: hidden; /* only the active screen scrolls */
}

body {
  font-family: 'Fredoka One', 'Arial Black', Arial, sans-serif;
  background: #111;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#game {
  width: 100%;
  max-width: 700px;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: #FFC72C;
}

/* ── SCREENS ────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0; left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  animation: fadeIn 0.35s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── SHARED MOOD BAR ────────────────────────────────── */
.mood-bar {
  background: #27251F;
  color: #FFC72C;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.9rem;
  width: 100%;
  border-top: 2px solid #FFC72C;
  flex-shrink: 0;
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  font-family: 'Fredoka One', 'Arial Black', sans-serif;
  font-size: 1.15rem;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.35);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0,0,0,0.35); }
.btn:active { transform: translateY(3px);  box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none !important; box-shadow: 0 6px 0 rgba(0,0,0,0.2); }

.btn-start   { background: #DA291C; color: #fff;     font-size: 1.35rem; }
.btn-drive   { background: #27AE60; color: #fff; }
.btn-retry   { background: #DA291C; color: #fff; }
.btn-restart { background: #27251F; color: #FFC72C; }


/* ═══════════════════════════════════════════════════════
   SCREEN 1 — START
═══════════════════════════════════════════════════════ */
#screen-start {
  background: linear-gradient(155deg, #c00f0f 0%, #8a0000 45%, #1a0000 100%);
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 30px 24px;
}

.start-emoji {
  font-size: 4.5rem;
  animation: bounce 1.1s ease-in-out infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-14px); }
}

.game-title {
  font-size: 2.4rem;
  color: #FFC72C;
  text-shadow: 3px 3px 0 #27251F, 5px 5px 12px rgba(0,0,0,0.5);
  line-height: 1.15;
}

.tagline {
  font-size: 1rem;
  color: #ffd57e;
  max-width: 320px;
  font-family: 'Patrick Hand', 'Comic Sans MS', cursive;
  font-weight: normal;
}

/* ── Harry avatar (shared base) ── */
.avatar-wrap { position: relative; width: 120px; height: 120px; margin: 4px auto; }

.harry-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #FFC72C;
  display: none; /* revealed by onload */
  box-shadow: 0 0 20px rgba(255,199,44,0.5);
}

/* Placeholder shown when assets/harry.png is missing */
.harry-ph {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #FFC72C;
  color: #27251F;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #fff;
  box-shadow: 0 0 20px rgba(255,199,44,0.4);
}

.mood-line { color: #ffd57e; font-size: 0.95rem; }

.legal {
  color: rgba(255,255,255,0.3);
  font-size: 0.65rem;
  font-family: sans-serif;
  margin-top: 6px;
}


/* ═══════════════════════════════════════════════════════
   SCREEN 2 — ORDER SELECTION
═══════════════════════════════════════════════════════ */
#screen-order {
  background: #1a1a1a;
  justify-content: flex-start;
}

.menu-header {
  background: #27251F;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid #FFC72C;
  flex-shrink: 0;
}

.g-arch {
  font-family: 'Times New Roman', serif;
  font-size: 2.8rem;
  color: #FFC72C;
  font-style: italic;
  font-weight: bold;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  line-height: 1;
}

.menu-header-text { text-align: center; }
.menu-header-text h2 { color: #FFC72C; font-size: 1.15rem; }
.menu-header-text p  { color: #bbb; font-size: 0.78rem; font-family: sans-serif; margin-top: 2px; }

/* ── Order cards grid ── */
.order-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px;
  width: 100%;
}

/* Cards injected by JS — see buildOrderGrid() in script.js */
.order-card {
  background: #2c2c2c;
  border: 3px solid #444;
  border-radius: 18px;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.order-card:hover  { border-color: #FFC72C; background: #353535; transform: scale(1.03); }
.order-card:active { transform: scale(0.98); }
.order-card.selected {
  border-color: #FFC72C;
  background: #3a2a00;
  box-shadow: 0 0 16px rgba(255,199,44,0.5);
}

.oc-emoji { font-size: 2.2rem; }
.oc-name  { color: #eee; font-size: 0.85rem; line-height: 1.3; }
.oc-price { color: #FFC72C; font-size: 1.05rem; }

/* Luxury combo gets a special look */
.order-card.luxury { border-color: #666; }
.order-card.luxury .oc-name  { color: #FFD700; }
.order-card.luxury .oc-price { color: #FF6B6B; }

/* ── Footer / confirm row ── */
.order-footer {
  width: 100%;
  padding: 0 14px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.selected-display {
  background: #2c2c2c;
  color: #FFC72C;
  border: 2px solid #444;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.88rem;
  text-align: center;
  width: 100%;
}


/* ═══════════════════════════════════════════════════════
   SCREEN 3 — DRIVING SCENE
═══════════════════════════════════════════════════════ */
#screen-drive {
  padding: 0;
  overflow: hidden;
  background: #87CEEB;
}

.drive-scene {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Sky ── */
.sky {
  flex: 1;
  background: linear-gradient(to bottom, #5ba8d8 0%, #87CEEB 60%, #b0dff7 100%);
  position: relative;
  overflow: hidden;
}

/* Floating clouds */
.cloud {
  position: absolute;
  background: rgba(255,255,255,0.9);
  border-radius: 50px;
  width: 80px;
  height: 26px;
  animation: floatCloud 10s linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  position: absolute;
}
.cloud::before { width: 38px; height: 38px; top: -20px; left: 12px; }
.cloud::after  { width: 28px; height: 28px; top: -14px; left: 38px; }

@keyframes floatCloud {
  from { transform: translateX(-130px); }
  to   { transform: translateX(780px); }
}

/* McDonald's sign in sky */
.mcdo-sign {
  position: absolute;
  right: 20px;
  top: 16px;
  text-align: center;
}
.mcdo-arch {
  font-family: 'Times New Roman', serif;
  font-size: 5rem;
  color: #FFC72C;
  font-style: italic;
  font-weight: bold;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.35), 0 0 24px rgba(255,199,44,0.6);
  line-height: 1;
}
.mcdo-sign-text {
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #DA291C;
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* ── Road ── */
.road {
  height: 150px;
  background: #666;
  position: relative;
  border-top: 5px solid #FFC72C;
  flex-shrink: 0;
  overflow: visible; /* car can peek above road */
}

.road-dashes {
  position: absolute;
  bottom: 28px;
  left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #fff 0 32px,
    transparent 32px 60px
  );
}

/* ── Drive-thru building (right side) ── */
.building {
  position: absolute;
  right: 0; top: -90px;
  width: 120px;
  height: 240px;
  background: #DA291C;
  border-left: 5px solid #b01010;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 5;
}

.building-window {
  width: 72px;
  height: 72px;
  background: #87CEEB;
  border: 4px solid #ccc;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cashier-emoji-drive { font-size: 2.8rem; }
.building-label { color: #FFC72C; font-size: 0.58rem; letter-spacing: 2px; text-align: center; }

/* ── Car wrapper — JS sets initial left and animates via JS transition ── */
.car-wrap {
  position: absolute;
  bottom: 4px;
  width: 220px;   /* fixed so bubble text length doesn't affect car positioning */
  /* initial left position set by JS */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 4;
}

/* ── Speech bubble ── */
.bubble {
  background: white;
  border: 3px solid #27251F;
  border-radius: 14px;
  padding: 7px 12px;
  font-size: 0.78rem;
  color: #27251F;
  max-width: 200px;
  text-align: center;
  margin-bottom: 5px;
  margin-right: 10px;
  position: relative;
  opacity: 0;
  transform: scale(0.5) translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  right: 36px;
  border: 6px solid transparent;
  border-top-color: #27251F;
}
.bubble.visible { opacity: 1; transform: scale(1) translateY(0); }

/* ── Driver head (Harry peeking out) ── */
.driver-head {
  position: absolute;
  top: 4px;
  right: 58px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #FFC72C;
  background: #FFC72C;
  z-index: 7;
}
.driver-img { width: 100%; height: 100%; object-fit: cover; display: none; }
.driver-ph  {
  width: 100%; height: 100%;
  background: #FFC72C;
  color: #27251F;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

/* ── CSS-art Tesla ── */
.tesla { position: relative; width: 190px; }

.tesla-roof {
  width: 105px;
  height: 36px;
  background: #c00;
  border-radius: 18px 18px 0 0;
  margin-left: 38px;
}

.tesla-body {
  width: 190px;
  height: 52px;
  background: linear-gradient(to bottom, #cc0000, #a00000);
  border-radius: 10px 10px 6px 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 18px;
  position: relative;
}

/* Windshield (driver's window) */
.tesla-windshield {
  position: absolute;
  left: 28px;
  top: 6px;
  width: 56px;
  height: 36px;
  background: rgba(135,206,235,0.55);
  border-radius: 6px 6px 3px 3px;
  border: 2px solid rgba(255,255,255,0.25);
}

.tesla-logo {
  color: rgba(255,255,255,0.85);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: bold;
}

.tesla-wheels {
  position: absolute;
  bottom: -20px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 22px;
}
.wheel {
  width: 38px;
  height: 38px;
  background: #1a1a1a;
  border-radius: 50%;
  border: 4px solid #555;
  position: relative;
}
.wheel::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #888;
}

/* ── Credit meter ── */
.credit-strip {
  background: #27251F;
  padding: 12px 18px 8px;
  flex-shrink: 0;
}
.credit-label {
  color: #FFC72C;
  font-size: 0.85rem;
  margin-bottom: 5px;
}
.credit-track {
  background: #444;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
}
.credit-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, #27AE60, #FFC72C 60%, #DA291C);
  border-radius: 8px;
  transition: width 3s linear;
}
.credit-fill.empty { width: 0% !important; }


/* ═══════════════════════════════════════════════════════
   SCREEN 4 — PAYMENT
═══════════════════════════════════════════════════════ */
#screen-payment {
  background: linear-gradient(160deg, #27251F 0%, #1c0000 100%);
  justify-content: center;
  gap: 22px;
  padding: 30px 20px;
}

.pay-title {
  color: #FFC72C;
  font-size: 1.35rem;
  text-align: center;
}

.pay-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Cashier box */
.cashier-box {
  background: #DA291C;
  border: 3px solid #FFC72C;
  border-radius: 16px;
  padding: 18px 16px;
  text-align: center;
}
.cashier-face    { font-size: 3rem; }
.cashier-nametag { color: #FFC72C; font-size: 0.7rem; margin-top: 4px; }

/* Card + arrow zone */
.card-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.card-arrow {
  font-size: 2rem;
  color: #FFC72C;
  animation: pulseArrow 0.7s ease infinite alternate;
}
@keyframes pulseArrow { from { opacity: 0.2; } to { opacity: 1; } }

/* FIDELITY credit card */
.fidelity-card {
  width: 148px;
  height: 92px;
  background: linear-gradient(135deg, #163566, #2d5fa0);
  border-radius: 10px;
  padding: 11px;
  color: #fff;
  font-family: 'Courier New', monospace;
  border: 2px solid #5580c0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
  animation: cardWobble 2s ease infinite;
}
@keyframes cardWobble {
  0%, 100% { transform: rotate(-1deg); }
  50%       { transform: rotate(1deg); }
}

.fc-top  { display: flex; justify-content: space-between; align-items: center; }
.fc-bank { font-size: 0.7rem; letter-spacing: 1px; color: #a0c4ff; font-weight: bold; }
.fc-chip { font-size: 1.1rem; }
.fc-num  { font-size: 0.65rem; letter-spacing: 2px; margin-top: 8px; color: #dceeff; }
.fc-name { font-size: 0.62rem; letter-spacing: 1px; margin-top: 6px; color: #c5dcff; }

/* Harry medium avatar (payment screen) */
.pay-harry { text-align: center; }
.harry-med {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #FFC72C;
  display: none;
}
.harry-med-ph {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #FFC72C;
  color: #27251F;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border: 3px solid #fff;
}

/* Processing box */
.processing-box {
  background: rgba(255,255,255,0.05);
  border: 2px solid #FFC72C;
  border-radius: 18px;
  padding: 22px 36px;
  text-align: center;
  min-width: 250px;
  max-width: 360px;
  width: 90%;
}
.proc-text {
  color: #fff;
  font-size: 1.25rem;
  min-height: 2.2em;
  transition: opacity 0.25s;
}

/* Animated dots */
.dots { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.dots span {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #FFC72C;
  animation: dotPop 0.8s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.13s; }
.dots span:nth-child(3) { animation-delay: 0.26s; }
@keyframes dotPop {
  0%, 80%, 100% { transform: scale(0.45); opacity: 0.35; }
  40%            { transform: scale(1.3);  opacity: 1; }
}


/* ═══════════════════════════════════════════════════════
   SCREEN 5 — DECLINED
═══════════════════════════════════════════════════════ */
#screen-declined {
  background: #150000;
  overflow-y: auto;
  justify-content: flex-start;
}

.declined-scene {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 40px;
}

/* ── DECLINED stamp ── */
.stamp-wrap { position: relative; padding: 8px; }

.stamp {
  font-size: 2.8rem;
  font-weight: 900;
  color: #DA291C;
  border: 8px solid #DA291C;
  padding: 12px 26px;
  border-radius: 6px;
  line-height: 1.1;
  letter-spacing: 4px;
  text-align: center;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
  opacity: 0;
  transform: scale(3) rotate(-25deg);
  filter: blur(6px);
}
.stamp.in {
  animation: stampIn 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s forwards;
}
@keyframes stampIn {
  0%   { opacity: 0; transform: scale(3) rotate(-25deg); filter: blur(6px); }
  55%  { opacity: 1; transform: scale(0.88) rotate(-13deg); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) rotate(-11deg); filter: blur(0); }
}

.decline-reason {
  color: #ccc;
  font-size: 0.95rem;
  text-align: center;
  font-family: sans-serif;
}

/* Funny quote box */
.funny-msg {
  color: #FFC72C;
  font-size: 1.05rem;
  text-align: center;
  padding: 12px 18px;
  background: rgba(255,199,44,0.08);
  border: 2px dashed #FFC72C;
  border-radius: 14px;
  max-width: 380px;
  width: 90%;
  font-style: italic;
}

/* ── Fake receipt ── */
.receipt {
  background: #fff;
  color: #1a1a1a;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  padding: 16px 20px;
  border-radius: 4px;
  max-width: 270px;
  width: 90%;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  position: relative;
}
/* Torn-edge effect top & bottom */
.receipt::before, .receipt::after {
  content: '';
  position: absolute;
  left: 0; right: 0; height: 8px;
  background: repeating-linear-gradient(90deg, #fff 0 10px, #150000 10px 16px);
}
.receipt::before { top: -8px; }
.receipt::after  { bottom: -8px; }

.receipt-arch  { font-family: 'Times New Roman', serif; font-size: 2rem; color: #DA291C; font-style: italic; font-weight: bold; }
.receipt-store { font-size: 0.72rem; line-height: 1.5; margin-bottom: 4px; }
.rcpt-divider  { color: #aaa; letter-spacing: 1px; margin: 5px 0; }
.rcpt-row      { display: flex; justify-content: space-between; margin: 3px 0; }
.rcpt-total-row { font-weight: bold; font-size: 0.85rem; }
.rcpt-status   { font-size: 1rem; font-weight: bold; letter-spacing: 2px; margin: 5px 0; }
.rcpt-footer   { color: #777; font-size: 0.68rem; margin-top: 8px; line-height: 1.5; }
.red-text      { color: #DA291C; font-weight: bold; }

.final-mood { margin-top: 4px; }

/* ── Declined buttons ── */
.declined-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 6px;
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 500px)
═══════════════════════════════════════════════════════ */
@media (max-width: 500px) {
  .game-title { font-size: 1.75rem; }
  .start-emoji { font-size: 3.2rem; }

  .order-grid { grid-template-columns: 1fr; }

  .building { width: 95px; top: -70px; height: 220px; }
  .building-window { width: 58px; height: 58px; }
  .cashier-emoji-drive { font-size: 2.2rem; }
  .mcdo-arch { font-size: 3.8rem; }

  .tesla { width: 150px; }
  .tesla-body { width: 150px; height: 44px; }
  .tesla-roof { width: 82px; height: 30px; margin-left: 28px; }
  .tesla-windshield { width: 44px; height: 28px; left: 22px; }

  .pay-visual { flex-direction: column; gap: 10px; }
  .processing-box { min-width: 220px; padding: 16px 20px; }

  .stamp { font-size: 2rem; padding: 10px 18px; }

  .btn { font-size: 0.95rem; padding: 12px 24px; }
  .declined-btns { flex-direction: column; align-items: center; }
}
