:root {
  --straw: #f6e7c1;
  --straw-d: #e9d39c;
  --paper: #fffaf0;
  --ink: #3a2a1e;
  --ink-soft: #6b5745;
  --comb: #e63946;
  --comb-d: #b8202d;
  --yolk: #ffc93c;
  --yolk-soft: #ffe7a3;
  --beak: #ffb703;
  --user: #2463b8;
  --grass: #dff0d0;
  --display: 'Bagel Fat One', 'Cooper Black', Georgia, serif;
  --ui: 'Gabarito', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--ui);
  background-color: var(--straw);
  background-image:
    repeating-linear-gradient(115deg, rgba(190, 140, 60, .09) 0 2px, transparent 2px 23px),
    repeating-linear-gradient(62deg, rgba(190, 140, 60, .07) 0 2px, transparent 2px 31px),
    radial-gradient(ellipse at 50% 0%, #fff6dc 0, transparent 60%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------------- header ---------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 6px; max-width: 1180px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; }
.logo-hen { width: 44px; height: 44px; display: block; }
.logo-hen .hen { width: 100%; height: 100%; }
.logo-text { font-family: var(--display); font-size: 26px; letter-spacing: .5px; color: var(--ink); }
.logo-text b { font-weight: 400; color: var(--comb); }
.top-actions { display: flex; gap: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--paper); border: 2.5px solid var(--ink);
  font-weight: 800; font-size: 14px;
  box-shadow: 2px 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.chip-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--ink); }
.chip-btn:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button:focus-visible, input:focus-visible + .switch { outline: 3px solid var(--user); outline-offset: 3px; }

/* ---------------- shared hen face states ---------------- */
.hen .eye-happy, .hen .eye-x, .hen .eye-shock, .hen .beak-open { display: none; }
.hen.happy .eye-open { display: none; } .hen.happy .eye-happy { display: inline; }
.hen.shock .eye-open, .hen.faint .eye-open { display: none; }
.hen.shock .eye-shock { display: inline; } .hen.faint .eye-x { display: inline; }
.hen.shock .beak, .hen.sing .beak, .hen.faint .beak { display: none; }
.hen.shock .beak-open, .hen.sing .beak-open, .hen.faint .beak-open { display: inline; }
.hen.sing .eye-open { display: none; } .hen.sing .eye-happy { display: inline; }
.hen .eye-open { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; }
.hen .tail { transform-box: fill-box; transform-origin: 100% 100%; animation: wag 1.8s ease-in-out infinite; }
.hen .wing { transform-box: fill-box; transform-origin: 20% 30%; }
.hen.flap .wing, .hen.dance .wing { animation: flap .18s ease-in-out infinite alternate; }
.hen.furious .bodyshape { fill: #ffd0c8; }
.hen.furious .comb { fill: #ff1f3d; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
@keyframes flap { from { transform: rotate(0); } to { transform: rotate(-28deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------------- home ---------------- */
.home { max-width: 780px; margin: 0 auto; padding: 4px 18px 48px; display: grid; gap: 18px; }
.hero { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.hero-hen .hen { width: 170px; height: 175px; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(4px 6px 0 rgba(58, 42, 30, .18)); cursor: pointer; }
.hero-copy h1 { font-family: var(--display); font-weight: 400; font-size: clamp(54px, 11vw, 92px); line-height: .9; margin: 0; color: var(--ink); letter-spacing: 1px; text-shadow: 4px 5px 0 var(--yolk); }
.hero-copy h1 span { color: var(--comb); }
.tagline { margin: 8px 0 12px; font-weight: 800; font-size: 18px; color: var(--ink-soft); }
.hero-bubble {
  position: relative; margin: 0; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px;
  padding: 10px 14px; font-size: 15px; line-height: 1.35; box-shadow: 3px 4px 0 rgba(58, 42, 30, .2);
}
.hero-bubble::before { content: ''; position: absolute; left: -11px; top: 18px; width: 16px; height: 16px; background: var(--paper); border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.hero-bubble b { color: var(--comb); }

.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 14px 18px;
  box-shadow: 4px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 7px 0 var(--ink); }
.card:active { transform: translate(2px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.resume { background: var(--yolk); font-weight: 800; font-size: 17px; justify-content: space-between; }
.resume small { font-weight: 600; opacity: .8; }
.daily-egg { width: 46px; height: 58px; flex: none; }
.daily-egg .egg { width: 100%; height: 100%; animation: wobble 2.4s ease-in-out infinite; }
.daily-text { display: grid; gap: 2px; flex: 1; }
.daily-text b { font-family: var(--display); font-weight: 400; font-size: 22px; }
.daily-text small { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.daily-date { font-weight: 900; font-size: 13px; background: var(--ink); color: var(--yolk); border-radius: 999px; padding: 5px 10px; }
.daily.done { opacity: .75; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }

.picker h2 { font-family: var(--display); font-weight: 400; font-size: 22px; margin: 0 0 10px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.level {
  display: grid; justify-items: center; gap: 2px; padding: 12px 6px 14px;
  background: var(--paper); border: 3px solid var(--ink);
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  box-shadow: 3px 4px 0 var(--ink); transition: transform .15s, background .15s;
}
.level svg { width: 62px; height: 62px; }
.level b { font-weight: 900; font-size: 15px; line-height: 1.1; text-align: center; }
.level small { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; text-align: center; line-height: 1.15; }
.level:hover { transform: translateY(-3px) rotate(-2deg); }
.level.on { background: var(--yolk); transform: translateY(-4px) scale(1.04); box-shadow: 4px 6px 0 var(--ink); }
.level.on svg { animation: bob 1.2s ease-in-out infinite; }
.variants { display: flex; flex-wrap: wrap; gap: 9px; }
.variant {
  padding: 9px 15px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink);
  font-weight: 800; font-size: 15px; box-shadow: 2px 3px 0 var(--ink);
}
.variant.on { background: var(--comb); color: #fff; }
.variant-note { margin: 10px 2px 0; font-size: 14.5px; color: var(--ink-soft); font-weight: 600; min-height: 1.4em; }

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 54px; height: 30px; flex: none; border-radius: 999px; background: #d8c8a8; border: 2.5px solid var(--ink); position: relative; transition: background .2s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); transition: transform .2s; }
.toggle input:checked + .switch { background: var(--comb); }
.toggle input:checked + .switch::after { transform: translateX(23px); }
.toggle b { display: block; font-weight: 900; font-size: 16px; }
.toggle small { display: block; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.chaos-toggle { background: var(--paper); border: 2.5px dashed var(--ink-soft); border-radius: 16px; padding: 12px 16px; }

.big-btn {
  justify-self: center; display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 30px; letter-spacing: .5px;
  padding: 14px 40px 16px; border-radius: 999px;
  background: var(--comb); color: #fff; border: 3.5px solid var(--ink);
  box-shadow: 5px 6px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.big-btn:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 7px 8px 0 var(--ink); }
.big-btn:active { transform: translate(3px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.big-btn.small { font-size: 22px; padding: 10px 26px 12px; }
.big-btn.alt { background: var(--yolk); color: var(--ink); }

/* ---------------- game ---------------- */
.game {
  --bs: min(600px, calc(100dvh - 170px), calc(100vw - 380px));
  max-width: 1120px; margin: 0 auto; padding: 4px 20px 28px;
  display: grid; grid-template-columns: auto 320px; gap: 28px; justify-content: center; align-items: start;
}
.board-col { display: grid; gap: 10px; width: var(--bs); }
.status { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 15px; }
.status-title { font-family: var(--display); font-weight: 400; font-size: 18px; }
.timer { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 5px 12px; font-weight: 900; font-variant-numeric: tabular-nums; box-shadow: 2px 2px 0 var(--ink); }

.board-box { position: relative; width: var(--bs); height: var(--bs); }
.board-box.spinning { transform: rotate(90deg); transition: transform .95s cubic-bezier(.5, -.25, .3, 1.35); }
.board {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  background: var(--paper); border: 4px solid var(--ink); border-radius: 14px; overflow: hidden;
  box-shadow: 7px 8px 0 rgba(58, 42, 30, .28);
}
.cell {
  position: relative; border: 0; padding: 0; margin: 0; background: transparent;
  border-right: 1px solid #dccdb2; border-bottom: 1px solid #dccdb2;
  font-family: var(--ui); font-weight: 800; font-size: calc(var(--bs) / 9 * .56); line-height: 1;
  display: grid; place-items: center; color: var(--user); cursor: pointer;
  transition: background .12s;
}
.cell.c8 { border-right: 0; } .cell.r8 { border-bottom: 0; }
.cell.br { border-right: 3px solid var(--ink); } .cell.bb { border-bottom: 3px solid var(--ink); }
.cell.diag { background: #fff2dd; }
.cell.coop { background: var(--grass); }
.cell.eggcell::before {
  content: ''; position: absolute; left: 18%; right: 18%; top: 10%; bottom: 10%;
  background: #f0e3cc; border: 1.5px solid #dcc6a2; border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
}
.cell .v { position: relative; z-index: 1; }
.cell.given { color: var(--ink); font-weight: 900; }
.cell.peer { background: #fbf1d9; }
.cell.peer.coop { background: #d3eac0; }
.cell.same { background: var(--yolk-soft); }
.cell.sel { background: var(--yolk); }
.cell.wrong { color: var(--comb); background: #ffe1df; }
.cell.wrong .v { animation: nope .4s; }
.cell.conflict { background: #ffd2cf; }
.cell.hinted .v::after { content: ''; position: absolute; right: -9px; top: -4px; width: 7px; height: 9px; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; background: var(--yolk); border: 1.5px solid var(--ink); }
.cell.gold .v { color: #d48a00; text-shadow: 0 0 8px #ffd23f, 0 0 2px #fff; }
.cell.pop .v { animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
.cell.flash { animation: flash .7s ease-out; }
.cell .notes { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); z-index: 1; }
.cell .notes i { font-style: normal; font-size: calc(var(--bs) / 9 * .23); font-weight: 700; color: #8a765f; display: grid; place-items: center; }
.cell .notes i.hl { color: var(--ink); background: var(--yolk-soft); border-radius: 4px; }
@keyframes pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
@keyframes nope { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes flash { 0% { background: #fff6a8; } 100% { } }

.diag-lines { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); pointer-events: none; display: none; }
.diag-lines line { stroke: rgba(230, 57, 70, .28); stroke-width: .5; stroke-dasharray: 2 1.5; }
.board-box.diagonal .diag-lines { display: block; }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fx > * { pointer-events: auto; }
.pause-cover {
  position: absolute; inset: 0; z-index: 8; border-radius: 14px; border: 4px solid var(--ink);
  background: var(--straw); display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 20px;
  font-weight: 800; font-size: 18px;
}
.pause-hen .hen { width: 130px; height: 130px; }
.pause-hen .hen .eye-open { display: none; } .pause-hen .hen .eye-happy { display: inline; }

.ticker {
  position: relative; overflow: hidden; height: 34px; border-radius: 10px;
  background: var(--ink); color: var(--yolk); display: flex; align-items: center;
  font-weight: 800; font-size: 14px; opacity: .35; transition: opacity .3s;
}
.ticker.live { opacity: 1; }
.ticker-label { flex: none; background: var(--comb); color: #fff; padding: 0 10px; height: 100%; display: grid; place-items: center; font-family: var(--display); font-weight: 400; letter-spacing: .5px; z-index: 1; }
.ticker-text { white-space: nowrap; padding-left: 100%; }
.ticker.live .ticker-text { animation: ticker 16s linear forwards; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* side panel */
.side { display: grid; gap: 14px; position: sticky; top: 10px; }
.mascot { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; min-height: 120px; }
.mascot-hen .hen { width: 110px; height: 114px; animation: bob 2.4s ease-in-out infinite; cursor: pointer; transition: transform .3s; }
.mascot-hen .hen.faint { animation: faint 1.6s ease-in-out; }
.mascot-hen .hen.dance { animation: dance .45s ease-in-out infinite; }
.mascot-hen .hen.lay { animation: lay .7s ease-in-out; }
.mascot-hen .hen.sing { animation: sing .3s ease-in-out infinite; }
@keyframes faint { 0% { transform: rotate(0); } 25%, 75% { transform: rotate(-85deg) translate(-10px, 30px); } 100% { transform: rotate(0); } }
@keyframes dance { 0% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(12deg) translateY(-12px); } 100% { transform: rotate(-12deg) translateY(0); } }
@keyframes lay { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(1.12, .82) translateY(8px); } }
@keyframes sing { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06, .96); } }
.bubble {
  position: relative; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px;
  padding: 10px 13px; font-size: 14.5px; line-height: 1.32; font-weight: 600; min-height: 46px;
  box-shadow: 3px 4px 0 rgba(58, 42, 30, .2); transition: transform .2s;
}
.bubble::before { content: ''; position: absolute; left: -10px; top: 50%; width: 15px; height: 15px; margin-top: -8px; background: var(--paper); border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.bubble.say { animation: say .35s cubic-bezier(.3, 1.6, .5, 1); }
.bubble b { color: var(--comb); }
@keyframes say { from { transform: scale(.7); } to { transform: scale(1); } }

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 9px 4px 8px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px;
  font-weight: 800; font-size: 12.5px; box-shadow: 2px 3px 0 var(--ink);
}
.tool .ti { font-size: 22px; line-height: 1; }
.tool:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.tool.on { background: var(--yolk); }
.tool-flag { position: absolute; top: -8px; right: -6px; font-style: normal; font-size: 11px; font-weight: 900; background: var(--ink); color: var(--yolk); border-radius: 999px; padding: 2px 6px; }
.tool.on .tool-flag { background: var(--comb); color: #fff; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  position: relative; aspect-ratio: 1.15; display: grid; place-items: center;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px;
  font-family: var(--ui); font-weight: 900; font-size: 30px; color: var(--ink);
  box-shadow: 3px 4px 0 var(--ink); transition: transform .1s, box-shadow .1s, background .15s;
}
.key:hover { background: var(--yolk-soft); }
.key:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.key small { position: absolute; right: 7px; bottom: 4px; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.key.done { opacity: .32; }
.pad.notes-mode .key { color: var(--user); font-size: 22px; background: #eef4ff; }
.pad.panic .key { animation: panic .25s ease-in-out infinite alternate; }
.pad.panic .key:nth-child(2n) { animation-delay: -.12s; }
@keyframes panic { from { transform: rotate(-6deg) translateY(-2px); } to { transform: rotate(6deg) translateY(2px); } }
.legend { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 12px; padding: 8px; text-align: center; font-weight: 900; font-size: 13px; }
.legend span { display: grid; gap: 1px; }
.legend em { font-style: normal; font-size: 20px; }
.shortcuts { margin: 0; font-size: 12px; color: var(--ink-soft); font-weight: 600; line-height: 1.4; }

/* chicken language */
.kanakeel .cell .v, .kanakeel .key { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.kanakeel .cell .v { font-size: .78em; }

/* board moods */
.board-box.disco .board { animation: disco .5s steps(1) infinite; }
.board-box.disco .cell:nth-child(3n) { animation: discocell .5s steps(1) infinite; }
.board-box.disco .cell:nth-child(3n+1) { animation: discocell .5s steps(1) infinite -.25s; }
@keyframes disco { 0% { box-shadow: 0 0 0 6px #ff4fd8, 0 0 40px #ff4fd8; } 50% { box-shadow: 0 0 0 6px #3fd0ff, 0 0 40px #3fd0ff; } }
@keyframes discocell { 0% { background: rgba(255, 79, 216, .25); } 50% { background: rgba(63, 208, 255, .25); } }
.board-box.hypno .board { animation: hypno 2.2s ease-in-out infinite; }
@keyframes hypno { 0%, 100% { transform: rotate(0) skew(0); } 25% { transform: rotate(2deg) skew(3deg, 1deg); } 75% { transform: rotate(-2deg) skew(-3deg, -1deg); } }
.board-box.shake { animation: shake .12s linear 10; }
@keyframes shake { 0%, 100% { translate: 0 0; } 25% { translate: -5px 2px; } 75% { translate: 5px -2px; } }

/* fx pieces on the board */
.fx .egg-on { position: absolute; width: 11.1%; height: 11.1%; display: grid; place-items: center; cursor: pointer; border: 0; background: none; padding: 0; z-index: 6; }
.fx .egg-on .egg { width: 70%; height: 88%; animation: wobble 1.6s ease-in-out infinite; filter: drop-shadow(2px 3px 0 rgba(58, 42, 30, .3)); }
.fx .egg-on .crack { display: none; }
.fx .egg-on.cracking .crack { display: inline; }
.fx .egg-on.cracking .egg { animation: wobble .12s linear infinite; }
.fx .egg-on .chick { position: absolute; width: 80%; animation: hatch .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hatch { from { transform: translateY(30%) scale(.3); } to { transform: none; } }
.fx .flyer { position: absolute; width: 14%; transition: left .9s ease-in-out, top .9s ease-in-out; z-index: 7; pointer-events: none; }
.fx .flyer .hen { width: 100%; height: auto; }
.fx .stroller { position: absolute; width: 13%; transition: left 7s linear; z-index: 7; cursor: pointer; border: 0; background: none; padding: 0; }
.fx .stroller .hen { width: 100%; height: auto; animation: peckwalk .35s ease-in-out infinite; }
.fx .stroller.run { transition: left .7s ease-in; }
@keyframes peckwalk { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(14deg) translateY(4px); } }
.fx .peck { position: absolute; font-weight: 900; font-size: 13px; color: var(--comb); pointer-events: none; animation: rise .8s ease-out forwards; }
@keyframes rise { to { transform: translateY(-26px); opacity: 0; } }
.fx .golden { position: absolute; width: 9%; border: 0; background: none; padding: 0; cursor: pointer; animation: goldroll 1s ease-in-out infinite; z-index: 7; filter: drop-shadow(0 0 10px #ffd23f); }
.fx .golden .egg { width: 100%; height: auto; }
@keyframes goldroll { 0%, 100% { transform: rotate(-14deg) translateY(0); } 50% { transform: rotate(14deg) translateY(-8px); } }
.fx .foxrun { position: absolute; bottom: -6%; width: 34%; left: -40%; transition: left 4.2s linear; z-index: 7; pointer-events: none; }
.fx .foxrun .fox { width: 100%; height: auto; animation: peckwalk .3s ease-in-out infinite; }
.fx .rooster-pop { position: absolute; left: 50%; bottom: 0; width: 46%; translate: -50% 110%; transition: translate .45s cubic-bezier(.3, 1.6, .5, 1); z-index: 7; pointer-events: none; }
.fx .rooster-pop.up { translate: -50% 10%; }
.fx .rooster-pop .rooster { width: 100%; height: auto; }
.fx .eye-peek { position: absolute; left: 50%; bottom: 0; width: 70%; translate: -50% 100%; transition: translate .8s ease-out; z-index: 7; pointer-events: none; }
.fx .eye-peek.up { translate: -50% 18%; }
.fx .eye-peek .bigeye { width: 100%; height: auto; }
.fx .eye-peek .lid { transform-box: fill-box; transform-origin: top; transform: scaleY(0); animation: bigblink 2.6s infinite; }
@keyframes bigblink { 0%, 90%, 100% { transform: scaleY(0); } 94% { transform: scaleY(1); } }
.fx .note-fly { position: absolute; font-size: 26px; pointer-events: none; animation: notefly 2s ease-out forwards; }
@keyframes notefly { to { transform: translate(var(--dx), -140px) rotate(var(--rot)); opacity: 0; } }

/* sky layer: rain, parade, rockets, eggs */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.sky .fall { position: absolute; top: -120px; width: 70px; animation: fall linear forwards; }
.sky .fall .hen, .sky .fall .egg, .sky .fall .feather { width: 100%; height: auto; }
@keyframes fall { to { transform: translateY(calc(100vh + 160px)) rotate(var(--rot, 360deg)); } }
.sky .march { position: absolute; bottom: 8px; display: flex; align-items: flex-end; gap: 6px; left: 100%; animation: march 9s linear forwards; }
.sky .march .hen { width: 74px; height: auto; animation: peckwalk .3s ease-in-out infinite; }
.sky .march .rooster { width: 96px; height: auto; animation: peckwalk .3s ease-in-out infinite; }
.sky .march .flag { align-self: flex-start; background: var(--comb); color: #fff; font-family: var(--display); font-size: 20px; padding: 4px 10px; border: 3px solid var(--ink); border-radius: 8px; margin-right: -4px; }
@keyframes march { to { transform: translateX(calc(-100vw - 110%)); } }
.sky .spacehen { position: absolute; left: -260px; top: 70%; width: 230px; animation: space 4.2s ease-in forwards; }
.sky .spacehen svg { width: 100%; height: auto; display: block; }
.sky .spacehen .pilot { position: absolute; left: 50%; top: -38px; width: 70px; }
.sky .spacehen .pilot .hen { width: 100%; height: auto; }
@keyframes space { to { transform: translate(calc(100vw + 300px), -65vh) rotate(-18deg); } }
.sky .bounce { position: absolute; top: -90px; width: 46px; animation: bouncefall 1.8s cubic-bezier(.4, 0, .6, 1) forwards; }
.sky .bounce .egg { width: 100%; height: auto; }
@keyframes bouncefall { 60% { transform: translateY(var(--land)) rotate(200deg); } 75% { transform: translateY(calc(var(--land) - 60px)) rotate(260deg); } 100% { transform: translateY(var(--land)) rotate(320deg); opacity: 0; } }
.sky .feathers { position: absolute; width: 22px; animation: fall linear forwards; }

/* banners & toasts */
.banner {
  position: fixed; left: 50%; top: 14px; z-index: 70; translate: -50% -160%;
  max-width: min(92vw, 620px); text-align: center;
  font-family: var(--display); font-size: clamp(18px, 3.4vw, 26px); line-height: 1.15;
  background: var(--comb); color: #fff; border: 3.5px solid var(--ink); border-radius: 18px;
  padding: 12px 20px 14px; box-shadow: 5px 6px 0 var(--ink);
  transition: translate .45s cubic-bezier(.3, 1.5, .5, 1);
}
.banner.show { translate: -50% 0; }
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 70; translate: -50% 200%;
  background: var(--ink); color: var(--yolk); border-radius: 999px; padding: 10px 18px;
  font-weight: 900; font-size: 15px; transition: translate .35s cubic-bezier(.3, 1.5, .5, 1);
  max-width: 92vw; text-align: center;
}
.toast { opacity: 0; visibility: hidden; transition: translate .35s cubic-bezier(.3, 1.5, .5, 1), opacity .25s, visibility 0s .35s; }
.toast.show { translate: -50% 0; opacity: 1; visibility: visible; transition: translate .35s cubic-bezier(.3, 1.5, .5, 1), opacity .25s; }
.banner { visibility: hidden; transition: translate .45s cubic-bezier(.3, 1.5, .5, 1), visibility 0s .45s; }
.banner.show { visibility: visible; transition: translate .45s cubic-bezier(.3, 1.5, .5, 1); }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(58, 42, 30, .55); backdrop-filter: blur(3px); overflow-y: auto; }
.panel {
  width: min(560px, 100%); background: var(--paper); border: 3.5px solid var(--ink); border-radius: 22px;
  padding: 22px 22px 24px; box-shadow: 7px 8px 0 var(--ink); position: relative;
  animation: panelin .4s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes panelin { from { transform: scale(.8) rotate(-2deg); opacity: 0; } }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 0 0 12px; }
.panel .x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); font-weight: 900; font-size: 18px; }
.win-panel { text-align: center; }
.win-panel h2 { font-size: clamp(38px, 8vw, 56px); color: var(--comb); text-shadow: 3px 4px 0 var(--yolk); margin-bottom: 4px; }
.win-hen .hen { width: 150px; height: 155px; }
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.win-stats div { background: var(--straw); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 4px; }
.win-stats b { display: block; font-size: 22px; font-weight: 900; }
.win-stats small { font-weight: 700; color: var(--ink-soft); font-size: 12.5px; }
.record { display: inline-block; background: var(--yolk); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 900; rotate: -3deg; animation: bob 1s ease-in-out infinite; }
.win-fact { background: #fff3d4; border-radius: 14px; padding: 10px 12px; font-size: 14.5px; line-height: 1.35; margin: 10px 0 14px; text-align: left; }
.win-fact b { color: var(--comb); }
.win-ach { display: grid; gap: 6px; margin-bottom: 12px; }
.ach { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--straw); border: 2px solid var(--ink); border-radius: 14px; padding: 7px 10px; }
.ach .medal { font-size: 26px; }
.ach b { display: block; font-size: 15px; } .ach small { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.ach.locked { opacity: .38; filter: grayscale(1); }
.panel-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stats-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.stats-table th, .stats-table td { padding: 8px 6px; border-bottom: 1.5px dashed #d8c8a8; text-align: left; font-weight: 700; }
.stats-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.settings-list { display: grid; gap: 14px; margin-bottom: 18px; }

/* loading: the hen lays your puzzle */
.laying { display: grid; justify-items: center; gap: 4px; color: var(--paper); font-weight: 900; font-size: 20px; text-align: center; }
.laying-hen .hen { width: 170px; height: 175px; animation: lay .7s ease-in-out infinite; }
.laying-egg .egg { width: 54px; height: 70px; animation: drop .7s ease-in infinite; }
@keyframes drop { 0% { transform: translateY(-40px) scale(.3); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(0) scale(1); } }

/* ---------------- phones (built for Samsung Galaxy, 360–412 px wide) ---------------- */
button, .board, .pad { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.board, .pad, .tools, .status { -webkit-user-select: none; user-select: none; }
.menu-btn {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--paper); border: 2.5px solid var(--ink); font-size: 18px; font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink); padding: 0;
}
.status-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-sub { margin: 0 0 6px; font-weight: 800; color: var(--ink-soft); }
.win-extra { margin: 4px 0; font-weight: 700; font-size: 14.5px; }
.win-ach-title { font-weight: 900; margin: 6px 0; }
.install-box { background: var(--straw); border: 2px dashed var(--ink-soft); border-radius: 16px; padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 6px; justify-items: start; }
.install-box p { margin: 0; font-size: 14px; line-height: 1.4; }
@media (min-width: 861px) { .menu-btn { display: none; } }

@media (max-width: 860px) {
  body.in-game { overscroll-behavior: none; }
  body.in-game .top { display: none; }
  .game {
    --bs: min(calc(100vw - 12px), calc(100dvh - 268px - env(safe-area-inset-bottom) - env(safe-area-inset-top)), 560px);
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: calc(6px + env(safe-area-inset-top)) 6px calc(10px + env(safe-area-inset-bottom));
    max-width: none; min-height: 100dvh;
  }
  .board-col, .side { display: contents; }
  .status { order: 1; width: var(--bs); height: 42px; gap: 7px; font-size: 14px; }
  .status-title { font-size: 14.5px; }
  .status-mist span[data-i] { display: none; }
  .status-mist::before { content: '✖ '; color: var(--comb); }
  .timer { padding: 6px 10px; }
  .mascot { order: 2; width: var(--bs); height: 52px; min-height: 0; display: block; position: relative; z-index: 9; }
  .mascot-hen { position: absolute; left: 0; top: 0; }
  .mascot-hen .hen { width: 52px; height: 54px; }
  .bubble { position: absolute; left: 62px; right: 0; top: 3px; font-size: 13.5px; line-height: 1.3; padding: 6px 10px 7px; min-height: 0; }
  .bubble::before { top: 18px; margin-top: 0; }
  .bubble.quiet { opacity: 0; transform: scale(.95); pointer-events: none; transition: opacity .6s, transform .6s; }
  .board-box { order: 3; margin-block: auto; }
  .ticker { order: 4; position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; height: 34px; border-radius: 0; z-index: 65; display: none; }
  .ticker.live { display: flex; }
  .tools { order: 5; width: var(--bs); gap: 6px; }
  .tool { padding: 6px 2px 6px; font-size: 12px; border-radius: 12px; }
  .tool .ti { font-size: 20px; }
  .pad { order: 6; width: var(--bs); grid-template-columns: repeat(9, 1fr); gap: 5px; }
  .key { aspect-ratio: auto; height: 58px; font-size: 28px; border-radius: 12px; box-shadow: 2px 3px 0 var(--ink); }
  .key small { right: 3px; bottom: 2px; font-size: 10px; }
  .pad.notes-mode .key { font-size: 21px; }
  .legend { position: fixed; top: calc(54px + env(safe-area-inset-top)); left: 6px; right: 6px; z-index: 30; grid-template-columns: repeat(9, 1fr); padding: 5px 4px; font-size: 11px; box-shadow: 3px 4px 0 rgba(58, 42, 30, .25); }
  .legend em { font-size: 17px; }
  .shortcuts { display: none; }
  .sky .march { bottom: auto; top: 40px; }
  .sky .march .hen { width: 56px; } .sky .march .rooster { width: 72px; }
  .cell .notes i { font-size: calc(var(--bs) / 9 * .26); }
  .banner { top: calc(6px + env(safe-area-inset-top)); padding: 10px 16px 12px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* tall phones (Galaxy S2x and friends): bigger thumb keys, controls sit at the bottom */
@media (max-width: 860px) and (min-height: 760px) {
  .key { height: clamp(62px, calc((100dvh - var(--bs) - 210px) * .5), 78px); font-size: 30px; }
  .tool { padding: 9px 2px 8px; }
  .game { --bs: min(calc(100vw - 12px), calc(100dvh - 276px - env(safe-area-inset-bottom) - env(safe-area-inset-top)), 560px); }
}

@media (max-width: 560px) {
  .top { padding: 8px 12px 4px; }
  .logo-text { display: none; } .logo-hen { width: 40px; height: 40px; }
  .chip-btn { padding: 7px 10px; font-size: 13px; }
  .chip-btn span[data-i] { display: none; }
  .home { padding: 2px 12px calc(104px + env(safe-area-inset-bottom)); gap: 14px; }
  .hero { grid-template-columns: 104px 1fr; gap: 10px; }
  .hero-hen .hen { width: 104px; height: 108px; }
  .hero-copy h1 { font-size: 48px; }
  .tagline { font-size: 14.5px; margin: 4px 0 8px; }
  .hero-bubble { font-size: 13px; padding: 8px 10px; }
  .levels { gap: 7px; }
  .level { padding: 9px 3px 11px; }
  .level svg { width: 44px; height: 44px; }
  .level b { font-size: 13px; }
  .level small { font-size: 10.5px; }
  .variant { padding: 8px 12px; font-size: 14px; }
  .card { padding: 12px 14px; }
  #startBtn { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 20; white-space: nowrap; }
  #startBtn:hover { transform: none; }
  .win-stats b { font-size: 18px; }
  .panel { padding: 18px 16px 20px; }
  .win-hen .hen { width: 110px; height: 114px; }
}
@media (max-width: 380px) { .level small { display: none; } }

/* phone held sideways */
@media (orientation: landscape) and (max-height: 520px) {
  body.in-game .top { display: none; }
  .game {
    --bs: min(calc(100dvh - 58px), 56vw);
    display: grid; grid-template-columns: var(--bs) minmax(250px, 1fr); gap: 14px; align-items: start; justify-content: center;
    padding: 6px 12px;
  }
  .board-col, .side { display: grid; gap: 6px; }
  .status { height: 40px; }
  .mascot { height: 46px; }
  .mascot-hen .hen { width: 46px; height: 48px; }
  .bubble { left: 54px; }
  .pad { width: auto; grid-template-columns: repeat(3, 1fr); }
  .key { height: calc((100dvh - 150px) / 3); }
  .tools, .legend { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .board-box.hypno .board, .board-box.disco .board, .board-box.shake { animation: none !important; }
}
