/* Хуяка: the хуя game screen of the mini-app. Tokens and shared components come from
   webapp/style/tokens.css (linked first); this file is the page's layout and its own pieces.
   Pixel grammar (webapp/style/tokens.css): lists and slots ×2 (an item 32 CSS px, a huyak 24), the
   showcase (item sheet head, chests, gacha) ×4, the paper doll ×2. Whole scales only. */

html, body { height: 100%; overflow: hidden; }
.pre { white-space: pre-line; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.row > .full { flex-basis: 100%; }
.gold-t { color: var(--gold-3); font-weight: 700; }
.badge { display: inline-block; padding: 4px 8px 4px; font: 400 12px/1.1 var(--font-display); letter-spacing: .03em; background: var(--ink-1);
  box-shadow: var(--frame); margin: 0; }

/* buttons: the shared .btn, plus the page's extras */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.green { background: var(--green-2); color: var(--bone-2); }
.btn.wide { width: calc(100% - 2 * var(--b)); }
.btn:disabled { background: var(--ink-2); color: var(--mist-1); }
body.busy .btn { pointer-events: none; }
.btns { display: grid; grid-template-columns: 1fr 1fr; grid-template-columns: round(down, calc((100% - 8px) / 2), 4px) 1fr; gap: 8px; margin-top: 8px; }
.btns.three { grid-template-columns: 1fr 1fr 1fr; grid-template-columns: repeat(2, round(down, calc((100% - 16px) / 3), 4px)) 1fr; }
.btns > .btn { width: auto; }
.btns > .btn { margin: 0 0 0; }
.btns > .full { grid-column: 1 / -1; }
/* three small buttons on a phone: the icon over the word, so «Переселить» fits a third of the card */
.btns.three > .btn { flex-direction: column; gap: 4px; padding: 4px; min-height: 52px; }
.chest .btn.wide { width: 100%; }

/* ---------------------------------------------------------------- bar */
#bar { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; gap: 8px; align-items: center;
  padding: calc(8px + var(--safe-top)) 8px 8px; background: var(--bar); box-shadow: 0 var(--b) 0 0 var(--ink-0); }
.chip { text-decoration: none; white-space: nowrap; }
.chip.back { background: var(--green-1); font-size: 14px; min-height: 44px; }
.chip.len { background: var(--ochre-1); font: 700 16px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.who b { font: 400 16px/1.1 var(--font-display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- layout */
#view { position: fixed; left: 0; right: 0; top: calc(60px + var(--safe-top)); bottom: calc(68px + var(--safe-bottom));
  overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 24px; max-width: 680px; margin: 0 auto; -webkit-overflow-scrolling: touch; }
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; padding: 4px 4px calc(4px + var(--safe-bottom));
  background: var(--ink-0); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--night-0); }
#tabs button { flex: 1; height: 56px; min-height: 56px; border: 0; background: none; color: var(--mist-1); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding-bottom: 8px; font: 400 12px/1 var(--font-display); letter-spacing: .02em; }
#tabs button.on { color: var(--gold-2); background: var(--ink-1); box-shadow: var(--frame), inset 0 -4px 0 0 var(--gold-2); }
#tabs .ti { width: 32px; height: 32px; image-rendering: pixelated; background-position: center; background-repeat: no-repeat; background-size: auto; }

/* ---------------------------------------------------------------- bars and pips */
.bar { position: relative; height: 16px; background: var(--ink-1); box-shadow: 0 0 0 var(--b) var(--ink); overflow: hidden; margin: 0; }
.bar i { display: block; height: 100%; }
.bar.hp i { background: repeating-linear-gradient(90deg, var(--ochre-3) 0 6px, var(--ochre-2) 6px 8px); }
.bar.xp i { background: repeating-linear-gradient(90deg, var(--gold-2) 0 6px, var(--gold-1) 6px 8px); }
.bar.sat i { background: repeating-linear-gradient(90deg, var(--wood-3) 0 6px, var(--wood-2) 6px 8px); }
.bar.mood i { background: repeating-linear-gradient(90deg, var(--berry-4) 0 6px, var(--berry-3) 6px 8px); }
.bar.trust i { background: repeating-linear-gradient(90deg, var(--green-4) 0 6px, var(--green-3) 6px 8px); }
.bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 12px/1 var(--font-ui);
  font-variant-numeric: tabular-nums; color: var(--bone-2); text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink); }
.stat { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; font-size: 12.5px; margin: 4px 0; }
.stat > b { color: var(--hint); font-weight: 600; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 10px; height: 14px; background: var(--ink-1); box-shadow: 0 0 0 var(--b) var(--ink); }
.pips i.on { background: var(--gold-2); box-shadow: 0 0 0 var(--b) var(--ink), inset 0 -3px 0 var(--gold-1); }
.chipline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fx { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--ink-1); box-shadow: 0 0 0 1px var(--line); font-size: 12px; margin: 0; }

/* ---------------------------------------------------------------- rarity frames */
.r-trash { --r: var(--r-trash); } .r-common { --r: var(--r-common); } .r-rare { --r: var(--r-rare); }
.r-epic { --r: var(--r-epic); } .r-legendary { --r: var(--r-legendary); }
.rc { color: var(--r, var(--text)); }
.frame { position: relative; display: flex; align-items: center; justify-content: center; border: 0; margin: 0;
  /* the rarity glows through a 25% checker dither of its colour, framed by a 2-px line of it */
  --dc: var(--r, var(--stone-1)); background: var(--dither-25), var(--night-2);
  box-shadow: var(--frame), inset 0 0 0 var(--b) var(--r, var(--stone-1)), inset 0 -4px 0 rgba(20, 12, 28, .45); }
.frame.r-epic { box-shadow: var(--frame), inset 0 0 0 var(--b) var(--r), 0 0 0 calc(var(--b) * 2) var(--ink-0), 0 0 0 calc(var(--b) * 3) var(--r); }
.frame.r-legendary { --dc: var(--r); background: var(--dither-50), var(--night-2);
  box-shadow: var(--frame), inset 0 0 0 var(--b) var(--r), 0 0 0 calc(var(--b) * 2) var(--ink-0), 0 0 0 calc(var(--b) * 3) var(--r); animation: glow 1.6s steps(2) infinite; }
@keyframes glow { 50% { box-shadow: var(--frame), inset 0 0 0 var(--b) var(--r), 0 0 0 calc(var(--b) * 2) var(--r), 0 0 0 calc(var(--b) * 3) var(--ink-0), 0 0 0 calc(var(--b) * 4) var(--r); } }
.frame .ico { width: 32px; height: 32px; }

/* ---------------------------------------------------------------- hero / doll */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.hero .lv { font: 400 15px/1 var(--font-display); letter-spacing: .06em; color: var(--link); }
.doll { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(6, auto); gap: 4px; margin: 12px 0 4px; }
.doll .body { grid-column: 2 / 5; grid-row: 2 / 6; display: flex; align-items: center; justify-content: center; position: relative; min-height: 304px;
  /* a lit backdrop in two dithered steps, not a soft vignette */
  --dc: var(--night-4); background: var(--dither-50), var(--night-3); box-shadow: var(--frame); margin: 0; }
.fig { position: relative; }
.fig canvas { width: 100%; height: 100%; display: block; }
.ruler { position: absolute; width: 6px; border: var(--b) solid var(--gold-2); border-left: 0; opacity: .85;
  background: repeating-linear-gradient(180deg, transparent 0 9px, var(--gold-2) 9px 11px); background-size: 4px 100%; background-repeat: no-repeat; }
.rlabel { position: absolute; right: -6px; font: 700 12px/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--gold-3); background: rgba(20, 12, 28, .87);
  padding: 4px 4px; box-shadow: var(--frame); white-space: nowrap; }
.slot { aspect-ratio: 1; min-width: 0; padding: 0; }
.slot .ico { width: 32px; height: 32px; }
.slot .lbl { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 12px; line-height: 1.1; color: var(--hint); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.slot.empty { background: var(--night-2); box-shadow: var(--frame), inset 0 0 0 var(--b) var(--ink-1); }
.slot.empty .ico { opacity: .55; }
.slot.locked { background: var(--night-1); box-shadow: var(--frame); }
.slot.locked .ico { width: 20px; height: 20px; }
.slot.auto { white-space: pre-line; background: var(--wood-1); box-shadow: var(--frame), var(--bevel); font: 400 12px/1.1 var(--font-display); color: var(--bone-2); }
.slot .gemdots { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.gemdots i { width: 4px; height: 4px; background: var(--gold-2); box-shadow: 0 0 0 1px var(--ink); }
.gemdots i.empty { background: var(--ink-1); }

/* ---------------------------------------------------------------- bag */
.cats { display: flex; gap: 4px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; min-height: 44px; padding: 0 12px; border: 0; background: var(--ink-1); color: var(--hint); font: 400 14px/1 var(--font-display);
  box-shadow: var(--frame); margin: 0; }
.cats button.on { background: var(--ochre-2); color: var(--bone-2); box-shadow: var(--frame), var(--bevel); }
.cats button .n { font: 600 12px/1 var(--font-ui); margin-left: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
.tile { aspect-ratio: 1; padding: 0; }
.tile .eq { position: absolute; left: 4px; top: 4px; font: 400 12px/1 var(--font-display); background: var(--gold-2); color: var(--ink); padding: 4px 4px 0; }
.tile .cg { position: absolute; left: 2px; top: 2px; }
.tile .gemdots { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; }
.tile.new { animation: pop .5s steps(5); }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } }
.empty-bag { text-align: center; padding: 32px 12px; color: var(--hint); }

/* item sheet */
.itemhead { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.itemhead .frame { width: 80px; height: 80px; flex: none; }
.itemhead .frame .ico { width: 64px; height: 64px; }
.itemhead .nm { font: 400 18px/1.2 var(--font-display); letter-spacing: .02em; }
.sockets { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.sockets .frame { width: 40px; height: 40px; }
.sockets .frame .ico { width: 32px; height: 32px; }
.sockets .hole { width: 40px; height: 40px; margin: 0; background: var(--night-1); box-shadow: var(--frame), inset 0 0 0 var(--b) var(--ink-2); }
.pick { display: flex; gap: 12px; align-items: center; width: calc(100% - 2 * var(--b)); text-align: left; padding: 8px; margin: 8px 0;
  border: 0; background: var(--card); box-shadow: var(--frame), var(--bevel); }
.pick .frame { width: 44px; height: 44px; flex: none; }
.pick .frame .ico { width: 32px; height: 32px; }
.pick b { display: block; font-size: 14px; }
.pick small { color: var(--hint); }

/* ---------------------------------------------------------------- chests */
.chests { display: grid; grid-template-columns: 1fr 1fr; grid-template-columns: round(down, calc((100% - 8px) / 2), 4px) 1fr; gap: 8px; }
.chest { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; text-align: center; background: var(--card);
  box-shadow: var(--frame), var(--bevel); margin: 0; }
.chest > canvas, .chest > img { width: 96px; height: 88px; } /* ×4 showcase */
.chest.daily .muted { color: var(--bone-1); }
.chest .btn { min-width: var(--tap); }
.chest .nm { font: 400 15px/1.15 var(--font-display); letter-spacing: .02em; }
.chest .price { font: 700 15px/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--link); }
.chest .why { font-size: 12px; color: var(--bad); min-height: 1em; }
.chest.daily { grid-column: 1 / -1; flex-direction: row; text-align: left; gap: 12px; background: var(--green-1); box-shadow: var(--frame), var(--bevel), inset 0 -4px 0 var(--green-0); }
.chest.daily .grow { display: flex; flex-direction: column; gap: 8px; }
.chest.off { opacity: .6; }
.wobble { animation: wob .5s steps(4) infinite; }
@keyframes wob { 25% { transform: rotate(-4deg) translateY(-2px); } 75% { transform: rotate(4deg) translateY(-2px); } }

/* ---------------------------------------------------------------- shop: boosts and energy (the chest card's frame, an item at ×4) */
.shopseg { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(2, round(down, calc(100% / 3), 4px)) 1fr; margin: 4px 0 12px; }
.shopseg button { min-width: 0; padding: 0 4px; }
.chest.ware .frame.show { width: 80px; height: 80px; }
.chest.ware .frame.show .ico { width: 64px; height: 64px; }
.chest.ware .what { color: var(--bone-1); min-height: 36px; }
.chest.ware .btn { margin-top: auto; }

/* the day's board on the doll */
.quests-open .frame { width: 44px; height: 44px; flex: none; }
.quests-open .qcount { font: 700 16px/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--gold-3); padding-right: 4px; }

/* ---------------------------------------------------------------- battle prep */
.card > .sec.first { margin-top: 0; }
.acts2 { margin-top: 8px; }
.acts2 > .btn { gap: 4px; padding: 0 8px; }
.fx.boost { color: var(--gold-3); }
.frame.mini { width: 40px; height: 40px; flex: none; }
.frame.mini .ico { width: 32px; height: 32px; }
.lrow .lact { width: 96px; }
.lrow .lact .btn { width: 100%; margin: 0; }
.move { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: var(--b) dotted var(--line); }
.move:not(.on) b { color: var(--hint); }
.tiername { font: 400 16px/1.2 var(--font-display); letter-spacing: .02em; }
.elo { font-weight: 700; color: var(--gold-3); }
.ladder { display: grid; gap: 4px; margin-top: 8px; }
.lad { display: flex; gap: 8px; padding: 4px 8px; background: var(--night-1); font-size: 14px; }
.lad.me { box-shadow: inset 4px 0 0 var(--gold-2); color: var(--gold-3); }
.party { padding: 8px; margin-bottom: 8px; background: var(--night-1); box-shadow: var(--frame); }
.pick.fam { margin: 8px 0 0; }
.loot2 { display: flex; gap: 4px; flex: none; }
.fight { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: var(--b) dotted var(--line); }
.res { flex: none; width: 72px; padding: 4px 0; text-align: center; font: 400 13px/1.2 var(--font-display); letter-spacing: .02em; box-shadow: var(--frame); }
.res.good { background: var(--green-1); color: var(--green-6); }
.res.bad { background: var(--ochre-0); color: var(--ochre-5); }
.res.muted { background: var(--ink-1); color: var(--mist-2); }

/* ---------------------------------------------------------------- the reveal (gacha) */
#reveal { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 16px;
  background: rgba(13, 9, 18, .97); padding: calc(16px + var(--safe-top)) 20px 20px; text-align: center; overflow: hidden; }
#reveal .stage { position: relative; width: 96px; height: 88px; display: flex; align-items: center; justify-content: center; transition: transform .35s steps(5), height .35s steps(5); }
#reveal .stage img { width: 96px; height: 88px; }
#reveal .stage.small { height: 88px; }
/* rays: hard wedges of a 2-px checker, turning in steps (no soft glow) */
#reveal .rays { position: absolute; inset: -60px; animation: spin 6s steps(24) infinite; --dc: var(--glow, var(--gold-3));
  background: var(--dither-50);
  mask: repeating-conic-gradient(from 0deg, #000 0 10deg, transparent 10deg 20deg); -webkit-mask: repeating-conic-gradient(from 0deg, #000 0 10deg, transparent 10deg 20deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.ghead { width: min(360px, 94vw); display: flex; align-items: center; gap: 8px; }
.ghead b { flex: 1; text-align: left; font: 400 19px/1.15 var(--font-display); letter-spacing: .02em; }
.gbtn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: var(--ink-1); color: var(--text); font: 400 14px/1 var(--font-display); padding: 0 12px;
  box-shadow: var(--frame), var(--bevel); margin: 0; }
.gbtn.skip { background: var(--ink-2); }
.gpity { color: var(--gold-3); font-size: 13px; min-height: 1em; }
.gbox { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: auto; }
.gfoot { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: auto 0 calc(18px + var(--safe-bottom)); }
.reelwrap { min-height: 92px; }
.reel { width: min(340px, 92vw); overflow: hidden; background: var(--night-1); position: relative; height: 92px; box-shadow: var(--frame); }
.reel .strip { display: flex; gap: 8px; padding: 8px; will-change: transform; }
.reel .strip .frame { width: 72px; height: 72px; flex: none; margin: 0; }
.reel .strip .frame .ico, .gcard .frame .ico, .loot .frame .ico { width: 64px; height: 64px; }
.reel .strip .frame.won { box-shadow: inset 0 0 0 var(--b) var(--r), 0 0 0 calc(var(--b) * 2) var(--r); z-index: 1; }
.reel::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: 0; background: var(--gold-2); box-shadow: 0 0 0 var(--b) var(--ink-0); }
.reel.stopped { box-shadow: var(--frame), 0 0 0 4px var(--glow), 0 0 0 6px var(--ink-0), 0 0 0 8px var(--glow); }
.reel.stopped::after { background: var(--glow); }
.loot { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop .45s steps(5); }
.loot .frame { width: 80px; height: 80px; }
.loot .nm { font: 400 22px/1.2 var(--font-display); letter-spacing: .02em; }
.loot .line { max-width: 340px; color: var(--bone-1); font-size: 14px; }
.gflash { position: absolute; inset: 0; pointer-events: none; animation: gflash .7s ease-out forwards; z-index: 3; }
@keyframes gflash { from { opacity: .9; } to { opacity: 0; } }
.gparts { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.shake { animation: shake .45s steps(6); }
.shake2 { animation: shake2 .8s steps(10); }
@keyframes shake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-2px, 2px); } 80% { transform: translate(2px, -2px); } }
@keyframes shake2 { 10% { transform: translate(-8px, 4px); } 25% { transform: translate(8px, -4px); } 40% { transform: translate(-6px, 2px); }
  55% { transform: translate(6px, -2px); } 70% { transform: translate(-4px, 2px); } 85% { transform: translate(2px, -2px); } }
.ggrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(340px, 92vw); }
.gcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; background: var(--night-2); box-shadow: var(--frame);
  opacity: 0; animation: flipin .45s steps(5) forwards; text-align: center; }
.gcard .frame { width: 72px; height: 72px; }
.gcard small { font-size: 12px; line-height: 1.15; }
.gcard.best { box-shadow: var(--frame), 0 0 0 var(--b) var(--r), 0 0 0 calc(var(--b) * 2) var(--ink-0), 0 0 0 calc(var(--b) * 3) var(--r); }
@keyframes flipin { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- farm */
.pen { display: flex; gap: 12px; align-items: flex-start; }
.scene { position: relative; width: 64px; height: 56px; flex: none; box-shadow: var(--frame); margin: 0; }
.scene > * { position: absolute; inset: 0; width: 64px; height: 56px; }
.scene .critter { inset: auto; left: 20px; top: 20px; width: 24px; height: 24px; animation: hop2 1.4s steps(2) infinite; }
.scene .critter.wild { animation-duration: .5s; }
@keyframes hop2 { 50% { transform: translateY(-3px); } }
.pen .nm { font: 400 17px/1.15 var(--font-display); letter-spacing: .02em; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.act { min-height: 44px; border: 0; background: var(--ink-1); font: 400 14px/1.1 var(--font-display); letter-spacing: .02em; padding: 4px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--frame), var(--bevel); margin: 0; }
.act.ready { background: var(--green-2); }
.act .cd { font: 600 12px/1.2 var(--font-ui); color: var(--hint); }
.act .cost { font: 600 12px/1.2 var(--font-ui); color: var(--gold-3); }
.ws { display: grid; gap: 4px; }

/* a tamed huyak's home: the cage or the aul (Хуяул's colony) */
.aulbox { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: var(--b) dotted var(--line); }
.aulbox p { margin: 0; }
.aulbox .pbar { margin: 0; }
.aulbox .btn { margin: 0; }

/* ---------------------------------------------------------------- skills: passive tree */
body[data-tab="skills"] #view { padding: 0; overflow: hidden; max-width: none; }
.tree { position: absolute; inset: 0; overflow: hidden; background: var(--night-0); }
.treecv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.tbar, .tsbar { position: absolute; left: 8px; right: 8px; display: flex; gap: 4px; align-items: center; pointer-events: none; }
.tbar { top: 8px; }
.tsbar { top: 58px; }
.tbar > *, .tsbar > * { pointer-events: auto; }
.tpoints { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 4px; padding: 0 12px; background: var(--night-2); box-shadow: var(--frame);
  font: 400 16px/1 var(--font-display); color: var(--gold-3); white-space: nowrap; }
.tpoints .num { font: 700 17px/1 var(--font-ui); }
.tbtn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: var(--ink-1); color: var(--text); font: 400 14px/1 var(--font-display); padding: 0 12px;
  box-shadow: var(--frame), var(--bevel); margin: 0; }
.tbtn.gold { background: var(--gold-1); color: var(--ink); }
.tsearch { flex: 1; min-width: 0; min-height: 44px; border: 0; background: var(--night-2); color: var(--text); padding: 0 12px; font: 15px var(--font-ui); box-shadow: var(--frame); margin: 0; }
.tfound { flex: none; align-self: stretch; display: flex; align-items: center; padding: 0 12px; background: var(--night-2); box-shadow: var(--frame); color: var(--water-5); font: 700 13px/1 var(--font-ui); }
.tfound[hidden] { display: none; }
.tbtn.off { background: var(--ink-2); color: var(--mist-1); }
.tcard { position: absolute; left: 8px; right: 8px; bottom: 10px; padding: 12px 12px; background: var(--night-2);
  box-shadow: var(--frame), 0 0 0 4px rgba(242, 194, 48, .25), var(--drop); display: grid; gap: 4px; animation: tin .18s steps(3); }
.tcard b { font: 400 17px/1.15 var(--font-display); letter-spacing: .02em; }
.tcard .teff { font-size: 15px; font-weight: 700; color: var(--gold-3); }
.tcard .btn { margin-top: 8px; }
.tcard .row { align-items: center; }
.tcard .tclose { flex: none; width: 44px; height: 44px; margin: -8px -8px 0 4px; padding: 0; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; }

.quest { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 12px; background: var(--card); margin: 8px 0; box-shadow: var(--frame); }
.quest.done { box-shadow: var(--frame), inset 0 0 0 var(--b) var(--green-2); }
.quest .bar { grid-column: 1 / -1; height: 10px; }

/* ---------------------------------------------------------------- toasts / sheet layout (colours from tokens) */
#toasts { position: fixed; top: calc(64px + var(--safe-top)); left: 0; right: 0; z-index: 45; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { white-space: pre-line; }
#shade { position: fixed; inset: 0; z-index: 19; --dc: rgba(20, 12, 28, .9); background: var(--dither-50); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 82vh; max-height: 82dvh; display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .22s steps(6); max-width: 680px; margin: 0 auto; padding-bottom: var(--safe-bottom); }
.sheet.up { transform: translateY(0); }
.sheet.drag { transition: none; }
.grab { display: flex; justify-content: center; padding: 8px 0 4px; touch-action: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 4px 16px 8px; touch-action: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-title { margin: 0; display: flex; align-items: center; gap: 8px; }
.sheet-sub { color: var(--hint); font-size: 13px; margin-top: 0; }
.sheet-close { width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: none; display: grid; place-items: center; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 20px; -webkit-overflow-scrolling: touch; }

#splash { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--night-2); color: var(--bone-2); transition: opacity .45s steps(4); }
#splash.gone { opacity: 0; pointer-events: none; }
#splash .title { font: 400 36px/1 var(--font-display); letter-spacing: .04em; color: var(--gold-2); text-shadow: 3px 3px 0 var(--ochre-1); }
#splash .say { color: var(--hint); max-width: 80%; text-align: center; }
#splash.fail .say { color: var(--bad); }
#splash .huyak { width: 56px; height: 48px; image-rendering: pixelated; animation: hop .5s steps(2) infinite;
  background:
    linear-gradient(#140c1c,#140c1c) 16px 8px / 8px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 8px 0 / 24px 8px no-repeat,
    linear-gradient(#f0aa9c,#f0aa9c) 0 8px / 48px 24px no-repeat,
    linear-gradient(#d27b78,#d27b78) 8px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 24px 32px / 8px 8px no-repeat,
    linear-gradient(#d27b78,#d27b78) 40px 32px / 8px 8px no-repeat; }
@keyframes hop { 50% { transform: translateY(-6px); } }

@media (min-width: 700px) {
  .sheet { bottom: 12px; box-shadow: var(--frame), var(--drop); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}
