/* Happy Wings: responsive Rails shell */
:root {
  color-scheme: light;
  --ink: #193542;
  --muted: #607780;
  --coral: #ef745e;
  --coral-dark: #d85c49;
  --mint: #bfead9;
  --sky: #eaf8f6;
  --cream: #fff9ec;
  --line: #dcebe5;
  font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: #fffdf8; }
a { color: inherit; }
.site-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 84px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.12rem; font-weight: 800; text-decoration: none; letter-spacing: -.03em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 12px; color: #fff; background: var(--coral); font-size: 1rem; }
.festival-label, .text-link { color: var(--muted); font-size: .9rem; font-weight: 650; }
.text-link { text-decoration: none; }
.text-link:hover { color: var(--coral-dark); }
.home-hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 56px; min-height: 510px; padding: 26px 0 54px; }
.hero-copy { padding: 0 0 10px 5px; }
.eyebrow { margin: 0 0 14px; color: var(--coral-dark); font-size: .72rem; font-weight: 850; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
.hero-copy h1 { margin-bottom: 20px; font-size: clamp(2.6rem, 5vw, 4.45rem); line-height: 1.02; letter-spacing: -.065em; }
.hero-copy h1 span { color: #398b80; }
.intro-copy { max-width: 470px; margin-bottom: 26px; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 52px; padding: 0 24px; border: 0; border-radius: 16px; font: inherit; font-size: .98rem; font-weight: 800; text-decoration: none; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: var(--coral); box-shadow: 0 8px 18px #ef745e33; }
.button-primary:hover { background: var(--coral-dark); }
.button-secondary { color: var(--ink); background: #e5f3ed; }
.control-hint { margin: 15px 0 0; color: #819398; font-size: .78rem; }
.hero-art { position: relative; height: 390px; overflow: hidden; border: 1px solid #d8eee9; border-radius: 38% 38% 22px 22px; background: linear-gradient(160deg, #d8f1ee 0%, #f1f8e8 100%); }
.sun, .stage-sun { position: absolute; top: 45px; right: 58px; width: 75px; height: 75px; border-radius: 50%; background: #ffd67d; box-shadow: 0 0 0 13px #ffd67d33; }
.cloud, .stage-cloud { position: absolute; width: 88px; height: 25px; border-radius: 50px; background: #ffffffb8; }
.cloud::before, .stage-cloud::before { position: absolute; bottom: 6px; left: 17px; width: 35px; height: 35px; border-radius: 50%; background: inherit; content: ""; }
.cloud-one { top: 85px; left: 42px; }.cloud-two { top: 150px; right: 35px; transform: scale(.7); }
.kite { position: absolute; z-index: 2; font-size: 2.4rem; }.kite-one { top: 70px; left: 44%; transform: rotate(-12deg); }.kite-two { top: 185px; right: 42px; transform: rotate(12deg) scale(.72); }
.baby-bubble { position: absolute; z-index: 3; top: 132px; left: 50%; display: grid; width: 140px; height: 140px; place-items: center; border: 8px solid #fff; border-radius: 50%; background: #ffd8b2; box-shadow: 0 12px 28px #30534d22; transform: translateX(-50%); }
.baby-face { font-size: 4.8rem; transform: translateY(4px); }.wing { position: absolute; top: 56px; color: #fff; font-size: 3rem; font-weight: 900; }.wing-left { left: -30px; transform: rotate(-35deg); }.wing-right { right: -30px; transform: scaleX(-1) rotate(-35deg); }
.hill { position: absolute; right: -8%; bottom: -30px; left: -8%; height: 145px; border-radius: 50% 50% 0 0; }.hill-back { bottom: 10px; background: #b8dfc8; transform: rotate(-5deg); }.hill-front { bottom: -58px; background: #8fcab0; transform: rotate(5deg); }
.art-caption { position: absolute; z-index: 4; right: 15px; bottom: 16px; left: 15px; color: #fff; font-size: .8rem; font-weight: 750; text-align: center; text-shadow: 0 1px 4px #2e6a59; }
.how-to-play { display: grid; grid-template-columns: .7fr 1.3fr; align-items: center; gap: 30px; padding: 30px 34px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.how-to-play h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.04em; }.steps-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.steps-list li { display: flex; align-items: flex-start; gap: 10px; }.step-number { display: grid; flex: 0 0 28px; height: 28px; place-items: center; border-radius: 10px; color: #267369; background: #e2f4eb; font-size: .82rem; font-weight: 850; }.steps-list strong, .steps-list small { display: block; }.steps-list strong { margin: 2px 0 5px; font-size: .83rem; }.steps-list small { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.site-footer { padding: 25px 0 30px; color: #819398; font-size: .78rem; text-align: center; }.site-footer span { color: var(--coral); }
.game-panel { padding: 8px 0 40px; }.game-toolbar { display: flex; align-items: end; justify-content: space-between; padding: 10px 0 18px; }.game-toolbar .eyebrow { margin-bottom: 5px; }.game-toolbar h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.05em; }.score-preview { display: flex; gap: 18px; color: var(--muted); font-size: .85rem; }.score-preview strong { margin-left: 6px; color: var(--ink); }.kite-count span { color: var(--coral); }
.game-stage { position: relative; display: grid; min-height: min(62vh, 570px); overflow: hidden; place-items: center; border: 1px solid #d5eae4; border-radius: 24px; background: linear-gradient(#dff5f2, #f7f7df 80%); }.stage-sun { top: 34px; right: 7%; width: 58px; height: 58px; }.stage-cloud-one { top: 18%; left: 8%; }.stage-cloud-two { top: 33%; right: 13%; transform: scale(.72); }.stage-kite { position: absolute; z-index: 1; color: var(--coral); font-size: 2.5rem; }.stage-kite-one { top: 22%; left: 24%; }.stage-kite-two { top: 49%; right: 22%; color: #eeb644; font-size: 2rem; }
.stage-baby { position: absolute; z-index: 2; top: 44%; left: 28%; display: grid; width: 82px; height: 82px; place-items: center; border: 5px solid #fff; border-radius: 50%; background: #ffd8b2; box-shadow: 0 8px 18px #30534d20; font-size: 2.8rem; transform: translateY(-50%); }.stage-baby b { position: absolute; right: -22px; color: #fff; font-size: 2rem; transform: rotate(-25deg); }
.stage-message { position: relative; z-index: 4; width: min(340px, calc(100% - 40px)); padding: 24px; border: 1px solid #ffffffb8; border-radius: 22px; background: #ffffffeb; box-shadow: 0 12px 35px #315b4d1c; text-align: center; }.message-sparkle { color: var(--coral); }.stage-message h2 { margin: 9px 0 7px; font-size: 1.18rem; letter-spacing: -.03em; }.stage-message p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }.stage-hills { position: absolute; right: -5%; bottom: -50px; left: -5%; height: 110px; border-radius: 50% 50% 0 0; background: #a9d5b3; }
.game-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 17px; }.game-actions p { margin: 0; color: var(--muted); font-size: .85rem; }kbd { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; font-size: .75rem; }
.results-screen { min-height: 100vh; }.results-card { display: flex; width: min(480px, 100%); min-height: 480px; margin: 48px auto 70px; padding: 40px; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(160deg, #f0faf4, #fffaf0); text-align: center; }.results-confetti { margin-bottom: 22px; font-size: 1.8rem; }.results-card h1 { margin-bottom: 12px; font-size: 2.3rem; letter-spacing: -.06em; }.results-card .intro-copy { margin-bottom: 18px; font-size: .95rem; }.results-stats { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 24px; }.results-stats div { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #ffffffb8; }.results-stats span { color: var(--muted); font-size: .76rem; }.results-stats strong { font-size: 1.3rem; }.results-home-link { margin-top: 15px; }

@media (max-width: 760px) {
  .site-shell { width: min(100% - 32px, 560px); }.site-header { min-height: 68px; }.festival-label { font-size: .75rem; }.home-hero { grid-template-columns: 1fr; gap: 26px; padding: 34px 0; }.hero-copy h1 { font-size: clamp(2.8rem, 12vw, 4rem); }.hero-art { height: 310px; }.how-to-play { grid-template-columns: 1fr; gap: 22px; padding: 24px; }.steps-list { grid-template-columns: 1fr; gap: 15px; }.steps-list small { font-size: .76rem; }.game-toolbar h1 { font-size: 1.45rem; }.score-preview { gap: 10px; font-size: .76rem; }.game-stage { min-height: 58vh; }.stage-baby { left: 16%; width: 68px; height: 68px; font-size: 2.2rem; }.stage-obstacle { right: 9%; }.game-actions { align-items: flex-start; gap: 12px; flex-direction: column; }.results-card { min-height: 420px; margin: 30px auto; padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }


/* Phone-first layout refinements */
html { min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
.site-shell {
  width: min(1120px, calc(100% - 32px));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.site-header { padding-top: max(8px, env(safe-area-inset-top)); }
.site-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.button { min-height: 48px; }
.text-link { display: inline-flex; min-height: 44px; align-items: center; padding: 0 8px; }
.game-screen { min-height: 100vh; min-height: 100dvh; }
.game-stage { min-height: min(62dvh, 570px); }

@media (max-width: 600px) {
  .site-shell { width: calc(100% - 24px); }
  .site-header { min-height: 64px; gap: 10px; }
  .brand { gap: 7px; font-size: 1rem; }
  .brand-mark { width: 32px; height: 32px; }
  .festival-label { max-width: 45%; font-size: .7rem; text-align: right; }
  .home-hero { min-height: auto; gap: 22px; padding: 22px 0 28px; }
  .hero-copy { padding-left: 0; }
  .hero-copy h1 { font-size: clamp(2.5rem, 11vw, 3.7rem); }
  .intro-copy { font-size: 1rem; line-height: 1.6; }
  .hero-art { height: clamp(250px, 48svh, 330px); border-radius: 30px 30px 18px 18px; }
  .how-to-play { gap: 18px; padding: 20px; }
  .steps-list { gap: 13px; }
  .game-header .text-link { margin-right: -8px; }
  .game-toolbar { align-items: center; gap: 8px; flex-wrap: wrap; }
  .game-toolbar h1 { font-size: 1.35rem; }
  .score-preview { gap: 12px; }
  .game-stage { min-height: clamp(330px, 58svh, 520px); border-radius: 18px; }
  .stage-message { padding: 20px 16px; }
  .game-actions .button { width: 100%; }
  .results-card { min-height: min(440px, calc(100dvh - 100px)); margin: 20px auto; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .home-hero { min-height: auto; padding: 12px 0 20px; }
  .hero-art { height: 250px; }
  .game-stage { min-height: 260px; }
  .game-panel { padding-top: 0; }
}

/* Live canvas game */
.avatar-picker { display: flex; margin: 2px 0 16px; flex-direction: column; align-items: center; gap: 8px; }
.avatar-picker[hidden] { display: none; }
.avatar-picker .eyebrow { margin: 0; font-size: .66rem; white-space: nowrap; }
.avatar-options { display: flex; justify-content: center; gap: 7px; }
.avatar-choice { position: relative; display: grid; width: 56px; height: 56px; padding: 3px; place-items: center; overflow: hidden; border: 2px solid transparent; border-radius: 16px; background: #edf6f1; cursor: pointer; }
.avatar-choice:hover { background: #e3f1e9; }
.avatar-choice.is-selected { border-color: var(--coral); background: #fff0e9; box-shadow: 0 0 0 3px #ef745e20; }
.avatar-choice-art { display: block; width: 100%; height: 100%; border-radius: 13px; background-image: var(--avatar-sheet); background-repeat: no-repeat; background-position: left center; background-size: 300% 100%; }
.avatar-choice-label { position: absolute; right: 2px; bottom: 2px; display: grid; width: 19px; height: 19px; place-items: center; border: 1px solid #ffffff; border-radius: 50%; color: var(--ink); background: #ffffffed; font-size: .66rem; font-weight: 850; }
.game-toolbar-actions { display: flex; align-items: center; gap: 12px; }
.timer-display { display: grid; min-width: 66px; padding: 7px 11px 6px; justify-items: center; border: 1px solid #d5eae4; border-radius: 14px; color: #53716c; background: #f2faf5; line-height: 1; transition: transform .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease; }
.timer-display span { font-size: .58rem; font-weight: 850; letter-spacing: .12em; }
.timer-display strong { margin-top: 4px; color: var(--ink); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.timer-display.timer-urgent { transform: scale(1.12); border-color: #ef8e74; color: #a74635; background: #fff0e9; box-shadow: 0 0 0 5px #ef8e7426; }
.timer-display.timer-urgent strong { color: #a74635; }
.timer-display.timer-urgent span { font-size: .67rem; }
.game-stage { isolation: isolate; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.game-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.game-overlay { position: absolute; z-index: 5; top: 50%; left: 50%; display: flex; width: min(340px, calc(100% - 32px)); padding: 24px 20px; flex-direction: column; align-items: center; border: 1px solid #ffffffc9; border-radius: 22px; background: #ffffffed; box-shadow: 0 12px 35px #315b4d24; text-align: center; transform: translate(-50%, -50%); }
.game-overlay[hidden], .pause-button[hidden] { display: none; }
.game-overlay h2 { margin: 8px 0 7px; font-size: 1.18rem; letter-spacing: -.03em; }
.game-overlay p { margin: 0 0 17px; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.nickname-field { display: grid; width: 100%; gap: 6px; margin: 0 0 16px; color: var(--ink); font-size: .73rem; font-weight: 750; text-align: left; }
.nickname-field[hidden] { display: none; }
.nickname-field small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.nickname-field input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #d5eae4; border-radius: 12px; color: var(--ink); background: #fff; font: inherit; font-size: .85rem; }
.nickname-field input:focus { outline: 3px solid #ef745e33; border-color: var(--coral); }
.overlay-button { min-width: 170px; cursor: pointer; }
.pause-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; font: inherit; font-size: 1rem; font-weight: 850; cursor: pointer; }
.pause-button:hover { background: #e5f3ed; }
.family-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px 34px; margin-top: 24px; padding: 26px 30px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(135deg, #f1faf4, #fffaf0); }
.family-card-copy h2 { margin: 0 0 8px; font-size: 1.45rem; letter-spacing: -.04em; }
.family-card-copy p:not(.eyebrow) { max-width: 560px; margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.family-card-copy .invite-note { margin-top: 8px; color: #71858a; font-size: .75rem; }
.family-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-self: center; }
.family-stats div { display: grid; gap: 5px; padding: 14px; border: 1px solid #dcebe5; border-radius: 14px; background: #ffffffb8; }
.family-stats span { color: var(--muted); font-size: .75rem; }
.family-stats strong { font-size: 1.3rem; }
.family-stats small { color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; }
.family-card-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.family-card-actions .button { cursor: pointer; }
.family-sync-status { min-height: 1.2em; margin: 0; color: #607780; font-size: .76rem; line-height: 1.4; }
.game-actions .family-sync-status { margin-top: 7px; }

@media (max-width: 600px) {
  .avatar-picker { margin-bottom: 14px; gap: 7px; }
  .avatar-options { gap: 6px; }
  .avatar-choice { width: 54px; height: 54px; border-radius: 15px; }
  .game-toolbar-actions { gap: 6px; }
  .timer-display { min-width: 58px; padding: 6px 8px; }
  .timer-display strong { font-size: 1.2rem; }
  .pause-button { width: 42px; height: 42px; }
  .game-stage { min-height: clamp(330px, 58svh, 520px); }
  .game-overlay { padding: 20px 16px; }
  .overlay-button { width: 100%; }
  .family-card { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .family-card-copy h2 { font-size: 1.3rem; }
  .family-card-actions { align-items: stretch; flex-direction: column; }
  .family-card-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .timer-display { transition: none; }
}
