/* Hatki demo: game styles shared by the site page and the playables.
   Tokens follow hatki.app (pages.js STYLE). */
.hk { --bg:#fbf6ec; --ink:#3b2f25; --muted:#6d5d50; --leaf:#4f7a3a; --card:#fffdf8; --line:#e6d9c3;
  position:relative; max-width:520px; margin:0 auto; color:var(--ink);
  -webkit-user-select:none; user-select:none; -webkit-tap-highlight-color:transparent; }
.hk *, .hk *::before, .hk *::after { box-sizing:border-box; }
.hk [hidden] { display:none !important; }
.hk img { max-width:none; }

/* top line */
.hk-top { display:flex; align-items:center; gap:12px; min-height:32px; }
.hk-progress { flex:1; display:flex; flex-direction:column; gap:4px; font-size:15px; font-weight:600; line-height:1.2; }
.hk-bar { display:block; height:5px; border-radius:99px; background:var(--line); overflow:hidden; }
.hk-bar i { display:block; height:100%; width:0; background:var(--leaf); border-radius:99px; transition:width .4s; }
.hk-hearts { font-size:20px; letter-spacing:2px; color:#cb5f47; line-height:1; }
.hk-heart.hk-lost { color:#c9b9a5; }

/* Granny Hoot */
.hk-coach { display:flex; gap:10px; align-items:flex-start; margin:10px 0 8px; min-height:76px; }
.hk-owl { width:56px; height:56px; flex:none; }
.hk-bubble { position:relative; flex:1; background:var(--card); border-radius:16px; padding:8px 12px; box-shadow:0 1px 4px rgba(59,47,37,.12); min-height:56px; }
.hk-bubble::before { content:""; position:absolute; left:-7px; top:18px; border:7px solid transparent; border-left:0; border-right-color:var(--card); }
.hk-hintlabel { font-size:12px; color:var(--muted); font-weight:600; text-transform:none; }
.hk-hintlabel:empty { display:none; }
.hk-say { margin:0; font-size:15px; line-height:1.4; }
.hk-acts { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.hk-acts:empty { display:none; }
.hk-acts .hk-btn { padding:7px 14px; font-size:14px; }

/* buttons */
.hk-btn { display:inline-block; border:0; border-radius:999px; background:var(--leaf); color:#fff; font:inherit; font-weight:600; padding:12px 24px; cursor:pointer; text-decoration:none; line-height:1.2; }
.hk-btn.hk-quiet { background:transparent; color:var(--ink); box-shadow:inset 0 0 0 2px #d9cbb4; }
.hk-btn:focus-visible, .hk-tool:focus-visible, .hk-textbtn:focus-visible { outline:3px solid var(--ink); outline-offset:2px; }
.hk-textbtn { background:none; border:0; color:var(--leaf); font:inherit; text-decoration:underline; cursor:pointer; padding:8px; }

/* board */
.hk-boardwrap { display:flex; justify-content:center; }
/* The board as in the app (board_view.dart): a cream frame (boardBacking
   #ECE1CC, radius 18, 1.5 px bark 18 % edge, soft bark shadow, 6 px inside);
   the meadows are an SVG under the cells (ui.js buildBoard). */
.hk-board { --cell:52px; --frame:#ece1cc; position:relative; display:grid; grid-template-columns:repeat(var(--n), var(--cell)); padding:6px; background:var(--frame);
  border-radius:18px; box-shadow:inset 0 0 0 1.5px rgba(107,74,51,.18), 0 4px 12px rgba(107,74,51,.14), 0 0 2px 1px rgba(107,74,51,.06); touch-action:none; }
.hk-meadows { position:absolute; left:6px; top:6px; width:calc(var(--n) * var(--cell)); height:calc(var(--n) * var(--cell)); pointer-events:none; overflow:visible; }
.hk-seams { fill:none; stroke:#fff; stroke-opacity:.45; stroke-width:1px; vector-effect:non-scaling-stroke; }
.hk-cell { position:relative; width:var(--cell); height:var(--cell); padding:0; margin:0; border:0; background:transparent; cursor:pointer; font:inherit; color:inherit; }
.hk-cell:focus-visible { outline:3px solid var(--ink); outline-offset:-3px; z-index:3; border-radius:6px; }
.hk-tile { position:absolute; inset:0; transition:background-color .2s; }
.hk-mark { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; z-index:1; }
/* A cross as in the app (CrossPainter): a white stroke over a dark edge (ink 80 %,
   core + 3 px), round ends, arms to 24 % of the cell from its centre. */
.hk-cross { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.hk-cross line { fill:none; stroke-linecap:round; }
.hk-cross .hk-cross-edge { stroke:rgba(47,42,36,.8); stroke-width:calc(max(var(--cell) * .09, 2.5px) + 3px); }
.hk-cross .hk-cross-core { stroke:#fff; stroke-width:max(var(--cell) * .09, 2.5px); }
/* A burrow as in the app (BurrowCell): hole 86 % wide, bottom at 94 % of the
   cell; the resident 64 % wide (hare 49 %, squirrel 63 %), standing 7 % of its
   height below the hole's middle line (69 % down) and hidden under it. */
.hk-hut { position:absolute; inset:0; }
.hk-burrow { position:absolute; left:7%; bottom:6%; width:86%; height:auto; }
.hk-resclip { position:absolute; inset:0; clip-path:inset(-100% -100% 30.94% -100%); }
.hk-resbox { position:absolute; left:18%; width:64%; bottom:30.94%; transform:translateY(7%); }
.hk-res-hare { left:25.33%; width:49.35%; }
.hk-res-squirrel { left:18.28%; width:63.44%; }
.hk-res { display:block; width:100%; height:auto; }
/* Flowers of a meadow with a home (app MeadowBloom): ease-out-back growth. */
.hk-bloom { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
.hk-bloom g { transform-box:view-box; animation:hk-bloom var(--d, 380ms) cubic-bezier(.175,.885,.32,1.275) both; }
@keyframes hk-bloom { from { transform:scale(0); } to { transform:scale(1); } }
.hk-peek { animation:hk-peek .5s ease-out; }
@keyframes hk-peek { from { transform:translateY(35%); opacity:0; } to { transform:none; opacity:1; } }
.hk-no { animation:hk-shake .45s; }
@keyframes hk-shake { 20%,60% { transform:translateX(-4px); } 40%,80% { transform:translateX(4px); } }

/* hint highlights */
.hk-dim .hk-cell:not(.hk-focus) .hk-tile { background:rgba(236,225,204,.62); }
.hk-dim .hk-cell:not(.hk-focus) .hk-mark { opacity:.5; }
.hk-pulse::after, .hk-guide::after, .hk-warn::after { content:""; position:absolute; inset:4px; border-radius:10px; z-index:2; pointer-events:none;
  box-shadow:0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.hk-pulse::after, .hk-guide::after { animation:hk-pulse 1.2s ease-in-out infinite; }
.hk-warn::after { box-shadow:0 0 0 3px #fff, 0 0 0 5px #b8432f; }
@keyframes hk-pulse { 50% { transform:scale(.86); } }

/* tools */
.hk-tools { display:grid; grid-template-columns:repeat(4, 1fr); gap:6px; margin-top:10px; }
.hk-tool { display:flex; flex-direction:column; align-items:center; gap:1px; background:var(--card); color:var(--ink); border:0; border-radius:14px;
  padding:6px 2px; font:inherit; font-size:12.5px; line-height:1.2; cursor:pointer; box-shadow:0 1px 3px rgba(59,47,37,.12); min-height:48px; }
.hk-tool .hk-ico { font-size:19px; line-height:1; font-weight:700; }
.hk-tool:disabled { opacity:.45; cursor:default; }
.hk-tool.hk-hint { background:var(--leaf); color:#fff; }
.hk-tool.hk-auto[aria-pressed="true"] { box-shadow:inset 0 0 0 2px var(--leaf); color:var(--leaf); }
.hk-note { margin:10px 0 0; text-align:center; color:var(--muted); font-size:13.5px; }

/* between levels */
.hk-between { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(251,246,236,.9); z-index:5; border-radius:16px; cursor:pointer; animation:hk-fade .25s; }
.hk-between-box { text-align:center; padding:16px; }
.hk-title { margin:8px 0 4px; font-size:1.5rem; line-height:1.25; }
.hk-muted { color:var(--muted); font-size:15px; margin:4px 0 14px; }
.hk-residents { display:flex; justify-content:center; align-items:flex-end; gap:4px; width:100%; max-width:380px; margin:0 auto; }
.hk-resident { width:58px; max-width:calc((100% - 20px) / 6); height:auto; flex:0 1 auto; align-self:flex-end; object-fit:contain; animation:hk-hop .7s ease-out both; }
.hk-resident:nth-child(2) { animation-delay:.06s; } .hk-resident:nth-child(3) { animation-delay:.12s; }
.hk-resident:nth-child(4) { animation-delay:.18s; } .hk-resident:nth-child(5) { animation-delay:.24s; } .hk-resident:nth-child(6) { animation-delay:.3s; }
@keyframes hk-hop { 0% { transform:translateY(16px); opacity:0; } 60% { transform:translateY(-6px); opacity:1; } 100% { transform:none; } }
@keyframes hk-fade { from { opacity:0; } }

/* intro and final card (site) */
.hk-intro, .hk-final { text-align:center; }
.hk-intro-head { display:flex; gap:12px; align-items:center; text-align:start; background:var(--card); border-radius:18px; padding:12px 14px; }
.hk-owl-big { width:88px; height:88px; flex:none; }
.hk-hello { margin:0; font-size:16px; line-height:1.45; }
.hk-rules { list-style:none; padding:0; margin:8px 0 10px; display:grid; gap:8px; text-align:start; }
.hk-rule { display:flex; gap:12px; align-items:flex-start; background:var(--card); border-radius:16px; padding:10px 14px; box-shadow:0 1px 4px rgba(59,47,37,.1); }
.hk-rule strong { display:block; font-size:16px; }
.hk-rule span span { display:block; font-size:15px; line-height:1.4; color:var(--muted); }
.hk-num { flex:none; width:28px; height:28px; border-radius:50%; background:var(--leaf); color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center; font-size:15px; margin-top:2px; }
.hk-how { margin:0 0 14px; }
.hk-start { font-size:18px; padding:13px 40px; }
.hk-final .hk-owl-big { width:110px; height:110px; }
.hk-lead { font-size:17px; margin:6px auto 12px; max-width:420px; }
.hk-store { margin:16px 0 4px; }
.hk-badges { color:var(--muted); font-size:15px; margin:6px 0 10px; }
.hk-links { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin:8px 0; }
.hk-link { color:#fff; }
a.hk-btn.hk-quiet { color:var(--ink); }

/* playable */
.hk-playable { max-width:480px; height:100%; display:flex; flex-direction:column; justify-content:center; padding:10px 14px; }
.hk-playable .hk-game { display:flex; flex-direction:column; }
.hk-cta-mini { padding:8px 16px; font-size:14px; }
.hk-chips { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-top:8px; }
.hk-chip { background:var(--card); border-radius:999px; padding:4px 10px; font-size:12.5px; box-shadow:0 1px 3px rgba(59,47,37,.1); }
.hk-end { position:fixed; inset:0; z-index:9; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:24px; text-align:center; background:rgba(251,246,236,.97); animation:hk-fade .4s; }
.hk-end .hk-resident { width:64px; }
.hk-formula { font-size:26px; font-weight:800; line-height:1.25; margin:4px 0; }
.hk-cta { font-size:20px; padding:16px 34px; margin-top:8px; }

@media (max-width:380px) {
  .hk-owl { width:46px; height:46px; }
  .hk-tool { font-size:11.5px; }
  .hk-owl-big { width:72px; height:72px; }
}
@media (prefers-reduced-motion: reduce) {
  .hk *, .hk *::before, .hk *::after { animation:none !important; transition:none !important; }
}
.hk-still *, .hk-still *::before, .hk-still *::after { animation:none !important; transition:none !important; }

/* Guided levels and the technique lesson (game tutorial-v2 §30.10, B-102 §1):
   the rule's band stays bright, the rest fades; dashed frames with ghost
   crosses are «your move»; the hut's cell gets a frame. */
.hk-banding .hk-cell:not(.hk-band) .hk-tile { background:rgba(236,225,204,.55); }
.hk-banding .hk-cell:not(.hk-band) .hk-mark { opacity:.55; }
.hk-ghost::after, .hk-target::after { content:""; position:absolute; inset:4px; border-radius:10px; z-index:2; pointer-events:none;
  border:2.5px dashed rgba(255,253,248,.98); box-shadow:0 0 0 1.5px rgba(47,42,36,.45); }
.hk-ghost:not(.hk-x)::before { content:"\00d7"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:2; pointer-events:none;
  font-size:calc(var(--cell) * .62); line-height:1; color:rgba(255,253,248,.85); text-shadow:0 0 2px rgba(47,42,36,.55); }
.hk-target::after { border-style:solid; animation:hk-pulse 1.2s ease-in-out infinite; }
.hk-still .hk-target::after { animation:none; }

/* «Живий салют» over the board when it is solved (B-102 §5). */
.hk-boardwrap { position:relative; }
.hk-salute { position:absolute; inset:0; pointer-events:none; z-index:4; }
.hk-salute i { position:absolute; left:50%; top:50%; width:10px; height:10px; margin:-5px; border-radius:50%; opacity:0;
  animation:hk-salute 1.3s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes hk-salute { 0% { opacity:1; transform:translate(0,0) scale(.6); } 70% { opacity:1; } 100% { opacity:0; transform:translate(var(--x),var(--y)) scale(1); } }
