/* The first-launch intro, the Cabbage House building and the chef name prompt.
   Ported from Intro.swift and NamePrompt.swift. Everything here is prefixed
   .intro-, .house- or .nameprompt-. */

/* ---- The Cabbage House building (CabbageHouseArt) */
.house-art { position: relative; flex: none; }
.house-art > * { position: absolute; }
.house-canvas { pointer-events: none; }

/* Chimney smoke rises 20% of the house height and fades, forever. */
.house-puff {
  border-radius: 50%; opacity: .9; pointer-events: none;
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.9), rgba(255,255,255,.6));
  animation: house-puff 2.2s ease-out infinite;
}
@keyframes house-puff { from { transform: translateY(0); opacity: .9; } to { transform: translateY(var(--house-rise)); opacity: 0; } }

/* String lights: dim until lit, then two groups twinkle against each other. */
.house-lights { left: 0; right: 0; height: 7px; display: flex; justify-content: center; pointer-events: none; }
.house-bulb { position: relative; flex: none; width: 7px; height: 7px; border-radius: 50%; opacity: .5; transition: opacity .8s ease-in-out; box-shadow: inset 0 -1px 1px rgba(0,0,0,.15); }
.house-bulb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .8s ease-in-out;
  box-shadow: 0 0 6px 2.5px rgba(255,214,10,.9);
  animation: house-twinkle .6s ease-in-out infinite alternate-reverse;
}
.house-bulb.house-even::before { animation-direction: alternate; }
.house-lit .house-bulb, .house-lit .house-bulb::before { opacity: 1; }
@keyframes house-twinkle { from { transform: scale(.4); } to { transform: scale(1.4); } }

/* Windows: pale glass, then warm light with a glow. */
.house-window { border-radius: 6px; box-shadow: 0 0 16px 3px rgba(255,227,138,0); transition: box-shadow .8s ease-in-out; }
.house-lit .house-window { box-shadow: 0 0 16px 3px rgba(255,227,138,.9); }
.house-glass, .house-glow { position: absolute; inset: 0; border-radius: 6px; }
.house-glass { background: linear-gradient(155deg, #E2F0F8, #BFD9EA 50%, #A8C7DC); }
.house-glow { background: radial-gradient(circle at 50% 62%, #FFF7CF, #FFE38A 58%, #FFCF5E); opacity: 0; transition: opacity .8s ease-in-out; }
.house-lit .house-glow { opacity: 1; }
.house-bar-v, .house-bar-h { position: absolute; background: #E3CFA6; }
.house-bar-v { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.house-bar-h { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }
.house-window::after { content: ""; position: absolute; inset: 0; border-radius: 6px; border: 3px solid #E3CFA6; box-shadow: inset 0 1px 2px rgba(120,90,40,.18); }

/* The doorway behind the door (web-only): dark and warm, glowing once the lights are on. */
.house-doorway { border-radius: 15px 15px 3px 3px; background: linear-gradient(#4A2E1F, #6B4128 60%, #8A5A36); box-shadow: inset 0 3px 6px rgba(0,0,0,.45); }
.house-doorway::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(ellipse at 50% 75%, rgba(255,227,138,.85), rgba(255,200,90,.25) 70%, rgba(255,200,90,0)); opacity: 0; transition: opacity .8s ease-in-out; }
.house-lit .house-doorway::after { opacity: 1; }
/* The back of an open door carries no sign and no knob. */
.house-knob, .house-sign { transition: opacity .2s ease .25s; }
.house-door-open .house-knob, .house-door-open .house-sign { opacity: 0; transition-delay: .12s; }

/* Door: hinged on its leading edge, swings 100 degrees with a spring. */
.house-door { transform-origin: 0 50%; transform: perspective(var(--house-persp)) rotateY(0deg); transition: transform .7s cubic-bezier(.34, 1.4, .64, 1); }
.house-door-open .house-door { transform: perspective(var(--house-persp)) rotateY(-100deg); }
.house-door-panel {
  position: absolute; inset: 0; border-radius: 16px 16px 4px 4px; border: 3px solid #976B46;
  background: linear-gradient(100deg, #D6A67B, #C98F5D 45%, #B58154);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset -3px 0 5px rgba(90,50,20,.12);
}
.house-knob { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF3B0, #FFD94F 60%, #DFAE2C); box-shadow: 0 1px 1px rgba(60,30,10,.35); }

/* OPEN / CLOSED sign: two faces back to back, flipped about the vertical axis. */
.house-sign { position: absolute; left: 50%; transform: translateX(-50%); perspective: 140px; }
.house-sign-flip { display: grid; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transform: rotateY(180deg); transition: transform .6s cubic-bezier(.34, 1.56, .64, 1); }
.house-open .house-sign-flip { transform: rotateY(0deg); }
.house-sign-face {
  grid-area: 1 / 1; justify-self: center; align-self: center; white-space: nowrap;
  font-size: 8px; font-weight: 900; line-height: 1.2; letter-spacing: .2px; color: #fff; padding: 2px 5px; border-radius: 4px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden; text-shadow: 0 .5px 0 rgba(0,0,0,.25);
  box-shadow: inset 0 .5px 0 rgba(255,255,255,.45), 0 1px 1.5px rgba(60,30,10,.35);
}
.house-sign-open { background: linear-gradient(#8AD06E, #6FB854 55%, #5DA345); }
.house-sign-closed { background: linear-gradient(#EA6274, #DB3A4E 55%, #C02E42); transform: rotateY(180deg); }

/* Sign board over the door */
.house-board {
  left: 50%; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-size: 9px; font-weight: 900; line-height: 1.2; color: #3f6335; padding: 3px 6px; border-radius: 5px;
  background: linear-gradient(#FFFCF3, #FFF3DC 60%, #F6E5C3); border: 2px solid #C98F5D;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 1.5px 2.5px rgba(80,50,20,.3);
}

/* ---- The intro overlay */
.intro-layer { cursor: pointer; font-weight: 900; }
.intro-layer > * { position: absolute; }
.intro-sky { inset: 0; }
/* The sky is tweened frame by frame, so the shared transitions would only lag behind it. */
.intro-sky .sky { transition: none; }
.intro-sky .sun { transition: opacity .8s ease; }
.intro-hills { left: 0; right: 0; bottom: 0; height: 36%; pointer-events: none; }

/* The house on the hill with a path. It shrinks up and away for the name and the tour. */
.intro-house {
  left: 50%; top: 0; width: 260px; height: 200px; margin-left: -130px; transform-origin: 50% 0;
  transform: translateY(calc(var(--H, 800px) * .22)) scale(1);
  transition: transform .7s cubic-bezier(.3, 1.3, .55, 1), opacity .45s ease;
}
.intro-house.intro-up { transform: translateY(calc(var(--H, 800px) * .10)) scale(.8); }
.intro-house.intro-away { opacity: 0; }
.intro-house > * { position: absolute; }
/* The hilltop the house stands on. The Swift numbers leave it floating above the hills. */
.intro-house::before {
  content: ""; pointer-events: none; position: absolute; left: 50%; top: 176px; width: 1100px; height: 1000px; margin-left: -550px; border-radius: 50%;
  background: radial-gradient(ellipse 60% 40% at 45% 0%, #b4e397, transparent 70%), linear-gradient(#97d47a, #6fb356 45%);
  box-shadow: 0 -4px 14px rgba(0,0,0,.10);
}
.intro-house .house-art { left: 15px; top: 0; }
.intro-path {
  left: 0; top: 194px; width: 260px; height: 40px; border-radius: 50%;
  background: radial-gradient(ellipse at 42% 30%, #F8EBCB, #E8D3A8 58%, #D6BC89);
  box-shadow: inset 0 -3px 5px rgba(120,90,40,.12), 0 2px 5px rgba(40,70,20,.15);
}
.intro-zzz { left: 196px; top: 0; font-size: 26px; line-height: 1; opacity: 0; transition: opacity .5s ease; animation: intro-zzz 2.4s ease-in-out infinite alternate; pointer-events: none; }
.intro-asleep .intro-zzz { opacity: 1; }
@keyframes intro-zzz { from { transform: translate(0, 4px) rotate(-6deg) scale(.92); } to { transform: translate(8px, -10px) rotate(8deg) scale(1.08); } }

/* Friends walking up the path */
.intro-friends-row { left: 0; right: 0; top: 180px; height: 50px; display: flex; justify-content: center; pointer-events: none; }
.intro-friends-row.intro-inside { opacity: 0; }
.intro-friends { display: flex; flex: none; transform: translateX(calc(var(--W, 400px) * -.8)); transition: transform 2.4s cubic-bezier(.42, 0, .58, 1); }
.intro-friends.intro-arrived { transform: translateX(0); }
.intro-critter { position: relative; display: inline-block; flex: none; }
.intro-friend + .intro-friend { margin-left: -14px; }
.intro-friend { transform-origin: 50% 100%; filter: drop-shadow(0 3px 3px rgba(40,60,20,.25)); }
.intro-marching .intro-friend { animation-name: intro-walk; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes intro-walk {
  0% { transform: translateY(0) rotate(0) scaleY(1); } 12.5% { transform: translateY(-5px) rotate(3.5deg) scaleY(1.05); }
  25% { transform: translateY(-7px) rotate(5deg) scaleY(1); } 37.5% { transform: translateY(-5px) rotate(3.5deg) scaleY(.95); }
  50% { transform: translateY(0) rotate(0) scaleY(1); } 62.5% { transform: translateY(-5px) rotate(-3.5deg) scaleY(1.05); }
  75% { transform: translateY(-7px) rotate(-5deg) scaleY(1); } 87.5% { transform: translateY(-5px) rotate(-3.5deg) scaleY(.95); }
  100% { transform: translateY(0) rotate(0) scaleY(1); }
}

/* The web-only first moment: tap to wake the house (audio needs a tap). */
.intro-wake { left: 20px; right: 20px; top: calc(var(--H, 800px) * .22 + 272px); text-align: center; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.intro-asleep .intro-wake { opacity: 1; }
.intro-emoji { text-shadow: none; }
.intro-wake .outlined { line-height: 1.25; animation: intro-pulse .9s ease-in-out infinite alternate; }
@keyframes intro-pulse { from { transform: scale(.97); } to { transform: scale(1.06); } }

/* ---- Tour diorama */
.intro-tour { left: 20px; right: 20px; height: 230px; top: max(60px, calc((var(--H, 800px) - 230px) / 2)); pointer-events: none; opacity: 0; transform: scale(.9); transition: opacity .35s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1); }
.intro-tour.intro-show { opacity: 1; transform: scale(1); }
.intro-page {
  position: absolute; inset: 0; border-radius: 24px;
  background: linear-gradient(rgba(255,255,255,.96), rgba(255,255,255,.86));
  box-shadow: inset 0 0 0 3px #fff, 0 10px 24px rgba(30,70,110,.2);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.intro-page-body { position: absolute; inset: 12px; }
.intro-scene { position: absolute; inset: 0; }
.intro-room { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.intro-room-sky { position: relative; flex: 1; }
.intro-floor { flex: none; width: 100% !important; height: 40px !important; }
.intro-prop { position: absolute; left: 0; bottom: 0; pointer-events: none; }

/* Page 0: tables and guests */
.intro-tables { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; align-items: flex-end; gap: 14px; }
.intro-seat { position: relative; flex: none; width: 66px; height: 50px; }
.intro-guest { position: absolute; left: 6px; bottom: 34px; width: 54px; height: 54px; transform-origin: 50% 100%; }
.intro-pop { animation: intro-pop .6s cubic-bezier(.34, 1.7, .6, 1) both; }
@keyframes intro-pop { from { transform: scale(.01); } to { transform: scale(1); } }

/* Page 1: the order and the tray */
.intro-ordering { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.intro-order-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.intro-order { padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: var(--ink, #2f2a24); }
.intro-caption { font-size: 12px; font-weight: 900; color: #7a7369; }
.intro-dish-pill { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; font-size: 15px; font-weight: 900; background: linear-gradient(#F1F7ED, #E8F1E3 55%, #DCE9D5); box-shadow: inset 0 0 0 1px rgba(93,138,78,.15); }
.intro-sub { font-size: 15px; font-weight: 900; }
.intro-tray { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; min-height: 50px; }
.intro-drop { display: block; animation: intro-drop .65s cubic-bezier(.34, 1.7, .6, 1) .8s both; }
@keyframes intro-drop { from { transform: translateY(-40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.intro-serve {
  font-size: 17px; font-weight: 900; color: #fff; padding: 8px 16px; border-radius: 999px; text-shadow: 0 1.5px 0 rgba(0,0,0,.2);
  background: linear-gradient(#FFA5B5, #ff8fa3 50%, #F27B91);
  box-shadow: 0 3px 0 #C0576B, 0 7px 10px rgba(255,143,163,.45), inset 0 0 0 1.5px rgba(255,255,255,.35);
  animation: intro-serve .6s ease-in-out 1.4s infinite alternate;
}
@keyframes intro-serve { from { transform: scale(1); } to { transform: scale(1.08); } }

/* Page 2: Daisy and the dishwasher */
.intro-dish-row { position: absolute; left: 24px; right: 24px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.intro-dirty { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; transition: opacity .3s ease; }
.intro-dirty .plate + .plate { margin-left: -6px; }
.intro-dirty.intro-gone { opacity: 0; }
.intro-tiny { font-size: 9px; line-height: 1; }
.intro-washer { position: relative; flex: none; }
.intro-suds { position: absolute; left: 0; right: 0; height: 0; display: none; justify-content: center; align-items: center; gap: 3px; }
.intro-running .intro-suds { display: flex; }
.intro-suds i { flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, rgba(255,255,255,.8)); box-shadow: inset 0 0 0 .5px rgba(90,160,210,.4); animation: intro-suds .5s ease-in-out infinite alternate; }
@keyframes intro-suds { from { transform: translateY(6px); } to { transform: translateY(-8px); } }
.intro-daisy { position: absolute; left: 60px; top: 45%; display: flex; align-items: center; transform: translate(-50%, -50%); transition: left 2s cubic-bezier(.42, 0, .58, 1) .55s; }
.intro-daisy.intro-walked { left: calc(100% - 70px); }
.intro-daisy .plate { margin-left: -6px; transform: translateY(8px); }

/* Page 3: the chipmunk dancers */
.intro-chip-wrap { position: absolute; inset: 10px; }
.intro-chip-stage { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; background: linear-gradient(#5E2A6E, #2E1040); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14), inset 0 -24px 30px rgba(0,0,0,.25); }
.intro-curtain { position: absolute; left: 0; right: 0; top: -8px; height: 18px; display: flex; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.intro-curtain i { flex: 1; border-radius: 50%; background: radial-gradient(ellipse at 40% 35%, #F26A7B, #DB3A4E 60%, #B42B3F); }
.intro-disco {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -47px 0 0 -11px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,255,255,.5) 0 25%, transparent 0 50%) 0 0 / 8.8px 8.8px, linear-gradient(135deg, #fff, #B9C7D4);
  box-shadow: 0 0 10px rgba(255,255,255,.55), inset -2px -2px 3px rgba(60,80,110,.35);
}
.intro-dancers { position: absolute; left: 0; right: 0; top: 50%; height: 60px; margin-top: -24px; display: flex; justify-content: center; gap: 22px; }
.intro-dancer { position: relative; flex: none; width: 64px; height: 60px; }
.intro-spot { position: absolute; left: 0; top: 46px; width: 64px; height: 22px; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,240,140,.7), rgba(255,220,60,.38) 55%, rgba(255,214,10,.08)); }
.intro-dancer-body { position: absolute; left: 2px; top: 0; width: 60px; height: 60px; display: block; }
.intro-chip-label { position: absolute; left: 0; right: 0; top: 50%; margin-top: 35px; text-align: center; }
.intro-heart { position: absolute; top: 100px; font-size: 14px; line-height: 1; pointer-events: none; }

/* Page 4: stickers */
.intro-stickers { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.intro-badges { display: flex; gap: 8px; }
.intro-badge { position: relative; flex: none; width: 70px; height: 70px; display: grid; place-items: center; }
.intro-badge-star { position: absolute; left: -7px; top: -7px; filter: drop-shadow(0 3px 3px rgba(190,130,20,.5)) drop-shadow(0 0 1px rgba(200,140,20,.6)); }
.intro-badge-disc { position: absolute; left: 11px; top: 11px; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #fff, #F1F4F7); box-shadow: inset 0 -2px 4px rgba(0,0,0,.06), 0 1px 3px rgba(120,80,0,.2); }
.intro-badge-emoji { position: relative; font-size: 28px; line-height: 1; }
.intro-cheer { display: flex; align-items: center; }
.intro-cheer .intro-critter + .intro-critter { margin-left: -10px; }

/* ---- Cabbie, the speech bubble and the big button */
.intro-talk { left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; pointer-events: none; }
.intro-talk.intro-top { bottom: auto; top: 70px; }
.intro-row { display: flex; align-items: flex-end; gap: 10px; padding: 0 16px; }
.intro-cabbie { flex: none; filter: drop-shadow(0 5px 6px rgba(30,60,20,.3)); }
.intro-bubble { flex: 1; min-width: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: default; pointer-events: auto; }
.intro-line { font-size: 20px; line-height: 1.25; font-weight: 900; color: #3f6335; }
.intro-input {
  display: block; width: 100%; min-width: 0; margin: 0; font: inherit; font-size: 26px; font-weight: 900; line-height: 1.2; color: #2f2a24;
  padding: 8px 14px; border-radius: 14px; border: 3px solid #f6c453; outline: none; -webkit-appearance: none; appearance: none;
  background: linear-gradient(#fff, #fffaf0); box-shadow: inset 0 2px 4px rgba(120,80,0,.10);
  -webkit-user-select: text; user-select: text; touch-action: manipulation; cursor: text;
}
.intro-input::placeholder, .nameprompt-input::placeholder { color: rgba(47,42,36,.3); }
.intro-input:focus, .nameprompt-input:focus { box-shadow: inset 0 2px 4px rgba(120,80,0,.10), 0 0 0 4px rgba(246,196,83,.35); }
.intro-buttons { padding: 12px 24px calc(14px + env(safe-area-inset-bottom, 0px)); transition: opacity .3s ease; pointer-events: auto; cursor: default; }
.intro-buttons.intro-hide { opacity: 0; pointer-events: none; }
.intro-next[hidden] { display: none; }

.intro-bits { left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; }
.intro-bit { position: absolute; left: 0; top: 0; display: grid; place-items: center; font-style: normal; font-size: 16px; line-height: 1; }

.intro-skip {
  right: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); padding: 6px 12px; border-radius: 999px;
  font-size: 15px; font-weight: 900; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2);
  background: linear-gradient(rgba(255,255,255,.12), rgba(0,0,0,.25)), rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 2px 6px rgba(0,0,0,.15);
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.intro-skip:active { transform: scale(.92); }

/* ---- The chef name prompt (NamePrompt) */
.nameprompt-dim { position: absolute; inset: 0; background: rgba(0,0,0,.35); animation: nameprompt-fade .25s ease both; }
@keyframes nameprompt-fade { from { opacity: 0; } }
/* Top third of the stage: the keyboard never covers it, on iPad or iPhone. */
.nameprompt-card {
  position: absolute; left: 50%; top: calc(70px + env(safe-area-inset-top, 0px)); width: 320px; margin-left: -160px; padding: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: nameprompt-in .45s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes nameprompt-in { from { transform: scale(.8); opacity: 0; } }
.nameprompt-face { filter: drop-shadow(0 5px 6px rgba(30,60,20,.3)); }
.nameprompt-input {
  display: block; width: 100%; min-width: 0; margin: 0; font: inherit; font-size: 28px; font-weight: 900; line-height: 1.2; text-align: center; color: #2f2a24;
  padding: 10px 14px; border-radius: 16px; border: 3px solid #f6c453; outline: none; -webkit-appearance: none; appearance: none;
  background: linear-gradient(#fff, #fffdf6); box-shadow: inset 0 2px 4px rgba(120,80,0,.10);
  -webkit-user-select: text; user-select: text; touch-action: manipulation; cursor: text;
}
