/* Pixel UI in the spirit of krillion.io: VT323, square corners, dark navy panels
   with double-ring borders and hard offset shadows, over a pixel-art farm sky. */

/* VT323 served from here rather than Google Fonts: two fewer servers to reach
   before the text shows (SIL Open Font License, fonts/OFL.txt) */
@font-face {
  font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/vt323-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/vt323-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Japanese: a pixel font with kana and kanji (DotGothic16, cut down by
   tools/build_ja_font.py). Only fetched when Japanese is on the page; a bit
   smaller, to match VT323's letters. */
@font-face {
  font-family: "DotGothic16"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 82%;
  src: url(fonts/dotgothic16-kana.woff2) format("woff2");
  unicode-range: U+3000-30FF, U+FF01-FF60;
}
@font-face {
  font-family: "DotGothic16"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 82%;
  src: url(fonts/dotgothic16-kanji.woff2) format("woff2");
  unicode-range: U+4E00-9FFF;
}

:root {
  --der: #4da3ff;
  --die: #ff5d73;
  --das: #3fd394;
  --abyss: #050a14;
  --deep: #0d1a2e;
  --panel: #101d33;
  --line: #1b3050;
  --text: #e8f1ff;
  --muted: #7d93b8;
  --cyan: #4de3ff;
  --pink: #ff5d8f;
  --gold: #ffd166;
  --cream: #fff6c8;
  --px: 3px; /* set from the sky's pixel scale */
  --font: "VT323", "DotGothic16", "Courier New", monospace;
  --ring: 0 0 0 2px var(--abyss), 0 0 0 4px var(--line);
  --ring-lift: var(--ring), 0 4px 0 4px var(--deep);
  --panel-shadow: 0 0 0 3px var(--abyss), 0 0 0 5px var(--line), 10px 10px 0 #02050bd9;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font);
  font-size: 22px;
  line-height: 1.2;
  color: var(--text);
  background: #4f9f92;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; }
a { color: var(--cyan); }
b { font-weight: normal; color: var(--cream); }

#sky { position: fixed; left: 0; top: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

.art-m, .noun-m { color: var(--der); }
.art-f, .noun-f { color: var(--die); }
.art-n, .noun-n { color: var(--das); }

/* ---------- play ---------- */
#play {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  padding: calc(14px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
}
body[data-screen="home"] .hud,
body[data-screen="home"] .deck,
body[data-screen="home"] .gauge,
body:not([data-screen]) #play { visibility: hidden; }
body[data-screen="result"] .deck { opacity: 0; pointer-events: none; transition: opacity .3s steps(3); }

.hud { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 40px; height: 40px; border: 0;
  background: var(--panel); color: var(--text); font-size: 22px;
  box-shadow: var(--ring-lift);
}
.icon-btn:active { transform: translateY(2px); }
.mode, .alt {
  background: var(--panel);
  box-shadow: var(--ring);
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.mode { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 20px; }
.alt { font-size: 30px; line-height: 1; color: var(--gold); text-shadow: 0 0 8px #ffd16673; font-variant-numeric: tabular-nums; }
.alt small { font-size: 18px; margin-left: 2px; color: var(--muted); text-shadow: none; }

.gauge {
  position: fixed; right: 10px; top: 25%; bottom: 25%; width: 10px;
  background: var(--abyss);
  box-shadow: 0 0 0 2px var(--line);
}
/* --fill (0..1) reveals the stripes from the bottom: the window slides up while the
   stripes inside it slide down by as much, so they stay put. Transforms only, so
   the browser never lays the page out for it. */
.gauge { overflow: hidden; }
#gauge-fill {
  position: absolute; inset: 2px; overflow: hidden;
  transform: translateY(calc((1 - var(--fill, 0)) * 100%));
  transition: transform .8s steps(8);
}
#gauge-fill::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to top, var(--gold) 0 6px, transparent 6px 8px);
  transform: translateY(calc((var(--fill, 0) - 1) * 100%));
  transition: transform .8s steps(8);
}

/* ---------- balloon ---------- */
.bird {
  will-change: transform, translate, rotate;
  align-self: center;
  justify-self: center;
  position: relative;
  width: calc(var(--px) * 40);
  height: calc(var(--px) * 54);
  margin-right: 0; /* centred over the meadow */
  margin-bottom: 40px;
  /* --climb (-1..1) comes from the sky's altitude spring: a slight lean and lift while climbing */
  rotate: calc(var(--climb, 0) * 3deg);
  translate: 0 calc(var(--climb, 0) * -14px);
  /* resting on the meadow: --lift (set from the sky's ground height) moves the balloon
     down. A transform, not `top`, so taking off and landing never relayout the page. */
  transform: translateY(0);
  transition: transform 1.4s cubic-bezier(.3, 0, .2, 1), rotate .4s ease;
}
.bird[data-state="ground"] { transform: translateY(var(--lift, 0px)); }
.bird.no-move { transition: none; }
.bird-body { position: relative; width: 100%; height: 100%; transform-origin: 50% 0; }
.sprite, .layer, .pile { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* a light pixel rim keeps the dark outline readable against the night sky */
body.night .bird-body {
  --rim: #5d7ba6;
  filter: drop-shadow(var(--px) 0 0 var(--rim)) drop-shadow(calc(var(--px) * -1) 0 0 var(--rim)) drop-shadow(0 var(--px) 0 var(--rim)) drop-shadow(0 calc(var(--px) * -1) 0 var(--rim));
}
/* the burner fires while the balloon climbs, and on take-off */
.flame { opacity: clamp(0, calc(var(--climb, 0) * 5), 1); }
/* the flicker only runs while the burner is on (sky.js marks the balloon .climbing),
   not unseen all the time */
.bird.climbing .flame, .bird[data-state="takeoff"] .flame { animation: flicker .18s steps(1) infinite; }
.bird[data-state="takeoff"] .flame { opacity: 1; }
.bird[data-state="ground"] .flame { opacity: 0; }
.bird[data-state="fly"] .bird-body, .bird[data-state="takeoff"] .bird-body { animation: sway 4s ease-in-out infinite; }
/* the hen squats to lay; the balloon itself keeps swaying undisturbed */
.hen { transform-origin: calc(var(--px) * 15) calc(var(--px) * 44); }
.bird.laying:not([data-state="crash"]) .hen { animation: lay-squash .35s ease-out; }
.bird[data-state="hurt"] { animation: hurt .6s ease; }
/* crash: air rushes out and the balloon hangs for a moment, then drops with
   gravity, swaying a little, lands upright just behind the word card and settles
   with a small bounce. Only the envelope sags, anchored at its skirt, so the
   ropes stay attached to the gondola. */
.bird[data-state="crash"] {
  transform: translateY(var(--lift, 0px));
  rotate: 0deg;
  translate: 0 0;
  transition: none;
  animation: crash-fall 1.8s forwards;
}
.envelope { transform-box: view-box; transform-origin: 20px 34px; }
.bird[data-state="crash"] .envelope { animation: deflate 1.8s forwards; }

/* the hen can be tapped: a hit area over her, a hop and a "Buk buk buk!" bubble */
/* a rare, epic or legendary word: Birdie glows a little in its colour */
.bird[data-rarity="rare"] .hen { filter: drop-shadow(0 0 calc(var(--px) * 1.5) #4de3ff) drop-shadow(0 0 calc(var(--px) * .7) #4de3ffaa); }
.bird[data-rarity="epic"] .hen { filter: drop-shadow(0 0 calc(var(--px) * 1.5) #c08cff) drop-shadow(0 0 calc(var(--px) * .7) #ffd166aa); }
/* a steady glow (a filter, not an animation, so laying and hopping don't switch it off) */
.bird[data-rarity="legendary"] .hen { filter: drop-shadow(0 0 calc(var(--px) * 2) #ffd166) drop-shadow(0 0 calc(var(--px) * .8) #ff9ec0); }
.hen-hit {
  position: absolute; left: calc(var(--px) * 9); top: calc(var(--px) * 34);
  width: calc(var(--px) * 13); height: calc(var(--px) * 10);
  padding: 0; border: 0; background: none; cursor: pointer;
}
.bird.clucking .hen { animation: hen-hop .5s ease-out; }
.cluck {
  position: absolute; left: calc(var(--px) * 15); top: calc(var(--px) * 33); z-index: 3;
  translate: -100% -100%; transform-origin: 100% 100%;
  opacity: 0; pointer-events: none;
  filter: drop-shadow(2px 0 0 var(--abyss)) drop-shadow(-2px 0 0 var(--abyss)) drop-shadow(0 2px 0 var(--abyss)) drop-shadow(0 -2px 0 var(--abyss));
}
.cluck-bubble {
  display: block; padding: 3px 10px 4px; white-space: nowrap;
  font-size: 22px; line-height: 1; color: var(--abyss); background: var(--cream);
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
.cluck::after {
  content: ""; position: absolute; right: 6px; bottom: -8px;
  width: 10px; height: 9px; background: var(--cream);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 70% 100%, 70% 67%, 40% 67%, 40% 34%, 0 34%);
}
.bird.clucking .cluck { animation: cluck-pop 1.5s ease-out forwards; }
/* a hint: the bubble sits centred over the hen (so it fits a narrow phone), wraps,
   and stays until the next word */
.bird.hinting .hen { animation: hen-hop .5s ease-out; }
.bird.hinting .cluck { opacity: 1; translate: -50% -100%; transform-origin: 50% 100%; animation: hint-pop .3s ease-out; }
.bird.hinting .cluck-bubble { width: max-content; max-width: min(250px, 72vw); white-space: normal; text-align: center; font-size: 20px; line-height: 1.05; }
.bird.hinting .cluck::after { right: auto; left: calc(50% - 5px); }
@keyframes hint-pop { 0% { opacity: 0; scale: .3; } 60% { opacity: 1; scale: 1.08; } 100% { scale: 1; } }
@keyframes hen-hop { 25% { translate: 0 calc(var(--px) * -3); } 50% { translate: 0 0; } 70% { translate: 0 calc(var(--px) * -1.5); } }
@keyframes cluck-pop {
  0% { opacity: 0; scale: .3; rotate: 6deg; }
  15% { opacity: 1; scale: 1.12; rotate: -2deg; }
  25% { scale: 1; rotate: 0deg; }
  80% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: .8; }
}
body.over-mill { cursor: pointer; } /* over the windmill, a sheep or a chick */
/* what a tapped sheep or chick says, in the same pixel bubble as the hen */
.speech {
  position: fixed; z-index: 4; translate: -50% calc(-100% - 6px); transform-origin: 50% 100%;
  opacity: 0; pointer-events: none;
  filter: drop-shadow(2px 0 0 var(--abyss)) drop-shadow(-2px 0 0 var(--abyss)) drop-shadow(0 2px 0 var(--abyss)) drop-shadow(0 -2px 0 var(--abyss));
}
.speech-bubble {
  display: block; padding: 3px 10px 4px; white-space: nowrap;
  font-size: 22px; line-height: 1; color: var(--abyss); background: var(--cream);
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
.speech::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; translate: -50% 0;
  width: 10px; height: 9px; background: var(--cream);
  clip-path: polygon(0 0, 100% 0, 100% 34%, 80% 34%, 80% 67%, 60% 67%, 60% 100%, 40% 100%, 40% 67%, 20% 67%, 20% 34%, 0 34%);
}
.speech.show { animation: cluck-pop 1.2s ease-out forwards; }
.pile { filter: drop-shadow(var(--px) 0 0 #0d1a2e) drop-shadow(calc(var(--px) * -1) 0 0 #0d1a2e) drop-shadow(0 calc(var(--px) * -1) 0 #0d1a2e); }
.egg {
  position: absolute;
  width: calc(var(--px) * 4); height: calc(var(--px) * 5);
  background:
    linear-gradient(#fff 0 0) var(--px) var(--px) / var(--px) var(--px) no-repeat,
    linear-gradient(#0003 0 0) right calc(var(--px) * 1) bottom / var(--px) calc(var(--px) * 2) no-repeat,
    var(--egg);
  clip-path: polygon(25% 0, 75% 0, 75% 20%, 100% 20%, 100% 80%, 75% 80%, 75% 100%, 25% 100%, 25% 80%, 0 80%, 0 20%, 25% 20%);
  /* its slot in the pile is a translate, so making room slides it without a relayout */
  left: 0; top: 0;
  transition: translate .25s ease;
}
.egg.lay { animation: lay .55s cubic-bezier(.3, .7, .4, 1) both; }
.egg.wobble { animation: egg-wobble .16s steps(1) infinite; }
.egg.crack {
  background:
    repeating-linear-gradient(90deg, #1c2333 0 var(--px), transparent var(--px) calc(var(--px) * 2)) 0 calc(var(--px) * 2) / 100% var(--px) no-repeat,
    linear-gradient(#fff 0 0) var(--px) var(--px) / var(--px) var(--px) no-repeat,
    var(--egg);
}
.chick { position: absolute; width: calc(var(--px) * 7); height: calc(var(--px) * 8); }
.chick svg { display: block; width: 100%; height: 100%; }
@keyframes egg-wobble { 0% { transform: translateX(calc(var(--px) * -1)); } 50% { transform: translateX(var(--px)); } }
.count {
  position: absolute; left: calc(var(--px) * 31); top: calc(var(--px) * 36);
  padding: 0 4px; font-size: 18px; line-height: 1.1;
  background: var(--panel); color: var(--gold); box-shadow: var(--ring);
}
.pop { animation: pop .3s steps(3); }

@keyframes sway { 0%, 100% { transform: rotate(-1.5deg) translateY(0); } 50% { transform: rotate(1.5deg) translateY(calc(var(--px) * -2)); } }
@keyframes flicker { 50% { translate: 0 -1px; } } /* SVG user units: one sprite pixel */
@keyframes crash-fall {
  0% { transform: translateY(0px); rotate: 0deg; animation-timing-function: ease-out; }
  15% { transform: translateY(-8px); rotate: -2deg; animation-timing-function: cubic-bezier(.5, 0, 1, .55); }
  42% { rotate: 2deg; }
  72% { transform: translateY(var(--lift, 0px)); rotate: 0deg; animation-timing-function: ease-out; }
  82% { transform: translateY(calc(var(--lift, 0px) - 10px)); animation-timing-function: ease-in; }
  91% { transform: translateY(var(--lift, 0px)); animation-timing-function: ease-out; }
  96% { transform: translateY(calc(var(--lift, 0px) - 2px)); animation-timing-function: ease-in; }
  100% { transform: translateY(var(--lift, 0px)); rotate: 0deg; }
}
@keyframes deflate {
  15% { scale: 1.03 .95; }
  70% { scale: 1.08 .8; }
  76% { scale: 1.14 .7; }
  86% { scale: 1.08 .78; }
  100% { scale: 1.1 .75; }
}
/* the egg drops out under the hen, then arcs over onto the pile */
@keyframes lay {
  0% { transform: translate(var(--fx), calc(var(--fy) - var(--px) * 2)) scale(.3); }
  20% { transform: translate(var(--fx), var(--fy)) scale(1); }
  60% { transform: translate(calc(var(--fx) * .4), calc(var(--fy) * .4 - var(--px) * 9)); }
  100% { transform: translate(0, 0); }
}
@keyframes lay-squash { 30% { scale: 1.08 .85; } }
@keyframes pop { from { transform: scale(0); } }
@keyframes hurt { 20% { transform: translate(-6px, 10px); } 50% { transform: translate(6px, 14px); } }

/* ---------- card & answers ---------- */
.deck { display: grid; gap: 16px; align-self: end; }
/* The countdown runs as a CSS animation, like the gauge: the window slides left
   while the stripes inside slide right by as much, so they stay put. Transforms
   only, so it runs smoothly on the compositor; the border clips it (not padding). */
.timer { height: 12px; border: 2px solid var(--abyss); overflow: hidden; background: var(--abyss); box-shadow: 0 0 0 2px var(--line); }
#timer-fill { position: relative; height: 100%; overflow: hidden; }
#timer-fill::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, var(--pink) 0 8px, transparent 8px 10px); }
.timer.run #timer-fill { animation: timer-out var(--t) linear forwards; }
.timer.run #timer-fill::before { animation: timer-keep var(--t) linear forwards; }
.timer.hold #timer-fill, .timer.hold #timer-fill::before { animation-play-state: paused; } /* answered: the bar stops where it was */
@keyframes timer-out { to { transform: translateX(-100%); } }
@keyframes timer-keep { to { transform: translateX(100%); } }

.card {
  position: relative;
  background: var(--panel);
  padding: 14px 18px 16px;
  min-height: 150px;
  text-align: center;
  box-shadow: var(--panel-shadow);
}
.card-meta { font-size: 18px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
/* the hen's hint, top right of the card: 3 a day */
.hint-btn {
  position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border: 0; font-size: 20px; line-height: 1;
  background: var(--deep); color: var(--gold); box-shadow: var(--ring);
}
.hint-btn span { font-size: 17px; letter-spacing: .08em; text-transform: uppercase; }
.hint-btn .px { filter: drop-shadow(0 0 3px #ffd16699); }
.hint-btn:not(:disabled):hover .px { filter: drop-shadow(0 0 5px #ffd166); }
.hint-btn:disabled { color: var(--muted); opacity: .6; cursor: default; }
.hint-btn:disabled .px { filter: grayscale(1) brightness(.8); } /* the bulb is off */
body:not([data-screen="play"]) .hint-btn { visibility: hidden; }
.noun {
  font-size: clamp(48px, 15vw, 72px);
  line-height: 1;
  margin: 8px 0 6px;
  overflow-wrap: anywhere;
  color: var(--text);
  text-shadow: 3px 3px 0 var(--abyss);
}
.feedback { min-height: 1.2em; font-size: 26px; }
/* tap the noun: its English meaning pops up briefly above the card in a little
   pixel speech bubble (notched corners, stepped tail, dark pixel outline) */
.noun.has-gloss { cursor: pointer; }
.gloss {
  position: absolute; left: 50%; top: -18px; z-index: 2;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  max-width: 92%;
  pointer-events: none; opacity: 0;
  filter: drop-shadow(2px 0 0 var(--abyss)) drop-shadow(-2px 0 0 var(--abyss)) drop-shadow(0 2px 0 var(--abyss)) drop-shadow(0 -2px 0 var(--abyss));
}
.gloss-bubble {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 5px 8px;
  background: var(--cream); color: var(--abyss);
  font-size: 24px; line-height: 1; white-space: nowrap;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
.gloss-text { overflow: hidden; text-overflow: ellipsis; }
.gloss-tag { padding: 1px 4px 2px; font-size: 15px; letter-spacing: .08em; background: var(--pink); color: var(--cream); }
.gloss::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; translate: -50% 0;
  width: 12px; height: 10px; background: var(--cream);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 83% 40%, 83% 70%, 67% 70%, 67% 100%, 33% 100%, 33% 70%, 17% 70%, 17% 40%, 0 40%);
}
.gloss.show { animation: gloss-pop .4s cubic-bezier(.3, 1.5, .5, 1) forwards, gloss-float 1.1s ease-in-out .4s infinite alternate; }
.gloss.hide { animation: gloss-out .18s ease-in forwards; }
@keyframes gloss-pop { 0% { opacity: 0; scale: .3; rotate: -6deg; } 60% { opacity: 1; scale: 1.12; rotate: 2deg; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes gloss-float { from { opacity: 1; translate: -50% -100%; } to { opacity: 1; translate: -50% calc(-100% - 4px); } }
@keyframes gloss-out { from { opacity: 1; scale: 1; } to { opacity: 0; scale: .7; } }
.rule { display: block; margin-top: 8px; font-size: 20px; line-height: 1.15; color: var(--muted); }
.rule b { color: var(--text); }
.rule .new { font-style: normal; color: var(--gold); text-shadow: 0 0 8px #ffd16673; }
.card.enter { animation: enter .3s steps(3); }
.card.good { animation: good .3s steps(3); }
.card.bad { animation: shake .4s steps(4); }
@keyframes enter { from { transform: translateY(16px); opacity: 0; } }
@keyframes good { 50% { transform: translateY(-6px); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.answers button {
  position: relative;
  border: 0;
  padding: 12px 0 14px;
  font-size: 40px;
  line-height: 1;
  color: var(--abyss);
  /* translucent, so the farm shows through a little */
  background: color-mix(in srgb, var(--c) 72%, transparent);
  box-shadow: 0 0 0 2px var(--abyss), 0 5px 0 2px var(--abyss);
  transition: filter .2s steps(2);
}
.answers button[data-g="m"] { --c: var(--der); }
.answers button[data-g="f"] { --c: var(--die); }
.answers button[data-g="n"] { --c: var(--das); }
.answers button:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--abyss), 0 2px 0 2px var(--abyss); }
.answers button.right { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 6px var(--gold); }
.answers button.wrong { filter: grayscale(.85) brightness(.6); }
.answers button.out { filter: grayscale(.85) brightness(.45); cursor: default; } /* ruled out by a hint */

/* ---------- panels, buttons ---------- */
.panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  padding: 20px 18px;
  box-shadow: var(--panel-shadow);
  animation: rise .2s steps(4); /* quick, still in pixel steps */
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.panel h2 {
  font-weight: normal; font-size: 40px; line-height: 1; margin: 0 0 14px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--cyan); text-shadow: 0 0 8px #4de3ff73;
}
.panel h3 { font-weight: normal; font-size: 20px; margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.panel p { margin: 0 0 10px; line-height: 1.25; }
.panel .indent { padding-left: 22px; }
.panel .indent2 { padding-left: 44px; }
/* How to play: right and wrong, golden things and rarities in their colours */
.hw-right { color: #c3e86b; } /* lime and orange: apart from das green and die pink */
.hw-wrong { color: #ff9a3c; }
.hw-gold { color: var(--gold); }
.hw-common { color: #9fb0c8; }
.hw-rare { color: var(--cyan); }
.hw-epic { color: #c08cff; }
.hw-legendary { color: #ffd166; background: linear-gradient(90deg, #ff9ec0, #ffd166, #8ff0b4, #7fd3ff, #c08cff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.big-btn {
  display: grid; gap: 2px;
  border: 0;
  padding: 12px 16px;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text);
  background: var(--deep);
  box-shadow: var(--ring-lift);
}
.big-btn small { font-size: 18px; letter-spacing: .04em; text-transform: none; color: var(--muted); }
.big-btn.primary { background: var(--cyan); color: var(--abyss); box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--cyan), 0 4px 0 4px #123048, 0 0 18px #4de3ff40; }
.big-btn.primary small { color: #123048; }
.big-btn.ghost { background: transparent; box-shadow: none; color: var(--muted); font-size: 22px; }
.big-btn:active { transform: translateY(3px); }
.big-btn:hover:not(.ghost), .icon-btn:hover { filter: brightness(1.15); }
.big-btn.ghost:hover, .links button:hover, .link-btn:hover { color: var(--cyan); }

/* ---------- home ---------- */
.overlay, .sheet {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  grid-template-columns: minmax(0, 1fr);
}
.home { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; pointer-events: none; }
.home > * { pointer-events: auto; } /* only the title and the menu catch clicks */
.title { text-align: center; }
.title h1 {
  margin: 0;
  font-weight: normal;
  font-size: clamp(96px, 30vw, 160px);
  line-height: .9;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--cream);
  text-shadow: 0 6px 0 var(--abyss), -3px 2px 0 #ff5d8fcc, 3px -2px 0 #4de3ffb3;
}
.title-box { display: inline-grid; gap: 12px; margin-top: 14px; } /* picker spans the tagline's width */
.tagline {
  margin: 0;
  padding: 4px 10px;
  font-size: 22px;
  background: var(--panel);
  box-shadow: var(--ring);
}
.home-inner { grid-row: 3; max-width: 440px; text-align: center; padding: 18px; }
.modes { display: grid; gap: 18px; }
.title .levels { gap: 12px; }
.title .levels button {
  flex: 1; padding: 2px 6px; font-size: 18px; text-transform: uppercase; letter-spacing: .08em;
  background: var(--panel); box-shadow: var(--ring);
  transition: background .15s, color .15s, transform .1s;
}
.title .levels button[aria-checked="true"] { background: var(--cyan); color: var(--abyss); box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--cyan); }
.title .levels button:active { transform: scale(.92); }
.title .levels button.picked { animation: pick .3s ease-out; }
@keyframes pick { 0% { transform: scale(.86); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; margin-top: 18px; }
.links button, .link-btn {
  background: none; border: 0; padding: 4px 2px;
  font-size: 20px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.links button::before { content: "▸ "; color: var(--line); }

/* ---------- result ---------- */
.result { display: grid; place-items: end center; background: linear-gradient(to top, #050a1499, transparent 60%); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; }
.stat-grid div { background: var(--deep); box-shadow: var(--ring); padding: 8px 6px; text-align: center; display: grid; }
.stat-grid b { font-size: 34px; line-height: 1; color: var(--gold); }
.stat-grid span { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel .note { margin: 26px 0 10px; font-size: 18px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.story { margin: 0; padding: 12px 14px; background: var(--abyss); border: 2px dashed var(--line); }
.story .de { margin: 0; font-size: 28px; line-height: 1.15; }
.story .de.loading { color: var(--muted); animation: pulse 1.2s steps(2) infinite; font-size: 22px; }
.story .en { margin: 8px 0 0; color: var(--muted); font-size: 22px; }
.story .link-btn { margin-top: 6px; padding: 2px 0; font-size: 18px; }
.story .link-btn::before { content: "▸ "; }
@keyframes pulse { 50% { opacity: .35; } }
.words { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; max-height: 32vh; overflow-y: auto; }
.words li { padding: 6px 10px; background: var(--deep); box-shadow: inset 3px 0 0 var(--das); font-size: 22px; }
.words li.miss { box-shadow: inset 3px 0 0 var(--pink); background: #2a1024; }
.words li:empty { display: none; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.actions .big-btn { text-align: center; justify-content: center; }
.actions .ghost { grid-column: 1 / -1; padding: 4px; }

/* ---------- sheets ---------- */
.sheet { z-index: 5; display: grid; place-items: center; background: #050a14b3; overflow: hidden; }
/* the whole box stays on screen: title and controls stay put, only the part
   marked .scroll (the list or the text) scrolls inside it */
.sheet .panel {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px - var(--safe-top) - var(--safe-bottom));
  max-height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
}
.sheet .panel > * { flex-shrink: 0; }
/* margins add up in a flex column; keep the gaps under the title as they were */
.sheet .panel > h2 + h3 { margin-top: 6px; }
.sheet .panel > h2 + .note { margin-top: 12px; }
.sheet .panel > .scroll {
  flex-shrink: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
/* a pixel ✕, drawn as a mask so it sits exactly in the middle of its box */
.close {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; padding: 0;
  border: 0; background: var(--deep); color: var(--muted); font-size: 0;
  box-shadow: var(--ring);
}
.close::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--x-icon) center / contain no-repeat; mask: var(--x-icon) center / contain no-repeat;
}
:root { --x-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1H0zM1 1h1v1H1zM2 2h1v1H2zM3 3h1v1H3zM4 4h1v1H4zM5 5h1v1H5zM6 6h1v1H6zM6 0h1v1H6zM5 1h1v1H5zM4 2h1v1H4zM2 4h1v1H2zM1 5h1v1H1zM0 6h1v1H0z'/%3E%3C/svg%3E"); }
.close:hover { color: var(--pink); }
.dist { display: grid; gap: 6px; }
/* the level tabs under the numbers, small */
.seg.stats-levels { gap: 10px; margin: 14px 0 4px; }
.seg.stats-levels button { flex: 1; padding: 1px 4px 2px; font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
.dist .bar { display: grid; grid-template-columns: 22px 1fr 28px; align-items: center; gap: 8px; font-size: 20px; }
.dist i { display: block; height: 14px; min-width: 4px; background: var(--cyan); box-shadow: inset 0 -3px 0 #0b5a7a; } /* one solid bar, pixel shade at its foot */
.dist i.zero { background: var(--line); box-shadow: none; }
.dist b { text-align: right; }
.feather-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.feather-list li { padding: 8px 10px; background: var(--deep); box-shadow: var(--ring); display: grid; gap: 2px; font-size: 19px; line-height: 1.15; }
.feather-list li b { font-size: 22px; }
.feather-list li.g-m { box-shadow: var(--ring), inset 4px 0 0 var(--der); }
.feather-list li.g-f { box-shadow: var(--ring), inset 4px 0 0 var(--die); }
.feather-list li.g-n { box-shadow: var(--ring), inset 4px 0 0 var(--das); }
.feather-list li.locked { opacity: .4; }
/* room for the cards' outlines, which the scroll area would otherwise clip */
.feather-list.scroll, #stats-body, #settings-body { padding: 4px; margin: 0 -4px; }

.credit { margin-top: 18px; padding-top: 12px; border-top: 2px solid var(--line); color: var(--muted); }

/* ---------- coop ---------- */
.coop-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
#coop .coop-stats { grid-template-columns: repeat(4, 1fr); }
/* all four boxes are as tall as the tallest (the food, with its sack): the labels
   sit on one line at the bottom, the numbers centred in the same space above */
.coop-stats > * { display: grid; grid-template-rows: 1fr auto; align-items: center; padding: 6px 4px; text-align: center; background: var(--deep); box-shadow: var(--ring); }
.coop-stats b { font-size: 30px; line-height: 1; color: var(--gold); }
.coop-stats span { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.coop-filter { display: flex; gap: 10px; margin-bottom: 14px; }
.coop-filter button {
  flex: 1; padding: 4px 0; border: 0; font-size: 20px;
  background: var(--deep); color: var(--muted); box-shadow: var(--ring);
}
.coop-filter button[aria-pressed="true"] { background: var(--c, var(--cyan)); color: var(--abyss); box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--c, var(--cyan)); }
.coop-filter [data-g="m"] { --c: var(--der); }
.coop-filter [data-g="f"] { --c: var(--die); }
.coop-filter [data-g="n"] { --c: var(--das); }
/* a wooden wall of nest boxes with straw on the floor; three per row on a 360px phone */
.coop {
  list-style: none; margin: 0; padding: 8px;
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  /* rows exactly one nest tall: Safari otherwise squeezes them all into the
     scroll area's height (content-visibility leaves it no size to go by) */
  grid-auto-rows: 141px; align-content: start;
  background: repeating-linear-gradient(90deg, #5a3d33 0 22px, #4e352f 22px 24px);
  box-shadow: var(--ring);
}
.coop:empty { display: none; }
/* nests out of sight are not drawn at all (nor their glows animated). The extra
   4px all round keeps a picked nest's outline from being clipped. */
.coop > li { margin: -4px; padding: 4px; content-visibility: auto; contain-intrinsic-size: auto 149px; }
.nest {
  position: relative; display: grid; justify-items: center; align-content: end; gap: 4px;
  /* all boxes the same: room for the tallest bird (72px, a hen in a tall hat) and the
     label. The label sits the same 4px inside the frame on both sides, and a full
     strip of straw shows below it, so the frame is equally thick all round. */
  width: 100%; height: 141px; padding: 6px 6px 12px; border: 0;
  background: linear-gradient(to top, #d9b45a 0 10px, #b8923f 10px 12px, #2a1d19 12px);
  box-shadow: 0 0 0 2px var(--abyss);
  color: var(--text);
}
.nest[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
/* a little gem in the corner shows the rarity */
.nest::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--abyss); }
.nest[data-rarity="common"]::after { display: none; }
/* a fed bird has a tin bowl of grain in its nest */
.nest .bowl { position: absolute; left: 5px; top: 70px; z-index: 1; }
/* picking a bird to feed: the hungry ones wait, the rest step back */
.coop.feeding .nest:not([data-hungry]) { opacity: .4; }
.coop.feeding .nest[data-hungry] { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
.coop.feeding .nest[data-hungry]::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 0 3px #ffd166, inset 0 0 14px #ffd16680;
  animation: hungry .7s ease-in-out infinite alternate;
}
@keyframes hungry { from { opacity: 1; } to { opacity: .15; } }
.nest[data-rarity="rare"]::after { background: var(--cyan); }
.nest[data-rarity="epic"]::after { background: linear-gradient(135deg, #c08cff 50%, #ffd166 50%); }
.nest[data-rarity="legendary"]::after { background: linear-gradient(135deg, #ff9ec0, #ffd166, #8ff0b4, #7fd3ff); }

/* the birds (drawn by coop-art.js); outlines and glows are in sprite pixels */
.coop-bird { display: block; overflow: visible; }
.coop-bird .body { filter: drop-shadow(1px 0 0 var(--abyss)) drop-shadow(-1px 0 0 var(--abyss)) drop-shadow(0 1px 0 var(--abyss)) drop-shadow(0 -1px 0 var(--abyss)); }
.coop-bird.epic .body { filter: drop-shadow(1px 0 0 var(--abyss)) drop-shadow(-1px 0 0 var(--abyss)) drop-shadow(0 1px 0 var(--abyss)) drop-shadow(0 -1px 0 var(--abyss)) drop-shadow(0 0 2px var(--glow)); }
.coop-bird.legendary .body { animation: legend 3s steps(6) infinite; }
@keyframes legend {
  0%, 100% { filter: drop-shadow(1px 0 0 var(--abyss)) drop-shadow(-1px 0 0 var(--abyss)) drop-shadow(0 1px 0 var(--abyss)) drop-shadow(0 -1px 0 var(--abyss)) drop-shadow(0 0 3px #ffd166); }
  33% { filter: drop-shadow(1px 0 0 var(--abyss)) drop-shadow(-1px 0 0 var(--abyss)) drop-shadow(0 1px 0 var(--abyss)) drop-shadow(0 -1px 0 var(--abyss)) drop-shadow(0 0 3px #ff9ec0); }
  66% { filter: drop-shadow(1px 0 0 var(--abyss)) drop-shadow(-1px 0 0 var(--abyss)) drop-shadow(0 1px 0 var(--abyss)) drop-shadow(0 -1px 0 var(--abyss)) drop-shadow(0 0 3px #7fd3ff); }
}
.coop-bird .egg { animation: egg-shine 1.6s steps(8) infinite; } /* the golden egg: 5 redraws a second, not 60 */
@keyframes egg-shine { 0%, 100% { filter: drop-shadow(0 0 1px #ffd16699); } 50% { filter: drop-shadow(0 0 3px #ffd166); } }
.coop-bird .twinkle rect { animation: twinkle 1.6s steps(1) infinite; }
.coop-bird .twinkle rect:nth-child(2n) { animation-delay: .8s; }
.coop-bird .twinkle rect:nth-child(3n) { animation-delay: .4s; }
@keyframes twinkle { 50% { opacity: 0; } }
/* every label has room for the article and two lines of the word, so a long name
   never makes its box (and with it the whole row) taller; longer still ends in … */
.nest .label {
  display: grid; align-content: center; height: 47px;
  width: 100%; padding: 1px 0 2px; font-size: 17px; line-height: 1; text-align: center;
  background: var(--panel); box-shadow: 0 0 0 2px var(--abyss);
  overflow-wrap: anywhere; hyphens: manual;
}
.nest .label.long { font-size: 15px; } /* e.g. Kühlschrank stays on one line on a 360px phone */
.nest .label.longer { font-size: 13px; } /* e.g. Geschwindigkeits-/begrenzung on two lines */
.nest .label small { display: block; font-size: 14px; }
.nest .label .w { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* the picked bird, at the bottom of the box within thumb reach */
.coop-detail {
  margin: 14px -18px -20px; padding: 12px 18px 14px;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center;
  background: var(--deep); box-shadow: 0 -2px 0 var(--line);
}
.coop-detail:empty { display: none; }
.coop-detail .coop-bird { grid-row: span 5; align-self: end; }
.coop-detail .feed { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 17px; color: var(--muted); }
.coop-detail .feed .small-btn { display: flex; align-items: center; gap: 6px; font-size: 18px; padding: 2px 10px 2px 7px; color: var(--gold); }
.coop-detail .feed-pick { font-size: 20px; color: #f2d27a; }
.coop-detail .feed-cancel { grid-column: 2; justify-self: start; font-size: 18px; padding: 2px 10px; }
.coop-detail > .px { grid-row: span 2; }
/* reporting a mistake: a small flag next to the word, then the form in its place */
.coop-detail .report-btn { margin-left: 4px; padding: 4px; border: 0; background: none; vertical-align: middle; cursor: pointer; opacity: .7; }
.coop-detail .report-btn:hover { opacity: 1; }
.coop-detail .report { grid-column: 1 / -1; display: grid; gap: 8px; }
.coop-detail .report-title { font-size: 22px; line-height: 1.1; }
.coop-detail .report-what { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.coop-detail .report-what button { padding: 3px 4px; border: 0; font: inherit; font-size: 17px; color: var(--muted); background: var(--panel); box-shadow: var(--ring); cursor: pointer; }
.coop-detail .report-what button[aria-pressed="true"] { color: var(--abyss); background: var(--cyan); }
.coop-detail .report-note { padding: 4px 8px; border: 0; font: inherit; font-size: 18px; color: var(--cream); background: var(--abyss); box-shadow: var(--ring); }
.coop-detail .report-actions { display: flex; gap: 10px; }
.coop-detail .report-actions .small-btn { font-size: 18px; padding: 2px 12px; }
.coop-detail .report-send { color: var(--gold); }
/* the sack of the day's chicken food, next to the coop's counts */
.feed-bag:active { transform: translateY(2px); }
.feed-bag { border: 0; font: inherit; color: var(--text); cursor: pointer; background: var(--deep); box-shadow: var(--ring); }
.feed-bag .bag { display: flex; justify-content: center; align-items: center; gap: 4px; }
.feed-bag #sack { display: flex; }
.feed-bag:hover #sack { animation: wiggle .4s steps(2); }
.feed-bag[aria-pressed="true"] { background: #3a2a14; box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
.feed-bag.empty #sack { filter: grayscale(1) brightness(.7); }
.feed-bag.empty b { color: var(--muted); }
@keyframes wiggle { 50% { transform: rotate(-8deg); } }
/* fed: grain rains down, the bird pecks and a heart floats up */
.coop-detail { position: relative; }
.grain-fall { position: absolute; z-index: 2; pointer-events: none; }
.nest > .grain-fall { left: 50%; top: 4px; width: 56px; height: 80px; translate: -50% 0; }
.coop-detail > .grain-fall { left: 14px; bottom: 30px; width: 80px; height: 120px; }
.grain-fall i {
  position: absolute; left: var(--x); top: 0; width: 4px; height: 4px; background: #ffd166; box-shadow: 0 0 0 1px #9c6410; opacity: 0;
  animation: grain-drop .6s steps(6) var(--d) forwards;
}
.grain-fall i:nth-child(2n) { background: #e0a93a; }
@keyframes grain-drop { 0% { opacity: 1; transform: translateY(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(var(--fall, 64px)); } }
.coop-detail > .grain-fall i { --fall: 90px; }
.grain-fall .yum { position: absolute; left: 50%; top: 20%; translate: -50% 0; opacity: 0; animation: yum .7s steps(5) .7s forwards; }
@keyframes yum { 0% { opacity: 1; transform: translateY(10px); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.eating .coop-bird { transform-origin: 50% 100%; animation: peck .2s steps(1) .45s 4; }
@keyframes peck { 50% { transform: translateY(3px) rotate(10deg); } }
.nest.eating .bowl { animation: bowl-in .3s steps(3); }
@keyframes bowl-in { from { transform: scale(0); } }
.coop-detail .fed { color: #f2d27a; }
.coop-detail .word { font-size: 30px; line-height: 1; }
.rarity-badge { display: inline-block; vertical-align: middle; padding: 0 6px 1px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--abyss); }
.rarity-badge.common { background: #9fb0c8; }
.rarity-badge.rare { background: var(--cyan); }
.rarity-badge.epic { background: linear-gradient(90deg, #c08cff, #ffd166); }
.rarity-badge.legendary { background: linear-gradient(90deg, #ff9ec0, #ffd166, #8ff0b4, #7fd3ff, #c08cff); }
.coop-detail .desc { margin: 2px 0; padding: 0; border: 0; background: none; text-align: left; font-size: 18px; line-height: 1.1; color: var(--text); cursor: pointer; }
.coop-detail .desc small { display: block; margin-top: 2px; font-size: 16px; color: var(--muted); }
.coop-detail .en { font-size: 20px; line-height: 1; color: var(--muted); }
.pips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 17px; line-height: 1.1; color: var(--muted); }
.pips i { width: 10px; height: 10px; background: var(--abyss); box-shadow: 0 0 0 2px var(--line); }
.pips i.on { background: var(--gold); box-shadow: 0 0 0 2px #8a6a1e; }
.pips span { margin-left: 6px; }
.pips .sad { color: #7fd3ff; }

.seg { display: flex; gap: 14px; }
.seg button {
  flex: 1; border: 0; padding: 8px; font-size: 24px;
  background: var(--deep); color: var(--muted); box-shadow: var(--ring-lift);
}
.seg button[aria-checked="true"] { background: var(--cyan); color: var(--abyss); box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--cyan), 0 4px 0 4px #123048; }
.toggle { display: flex; gap: 12px; align-items: flex-start; font-size: 20px; color: var(--muted); cursor: pointer; }
.toggle input {
  appearance: none; flex: none; margin: 2px 0 0; width: 22px; height: 22px;
  background: var(--abyss); box-shadow: var(--ring); cursor: pointer;
}
.toggle input:checked { background: linear-gradient(var(--gold) 0 0) center / 10px 10px no-repeat, var(--abyss); }
#settings-body > h3:first-child { margin-top: 4px; }
/* account sync: the code, and a field for another device's code */
.account { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; font-size: 20px; color: var(--muted); }
.account .code-row + * { margin-top: 8px; }
.code-row { display: flex; gap: 12px; align-items: center; margin: 0; }
.code-row .code { flex: 1; font-weight: normal; font-size: 26px; letter-spacing: .08em; color: var(--gold); user-select: all; }
.code-row input {
  flex: 1; width: 0; padding: 4px 8px; border: 0; /* takes what the button leaves */
  font: inherit; font-size: 22px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--abyss); color: var(--text); box-shadow: var(--ring);
}
.code-row input::placeholder { color: var(--muted); opacity: .5; }
.small-btn {
  flex: none; padding: 4px 12px; border: 0; font-size: 20px;
  background: var(--deep); color: var(--text); box-shadow: var(--ring-lift);
}
.small-btn:active { transform: translateY(2px); }
.small-btn:disabled { opacity: .5; }

/* ---------- friends ---------- */
.friends-link { position: relative; }
.badge {
  position: absolute; top: -4px; right: -10px; min-width: 18px; padding: 0 4px;
  font-size: 15px; line-height: 18px; text-align: center; color: var(--abyss); background: var(--gold);
  box-shadow: 0 0 0 2px var(--abyss); animation: badge-bob 1s steps(2) infinite;
}
@keyframes badge-bob { 50% { transform: translateY(-2px); } }
/* room for the gold ring and the buttons' raised edges, which the scroll box would cut off */
#friends-body { margin: 0 -8px; padding: 6px 8px 12px; }
#friends-body > h3:first-of-type { margin-top: 18px; }
#friends-status { position: absolute; top: 30px; right: 62px; margin: 0; font-size: 15px; pointer-events: none; }
/* the friend code: a gold name tag to share */
.friend-tag {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: center;
  padding: 10px 12px; background: #3a2a14; color: var(--cream);
  box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold);
}
/* my balloon: tap it to pick another colour */
.friend-tag .avatar {
  grid-row: 1 / span 2; display: grid; place-items: center; min-width: 44px; padding: 2px; border: 0; cursor: pointer;
  background: linear-gradient(#3b8aa0, #a8dcc0); box-shadow: 0 0 0 2px var(--abyss);
}
.friend-tag .avatar:hover, .friend-tag .avatar[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
.friend-tag small { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.friend-tag .fid { grid-column: 2; font-weight: normal; font-size: 34px; line-height: 1; letter-spacing: .12em; color: var(--gold); user-select: all; }
.friend-tag .small-btn { grid-column: 3; grid-row: 1 / span 2; color: var(--gold); }
.nick { display: grid; gap: 4px; margin-top: 14px; font-size: 18px; color: var(--muted); }
.nick input { padding: 4px 8px; border: 0; font: inherit; font-size: 22px; color: var(--cream); background: var(--abyss); box-shadow: var(--ring); }
/* the save code: a different, secret code, kept locked away in Settings */
.panel .secret { margin: 18px 0 0; padding: 6px 10px; font-size: 17px; line-height: 1.2; color: var(--muted); background: var(--abyss); box-shadow: 0 0 0 2px var(--line); }
.panel .secret b { color: var(--pink); }
#add-friend { margin-bottom: 10px; }
/* the ranking box: three rows tall, the rest scrolls */
.friend-list {
  list-style: none; margin: 0; padding: 4px; display: grid; gap: 8px; max-height: 232px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
#deliveries h3 { margin-top: 16px; }
.friend-list .empty { padding: 10px; text-align: center; font-size: 18px; color: var(--muted); background: var(--deep); box-shadow: var(--ring); }
/* the ranking: everyone by their coop, medals for the top three */
.friend { display: grid; grid-template-columns: 24px 48px minmax(0, 1fr) auto auto; gap: 0 8px; align-items: center; padding: 6px; background: var(--deep); box-shadow: var(--ring); }
.friend .rank { display: grid; place-items: center; width: 24px; height: 24px; font-weight: normal; font-size: 20px; color: var(--muted); background: var(--panel); box-shadow: 0 0 0 2px var(--abyss); }
.friend.medal1 .rank { color: var(--abyss); background: #ffd166; }
.friend.medal2 .rank { color: var(--abyss); background: #c8d6ee; }
.friend.medal3 .rank { color: var(--abyss); background: #d0884a; }
.friend.medal1 { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px #ffd16699; }
.friend.me { background: #16294a; box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--cyan); }
.friend.me.medal1 { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px #ffd166; }
.friend-pic {
  display: grid; place-items: center; width: 48px; height: 52px; overflow: hidden;
  background: linear-gradient(#3b8aa0, #a8dcc0); box-shadow: 0 0 0 2px var(--abyss);
}
.friend .who { display: grid; gap: 2px; min-width: 0; }
.friend .line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.friend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: normal; font-size: 24px; line-height: 1; color: var(--cream); }
.friend .you { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.friend .pts { margin-left: auto; font-size: 17px; white-space: nowrap; color: var(--gold); }
.friend .chips { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 17px; color: var(--muted); }
.friend .chips span { display: flex; align-items: center; gap: 3px; }
.gem { display: inline-block; width: 8px; height: 8px; }
.gem.rare { background: var(--cyan); }
.gem.epic { background: linear-gradient(135deg, #c08cff 50%, #ffd166 50%); }
.gem.legendary { background: linear-gradient(135deg, #ff9ec0, #ffd166, #8ff0b4, #7fd3ff); }
.friend .send { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 6px; font-size: 17px; color: var(--gold); }
.friend .send:disabled { color: var(--das); }
/* picking my balloon's colour */
.balloon-pick { display: grid; gap: 6px; margin-top: 14px; padding: 8px 10px 10px; font-size: 17px; color: var(--muted); background: var(--deep); box-shadow: var(--ring); }
.balloon-pick[hidden] { display: none; }
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; } /* the 8 fill the bar */
.swatches button { display: grid; place-items: center; width: 100%; height: 40px; padding: 0; border: 0; background: linear-gradient(#3b8aa0, #a8dcc0); box-shadow: 0 0 0 2px var(--abyss); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
.unfriend { padding: 4px; border: 0; background: none; font-size: 16px; color: var(--muted); opacity: .6; }
.unfriend:hover { color: var(--pink); opacity: 1; }
.px { display: block; }
/* inside the barn, where baskets land: plank walls with board seams and nails, a
   roof beam with a lantern, a loft window letting in a sunbeam, hay and a pitchfork */
.porch {
  position: relative; min-height: 220px; display: flex; flex-wrap: wrap; justify-content: center; align-items: end; gap: 14px;
  padding: 30px 128px 14px 40px; overflow: hidden;
  background:
    linear-gradient(#3a2620 0 10px, #6b4a3f 10px 12px, #2a1a16 12px 14px, transparent 14px), /* the roof beam */
    radial-gradient(circle at 11px 52px, #a07448 0 1.5px, transparent 2px) 0 0 / 24px 64px, /* nails */
    repeating-linear-gradient(transparent 0 62px, #3a2620 62px 64px), /* board seams */
    repeating-linear-gradient(90deg, #5a3d33 0 3px, #634438 3px 19px, #5a3d33 19px 22px, #4e352f 22px 24px); /* planks */
  box-shadow: var(--ring), inset 0 -40px 40px -20px #0004;
}
.porch .floor { position: absolute; left: 0; bottom: 0; width: 100%; height: 30px; image-rendering: pixelated; }
.porch .loft {
  position: absolute; left: 14px; top: 30px; width: 44px; height: 36px;
  background:
    linear-gradient(90deg, transparent 19px, #3a2620 19px 25px, transparent 25px),
    linear-gradient(transparent 15px, #3a2620 15px 21px, transparent 21px),
    linear-gradient(#7fc8f8, #d8eecf);
  box-shadow: 0 0 0 4px #3a2620, 0 0 0 6px #6b4a3f;
}
/* light from the loft window, falling across the barn */
.porch .sunbeam {
  position: absolute; left: 18px; top: 60px; width: 150px; height: 170px; pointer-events: none;
  background: linear-gradient(#fff6c822, #fff6c805); clip-path: polygon(0 0, 30% 0, 100% 100%, 55% 100%);
}
.porch .hang { position: absolute; left: 52%; top: 14px; display: grid; justify-items: center; filter: drop-shadow(0 0 6px #ffd16688); }
.porch .hang::before { content: ""; width: 2px; height: 16px; background: #2a1d19; }
.porch .lantern { animation: swing 3s ease-in-out infinite alternate; transform-origin: 50% -16px; }
@keyframes swing { from { rotate: -4deg; } to { rotate: 4deg; } }
.porch .fork { position: absolute; left: 70px; bottom: 12px; rotate: -10deg; transform-origin: bottom; }
.porch .bales { position: absolute; right: 6px; bottom: 12px; display: grid; grid-template-columns: repeat(2, auto); justify-items: center; gap: 0; }
.porch .bales .hay:first-child { grid-column: 1 / span 2; margin-bottom: -2px; }
.porch .none { position: relative; z-index: 1; align-self: center; font-size: 18px; color: #e8d9b8; }
.delivery { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; }
.delivery .from { padding: 0 6px; font-size: 16px; color: #fff8e8; background: #2a1a1699; } /* above, see-through */
.delivery:not(.done) .parcel { cursor: pointer; }
.delivery.arrive .parcel { animation: arrive 2.2s cubic-bezier(.25, .6, .35, 1) both; }
@keyframes arrive { 0% { transform: translate(-40px, -260px); } 45% { transform: translate(18px, -90px); } 80% { transform: translate(-4px, 4px); } 100% { transform: none; } }
.delivery.landed:not(.open) .p-egg { animation: p-wobble .5s steps(4) 1.2s infinite alternate; }
/* wrong: the balloon floats away with the cracked egg */
.delivery.leave .parcel { animation: away 1.6s ease-in forwards; }
.delivery.leave .from { opacity: 0; transition: opacity .3s steps(3); }
@keyframes away { to { transform: translate(40px, -280px); opacity: 0; } }
/* the question: see-through, in the middle of the barn, over the basket */
.ask {
  position: absolute; left: 50%; top: 50%; z-index: 3; translate: -50% -50%; width: max-content; max-width: calc(100% - 24px);
  display: grid; justify-items: center; gap: 4px; padding: 10px 16px 12px;
  font-size: 18px; text-align: center; color: #f2e2c4; background: #3a2620cc; box-shadow: 0 0 0 2px #2a1a16aa; /* brown, see-through */
  animation: ask-in .25s steps(3);
}
@keyframes ask-in { from { opacity: 0; scale: .8; } }
.ask.fade { opacity: 0; transition: opacity .4s steps(4); }
.ask b { font-weight: normal; font-size: 28px; color: var(--cream); }
.ask-answers { display: flex; gap: 8px; margin-top: 2px; }
.ask-answers button { padding: 2px 12px; border: 0; font-size: 24px; color: var(--abyss); box-shadow: none; }
.ask-answers button:active { transform: translateY(2px); }
.ask-answers [data-g="m"] { background: var(--der); }
.ask-answers [data-g="f"] { background: var(--die); }
.ask-answers [data-g="n"] { background: var(--das); }
.p-egg.crack { animation: crack .4s steps(4); }
@keyframes crack { 25% { transform: translateX(-3px) rotate(-8deg); } 75% { transform: translateX(3px) rotate(8deg); } }
.p-egg.broken { filter: grayscale(.8); }
/* hatched: balloon and basket vanish in a puff */
.delivery.poof .parcel, .delivery.poof .from { animation: poof .3s steps(3) forwards; }
@keyframes poof { to { transform: scale(1.3); opacity: 0; } }
/* the chick walking about the barn floor (the tag with its word floats above it) */
.walker { position: absolute; bottom: 14px; z-index: 2; translate: -50% 0; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
.walker .tag { padding: 0 6px; font-size: 16px; white-space: nowrap; color: #fff8e8; background: #2a1a1699; }
.walker .body { display: block; transform-origin: 50% 100%; animation: hatch .6s steps(5) both, joy .5s steps(4) .7s 2; }
.walker.left .body .coop-bird { transform: scaleX(-1); }
.walker.peep .body { animation: joy .5s steps(4); }
@keyframes hatch { from { transform: scale(0) translateY(10px); } 60% { transform: scale(1.15); } }
@keyframes joy { 40% { transform: translateY(-12px) rotate(-6deg); } 70% { transform: translateY(-2px); } }
.piep {
  position: absolute; left: 50%; top: -26px; z-index: 4; translate: -50% 0; padding: 2px 8px 3px; white-space: nowrap;
  font-size: 20px; line-height: 1; color: var(--abyss); background: var(--cream); pointer-events: none;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
  animation: cluck-pop 1.2s ease-out forwards;
}
.sparkle { position: absolute; left: 50%; top: 40%; width: 4px; height: 4px; z-index: 3; background: var(--gold); animation: sparkle .9s steps(6) forwards; }
@keyframes sparkle { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
/* the balloon basket that carries a golden egg */
.parcel { position: relative; display: grid; justify-items: center; width: 64px; }
.p-balloon { transform-origin: 50% 100%; animation: bob 1.6s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-4px); } }
.p-basket { position: relative; width: 56px; height: 32px; margin-top: -2px; }
.p-basket .handle { position: absolute; left: 0; top: 0; }
.p-basket .front { position: absolute; left: 0; bottom: 0; z-index: 2; }
.p-egg { position: absolute; left: 16px; bottom: 8px; z-index: 1; transform-origin: 50% 100%; }
.p-egg.drop { animation: drop .45s cubic-bezier(.5, 0, 1, .6) both, p-wobble .5s steps(4) .45s 2; }
@keyframes drop { from { transform: translateY(-80px); opacity: 0; } 20% { opacity: 1; } }
@keyframes p-wobble { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.p-balloon.inflate { animation: inflate .6s steps(5) both; }
@keyframes inflate { from { transform: scale(0); } 70% { transform: scale(1.1); } }
.parcel.fly { animation: fly 1.9s ease-in forwards; }
@keyframes fly { 15% { transform: translateY(6px); } 100% { transform: translate(50px, -360px) rotate(6deg); } }
/* sending: a sheet over the friends list */
.send-egg[hidden] { display: none; }
/* in place of the friends list, so the sheet is only as tall as this */
.send-egg { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-bottom: 6px; overflow-y: auto; }
/* no golden hens yet: just the note, and Cancel */
.send-egg.empty .send-hens, .send-egg.empty .send-stage, .send-egg.empty #send-go { display: none; }
.send-egg h3 { margin: 0; color: var(--gold); font-size: 26px; text-transform: none; letter-spacing: .02em; }
.send-egg .note { margin: 0; text-transform: none; letter-spacing: 0; }
.send-hens { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; max-height: 190px; overflow-y: auto; padding: 4px; }
.send-hens button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; font-size: 16px; color: var(--text); background: var(--deep); box-shadow: var(--ring); overflow-wrap: anywhere; }
.send-hens button[aria-pressed="true"] { background: #3a2a14; box-shadow: 0 0 0 2px var(--abyss), 0 0 0 4px var(--gold); }
/* the farm's own sky and meadow (sky.js): teal sky, cream clouds, banded grass */
.send-stage {
  position: relative; flex: none; height: 170px; display: grid; place-items: end center; padding-bottom: 26px; overflow: hidden;
  background: #4f9f92; box-shadow: var(--ring);
}
/* pixel clouds drifting by, two at different heights and speeds */
.send-stage::before, .send-stage::after {
  content: ""; position: absolute; z-index: 1; left: 0; width: 16px; height: 8px; background: #fff6c8;
  box-shadow: 8px -8px 0 #fff6c8, 16px -8px 0 #fff6c8, 24px -8px 0 #fff6c8, 16px -16px 0 #fff6c8, 16px 0 0 #fff6c8, 32px 0 0 #f0e2b6, 40px 0 0 #e3d3a5;
  animation: stage-cloud 38s linear infinite;
}
.send-stage::before { top: 44px; animation-delay: -12s; }
.send-stage::after { top: 78px; scale: .75; animation-duration: 26s; animation-delay: -20s; opacity: .9; }
@keyframes stage-cloud { from { translate: -60px 0; } to { translate: 420px 0; } }
.send-stage .scene { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.send-stage .parcel { z-index: 2; }
.send-stage .p-balloon:not(.inflate) { visibility: hidden; }
.stage-hint { position: absolute; z-index: 2; top: 8px; left: 0; right: 0; text-align: center; color: var(--cream); text-shadow: 2px 2px 0 var(--abyss); }
#send-go { color: var(--gold); }
/* the "Support Birdie" box in Settings: flat, with a thin outline */
.support {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; margin-top: 16px; padding: 10px 12px;
  background: #3a2a14; box-shadow: 0 0 0 2px #ff5d7380;
}
.support[hidden] { display: none; }
.support .heart { grid-row: span 2; }
.support b { display: block; font-weight: normal; font-size: 20px; color: var(--cream); }
.support span { font-size: 17px; line-height: 1.15; color: #d8c8a8; }
.support .support-btn { grid-column: 2; justify-self: start; color: var(--pink); text-decoration: none; box-shadow: 0 0 0 2px var(--abyss); }

/* ---------- up high: milestones, names of things in the sky, gusts ---------- */
.milestone {
  position: fixed; left: 50%; top: calc(16% + var(--safe-top)); z-index: 6; translate: -50% 0; padding: 6px 16px 8px; white-space: nowrap;
  font-size: 26px; color: var(--abyss); background: var(--gold); box-shadow: 0 0 0 2px var(--abyss), 0 4px 0 2px var(--abyss);
  opacity: 0; pointer-events: none;
}
.milestone.show { animation: milestone 2.8s steps(14) forwards; }
@keyframes milestone { 0% { opacity: 0; transform: translateY(-14px) scale(.8); } 12%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
/* small, beige, with a greyish outline */
.sky-tag {
  position: fixed; z-index: 6; translate: -50% calc(-100% - 10px); padding: 2px 8px 3px; white-space: nowrap; font-size: 16px;
  color: var(--abyss); background: #f2e7c9; box-shadow: 0 0 0 2px #7d8996; opacity: 0; pointer-events: none;
}
.sky-tag.show { animation: cluck-pop 2s ease-out forwards; }
.sky-tag small { font-size: 14px; color: #5a6478; }
.sky-tag .new { color: #b07a10; }
/* the article colours, a shade darker so they read on beige */
.sky-tag .art-m { color: #2f7fd6; }
.sky-tag .art-f { color: #e0405a; }
.sky-tag .art-n { color: #1f9e68; }
.bird.gust .bird-body { animation: gust 1.4s ease-in-out; }
@keyframes gust { 25% { transform: rotate(6deg) translateX(8px); } 60% { transform: rotate(-3deg) translateX(-3px); } }
/* the feathers page: tabs for the rule feathers and the sky log */
.seg.feather-tabs { gap: 10px; margin: -4px 0 4px; }
.seg.feather-tabs button { flex: 1; padding: 1px 4px 2px; font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
/* the sky log */
.feather-list .log-head { grid-column: 1 / -1; margin-top: 0; padding: 0; background: none; box-shadow: none; font-size: 18px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.feather-list .heights { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; background: none; box-shadow: none; }
.feather-list .heights span { padding: 2px 0; font-size: 18px; text-align: center; white-space: nowrap; color: var(--abyss); background: var(--gold); box-shadow: inset 0 0 0 1px currentColor; }
.feather-list .heights span.off { color: #3a4a66; background: var(--deep); }

.loading-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-size: 26px; color: var(--cream); text-shadow: 2px 2px 0 var(--abyss); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 30px);
  background: var(--panel); color: var(--text); padding: 8px 14px; box-shadow: var(--ring);
  opacity: 0; transition: .25s steps(3); pointer-events: none; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the menu on phones: slimmer buttons and two rows of links, so the balloon and
   its basket stay in view above it */
@media (max-width: 600px) {
  .home-inner { display: flex; flex-direction: column; justify-content: center; padding: 14px 14px 12px; } /* main.js stretches it up to the basket */
  .modes { gap: 12px; }
  .home .big-btn { padding: 8px 12px 9px; font-size: 25px; }
  .home .big-btn small { font-size: 16px; }
  .links { gap: 0 14px; margin-top: 10px; }
  .links button { padding: 3px 0; font-size: 18px; }
  .links button::before { content: none; }
}
/* the coop on phones: three nests a row at most, a slimmer top, and only the
   nests scroll, so the picked bird always stays in view below them. Only if
   not even one row fits does the whole sheet scroll. */
@media (max-width: 600px) {
  #coop.sheet { padding-top: calc(12px + var(--safe-top)); padding-bottom: calc(12px + var(--safe-bottom)); }
  #coop .panel {
    padding: 14px 14px 16px; overflow-y: auto; overscroll-behavior: contain;
    max-height: calc(100vh - 24px - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
  }
  #coop .close { top: 12px; right: 12px; }
  #coop h2 { font-size: 30px; margin-bottom: 10px; }
  #coop .coop-stats { gap: 8px; margin-bottom: 10px; }
  #coop .coop-stats b { font-size: 24px; }
  #coop .coop-stats span { font-size: 13px; }
  #coop .coop-filter { gap: 8px; margin-bottom: 10px; }
  #coop .coop-filter button { padding: 2px 0; font-size: 18px; }
  #coop .coop { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); min-height: 157px; }
  #coop .coop-detail { margin: 10px -14px -16px; padding-left: 14px; padding-right: 14px; }
}
/* short phones: the picked bird's bar is more compact */
@media (max-width: 600px) and (max-height: 780px) {
  .coop-detail { padding: 8px 18px 10px; gap: 2px 12px; }
  .coop-detail .coop-bird { width: auto; height: 84px; }
  .coop-detail .word { font-size: 26px; }
  .coop-detail .desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; font-size: 16px; }
  .coop-detail .desc:has(small:not([hidden])) { display: block; } /* tapped for English: all of it */
}
/* short phones: the two flights side by side */
@media (max-width: 600px) and (max-height: 700px) {
  .home .modes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home .big-btn { padding: 8px 6px 9px; font-size: 21px; }
  .home .big-btn small { display: none; }
}

/* short phones (iPhone X, SE, …): a slimmer card and buttons leave room to see
   Birdie in the basket. Only phone-sized screens; a desktop window keeps it all. */
@media (max-width: 600px) and (max-height: 720px) {
  #play { padding-bottom: calc(12px + var(--safe-bottom)); }
  .deck { gap: 10px; }
  .card { min-height: 112px; padding: 8px 14px 10px; }
  .card-meta { font-size: 16px; }
  .hint-btn { top: 6px; right: 6px; }
  .noun { font-size: clamp(40px, 12.5vw, 58px); margin: 6px 0 4px; }
  .feedback { font-size: 22px; }
  .rule { margin-top: 4px; font-size: 18px; }
  .answers { gap: 12px; }
  .answers button { padding: 8px 0 10px; font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .timer.run #timer-fill, .timer.run #timer-fill::before { animation-duration: var(--t) !important; } /* the countdown is a clock, not decoration */
}

/* ---------- share sheet ---------- */
.share-panel { max-width: 440px; }
.share-card { display: block; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto 12px; image-rendering: pixelated; box-shadow: var(--ring); background: var(--deep); }
.share-text {
  display: block; width: 100%; margin: 0 0 12px; padding: 8px 10px; resize: none;
  font: inherit; font-size: 19px; line-height: 1.15; color: var(--text);
  background: var(--abyss); border: 0; box-shadow: var(--ring);
}
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.share-grid .big-btn { font-size: 22px; padding: 10px 6px; text-align: center; justify-content: center; }
/* the scroll area clips shadows, so it gets room all round: the buttons' pixel edges (their rings) stay whole */
.share-panel > .scroll { padding: 8px 8px 12px; margin: 0 -8px; }
.share-tip { margin: 14px 0 4px; }

/* the coop stays put: never any sideways scrolling, and no scrolling at all (so no rubber-banding on iOS)
   while everything fits; main.js sets .fits */
#coop .coop { overflow-x: hidden; overscroll-behavior: none; touch-action: pan-y; }
#coop .panel { overflow-x: hidden; overscroll-behavior: none; }
#coop .coop.fits, #coop .panel.fits { overflow-y: hidden; touch-action: none; }

/* ---------- Competitive ---------- */
/* while Birdie flies off to the arena the title and the menu drop away */
.home.away .title { transform: translateY(-140%); transition: transform .9s cubic-bezier(.5, 0, 1, .6); }
.home.away .home-inner { transform: translateY(140%); transition: transform .9s cubic-bezier(.5, 0, 1, .6); animation: none; }
/* the arena (competitive/) opens in a frame over the farm */
.comp-frame { position: fixed; inset: 0; z-index: 9; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; pointer-events: none; transition: opacity .25s steps(4); }
.comp-frame.show { opacity: 1; pointer-events: auto; }
/* three menu buttons: the Daily Flight on its own, Sky High and Competitive side by side, so the menu stays as low as before
   and does not cover the balloon's basket */
#home .modes { grid-template-columns: 1fr 1fr; gap: 12px; }
#home #daily-btn { grid-column: 1 / -1; }
#home .modes .big-btn:not(.primary) { font-size: 23px; padding: 9px 8px 10px; text-align: center; justify-items: center; }
#home .modes .big-btn:not(.primary) small { font-size: 15px; line-height: 1.05; }
/* very short screens (an iPhone SE): the menu buttons drop their small print, so the menu stays clear of the basket */
@media (max-height: 600px) {
  #home .modes { gap: 8px; }
  #home .modes .big-btn { padding: 7px 8px 8px; }
  #home .modes .big-btn small { display: none; }
  #home .links { margin-top: 4px; }
  #home .home-inner { padding: 9px 12px 8px; }
  #home .links button { padding: 1px 0; }
}
.share-panel h2 { font-size: 30px; padding-right: 38px; } /* "Share your flight" no longer runs under the close button */
/* without the phone's own Share button the Post on X button takes the whole row, so the others pair up */
.share-grid:not(:has(#share-more:not([hidden]))) .big-btn:first-child { grid-column: 1 / -1; }
/* a little air between the "other device" code box and the Google sign-in below it */
#google-box { margin-top: 22px; }
