/* Fenceville — mirrors docs/DESIGN.md of the game (direction D "Pixel farm": parchment background, dark brown
   outlines (never black), square buttons with notched pixel corners and a 4 px lip, Fredoka; pixel art stays in the
   drawings). */
:root {
  color-scheme: light;
  --bg: #f4e8c9;
  --bg-deep: #ecdcb4;
  --surface: #fff7e2;
  --text: #3a2718;
  --muted: #6e5338;
  --primary: #4e7a2e;
  --primary-text: #fff7e2;
  --accent: #e0a33a;
  --danger: #a63f2b;
  --border: #3a2718;
  --track: #e2cfa2;
  --ground: #c9a56b;
  --grass: #7fb04a;
  --fence: #d9985a;
  --post: #8a5a2e;
  --sign: #f2d9a2;
  --salon: #e58fa6;
  --space: #5b3fa8;
  --space-bg: #1b1838;
  --laser: #7ff3ff;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 500 17px/1.6 'Fredoka', system-ui, sans-serif; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 700; line-height: 1.1; }
a:focus-visible, button:focus-visible, .gallery:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--text); }
.wrap { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
.game-skip { position: fixed; top: -80px; left: 16px; z-index: 30; padding: 10px 16px; background: var(--primary); color: var(--primary-text); font-weight: 600; text-decoration: none; }
.game-skip:focus { top: 12px; }

/* Pixel frame: a 3 px outline on the four sides with empty corners (DESIGN.md › Boutons, Cartes). */
/* Applied to every framed element; each one sets --fill. */
.panel, .btn, .ribbon, .eyebrow, .languages a, .device, .mission, .hud .time, .float-tag, .cards .icon, .hint-card .quote { --fill: var(--surface); --line: var(--border); background:
  linear-gradient(var(--line), var(--line)) 3px 0 / calc(100% - 6px) 3px no-repeat,
  linear-gradient(var(--line), var(--line)) 3px 100% / calc(100% - 6px) 3px no-repeat,
  linear-gradient(var(--line), var(--line)) 0 3px / 3px calc(100% - 6px) no-repeat,
  linear-gradient(var(--line), var(--line)) 100% 3px / 3px calc(100% - 6px) no-repeat,
  linear-gradient(var(--fill), var(--fill)) 3px 3px / calc(100% - 6px) calc(100% - 6px) no-repeat; }

/* ---------- Header + hero ---------- */
.meadow { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse 55% 65% at 75% 50%, #f9efd5 0%, transparent 70%), var(--bg); }
/* Dirt specks, like the ground tiles of the board. */
.meadow::before { content: ''; position: absolute; z-index: -1; inset: 0; opacity: .5; background-image: radial-gradient(#d8c08f 1.5px, transparent 1.6px), radial-gradient(#e2cfa2 1.5px, transparent 1.6px); background-size: 46px 46px, 70px 70px; background-position: 0 0, 23px 31px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 25px; text-decoration: none; }
.brand img { width: 46px; height: 46px; image-rendering: pixelated; box-shadow: 0 0 0 3px var(--border); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; }
.site-nav a { padding: 6px 12px; text-decoration: none; }
.site-nav a:not(.btn):hover { background: #fff7e2aa; }
.site-nav .nav-world { color: var(--muted); }
.site-nav .nav-cta { margin-left: 6px; padding: 8px 16px; font-size: 16px; }
.languages { display: flex; flex-wrap: wrap; gap: 8px; }
.languages a { min-width: 46px; padding: 3px 10px; text-align: center; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--muted); }
.languages a[aria-current="page"] { --fill: var(--primary); color: var(--primary-text); }

.hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; padding-block: 30px 90px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 9px; height: 9px; background: var(--grass); box-shadow: 0 0 0 2px var(--border); }
h1 { margin: 22px 0 18px; font-size: clamp(62px, 8vw, 100px); letter-spacing: -.02em; line-height: .95; }
.h1-sub { display: block; margin-top: 14px; color: var(--primary); font-size: clamp(26px, 3vw, 36px); line-height: 1.15; }
.intro { max-width: 480px; color: var(--muted); font-size: 18px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding: 0; list-style: none; }
.chips li { padding: 3px 12px; border: 2px dashed var(--track); color: var(--muted); font-size: 14px; font-weight: 600; }

/* Buttons: no rounding, notched corners, 4 px solid lip; pressed drops 4 px at once (DESIGN.md › Boutons). */
.btn { --fill: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 24px; border: 0; box-shadow: 0 4px 0 var(--border); color: var(--text); font: 600 18px/1.2 'Fredoka', sans-serif; text-decoration: none; cursor: pointer; }
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn-primary { --fill: var(--primary); color: var(--primary-text); box-shadow: inset 0 3px 0 #ffffff40, 0 4px 0 var(--border); }

/* Hero board: a 4 × 4 meadow grid. The fence goes down one plank per step, then the grass grows and the sheep moves in. */
.hero-visual { position: relative; display: grid; place-items: center; min-height: 480px; }
.device { position: relative; width: min(420px, 100%); padding: 18px; --fill: var(--surface); box-shadow: 0 6px 0 #3a271833, 0 30px 60px #6e533833; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-weight: 600; }
.hud .time { padding: 2px 12px; font-variant-numeric: tabular-nums; }
.mission { margin-bottom: 14px; padding: 8px 14px; text-align: center; font-size: 15px; }
.mission span { color: var(--muted); }
.board { display: block; width: 100%; height: auto; shape-rendering: crispEdges; }
.board text { font: 700 22px 'Fredoka', sans-serif; fill: var(--text); text-anchor: middle; dominant-baseline: central; }
.board .loop { stroke-dasharray: 560; stroke-dashoffset: 0; }
.progress { margin-top: 14px; font-size: 14px; font-weight: 600; }
.progress i { display: block; height: 10px; margin-top: 6px; background: linear-gradient(var(--accent), var(--accent)) 0 0 / 100% 100% no-repeat, var(--track); }
.float-tag { position: absolute; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 7px 16px; box-shadow: 0 4px 0 #3a271833; font-size: 15px; font-weight: 600; white-space: nowrap; }
.float-tag b { color: var(--primary); }
.tag-a { top: 40%; left: -54px; }
.tag-b { bottom: 4px; right: -30px; }

/* ---------- Sections ---------- */
main section { padding-block: 70px; }
.section-head { display: grid; justify-items: center; gap: 18px; margin-bottom: 40px; text-align: center; }
.section-head h2 { font-size: clamp(34px, 4.6vw, 54px); }
.section-head p { max-width: 620px; color: var(--muted); font-size: 18px; }
.ribbon { display: inline-block; padding: 6px 20px; --fill: var(--primary); color: var(--primary-text); box-shadow: 0 4px 0 var(--border); font-size: 16px; font-weight: 600; }
.ribbon.straw { --fill: var(--accent); color: var(--text); }
.ribbon.plain { --fill: var(--surface); color: var(--text); }

.panel p { color: var(--muted); }
.panel h3 { font-size: 23px; margin-bottom: 8px; }
.panel strong { color: var(--text); font-weight: 700; }
.band { background: var(--bg-deep); }

/* How to play */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { padding: 30px 26px 28px; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 16px; background: var(--sign); box-shadow: inset 0 0 0 3px var(--border), inset 0 -6px 0 var(--ground); font-size: 24px; font-weight: 700; }
.rules-note { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 26px 0 0; padding: 0; list-style: none; }
.rules-note li { padding: 18px 22px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.rules-note li + li { border-left: 2px dashed var(--track); }
.rules-note b { display: block; margin-bottom: 2px; color: var(--text); font-size: 16px; font-weight: 600; }

/* Worlds (= difficulty tracks) */
.worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 0; margin: 0; list-style: none; }
.worlds li { display: flex; flex-direction: column; align-items: flex-start; padding: 0 0 26px; overflow: hidden; }
.worlds .scene { align-self: stretch; height: 90px; margin: 3px 3px 22px; background: var(--scene); background-image: radial-gradient(var(--speck) 2px, transparent 2.1px); background-size: 22px 22px; box-shadow: inset 0 -3px 0 var(--border); }
.worlds li:nth-child(1) { --scene: var(--grass); --speck: #5e8f35; }
.worlds li:nth-child(2) { --scene: var(--salon); --speck: #f4b6c2; }
.worlds li:nth-child(3) { --scene: var(--space); --speck: #7a5cd0; }
.worlds li > :not(.scene) { margin-inline: 26px; }
.worlds .count { display: inline-block; margin-bottom: 14px; padding: 2px 12px; background: var(--track); font-size: 14px; font-weight: 600; }
.worlds li > p { margin-bottom: 16px; }
.worlds .rule { display: block; align-self: stretch; margin-top: auto; padding-top: 14px; border-top: 2px dashed var(--track); color: var(--text); font-size: 15px; font-weight: 600; }
.worlds .rule b { color: var(--primary); }
.stars-panel { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 22px; margin-top: 26px; padding: 22px 28px; }
.stars { display: flex; gap: 6px; color: var(--accent); font-size: 30px; line-height: 1; }

/* Hints */
.hint-demo { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 50px; }
.hint-demo .section-head { justify-items: start; margin: 0; text-align: left; }
.hint-card { padding: 26px 28px; }
.hint-card .quote { padding: 14px 18px; --fill: var(--bg); color: var(--text); font-size: 18px; font-weight: 600; }
.hint-card .quote::before { content: '💡'; margin-right: 8px; }
.hint-card ul { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 15px; line-height: 1.45; }
.hint-card li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; }
.hint-card li::before { content: '✓'; color: var(--primary); font-weight: 700; }

/* Daily puzzle + promise */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 0; margin: 0; list-style: none; }
.cards.four { grid-template-columns: repeat(4, 1fr); }
.cards li { padding: 26px 24px; }
.cards .icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 14px; --fill: var(--primary); box-shadow: 0 4px 0 var(--border); color: var(--primary-text); font-size: 22px; font-weight: 700; }
.cards.four .icon { --fill: var(--accent); color: var(--text); }
.cards h3 { font-size: 20px; }
.cards p { font-size: 15px; }
.cards-note { margin-top: 20px; color: var(--muted); text-align: center; font-size: 15px; }

/* Gallery */
.gallery { display: flex; gap: 20px; overflow-x: auto; padding: 6px 4px 22px; scroll-snap-type: x mandatory; scrollbar-color: var(--primary) transparent; }
.gallery figure { flex: 0 0 auto; width: min(240px, 66vw); margin: 0; scroll-snap-align: center; }
.gallery img { width: 100%; box-shadow: 0 0 0 3px var(--border), 0 16px 30px #6e533826; }
.gallery-hint { margin-top: 4px; color: var(--muted); text-align: center; font-size: 14px; }

/* Download (coming soon) */
.download { display: grid; justify-items: center; gap: 18px; padding: clamp(40px, 6vw, 70px) 24px; text-align: center; }
.download > img { width: 112px; height: 112px; image-rendering: pixelated; box-shadow: 0 0 0 3px var(--border), 0 6px 0 3px #3a271833; }
.download .eyebrow { --fill: var(--bg); }
.download h2 { font-size: clamp(36px, 5vw, 58px); }
.download p { max-width: 520px; color: var(--muted); }
.stores { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 6px; }
.store-soon { display: grid; padding: 10px 22px; border: 3px dashed var(--muted); color: var(--muted); text-align: left; line-height: 1.25; }
.store-soon small { font-size: 13px; font-weight: 600; }
.store-soon strong { color: var(--text); font-size: 18px; font-weight: 700; }
.download .contact { font-size: 15px; }
.download .contact a { color: var(--primary); font-weight: 700; }

/* Footer */
.site-footer { background: var(--bg-deep); box-shadow: inset 0 3px 0 var(--track); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-block: 26px; font-size: 15px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--muted); }
.footer-links a { text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: 0 24px; color: var(--muted); font-size: 13px; }
.motion-toggle { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.motion-toggle[hidden] { display: none; }

/* ---------- Motion (paused by motion.js / reduced motion). Stepped, never eased, like the game (DESIGN.md › Motion). ---------- */
[data-reveal] { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .motion-ready [data-reveal]:not(.is-visible) { opacity: 0; transform: translateY(24px); }
  .motion-ready [data-reveal] { transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
  /* 14 planks, one per step, then grass and sheep; the loop holds and starts again. */
  .board .loop { animation: fence 10s steps(1) infinite; }
  .board .inside, .board .sheep { animation: grass 10s steps(1) infinite; }
  .progress i { animation: planks 10s steps(1) infinite; }
  .tag-a { animation: tag-bob 4s steps(2) infinite; }
  .tag-b { animation: grass 10s steps(1) infinite; }
}
@keyframes fence { 0% { stroke-dashoffset: 560; } 3% { stroke-dashoffset: 520; } 6% { stroke-dashoffset: 480; } 9% { stroke-dashoffset: 440; } 12% { stroke-dashoffset: 400; } 15% { stroke-dashoffset: 360; } 18% { stroke-dashoffset: 320; } 21% { stroke-dashoffset: 280; } 24% { stroke-dashoffset: 240; } 27% { stroke-dashoffset: 200; } 30% { stroke-dashoffset: 160; } 33% { stroke-dashoffset: 120; } 36% { stroke-dashoffset: 80; } 39% { stroke-dashoffset: 40; } 42%, 100% { stroke-dashoffset: 0; } }
@keyframes planks { 0% { background-size: 0 100%, auto; } 15% { background-size: 36% 100%, auto; } 30% { background-size: 72% 100%, auto; } 42%, 100% { background-size: 100% 100%, auto; } }
@keyframes grass { 0%, 44% { opacity: 0; } 46%, 96% { opacity: 1; } 98%, 100% { opacity: 0; } }
@keyframes tag-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.motion-paused *, .motion-paused *::before, .motion-paused *::after { animation-play-state: paused !important; }
.motion-paused .board .loop, .motion-paused .board .inside, .motion-paused .board .sheep, .motion-paused .progress i, .motion-paused .tag-b { animation: none !important; }
.motion-paused [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cards.four { grid-template-columns: 1fr 1fr; }
  .rules-note { grid-template-columns: 1fr 1fr; }
  .rules-note li:nth-child(3) { border-left: 0; }
  .rules-note li:nth-child(n+3) { border-top: 2px dashed var(--track); }
  .hero { gap: 20px; }
}
@media (max-width: 820px) {
  .site-nav .nav-section { display: none; }
  .hero { grid-template-columns: 1fr; padding-block: 16px 60px; text-align: center; }
  .hero > div:first-child { display: grid; justify-items: center; }
  .actions, .chips { justify-content: center; }
  .hero-visual { min-height: 0; padding-block: 30px 10px; }
  .steps, .worlds, .cards { grid-template-columns: 1fr; }
  .hint-demo { grid-template-columns: 1fr; gap: 30px; }
  .hint-demo .section-head { justify-items: center; text-align: center; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { width: calc(100% - 32px); }
  .site-header { flex-wrap: wrap; gap: 12px; padding-block: 14px; }
  .brand { font-size: 22px; }
  .brand img { width: 40px; height: 40px; }
  .site-nav { gap: 2px; font-size: 15px; }
  .site-nav a { padding: 6px 8px; }
  .device { padding: 14px; }
  .float-tag { font-size: 13px; padding: 6px 12px; }
  .tag-a { top: -20px; left: calc(50% - 100px); }
  .tag-b { right: -4px; bottom: -14px; }
  main section { padding-block: 50px; }
  .cards.four, .rules-note { grid-template-columns: 1fr; }
  .rules-note li + li { border-left: 0; border-top: 2px dashed var(--track); }
  .stars-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Privacy policy (privacy/, en/privacy/) ---------- */
.legal { padding-block: 36px 80px; }
.legal-card { max-width: 780px; margin-inline: auto; padding: clamp(24px, 5vw, 48px); }
.legal-card h1 { font-size: clamp(30px, 4.4vw, 46px); margin: 18px 0 8px; line-height: 1.1; }
.legal-card .updated { color: var(--muted); font-size: 15px; }
.legal-card .lead { margin-top: 22px; padding: 14px 18px; border-left: 8px solid var(--grass); background: var(--bg); color: var(--text); }
.legal-card h2 { margin: 34px 0 10px; font-size: 22px; color: var(--primary); }
.legal-card p { color: var(--muted); }
.legal-card p + p { margin-top: 10px; }
.legal-card a { color: var(--primary); font-weight: 600; overflow-wrap: anywhere; }
.legal-meadow { padding-bottom: 8px; }
