/* Kareys — mirrors docs/DESIGN.md of the game (direction C "Zen stones": warm stone background, soft surface tiles,
   terracotta primary with a 3D lip, pastel zones drawn with multiply, Nunito). */
:root {
  color-scheme: light;
  --bg: #ece7df;
  --bg-deep: #e3dcd1;
  --surface: #faf7f2;
  --text: #2f2a26;
  --muted: #6e655c;
  --primary: #a9502f;
  --primary-text: #fff8f2;
  --primary-lip: #7a3519;
  --accent: #7fa48b;
  --accent-ink: #4d7359;
  --danger: #b23a3a;
  --border: #8a7d6f;
  --cell-shadow: #d3c9bb;
  --card-shadow: #d8cfc3;
  --zone1: #c7dccb; --zone1-line: #5f8f6c;
  --zone2: #f0d9a8; --zone2-line: #a87b1f;
  --zone3: #ecc1b8; --zone3-line: #a9502f;
  --zone4: #bcd3e3; --zone4-line: #4f7a98;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.6 'Nunito', 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: 800; line-height: 1.1; letter-spacing: -.01em; }
a:focus-visible, button:focus-visible, .gallery:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--zone2); 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); border-radius: 12px; font-weight: 700; text-decoration: none; }
.game-skip:focus { top: 12px; }

/* ---------- Header + hero ---------- */
.garden { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse 60% 70% at 75% 45%, #f6f2ec 0%, transparent 70%), var(--bg); }
/* Soft concentric ripples, like raked sand behind the board (the store art's radial light). */
.garden::before { content: ''; position: absolute; z-index: -1; inset: -20% -20% -20% 35%; background: repeating-radial-gradient(circle at 50% 50%, transparent 0 34px, #ffffff55 34px 36px); mask-image: radial-gradient(circle at 50% 50%, #000 0 25%, transparent 60%); -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0 25%, transparent 60%); }
.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: 800; font-size: 24px; text-decoration: none; }
.brand img { width: 46px; height: 46px; border-radius: 13px; box-shadow: 0 3px 0 var(--card-shadow); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.site-nav a { padding: 6px 12px; border-radius: 99px; text-decoration: none; }
.site-nav a:not(.btn):hover { background: #ffffff99; }
.site-nav .nav-world { color: var(--muted); }
.site-nav .nav-cta { margin-left: 6px; padding: 8px 16px; font-size: 15px; }
.languages { display: flex; flex-wrap: wrap; gap: 8px; }
.languages a { min-width: 46px; padding: 3px 10px; border-radius: 10px; background: var(--surface); box-shadow: 0 3px 0 var(--cell-shadow); text-align: center; font-size: 13px; font-weight: 800; text-decoration: none; color: var(--muted); }
.languages a[aria-current="page"] { background: var(--primary); color: var(--primary-text); box-shadow: 0 3px 0 var(--primary-lip); }
.languages a:hover { transform: translateY(-1px); }

.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; border-radius: 99px; background: var(--surface); box-shadow: 0 3px 0 var(--card-shadow); color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }
h1 { margin: 22px 0 18px; font-size: clamp(64px, 8vw, 104px); letter-spacing: -.03em; line-height: .95; }
.h1-sub { display: block; margin-top: 14px; color: var(--primary); font-size: clamp(26px, 3vw, 36px); letter-spacing: -.01em; line-height: 1.15; }
.intro { max-width: 480px; color: var(--muted); font-size: 18px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; 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 solid var(--cell-shadow); border-radius: 99px; color: var(--muted); font-size: 13px; font-weight: 700; }

/* Chunky buttons: radius 18, a 5 px lip that collapses when pressed (DESIGN.md › Buttons). */
.btn { --face: var(--surface); --lip: #8a7d6f8c; --ink: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 24px; border: 0; border-radius: var(--radius); background: var(--face); box-shadow: 0 5px 0 var(--lip); color: var(--ink); font: 800 17px/1.2 'Nunito', sans-serif; text-decoration: none; cursor: pointer; transition: transform .12s ease-out, box-shadow .12s ease-out; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--lip); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--lip); transition-duration: .08s; }
.btn-primary { --face: var(--primary); --lip: var(--primary-lip); --ink: var(--primary-text); }

/* Hero board: the HUD and a 5 × 5 grid from Medium 3 (target 13), whose three overlapping zones bloom in turn. */
.hero-visual { position: relative; display: grid; place-items: center; min-height: 500px; }
.device { --cell: clamp(54px, 7.2vw, 78px); --gap: 9px; position: relative; padding: 22px; border-radius: 32px; background: var(--bg); box-shadow: inset 0 0 0 1px #ffffffaa, 0 6px 0 var(--card-shadow), 0 30px 60px #6e655c33; }
.hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.target { padding: 6px 18px 8px; border-radius: 16px; background: var(--surface); box-shadow: 0 3px 0 var(--card-shadow); text-align: center; }
.target small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.target b { display: block; font-size: 34px; font-weight: 800; line-height: 1; }
.lives { display: flex; gap: 4px; color: var(--danger); font-size: 22px; line-height: 1; }
.board { position: relative; }
.cells, .zones { display: grid; grid-template-columns: repeat(5, var(--cell)); grid-template-rows: repeat(5, var(--cell)); gap: var(--gap); }
.cells span { display: grid; place-items: center; border-radius: 12px; background: var(--surface); box-shadow: 0 2px 0 var(--cell-shadow); font-size: calc(var(--cell) * .46); font-weight: 800; }
.cells .empty { background: #f1ece5; box-shadow: 0 2px 0 #ddd4c8; }
.zones { position: absolute; inset: 0; pointer-events: none; }
.zone { margin: -4px; border: 4px solid var(--line); border-radius: 15px; background: var(--fill); mix-blend-mode: multiply; }
.zone.z1 { --fill: var(--zone1); --line: var(--zone1-line); grid-area: 1 / 3 / 3 / 5; }
.zone.z2 { --fill: var(--zone2); --line: var(--zone2-line); grid-area: 2 / 4 / 4 / 6; }
.zone.z3 { --fill: var(--zone3); --line: var(--zone3-line); grid-area: 2 / 4 / 5 / 5; margin-inline: 2px; }
.float-tag { position: absolute; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 99px; background: var(--surface); box-shadow: 0 4px 0 var(--card-shadow), 0 14px 30px #6e655c22; font-size: 14px; font-weight: 800; white-space: nowrap; }
.float-tag b { color: var(--primary); }
.float-tag .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--zone1); box-shadow: inset 0 0 0 2px var(--zone1-line); }
.tag-a { top: 47%; left: -46px; }
.tag-b { bottom: -18px; right: -26px; }

/* ---------- 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: 600px; color: var(--muted); font-size: 18px; }
.ribbon { display: inline-block; padding: 6px 20px; border-radius: 99px; background: var(--primary); box-shadow: 0 4px 0 var(--primary-lip); color: var(--primary-text); font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.ribbon.sage { background: var(--accent); box-shadow: 0 4px 0 var(--accent-ink); color: #fff; }
.ribbon.stone { background: var(--surface); box-shadow: 0 4px 0 var(--cell-shadow); color: var(--text); }

.panel { border-radius: 22px; background: var(--surface); box-shadow: 0 3px 0 var(--card-shadow); }
.panel p { color: var(--muted); }
.panel h3 { font-size: 23px; margin-bottom: 8px; }
.panel strong { color: var(--text); font-weight: 800; }
.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; border-radius: 14px; background: var(--zone1); box-shadow: inset 0 0 0 3px var(--zone1-line); font-size: 22px; font-weight: 800; }
.steps li:nth-child(2)::before { background: var(--zone2); box-shadow: inset 0 0 0 3px var(--zone2-line); }
.steps li:nth-child(3)::before { background: var(--zone3); box-shadow: inset 0 0 0 3px var(--zone3-line); }
.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(--cell-shadow); }
.rules-note b { display: block; margin-bottom: 2px; color: var(--text); font-size: 16px; }

/* Tracks */
.tracks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 0; margin: 0; list-style: none; }
.tracks li { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; padding: 30px 26px 26px; border-top: 10px solid var(--line); }
.tracks li:nth-child(1) { --line: var(--zone1-line); --fill: var(--zone1); }
.tracks li:nth-child(2) { --line: var(--zone2-line); --fill: var(--zone2); }
.tracks li:nth-child(3) { --line: var(--zone3-line); --fill: var(--zone3); }
.tracks .count { display: inline-block; margin-bottom: 14px; padding: 2px 12px; border-radius: 99px; background: var(--fill); font-size: 13px; font-weight: 800; }
.tracks li > p { margin-bottom: 16px; }
.tracks .rule { display: block; align-self: stretch; margin-top: auto; padding-top: 14px; border-top: 2px dashed var(--cell-shadow); color: var(--text); font-size: 15px; font-weight: 700; }
.tracks .rule b { color: var(--primary); }
.lives-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: #d9a21b; font-size: 30px; line-height: 1; }
.stars span:last-child { color: var(--cell-shadow); }

/* Daily puzzle */
.daily { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 50px; }
.daily .section-head { justify-items: start; margin: 0; text-align: left; }
.daily-facts { display: grid; gap: 14px; padding: 0; margin: 0; list-style: none; }
.daily-facts li { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 16px; padding: 16px 20px; }
.daily-facts .icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: var(--bg); color: var(--primary); font-size: 22px; font-weight: 800; }
.daily-facts h3 { margin: 0 0 2px; font-size: 18px; }
.daily-facts p { font-size: 15px; line-height: 1.45; }

/* Helps + 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; border-radius: 14px; background: var(--primary); box-shadow: 0 4px 0 var(--primary-lip); color: var(--primary-text); font-size: 22px; font-weight: 800; }
.cards.four .icon { background: var(--accent); box-shadow: 0 4px 0 var(--accent-ink); color: #fff; font-size: 30px; }
.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%; border-radius: 20px; box-shadow: 0 4px 0 var(--card-shadow), 0 16px 30px #6e655c26; }
.gallery-hint { margin-top: 4px; color: var(--muted); text-align: center; font-size: 14px; }

/* Download */
.download { position: relative; isolation: isolate; overflow: hidden; display: grid; justify-items: center; gap: 18px; padding: clamp(40px, 6vw, 70px) 24px; border-radius: 30px; background: var(--surface); box-shadow: 0 4px 0 var(--card-shadow); text-align: center; }
.download::before { content: ''; position: absolute; z-index: -1; inset: -40%; background: repeating-radial-gradient(circle at 50% 30%, transparent 0 34px, #ece7df88 34px 36px); }
.download > img { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 5px 0 var(--card-shadow); }
.download .eyebrow { background: var(--bg); box-shadow: none; }
.download h2 { font-size: clamp(36px, 5vw, 58px); }
.download p { max-width: 500px; color: var(--muted); }
.stores { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 6px; }
.store-link { text-align: left; line-height: 1.25; }
.store-link small { display: block; font-size: 13px; font-weight: 700; }
.store-link strong { font-size: 18px; font-weight: 800; }
.download .contact { font-size: 15px; }
.download .contact a { color: var(--primary); font-weight: 800; }

/* Footer */
.site-footer { background: var(--bg-deep); }
.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: 700; }
.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) ---------- */
[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); }
  /* The three zones bloom one after another (320 ms, 0.92 → 1), stay, then the board resets. */
  .zone.z1 { animation: zone-1 9s cubic-bezier(.3,1.4,.5,1) infinite; }
  .zone.z2 { animation: zone-2 9s cubic-bezier(.3,1.4,.5,1) infinite; }
  .zone.z3 { animation: zone-3 9s cubic-bezier(.3,1.4,.5,1) infinite; }
  .tag-a { animation: tag-float 6s ease-in-out infinite; }
  .tag-b { animation: tag-float 6s 1.2s ease-in-out infinite; }
}
@keyframes zone-1 { 0%, 8% { opacity: 0; transform: scale(.92); } 12%, 90% { opacity: 1; transform: scale(1); } 96%, 100% { opacity: 0; transform: scale(1); } }
@keyframes zone-2 { 0%, 30% { opacity: 0; transform: scale(.92); } 34%, 90% { opacity: 1; transform: scale(1); } 96%, 100% { opacity: 0; transform: scale(1); } }
@keyframes zone-3 { 0%, 52% { opacity: 0; transform: scale(.92); } 56%, 90% { opacity: 1; transform: scale(1); } 96%, 100% { opacity: 0; transform: scale(1); } }
@keyframes tag-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.motion-paused *, .motion-paused *::before, .motion-paused *::after { animation-play-state: paused !important; }
.motion-paused .zone { 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(--cell-shadow); }
  .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, .tracks, .cards { grid-template-columns: 1fr; }
  .daily { grid-template-columns: 1fr; gap: 30px; }
  .daily .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: 21px; }
  .brand img { width: 40px; height: 40px; }
  .site-nav { gap: 2px; font-size: 14px; }
  .site-nav a { padding: 6px 8px; }
  .device { --cell: calc((100vw - 32px - 28px - 36px) / 5); --gap: 7px; padding: 14px; border-radius: 24px; }
  .float-tag { font-size: 12px; padding: 6px 12px; }
  .tag-a { top: 30px; left: calc(50% - 50px); }
  .tag-b { right: -4px; }
  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(--cell-shadow); }
  .lives-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/, <lang>/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; letter-spacing: -.02em; 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(--accent); border-radius: 14px; 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: 700; overflow-wrap: anywhere; }
.legal-garden { padding-bottom: 8px; }
