/* ============================================
   Flap! — stylesheet
   Palette: sky blue / navy / sun-gold / pipe-green
   Headings: rounded system font stack (playful, chunky)
   Body: standard system-ui stack (readable)
   ============================================ */

:root {
  --sky-top: #4fb8e8;
  --sky-bottom: #dff3fc;
  --navy: #0b3559;
  --navy-soft: #12446f;
  --bird-blue: #2e86de;
  --bird-blue-dark: #1b4f8c;
  --belly: #fef6e4;
  --beak-orange: #f6a821;
  --pipe-green: #2fae5c;
  --pipe-green-dark: #1e7a3f;
  --ground-sand: #e8d9a0;
  --coral: #ff6b5b;
  --paper: #fbfdff;
  --ink: #12293f;
  --ink-soft: #4a6178;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-soft: 0 12px 30px -12px rgba(11, 53, 89, 0.35);

  --font-display: ui-rounded, "SF Pro Rounded", "Segoe UI Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, #fff8, transparent),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 45%, var(--paper) 45%);
  background-attachment: fixed;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

a { color: var(--bird-blue-dark); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

kbd {
  font-family: var(--font-body);
  font-size: 0.85em;
  background: var(--navy);
  color: #fff;
  padding: 0.12em 0.5em;
  border-radius: 6px;
  border-bottom: 2px solid #061c30;
}

code {
  background: #e6f1f9;
  padding: 0.1em 0.4em;
  border-radius: 5px;
  font-size: 0.92em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75em 1.6em;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary {
  background: linear-gradient(180deg, #ffcf5c, var(--beak-orange));
  color: var(--navy);
  box-shadow: 0 6px 0 #c47f0f, 0 10px 18px -8px rgba(196, 127, 15, 0.6);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #c47f0f; }

.btn-ghost {
  background: transparent;
  border: 2px solid var(--navy-soft);
  color: var(--navy-soft);
}
.btn-ghost:hover { background: var(--navy-soft); color: #fff; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 5vw;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 53, 89, 0.9);
  backdrop-filter: blur(6px);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; }
.brand-icon { font-size: 1.5rem; transform: scaleX(-1); }
.site-nav { display: flex; gap: 1.4rem; }
.site-nav a {
  color: #eaf6ff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--beak-orange); }

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: 4.5rem 6vw 5rem;
  max-width: 1200px;
  margin: 0 auto;
  color: #fff;
}
.hero-copy { max-width: 560px; }
.eyebrow {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: #eaf6ff;
  opacity: 0.9;
  margin-bottom: 0.6rem;
}
.hero h1 {
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  text-shadow: 0 3px 0 rgba(11,53,89,0.25);
}
.hero .lede { color: #f2fbff; font-size: 1.08rem; max-width: 50ch; }
.hero-art svg { width: min(280px, 40vw); height: auto; display: block; filter: drop-shadow(0 14px 20px rgba(11,53,89,0.35)); }

/* ---------- Game section ---------- */
.game-section {
  padding: 1rem 5vw 4rem;
  display: flex;
  justify-content: center;
}
.game-wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}
.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.hud-item { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.hud-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }
.hud-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--beak-orange); }

.canvas-frame {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 4px solid var(--navy);
  line-height: 0;
}
#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 600;
  touch-action: manipulation;
  cursor: pointer;
  outline: none;
}
#gameCanvas:focus-visible {
  box-shadow: inset 0 0 0 4px var(--beak-orange);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  text-align: center;
  padding: 1.5rem;
  background: rgba(11, 53, 89, 0.72);
  color: #fff;
}
.overlay h3 { color: #fff; font-size: 1.6rem; margin-bottom: 0.2rem; }
.overlay p { margin: 0; color: #eaf6ff; }

.controls-hint { color: var(--ink-soft); font-size: 0.92rem; text-align: center; }

/* ---------- How to play ---------- */
.how-to-play {
  background: var(--paper);
  padding: 4rem 6vw;
}
.how-to-play h2, .high-scores h2 {
  text-align: center;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin-bottom: 1.6rem;
}
.how-grid {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.steps {
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.steps li { padding-left: 0.3rem; }
.steps strong { color: var(--bird-blue-dark); }

.tips {
  background: #eaf6ff;
  border: 2px solid #cfeaf9;
  border-radius: var(--radius-md);
  padding: 1.4rem 1.6rem;
}
.tips h3 { font-size: 1.15rem; color: var(--bird-blue-dark); }
.tips ul { padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; margin: 0; }

/* ---------- High scores ---------- */
.high-scores {
  padding: 4rem 6vw 5rem;
  background: linear-gradient(180deg, var(--paper), #eef7fb);
}
.section-note {
  text-align: center;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 auto 1.8rem;
}
.score-panel {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
}
.score-list {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.score-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.85rem 1.3rem;
  border-bottom: 1px solid #eef2f6;
  font-weight: 600;
}
.score-list li:last-child { border-bottom: none; }
.score-list li:first-child {
  background: linear-gradient(90deg, #fff6df, #fff);
}
.score-rank { color: var(--bird-blue-dark); margin-right: 0.6em; }
.score-date { color: var(--ink-soft); font-weight: 400; font-size: 0.88rem; }
.score-empty { justify-content: center; color: var(--ink-soft); font-weight: 400; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: #cfe6f5;
  text-align: center;
  padding: 1.6rem 6vw;
  font-size: 0.88rem;
}
.site-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero { flex-direction: column-reverse; text-align: center; padding-top: 3rem; }
  .hero-copy { max-width: 100%; }
  .hero-art svg { width: 200px; }
  .how-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .site-header { padding: 0.9rem 4vw; }
  .site-nav { gap: 0.9rem; }
  .site-nav a { font-size: 0.85rem; }
  .brand-name { font-size: 1.1rem; }
  .hero { padding: 2.5rem 5vw 3rem; gap: 1.8rem; }
}
