@font-face { font-family: 'Rubik'; font-weight: 400; font-display: swap; src: url('fonts/rubik-400.woff2') format('woff2'); }
@font-face { font-family: 'Rubik'; font-weight: 500; font-display: swap; src: url('fonts/rubik-500.woff2') format('woff2'); }
@font-face { font-family: 'Rubik'; font-weight: 700; font-display: swap; src: url('fonts/rubik-700.woff2') format('woff2'); }
@font-face { font-family: 'Rubik'; font-weight: 900; font-display: swap; src: url('fonts/rubik-900.woff2') format('woff2'); }

:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --ink: #1C1C1E;
  --ink2: #3A3A3C;
  --muted: #8E8E93;
  --line: #E5E5EA;
  --purple: #AF52DE;
  --purple-d: #8E3CB8;
  --blue: #007AFF;
  --green: #34C759;
  --orange: #FF9500;
  --red: #FF3B30;
  --shadow: 0 4px 0 var(--ink);
  --radius: 20px;
  --bar: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
  position: fixed; inset: 0;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
img { display: block; }

/* screens */
.hb-screen { position: absolute; inset: 0; display: none; }
.hb-screen.on { display: block; }
#home { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 28px; }

/* header */
.hb-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 14px; }
.hb-title { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.hb-by { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.hb-by img { width: 18px; height: 18px; }
.hb-stats { display: flex; gap: 8px; }
.hb-chip {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 9px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 19px; box-shadow: 0 3px 0 var(--ink);
  font-weight: 700; font-size: 15px;
}
.hb-chip svg { width: 20px; height: 20px; }
.hb-chip.cold svg path { fill: #C7C7CC; }
.hb-goal { padding: 0 12px 0 6px; }
.hb-goal .ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.hb-goal .ring circle { fill: none; stroke-width: 4; }
.hb-goal .ring .bg { stroke: var(--line); }
.hb-goal .ring .fg { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }

/* hero */
.hb-hero {
  display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; padding: 14px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow);
}
.hb-hero .ic { width: 84px; height: 84px; border-radius: 20px; border: 2px solid var(--ink); flex: none; overflow: hidden; }
.hb-hero .ic img { width: 100%; height: 100%; }
.hb-hero .tx { flex: 1; min-width: 0; }
.hb-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--purple); }
.hb-hero h2 { margin: 3px 0 2px; font-size: 22px; font-weight: 900; letter-spacing: -0.01em; }
.hb-hero p { margin: 0 0 10px; font-size: 13px; color: var(--ink2); line-height: 1.3; }

.hb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--purple); color: #fff; font-weight: 700; font-size: 16px;
  border: 2px solid var(--ink); box-shadow: var(--shadow);
  transition: transform .06s ease, box-shadow .06s ease;
}
.hb-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.hb-btn.sm { height: 38px; font-size: 15px; padding: 0 16px; }
.hb-btn.white { background: var(--card); color: var(--ink); }
.hb-btn.green { background: var(--green); }
.hb-btn.block { display: flex; width: 100%; }
.hb-btn svg { width: 18px; height: 18px; }

/* continue */
.hb-cont {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 16px; padding: 8px 12px 8px 8px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink);
  text-align: left;
}
.hb-cont img { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--ink); }
.hb-cont .t { flex: 1; font-weight: 700; font-size: 15px; }
.hb-cont .t small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.hb-cont .go { font-weight: 700; color: var(--purple); font-size: 14px; }

/* sections */
.hb-h { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; }
.hb-h h3 { margin: 0; font-size: 18px; font-weight: 900; }
.hb-h span { font-size: 12px; color: var(--muted); font-weight: 500; }

.hb-note { margin: -4px 2px 12px; font-size: 13px; line-height: 1.3; color: var(--ink2); }
.hb-note b { color: var(--purple); }

/* tiles */
.hb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
@media (min-width: 400px) { .hb-grid { grid-template-columns: repeat(4, 1fr); } }
.hb-grid.small { grid-template-columns: repeat(4, 1fr); gap: 12px 10px; }
@media (min-width: 400px) { .hb-grid.small { grid-template-columns: repeat(5, 1fr); } }
.hb-grid.small .nm { font-size: 11px; }
.hb-grid.small .sub { display: none; }
.hb-tile { position: relative; text-align: center; }
.hb-tile .ic {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 22%; overflow: hidden;
  border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); background: #fff;
  transition: transform .06s ease, box-shadow .06s ease;
}
.hb-tile:active .ic { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.hb-tile .ic img { width: 100%; height: 100%; }
.hb-tile .nm { margin-top: 7px; font-size: 13px; font-weight: 700; line-height: 1.15; }
.hb-tile .sub { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.hb-tile .badge {
  position: absolute; top: -6px; right: -6px; z-index: 2; padding: 3px 7px; border-radius: 10px;
  background: var(--orange); color: #fff; font-size: 10px; font-weight: 900; border: 2px solid var(--ink);
}
/* locked games keep full-color art (no grey wash, owner call); a lock chip in the corner marks them */
.hb-lock {
  position: absolute; z-index: 1; right: 7%; top: 7%;
  width: 30%; aspect-ratio: 1; border-radius: 50%; background: #fff; border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.hb-lock svg { width: 55%; height: 55%; }
.hb-tile.locked .sub { color: var(--purple); font-weight: 700; }
.hb-tile.soon .ic { box-shadow: none; border-color: #C7C7CC; }
.hb-tile.soon .ic img { filter: grayscale(1); opacity: .5; }
.hb-tile.soon .nm { color: var(--muted); font-weight: 500; }

.hb-foot { margin: 26px 0 4px; text-align: center; font-size: 11px; color: var(--muted); }
.hb-foot a { color: var(--muted); text-decoration: none; }

/* game view */
#game { background: #fff; }
.hb-bar {
  position: absolute; left: 0; right: 0; top: 0; height: var(--bar); z-index: 3;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--card); border-bottom: 2px solid var(--ink);
}
.hb-back {
  width: 36px; height: 36px; border-radius: 18px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); background: #fff;
}
.hb-back:active { transform: translateY(3px); box-shadow: none; }
.hb-back svg { width: 18px; height: 18px; }
.hb-bar .ttl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 17px; }
.hb-bar .ttl img { width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid var(--ink); }
.hb-bar .ttl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-getapp {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; flex: none;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 13px;
}
.hb-getapp svg { width: 14px; height: 14px; }
.hb-frame { position: absolute; left: 0; right: 0; top: var(--bar); bottom: 0; width: 100%; height: calc(100% - var(--bar)); border: 0; background: #fff; }
.hb-frame.full { top: 0; height: 100%; }

/* sheets */
/* no dimming behind sheets (owner call): the scrim only catches taps, the sheet's own shadow lifts it */
.hb-scrim { position: absolute; inset: 0; z-index: 10; background: transparent; pointer-events: none; }
.hb-scrim.on { pointer-events: auto; }
.hb-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 88%; overflow-y: auto;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 2px solid var(--ink); border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 28px rgba(28,28,30,.16);
  transform: translateY(calc(100% + 48px)); transition: transform .28s cubic-bezier(.2,.9,.25,1);
}
.hb-sheet.on { transform: translateY(0); }
.hb-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.hb-sheet h4 { margin: 2px 0 4px; font-size: 24px; font-weight: 900; letter-spacing: -0.01em; text-align: center; }
.hb-sheet .lead { margin: 0 0 14px; text-align: center; font-size: 14px; color: var(--ink2); line-height: 1.35; }
.hb-sheet .big { width: 96px; height: 96px; margin: 4px auto 10px; border-radius: 22px; border: 2px solid var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.hb-sheet .big img { width: 100%; height: 100%; }
.hb-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.hb-linkbtn { height: 40px; font-weight: 700; font-size: 14px; color: var(--ink2); }
.hb-progress { display: flex; gap: 8px; justify-content: center; margin: 0 0 14px; }
.hb-pill { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 15px; background: var(--bg); font-size: 13px; font-weight: 700; }
.hb-pill svg { width: 16px; height: 16px; }
.hb-next { display: flex; align-items: center; gap: 12px; padding: 10px; border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 3px 0 var(--ink); text-align: left; width: 100%; }
.hb-next img { width: 52px; height: 52px; border-radius: 13px; border: 1.5px solid var(--ink); }
.hb-next .t { flex: 1; font-size: 16px; font-weight: 900; }
.hb-next .t small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.hb-next .arrow { width: 22px; height: 22px; }
.hb-fine { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.hb-play { display: inline-flex; align-items: center; gap: 8px; }
.hb-play svg { width: 18px; height: 18px; }

/* chips open explainers */
.hb-chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.hb-bigicon { width: 64px; height: 64px; margin: 6px auto 8px; }
.hb-bigicon svg { width: 100%; height: 100%; }
.hb-bigring { position: relative; width: 84px; height: 84px; margin: 6px auto 8px; }
.hb-bigring .ring { width: 84px; height: 84px; transform: rotate(-90deg); }
.hb-bigring .ring circle { fill: none; stroke-width: 3.2; }
.hb-bigring .ring .bg { stroke: var(--line); }
.hb-bigring .ring .fg { stroke: var(--green); stroke-linecap: round; }
.hb-bigring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; }
.hb-week { display: flex; justify-content: center; gap: 8px; margin: 8px 0 14px; }
.hb-week span { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.hb-week i { width: 34px; height: 34px; border-radius: 17px; background: var(--bg); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; }
.hb-week i svg { width: 20px; height: 20px; }
.hb-week span.on i { background: #FFF4E0; border-color: var(--orange); }
.hb-week span.today { color: var(--ink); }

/* collection (arm D) */
.hb-coll { display: block; width: 100%; text-align: left; margin: 0 0 12px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); background: var(--card); }
.hb-coll-top { display: flex; align-items: center; justify-content: space-between; font-weight: 900; font-size: 16px; }
.hb-coll-top .t { display: flex; align-items: center; gap: 7px; }
.hb-coll-top svg { width: 22px; height: 22px; }
.hb-coll-top .n { font-size: 15px; color: var(--ink2); font-weight: 700; }
.hb-coll-top .n b { color: var(--ink); font-weight: 900; }
.hb-coll-bar { height: 10px; border-radius: 5px; background: var(--line); margin: 9px 0 10px; overflow: hidden; }
.hb-coll-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #FFB800, #FF9500); }
.hb-coll-row, .hb-coll-mini { display: flex; gap: 6px; flex-wrap: wrap; }
.hb-coll-mini { justify-content: center; margin: 2px 0 10px; }
.hb-coll-row span, .hb-coll-mini span { width: 28px; height: 28px; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--ink); }
.hb-coll-row span img, .hb-coll-mini span img { width: 100%; height: 100%; }
.hb-coll-row span.off, .hb-coll-mini span.off { border-color: #C7C7CC; }
.hb-coll-row span.off img, .hb-coll-mini span.off img { filter: grayscale(1); opacity: .35; }
.hb-coll-mini span.me { outline: 3px solid var(--purple); outline-offset: 1px; }
.hb-coll-row .more { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); border-style: dashed; }
.hb-coll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; margin: 10px 0 16px; }
.hb-coll-grid button { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; }
.hb-coll-grid img { width: 56px; height: 56px; border-radius: 14px; border: 1.5px solid var(--ink); }
.hb-coll-grid .off img { filter: grayscale(1); opacity: .35; border-color: #C7C7CC; }
.hb-coll-grid .off span { color: var(--muted); }

/* dev menu (local copies, ?dev=1) */
.hb-devbar { display: flex; align-items: center; gap: 8px; width: 100%; margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; text-align: left; }
.hb-devbar .pill, .hb-devpill { padding: 2px 7px; border-radius: 6px; background: #FF9500; color: #1C1C1E; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.hb-devbar .code { font-weight: 900; }
.hb-devbar .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #D1D1D6; }
.hb-devbar .chev { opacity: .7; }
.hb-devpill { flex: none; height: 26px; padding: 0 9px; }
.hb-dev-list { display: flex; flex-direction: column; gap: 8px; }
.hb-dev-arm { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 16px; text-align: left; }
.hb-dev-arm.cur { border-color: var(--purple); background: #F7F0FC; }
.hb-dev-arm .code { flex: none; min-width: 32px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.hb-dev-arm .body { flex: 1; min-width: 0; }
.hb-dev-arm .body b { display: block; font-size: 15px; font-weight: 900; }
.hb-dev-arm .body small { display: block; font-size: 12.5px; color: var(--ink2); margin-top: 2px; line-height: 1.3; }
.hb-dev-arm .body em { display: block; font-style: normal; font-size: 12px; color: var(--purple-d); margin-top: 4px; line-height: 1.3; }
.hb-dev-arm .w { flex: none; font-size: 12px; font-weight: 900; color: var(--green); }
.hb-dev-arm .w.off { color: var(--muted); }
.hb-dev-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 10px; }
.hb-dev-tools button { height: 40px; border-radius: 12px; background: var(--bg); font-size: 12.5px; font-weight: 700; }
.hb-dev-links { text-align: center; font-size: 12.5px; color: var(--muted); }
.hb-dev-links a { color: var(--purple-d); font-weight: 700; text-decoration: none; }

/* ad slot preview */
.hb-ad { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(28,28,30,.92); }
.hb-ad.on { display: flex; }
.hb-ad .card { width: 82%; max-width: 330px; padding: 22px; border-radius: 22px; background: #fff; text-align: center; border: 2px solid var(--ink); }
.hb-ad .tag { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.hb-ad h5 { margin: 12px 0 6px; font-size: 20px; font-weight: 900; }
.hb-ad p { margin: 0 0 16px; font-size: 13px; color: var(--ink2); line-height: 1.35; }
.hb-ad .count { font-size: 13px; color: var(--muted); font-weight: 700; }

/* toast */
.hb-toast {
  position: absolute; left: 50%; top: 14px; z-index: 30; transform: translate(-50%, -80px);
  padding: 10px 16px; border-radius: 20px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  transition: transform .25s ease; white-space: nowrap;
}
.hb-toast.on { transform: translate(-50%, 0); }

/* loading */
.hb-loading { position: absolute; inset: var(--bar) 0 0 0; display: flex; align-items: center; justify-content: center; z-index: 2; background: #fff; }
.hb-loading.full { inset: 0; }
.hb-loading img { width: 88px; height: 88px; border-radius: 20px; border: 2px solid var(--ink); animation: hbPulse 1s ease-in-out infinite; }
@keyframes hbPulse { 50% { transform: scale(.94); } }

@media (prefers-reduced-motion: reduce) {
  .hb-sheet, .hb-toast, .hb-scrim { transition: none; }
  .hb-loading img { animation: none; }
}
/* preview still=1: headless screenshots run on virtual time, where transitions never finish */
.hb-still *, .hb-still *::before, .hb-still *::after { transition: none !important; animation: none !important; }

/* ---------------------------------------------------------------- anchored ad banner
   Open-web deployment only (shared/ads.js). body.has-banner reserves a strip at
   the bottom for a 320x50 AdSense unit; every screen shrinks above it so the
   ad never overlaps game or hub content (AdSense placement policy). Sheets
   (z-index 11) may slide over it while open — transient modals are fine. */
:root { --banner-h: calc(50px + env(safe-area-inset-bottom, 0px)); }
.hb-banner { display: none; }
body.has-banner .hb-banner {
  display: flex; align-items: flex-start; justify-content: center;
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--banner-h);
  padding-top: 2px; background: var(--card); border-top: 1px solid var(--line); z-index: 9;
}
body.has-banner .hb-screen { bottom: var(--banner-h); }
