.game {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  align-items: start;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px) 40px;
  max-width: 1400px; width: 100%; margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* ---------- User chip ---------- */
.user-chip {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 4px 6px 4px 6px; color: var(--text); cursor: pointer; transition: background .15s, border-color .15s;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--raised); border-color: var(--line-3); }
.user-chip .head { width: 26px; height: 26px; border-radius: 6px; image-rendering: pixelated; background-color: var(--raised); background-size: cover; display: flex; align-items: center; justify-content: center; color: var(--muted-2); }
.user-chip .head .ms { font-size: 18px; }
.user-chip .uname { font-size: 14px; font-weight: 700; }
.user-chip .caret { font-size: 18px; color: var(--muted-2); transition: transform .2s; }
.user-chip[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* ---------- Bakery ---------- */
.bakery { padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; overflow: hidden; min-height: 540px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.count { font-weight: 700; font-size: clamp(36px, 5vw, 56px); letter-spacing: -.02em; line-height: 1.1; text-align: center; color: var(--text); transition: color .3s; word-break: break-word; }
.count-label { color: var(--muted); font-size: 16px; font-weight: 600; }
.pills { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.pill { background: var(--raised); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.hl { color: var(--text); transition: color .3s; }
.boosted .count, .boosted .hl { color: var(--gold); }

.cookie-stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; min-height: 320px; }
.big-cookie {
  position: relative; z-index: 1;
  width: min(280px, 72%); aspect-ratio: 1; border-radius: 50%;
  border: none; cursor: pointer; padding: 0;
  transition: transform .09s ease;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(circle at 30% 28%, #4a2a14 0 5.5%, transparent 6%),
    radial-gradient(circle at 64% 22%, #4a2a14 0 4.5%, transparent 5%),
    radial-gradient(circle at 72% 55%, #4a2a14 0 6%, transparent 6.5%),
    radial-gradient(circle at 42% 60%, #4a2a14 0 5%, transparent 5.5%),
    radial-gradient(circle at 25% 72%, #4a2a14 0 4%, transparent 4.5%),
    radial-gradient(circle at 56% 82%, #4a2a14 0 4.5%, transparent 5%),
    radial-gradient(circle at 50% 40%, #5a3418 0 3%, transparent 3.5%),
    radial-gradient(circle at 38% 34%, #e9b36a, #c98a42 55%, #a86c2e 100%);
  box-shadow: inset -14px -18px 30px rgba(80, 40, 10, .45), inset 10px 12px 24px rgba(255, 220, 160, .25), 0 24px 60px rgba(0, 0, 0, .45);
}
.big-cookie:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }
.big-cookie.pressed { transform: scale(.94); }
.floater {
  position: absolute; z-index: 2; pointer-events: none;
  font-family: var(--mono); font-weight: 700; font-size: 22px; color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  animation: hjFloat .9s ease-out forwards;
}

.stats { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--inner); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted-2); font-weight: 600; }
.stat .v { font-size: 15px; font-weight: 700; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Showcase ---------- */
.showcase { padding: 16px 18px; display: flex; flex-direction: column; }
.showcase-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.showcase-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-2); }
.ghost-toggle { display: flex; align-items: center; gap: 6px; background: transparent; border: none; color: var(--muted-2); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.ghost-toggle:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.collapse { display: grid; grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .35s ease, opacity .35s ease; }
.collapse.closed { grid-template-rows: 0fr; opacity: 0; }
.collapse-inner { overflow: hidden; min-height: 0; }
.showcase-list { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.showcase-empty { color: var(--muted-2); font-size: 13px; padding: 6px 2px; }
.sc-row { background: var(--inner); border-radius: 12px; padding: 8px 10px 8px 12px; display: flex; flex-direction: column; }
.sc-row-head { display: flex; align-items: center; gap: 8px; }
.sc-row-head .ms { font-size: 16px; color: var(--muted-2); }
.sc-row-head .n { font-size: 13px; font-weight: 600; color: var(--muted); }
.sc-row-head .c { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.sc-row-head .icon-btn { margin-left: auto; color: var(--dim); padding: 3px; border-radius: 6px; }
.sc-row-head .icon-btn .ms { font-size: 17px; color: inherit; }
.sc-row .collapse { transition-duration: .3s; }
.sc-units { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding-top: 6px; }
.sc-units .ms { font-size: 18px; color: #56668a; }
.sc-units .more { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-left: 4px; }

/* ---------- Panels ---------- */
.panel { padding: 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head.wrap { align-items: center; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.panel-meta { font-size: 13px; color: var(--muted-2); font-weight: 600; }
.empty { border: 1px dashed var(--line-3); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted-2); font-size: 14px; }

.upgrade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.upgrade {
  text-align: left; background: var(--raised); border: 1px solid rgba(255, 255, 255, .04); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 4px; opacity: .6; transition: background .15s, opacity .15s, border-color .15s;
}
.upgrade:hover { background: var(--raised-hover); }
.upgrade.ok { opacity: 1; border-color: rgba(127, 162, 240, .45); }
.upgrade .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.upgrade .title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.upgrade .title .ms { font-size: 20px; color: var(--accent); width: 32px; height: 32px; border-radius: 9px; background: var(--inner); display: flex; align-items: center; justify-content: center; flex: none; }
.upgrade .title .n { font-weight: 700; font-size: 14px; }
.upgrade .eff { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); background: rgba(127, 162, 240, .12); border-radius: 6px; padding: 2px 6px; flex: none; }
.upgrade .d { font-size: 12px; color: var(--muted); line-height: 1.4; }
.price { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--red); }
.ok .price { color: var(--green); }
.upgrade .price { margin-top: 2px; }

.seg { display: flex; gap: 4px; background: var(--inner); border-radius: 10px; padding: 4px; }
.seg button { border: none; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; background: transparent; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--on-accent); }

.building-list { display: flex; flex-direction: column; gap: 8px; }
.building {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  text-align: left; background: var(--raised); border: 1px solid rgba(255, 255, 255, .04); border-radius: 14px;
  padding: 10px 16px 10px 10px; cursor: pointer; color: var(--text); opacity: .55;
  transition: background .15s, opacity .15s;
}
.building:hover { background: var(--raised-hover); }
.building.ok { opacity: 1; }
.building > .ms { width: 48px; height: 48px; border-radius: 12px; background: var(--inner); display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--accent); }
.building .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.building .n { font-weight: 700; font-size: 15px; }
.building .i { font-size: 12px; color: var(--muted); }
.building .owned { font-family: var(--mono); font-size: 28px; font-weight: 700; color: #4a5263; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(18, 20, 26, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: hjFade .2s ease both; }
.modal { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line-2); border-radius: 20px; padding: 24px; box-shadow: 0 24px 80px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 18px; animation: hjModalIn .28s cubic-bezier(.2, .9, .3, 1) both; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { display: flex; gap: 14px; align-items: center; }
.modal-title .tile { font-size: 26px; color: var(--accent); width: 48px; height: 48px; border-radius: 12px; background: var(--inner); display: flex; align-items: center; justify-content: center; flex: none; }
.modal-title > div { display: flex; flex-direction: column; gap: 2px; }
.modal-title .t { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.modal-title .s { font-size: 13px; color: var(--muted-2); }
.voucher-form { display: flex; flex-direction: column; gap: 10px; }
.voucher-input { background: var(--inner); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; color: var(--text); font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; text-align: center; outline: none; width: 100%; }
.voucher-input:focus { border-color: var(--accent); }
.voucher-input.err { border-color: rgba(240, 110, 110, .5); }
.voucher-error { display: flex; align-items: center; gap: 8px; color: var(--red); font-size: 13px; font-weight: 600; }
.reward { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--inner); border: 1px solid rgba(143, 227, 168, .25); border-radius: 14px; padding: 22px 16px; text-align: center; }
.reward-icon { font-size: 30px; color: var(--green); width: 56px; height: 56px; border-radius: 50%; background: rgba(143, 227, 168, .12); display: flex; align-items: center; justify-content: center; animation: hjReward .5s cubic-bezier(.2, .9, .3, 1.3) both; }
.reward-k { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green); margin-top: 6px; }
.reward-t { font-weight: 700; font-size: 26px; letter-spacing: -.01em; }
.reward-s { font-size: 13px; color: var(--muted); }
.modal.wide { max-width: 560px; max-height: calc(100vh - 40px); }
.cl-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; margin-right: -8px; padding-right: 8px; }
.cl-entry { background: var(--inner); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.cl-entry.new { border-color: rgba(127, 162, 240, .35); }
.cl-entry h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.cl-empty { color: var(--muted-2); font-size: 14px; text-align: center; padding: 20px; border: 1px dashed var(--line-3); border-radius: 12px; }

.redeemed { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.redeemed .k { font-size: 12px; font-weight: 600; color: var(--muted-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); background: var(--inner); border-radius: 8px; padding: 5px 9px; }

/* ---------- Cookie-Event FX ---------- */
.flyer { position: fixed; left: 0; top: 0; z-index: 60; will-change: transform; }
.flyer-bob { animation: hjBob 2.4s ease-in-out infinite; }
.flyer-halo { position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, rgba(246, 196, 83, .7), rgba(246, 196, 83, 0) 70%); animation: hjHalo 1s ease-in-out infinite; pointer-events: none; }
.flyer-cookie {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  background:
    radial-gradient(circle at 30% 30%, #5a3418 0 7%, transparent 8%),
    radial-gradient(circle at 66% 38%, #5a3418 0 6%, transparent 7%),
    radial-gradient(circle at 44% 68%, #5a3418 0 7%, transparent 8%),
    radial-gradient(circle at 36% 32%, #ffe39a, #f2b544 55%, #c98a2a);
  box-shadow: 0 0 0 3px rgba(255, 230, 150, .5), 0 0 28px rgba(246, 196, 83, .9), 0 10px 20px rgba(0, 0, 0, .4);
}
.fx-at { position: fixed; z-index: 71; pointer-events: none; }
.fx-flash { position: fixed; inset: 0; z-index: 70; pointer-events: none; animation: hjFlash 1s ease-out forwards; }
.fx-pop { font-family: var(--mono); font-weight: 700; font-size: 56px; color: var(--gold); text-shadow: 0 4px 24px rgba(246, 196, 83, .7), 0 2px 0 #7a5410; animation: hjPop 1.3s ease-out forwards; }

.boost-banner {
  position: fixed; left: 50%; top: 84px; z-index: 40;
  animation: hjBanner .6s cubic-bezier(.2, .9, .3, 1.2) both;
  min-width: 280px; background: var(--card); border: 1px solid rgba(246, 196, 83, .45); border-radius: 14px;
  padding: 10px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 0 30px rgba(246, 196, 83, .15);
  display: flex; flex-direction: column; gap: 8px;
}
.boost-banner .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.boost-banner .t { font-weight: 800; font-size: 15px; background-image: linear-gradient(90deg, #f6c453, #fff3c8, #f6c453); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: hjShine 2s linear infinite; }
.boost-banner .left { font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--text); }
.boost-banner .bar { height: 4px; border-radius: 4px; background: var(--inner); overflow: hidden; }
.boost-banner .bar > div { height: 100%; background: var(--gold); border-radius: 4px; }

@media (max-width: 640px) {
  .topbar.sticky { position: static; }
  .top-actions { justify-content: flex-start; }
  .top-actions .btn { padding: 7px 10px; font-size: 13px; }
  .top-actions .vsep { display: none; }
  .boost-banner { top: 16px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
}
