/* beagle.clicker. Colours are tokens here; dark mode follows the device. */
:root {
  --bg: #fbf4ea;
  --card: #ffffff;
  --ink: #2b1d14;
  --muted: #7a6656;
  --line: #ecdccb;
  --tan: #c8843f;
  --tan-dark: #a8682a;
  --brown: #6b3f1f;
  --cream: #fff8ef;
  --accent: #c8843f;
  --accent-ink: #ffffff;
  --good: #2f7d4f;
  --good-bg: #e6f4ea;
  --bad: #a33a2a;
  --bad-bg: #fbe9e5;
  --gold: #e3a92b;
  --gold-ink: #7a5208;
  --shadow: 0 1px 2px rgb(60 30 10 / 6%), 0 6px 20px rgb(60 30 10 / 6%);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18120e;
    --card: #241b15;
    --ink: #f4eadf;
    --muted: #b39f8d;
    --line: #3a2d23;
    --accent: #e09a52;
    --accent-ink: #1d140e;
    --good: #7fd19b;
    --good-bg: #1d3325;
    --bad: #f19a8a;
    --bad-bg: #3b1f1a;
    --gold: #f0bf4c;
    --gold-ink: #f6d68a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; letter-spacing: .01em; }
p { margin: 0; }
ol { list-style: none; margin: 0; padding: 0; }
.muted { color: var(--muted); }

/* --- Header --- */
.top {
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap;
  max-width: 1280px; margin: 0 auto; padding: 14px 16px 6px;
}
.brand { font-size: 1.5rem; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.who {
  color: var(--muted); font-size: .9rem; text-align: right; border: 0; background: none; padding: 4px 6px; border-radius: 8px;
}
.who:hover { color: var(--ink); background: var(--card); }
/* The timer to the next update, on every screen */
.next {
  margin-left: auto; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-weight: 700; font-size: .88rem; text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.next:hover { border-color: var(--accent); }
.next.building { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.rename {
  max-width: 1248px; margin: 6px auto 0; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.rename label { font-weight: 700; font-size: .9rem; }
.rename input { flex: 1 1 180px; min-width: 0; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.rename button { border: 0; border-radius: 999px; padding: 6px 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.rename button.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.rename .form-msg { flex-basis: 100%; }
.rename .form-msg:empty { display: none; }
@media (max-width: 1280px) { .rename { margin-left: 16px; margin-right: 16px; } }

/* --- Tabs: one screen at a time --- */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.tabs a {
  position: relative; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: .92rem;
  text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.tabs a.ping::after {
  content: ""; position: absolute; top: 3px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 2px var(--card);
}
/* A new trophy: the Trophies tab glows gold and a star twinkles on its corner */
.tabs a.sparkle { animation: tab-glow 1.4s ease-out; }
.tabs a.sparkle::before {
  content: "✨"; position: absolute; top: -8px; right: -4px; font-size: .95rem; pointer-events: none;
  animation: tab-twinkle 1.4s ease-out forwards;
}
@keyframes tab-glow { 20%, 60% { box-shadow: 0 0 0 2px var(--gold), 0 0 12px var(--gold); } }
@keyframes tab-twinkle {
  from { opacity: 0; transform: scale(.3) rotate(-30deg); }
  25% { opacity: 1; transform: scale(1.25) rotate(10deg); }
  50% { transform: scale(.9) rotate(-5deg); }
  75% { opacity: 1; transform: scale(1.1); }
  to { opacity: 0; transform: scale(.8) translateY(-4px); }
}
/* A Dig Frenzy starts: the Stats tab gives a happy little wiggle with a warm ring */
.tabs a.wiggle { animation: tab-wiggle .9s ease-in-out; }
@keyframes tab-wiggle {
  15% { transform: rotate(-8deg) scale(1.08); box-shadow: 0 0 0 2px var(--accent); }
  35% { transform: rotate(7deg) scale(1.08); }
  55% { transform: rotate(-5deg) scale(1.05); box-shadow: 0 0 0 2px var(--accent); }
  75% { transform: rotate(3deg); }
}
@media (max-width: 640px) {
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .brand { font-size: 1.25rem; }
  .next { font-size: .8rem; padding: 4px 10px; }
  .who { order: 4; width: 100%; text-align: center; font-size: .82rem; padding: 0; }
  .tabs a { flex: 1; text-align: center; padding: 6px 4px; font-size: .85rem; }
}
@media (max-width: 400px) { .tabs a span { display: none; } }

.notice {
  max-width: 1248px; margin: 8px auto 0; padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.notice.good { background: var(--good-bg); border-color: transparent; }
.notice.bad { background: var(--bad-bg); border-color: transparent; }
.notice button { border: 0; border-radius: 999px; padding: 4px 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
@media (max-width: 1280px) { .notice { margin-left: 16px; margin-right: 16px; } }

/* --- Screens --- */
main { max-width: 1280px; margin: 0 auto; padding: 12px 16px 24px; }
.view { display: grid; gap: 16px; align-items: start; }
.view > * { min-width: 0; }
/* Dig: the beagle | your dig | the shop, like a clicker should be */
.view-dig { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 4fr); }
.view-updates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1060px) {
  .view-dig { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .view-dig .dig { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 760px) {
  .view-dig, .view-updates { grid-template-columns: minmax(0, 1fr); }
  .view-dig .dig { order: 0; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* --- Bones and the beagle --- */
.play { text-align: center; }
.bones { font-size: clamp(2.2rem, 7vw, 3.2rem); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bones.bounce { transform-origin: 50% 100%; animation: bones-bounce .55s ease-out; }
/* Passing 1,000, 1 M or 1 B bones: the counter turns gold for a moment (gild() in main.js) */
.bones.golden { color: var(--gold-ink); text-shadow: 0 0 10px var(--gold); animation: bones-glow 2s ease-out; }
@keyframes bones-glow { 0% { text-shadow: 0 0 0 var(--gold); } 25% { text-shadow: 0 0 18px var(--gold), 0 0 4px var(--gold); } }
/* Buying ten or more: little bones sprinkle down past the counter (sprinkle() in main.js) */
.bank { position: relative; }
.sprinkle-bone {
  position: absolute; top: 0; z-index: 2; pointer-events: none; font-size: 1rem; opacity: 0;
  transform: translate(-50%, 0); animation: sprinkle-fall 1s ease-in forwards;
}
@keyframes sprinkle-fall {
  15%, 80% { opacity: 1; }
  to { transform: translate(-50%, 110px) rotate(var(--spin)); opacity: 0; }
}
@keyframes bones-bounce { 30% { transform: translateY(-8px) scale(1.12); } 60% { transform: translateY(2px) scale(.96); } 100% { transform: none; } }
.unit { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }
.rate { color: var(--muted); font-size: .9rem; margin-top: 4px; min-height: 1.3em; }
.streak { color: var(--ink); font-size: .85rem; font-weight: 700; margin-top: 4px; }
/* A new paw on the streak line: every paw hops, one after another (renderBank in main.js) */
.streak .paw { display: inline-block; }
.streak .paw.hop { animation: paw-hop .45s ease-out calc(var(--i) * 70ms) both; }
@keyframes paw-hop { 40% { transform: translateY(-7px) rotate(-10deg); } 70% { transform: translateY(1px); } }
.pat-area { position: relative; display: grid; place-items: center; padding: 14px 0 4px; user-select: none; -webkit-user-select: none; }
.beagle {
  width: min(240px, 62vw); aspect-ratio: 1; border: 0; padding: 14px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, var(--cream), color-mix(in srgb, var(--tan) 22%, var(--card)) 70%);
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / 6%), var(--shadow);
  transition: transform .08s ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.beagle:hover { transform: scale(1.03); }
.beagle:active { transform: scale(.95); }
.beagle svg { width: 100%; height: 100%; display: block; overflow: visible; }
/* The dog is a corgi now (its class and id are still "beagle"): big pointy ears that wiggle from the base */
.beagle .ear { fill: var(--tan); transform-box: fill-box; transform-origin: 50% 90%; }
.beagle .ear-in { fill: #f4c7b8; }
.beagle .head { fill: var(--tan); }
/* A fluffy tail behind the head: a slow happy wag, and a fast one for a moment when you grab a chest */
.beagle .tail { transform-box: view-box; transform-origin: 156px 148px; animation: wag 2.4s ease-in-out infinite; }
.beagle .tail-fur { fill: var(--tan); }
.beagle .tail-tip { fill: var(--cream); }
.beagle.wagging .tail { animation: wag-fast .14s ease-in-out infinite alternate; }
@keyframes wag { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes wag-fast { from { transform: rotate(-20deg); } to { transform: rotate(18deg); } }
.beagle .helmet { display: none; }
.beagle.has-helmet .helmet { display: inline; }
.beagle .hat, .beagle .hat-brim { fill: var(--gold); stroke: var(--gold-ink); stroke-width: 2.5; }
.beagle .hat-ridge { stroke: var(--gold-ink); stroke-width: 3; opacity: .35; }
.beagle .lamp { fill: #5b5b5b; }
.beagle .lamp-glass { fill: #fff6c8; }
.beagle .lamp-beam { fill: #fff3b0; opacity: .35; }
/* Goggles with a Bone Digger; a space helmet with a Moon Base (it hides the miner's helmet) */
.beagle .goggles, .beagle .space { display: none; }
.beagle.has-goggles .goggles, .beagle.has-space .space { display: inline; }
.beagle.has-space .helmet { display: none; }
/* A party hat once you own 100 of any one thing; it sits on top of the miner's helmet */
.beagle .party { display: none; }
.beagle.has-party .party { display: inline; }
.beagle.has-helmet:not(.has-space) .party { transform: translateY(-24px); }
.beagle .party-cone { fill: #ff8fb8; stroke: #c94f7d; stroke-width: 2.5; stroke-linejoin: round; }
.beagle .party-stripe { fill: none; stroke: #fff3b0; stroke-width: 4; stroke-linecap: round; }
.beagle .party-dot { fill: #7cc8ff; }
.beagle .party-pom { fill: #fff3b0; stroke: #e0b84a; stroke-width: 2; }
/* A red bandana with a Bone Train; drawn behind the head, so only its tip shows under the chin */
.beagle .bandana { display: none; }
.beagle.has-bandana .bandana { display: inline; }
.beagle .bandana-cloth { fill: #e5484d; stroke: #a8292e; stroke-width: 2.5; stroke-linejoin: round; }
.beagle .bandana-dot { fill: #fff; }
.beagle .goggle { fill: #bfe6ff; fill-opacity: .3; stroke: #4a5866; stroke-width: 6; }
.beagle .goggle-strap, .beagle .goggle-bridge { fill: none; stroke: #4a5866; stroke-width: 6; stroke-linecap: round; }
.beagle .goggle-glint { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .8; }
.beagle .space-glass { fill: #bfe6ff; fill-opacity: .16; stroke: #9fc7e6; stroke-width: 5; }
.beagle .space-glint { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; opacity: .7; }
.beagle .space-collar { fill: #e9eef3; stroke: #8796a5; stroke-width: 3; }
.beagle .space-light { fill: #ff8fa3; }
.beagle .blaze, .beagle .cheek, .beagle .muzzle { fill: var(--cream); }
.beagle .nose, .beagle .eye { fill: #2b1d14; }
.beagle .shine { fill: #fff; }
/* A blink: the eyes squash shut around their middle (y 88) for a moment and their shine hides */
.beagle .eye, .beagle .shine { transform-box: view-box; transform-origin: 100px 88px; transition: transform .07s, opacity .07s; }
.beagle.blinking .eye { transform: scaleY(.12); }
.beagle.blinking .shine { opacity: 0; }
.beagle .mouth { fill: none; stroke: #2b1d14; stroke-width: 3; stroke-linecap: round; }
.beagle .tongue { fill: #e46b7b; opacity: 0; transition: opacity .15s; }
.beagle.boop .tongue { opacity: 1; }
.beagle.boop svg { animation: boop .22s ease; }
.beagle.boop .ear { animation: flop .3s ease; }
@keyframes boop { 40% { transform: scale(.94) rotate(-2deg); } 100% { transform: none; } }
.beagle.boop .ear-r { animation-name: flop-r; }
@keyframes flop { 40% { transform: rotate(10deg); } 100% { transform: none; } }
@keyframes flop-r { 40% { transform: rotate(-10deg); } 100% { transform: none; } }
/* A new trophy: the ears give a happy little twitch, out and back twice */
.beagle.twitching .ear { animation: twitch .9s ease-in-out; }
.beagle.twitching .ear-r { animation-name: twitch-r; }
@keyframes twitch { 15%, 55% { transform: rotate(-12deg); } 35%, 75% { transform: rotate(4deg); } 100% { transform: none; } }
@keyframes twitch-r { 15%, 55% { transform: rotate(12deg); } 35%, 75% { transform: rotate(-4deg); } 100% { transform: none; } }
/* A buy in the shop: the ears perk up tall and straight for a moment */
.beagle.perking .ear { animation: perk .65s ease-out; }
.beagle.perking .ear-r { animation-name: perk-r; }
@keyframes perk { 25%, 60% { transform: translateY(-6px) rotate(5deg) scaleY(1.1); } 100% { transform: none; } }
@keyframes perk-r { 25%, 60% { transform: translateY(-6px) rotate(-5deg) scaleY(1.1); } 100% { transform: none; } }
/* A sleepy yawn: the mouth opens wide and round, the eyes squeeze shut and the head stretches up a little */
.beagle .yawn { opacity: 0; transform-box: view-box; transform-origin: 100px 134px; }
.beagle .yawn-mouth { fill: #6b2a32; }
.beagle .yawn-tongue { fill: #e46b7b; }
.beagle.yawning .yawn { animation: yawn 2.2s ease-in-out; }
.beagle.yawning .eye { animation: yawn-eye 2.2s ease-in-out; }
.beagle.yawning .shine { opacity: 0; }
.beagle.yawning svg { animation: yawn-stretch 2.2s ease-in-out; }
@keyframes yawn { 0%, 100% { opacity: 0; transform: scale(.2); } 10%, 85% { opacity: 1; } 35%, 70% { transform: scale(1, 1.1); } }
@keyframes yawn-eye { 25%, 75% { transform: scaleY(.12); } }
@keyframes yawn-stretch { 35%, 70% { transform: translateY(-3px) scale(1.03, 1.05); } }
/* A chest pops up: the nose sniffs (a quick puff bigger) and wiggles side to side around its middle (100, 120) */
.beagle .nose { transform-box: view-box; transform-origin: 100px 120px; }
.beagle.sniffing .nose { animation: sniff 1.1s ease-in-out; }
@keyframes sniff {
  10%, 30%, 50% { transform: translateX(-2px) scale(1.12, .92); } 20%, 40%, 60% { transform: translateX(2px) scale(1.12, .92); }
  75% { transform: scale(1.06); } 100% { transform: none; }
}
.floater.yawn, .floater.sniff { font-size: 1.1rem; color: var(--muted); }
.floater.sniff { font-size: 1rem; color: var(--ink); animation-duration: 1.4s; white-space: nowrap; }
.floater {
  position: absolute; pointer-events: none; font-weight: 800; color: var(--accent); font-size: 1.3rem;
  transform: translate(-50%, -50%); animation: float .9s ease-out forwards; text-shadow: 0 1px 0 var(--card);
}
@keyframes float { to { transform: translate(-50%, -160%); opacity: 0; } }
.floater.big { font-size: 1.7rem; color: var(--gold-ink); animation-duration: 1.6s; }
.chip {
  position: absolute; pointer-events: none; font-size: .95rem; transform: translate(-50%, -50%);
  animation: chip .7s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes chip {
  60% { opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) rotate(var(--spin)); opacity: 0; }
}
.heart {
  position: absolute; pointer-events: none; font-size: 1.5rem; transform: translate(-50%, -50%);
  animation: heart-up 2.2s ease-out forwards;
}
@keyframes heart-up {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  15% { transform: translate(-50%, -80%) scale(1.1); opacity: 1; }
  40% { transform: translate(calc(-50% - 10px), -180%) scale(1); }
  65% { transform: translate(calc(-50% + 10px), -280%) scale(1); opacity: 1; }
  to { transform: translate(-50%, -380%) scale(.9); opacity: 0; }
}
/* A Dig Frenzy: little pink hearts pop out of the cheeks on a pat (cheekHearts() in main.js), off to each side */
.cheek-heart {
  position: absolute; pointer-events: none; font-size: 1.3rem; font-weight: 800; color: #ff6f91; line-height: 1;
  transform: translate(-50%, -50%); animation: cheek-heart .9s ease-out forwards; text-shadow: 0 1px 0 var(--card);
}
@keyframes cheek-heart {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  25% { transform: translate(calc(-50% + var(--dx) / 2), -90%) scale(1.15); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), -260%) scale(.8); opacity: 0; }
}
/* Ten quick pats: a ring of tiny paw prints pops up around the corgi (pawPrints() in main.js), each turned outward */
.paw-print {
  position: absolute; pointer-events: none; font-size: 1.3rem; line-height: 1; opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--turn)) scale(.2); animation: paw-pop 1.1s ease-out forwards;
}
@keyframes paw-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--turn)) scale(.2); }
  25% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--turn)) scale(1.2); }
  70% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--turn)) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(var(--turn)) scale(.9); }
}
/* Sleepy after a yawn: little z's float up from the head and drift off to the right (snooze() in main.js) */
.snooze-z {
  position: absolute; pointer-events: none; font-size: 1.3rem; font-weight: 800; font-style: italic; line-height: 1;
  color: var(--muted); text-shadow: 0 1px 0 var(--card); opacity: 0; transform: translate(-50%, -50%);
  animation: snooze-up 2.6s ease-out forwards;
}
@keyframes snooze-up {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-10deg); }
  20% { opacity: 1; }
  50% { transform: translate(calc(-50% + 14px), -200%) scale(1) rotate(8deg); }
  75% { opacity: .9; }
  to { opacity: 0; transform: translate(calc(-50% + 30px), -360%) scale(1.25) rotate(-6deg); }
}
@keyframes heart-fade { 20%, 70% { opacity: 1; } from, to { opacity: 0; } }
.frenzy-bar {
  display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem;
  background: var(--gold); color: #3a2604; font-variant-numeric: tabular-nums;
}
.in-frenzy .beagle { box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 55%, transparent), var(--shadow); }
.in-frenzy .bones { color: var(--gold-ink); }
/* A Dig Frenzy: the corgi's cheeks turn a little rosy pink (two .blush ellipses in the SVG fade in) */
.beagle .blush { fill: #ff8fa3; opacity: 0; transition: opacity .6s ease; }
.in-frenzy .beagle .blush { opacity: .6; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 12px); z-index: 10; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: .95rem;
  text-align: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

/* Buried treasure: a chest that pops out beside the beagle for a few seconds */
.treasure {
  position: absolute; width: 68px; aspect-ratio: 64 / 60; padding: 0; border: 0; background: none; border-radius: 12px;
  transform: translate(-50%, -50%); animation: dig-up .35s ease-out, bob 1.2s ease-in-out .35s infinite; z-index: 1;
}
.treasure svg { width: 100%; height: 100%; display: block; overflow: visible; }
.treasure .dirt { fill: color-mix(in srgb, var(--brown) 70%, var(--card)); }
.treasure .chest-lid, .treasure .chest-box { fill: var(--tan-dark); stroke: var(--brown); stroke-width: 2.5; }
.treasure .chest-band { fill: none; stroke: var(--gold); stroke-width: 4; }
.treasure .chest-lock { fill: var(--gold); stroke: var(--brown); stroke-width: 2; }
.treasure .chest-glint { fill: var(--gold); }
.treasure:hover { filter: brightness(1.08); }
/* The rare gold chest: all gold, with extra sparkles and a glow */
.treasure .chest-sparkle { display: none; fill: var(--gold); }
.treasure.gold .chest-sparkle { display: inline; }
.treasure.gold .chest-lid, .treasure.gold .chest-box { fill: var(--gold); stroke: var(--gold-ink); }
.treasure.gold .chest-band { stroke: #fff3c4; }
.treasure.gold .chest-lock { fill: #fff3c4; stroke: var(--gold-ink); }
.treasure.gold svg { filter: drop-shadow(0 0 6px var(--gold)); }
/* One more chest for a treasure streak: a little cartoon flame flickers on the lid (checkTreasure in main.js) */
.treasure .chest-flame { display: none; transform-box: view-box; transform-origin: 32px 10px; animation: flicker .5s ease-in-out infinite alternate; }
.treasure.hot .chest-flame { display: inline; }
.treasure .flame-out { fill: #ff8a3d; stroke: var(--brown); stroke-width: 1.5; }
.treasure .flame-in { fill: #ffd84a; }
@keyframes flicker { to { transform: scale(.9, 1.1) rotate(4deg); } }
/* A grabbed chest pops open: the lid flips up, then the chest fades (popOpen in main.js) */
.treasure.chest-pop { pointer-events: none; animation: chest-fade .9s ease-in forwards; }
.chest-pop .chest-lid, .chest-pop .chest-lock, .chest-pop .chest-glint { transform-box: view-box; transform-origin: 8px 26px; animation: lid-open .3s ease-out forwards; }
.chest-pop .chest-band { display: none; }
/* A little bone peeks up out of the open chest, behind its front */
.treasure .chest-bone { display: none; fill: var(--cream); stroke: var(--brown); stroke-width: 2; }
.chest-pop .chest-bone { display: inline; transform-box: view-box; transform-origin: 32px 24px; transform: translateY(10px); animation: bone-peek .35s ease-out .12s forwards; }
@keyframes bone-peek { 70% { transform: translateY(-10px) rotate(-8deg); } to { transform: translateY(-8px) rotate(-6deg); } }
.chip.sparkle { font-size: 1.1rem; animation-duration: .9s; }
@keyframes lid-open { to { transform: translate(-4px, -8px) rotate(-35deg); } }
@keyframes chest-fade { 60% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
@keyframes dig-up { from { transform: translate(-50%, 0) scale(.4); opacity: 0; } }
@keyframes bob { 50% { transform: translate(-50%, -58%); } }
@media (prefers-reduced-motion: reduce) {
  .beagle.boop svg, .beagle.boop .ear, .beagle.twitching .ear, .beagle.perking .ear, .beagle .tail, .bones.bounce, .bones.golden,
  .beagle.yawning .eye, .beagle.yawning svg, .beagle.sniffing .nose { animation: none; }
  .beagle.yawning .yawn { animation: none; opacity: 1; }
  .floater { animation-duration: .5s; }
  .heart, .cheek-heart, .paw-print, .snooze-z { animation-name: heart-fade; }
  .treasure, .treasure .chest-flame, .streak .paw.hop { animation: none; }
  .tabs a.sparkle { animation: none; box-shadow: 0 0 0 2px var(--gold); }
  .tabs a.sparkle::before { animation: none; }
  .tabs a.wiggle { animation: none; box-shadow: 0 0 0 2px var(--accent); }
  .treasure.chest-pop { animation: chest-fade .9s step-end forwards; }
  .chest-pop .chest-lid, .chest-pop .chest-lock, .chest-pop .chest-glint { animation: none; transform: translate(-4px, -8px) rotate(-35deg); }
  .chest-pop .chest-bone { animation: none; transform: translateY(-8px) rotate(-6deg); }
  .toast, .beagle .blush { transition: none; }
}

/* --- Shop --- */
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.shop-head h2 { margin: 0; }
.amounts { display: flex; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.amounts button { border: 0; background: none; border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.amounts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.shop-list { display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; text-align: left;
  width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
  transition: transform .06s, border-color .15s;
}
.item:not(:disabled):hover { border-color: var(--accent); }
.item:not(:disabled):active { transform: scale(.985); }
.item:disabled { opacity: .55; }
.item-icon { font-size: 1.6rem; width: 2.2rem; text-align: center; }
.item-main, .item-side { display: grid; }
.item-name { font-weight: 700; }
.item-desc, .item-owned { color: var(--muted); font-size: .85rem; }
.item-side { text-align: right; }
.item-cost { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.boosts:not(:empty) { margin-bottom: 8px; }
.boosts .item { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--card)); }

/* --- Trophies --- */
.trophy-sum { color: var(--muted); font-weight: 700; font-size: .85rem; margin-left: 4px; }
.trophy-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.trophy {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px;
  border: 1px dashed var(--line); color: var(--muted);
}
.trophy .trophy-icon { font-size: 1.4rem; filter: grayscale(1); opacity: .45; }
.trophy.got { border-style: solid; border-color: var(--gold); color: var(--ink); background: color-mix(in srgb, var(--gold) 10%, var(--card)); }
.trophy.got .trophy-icon { filter: none; opacity: 1; }
.trophy-main { display: grid; min-width: 0; }
.trophy-name { font-weight: 700; font-size: .9rem; }
.trophy-desc { font-size: .78rem; color: var(--muted); }
.trophy-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* --- Your dig: a row of icons for each kind of upgrade you own --- */
.ticker {
  margin: -4px -4px 14px; padding: 8px 12px; border-radius: 12px; background: var(--bg); color: var(--muted);
  font-size: .88rem; font-style: italic; min-height: 2.6em; transition: opacity .25s;
}
.ticker.fade { opacity: 0; }
.scene { display: grid; gap: 10px; }
.row { padding: 8px 10px 10px; border-radius: 12px; background: linear-gradient(to bottom, var(--bg) 55%, color-mix(in srgb, var(--brown) 22%, var(--card))); }
.row-head { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.row-name { font-weight: 700; }
.row-makes { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-strip { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; font-size: 1.25rem; line-height: 1.2; }
.row-more { align-self: center; margin-left: 4px; font-size: .8rem; font-weight: 800; color: var(--muted); }
.nudge { margin-top: 14px; color: var(--muted); font-size: .88rem; }
.nudge a { color: var(--accent); font-weight: 700; }

/* --- Stats --- */
.stat-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; max-width: 560px; }
.stat-list dt { color: var(--muted); }
.stat-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Play: Bone Breaker (src/bricks.js draws the board) --- */
.bricks { max-width: 680px; }
.bricks-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bricks-head h2 { margin: 0; }
.bricks-best { margin-left: auto; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.bricks-sound { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: none; font-size: 1rem; line-height: 1.2; }
.bricks-go { border: 0; border-radius: 999px; padding: 6px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.bricks-board { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 1px solid var(--line); touch-action: none; }
.bricks-help { margin: 10px 0 0; color: var(--muted); font-size: .88rem; }

/* --- Next update --- */
.status-box { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg); margin-bottom: 14px; }
.status-box.building { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.status-icon { font-size: 1.5rem; line-height: 1.2; }
.status-line { font-weight: 700; }
.status-line strong { font-variant-numeric: tabular-nums; }
.status-text { margin-top: 2px; overflow-wrap: anywhere; }
.suggest { display: grid; gap: 6px; margin-bottom: 14px; }
.suggest label { font-weight: 700; font-size: .9rem; }
.suggest textarea {
  width: 100%; resize: vertical; min-height: 3.2em; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg);
}
.suggest-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.suggest button, .save button {
  border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.suggest button:disabled { opacity: .5; }
.form-msg { font-size: .88rem; min-height: 1.2em; }
.form-msg.good { color: var(--good); }
.form-msg.bad { color: var(--bad); }

.sugs { display: grid; gap: 8px; }
.sug {
  display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line);
}
.sug.is-building { border-color: var(--accent); }
.score { display: grid; justify-items: center; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score strong { font-size: 1.05rem; }
.sug-text { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .8rem; margin-top: 2px; overflow-wrap: anywhere; }
.mine { color: var(--accent); font-weight: 700; }
.gives { display: flex; gap: 4px; }
.give {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 9px; font-size: .82rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.give:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.give:disabled { opacity: .4; }
@media (max-width: 520px) {
  .sug { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .gives { grid-column: 2; }
}
.empty { color: var(--muted); padding: 6px 2px; font-size: .92rem; }
.tag {
  display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: 2px;
}
.tag.ok { background: var(--good-bg); color: var(--good); border-color: transparent; }
.tag.claude { color: var(--accent); border-color: var(--accent); background: none; }
.tag.pick { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* --- Patch notes --- */
.done { display: grid; gap: 12px; }
.note { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; padding-bottom: 0; }
.note-title { font-weight: 700; overflow-wrap: anywhere; }
.note-body { margin-top: 4px; overflow-wrap: anywhere; }
.note.declined .note-title { color: var(--muted); }
.note-from { margin-top: 4px; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.note-from q { font-style: italic; color: var(--ink); }
.note-list { margin: 6px 0 0; padding-left: 1.2em; }
.note-list li { margin: 2px 0; overflow-wrap: anywhere; }
.rating { margin-top: 10px; display: grid; gap: 6px; }
.rating-label, .rating .rate-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.rate-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.rate-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); font-size: .82rem; font-weight: 700;
}
.rate-btn:hover { border-color: var(--accent); }
.rate-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 20%, var(--card)); border-color: var(--accent); }
.rate-n { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .rate-name { display: none; } .rate-btn { padding: 5px 11px; font-size: 1rem; } }
.report {
  border: 0; background: none; padding: 0 0 0 6px; color: var(--muted); font-size: .78rem; text-decoration: underline;
}
.report:hover { color: var(--bad); }
.more { text-align: center; }
.more-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 16px; font-weight: 700; }

/* --- Footer and save --- */
.foot { max-width: 1280px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .88rem; display: grid; gap: 10px; }
.save summary { cursor: pointer; font-weight: 700; color: var(--ink); width: max-content; }
.save > p { margin: 8px 0; max-width: 60ch; }
.save-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.save-row input { flex: 1 1 220px; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
