* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #241d12;
  --muted: #9a8f7c;
  --green: #16a34a;
  --green-soft: #e6f7ec;
  --card: #ffffff;
  --track: #efe8da;
  --shadow-soft: 0 10px 30px rgba(150, 110, 50, .12), 0 2px 8px rgba(150, 110, 50, .08);
  --radius: 18px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf9 0%, #fdf3e0 100%);
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.bg-glow {
  position: fixed;
  left: 50%;
  top: 60%;
  width: 900px;
  height: 620px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(255, 214, 140, .30) 0%, rgba(255, 214, 140, 0) 62%);
  pointer-events: none;
  z-index: 0;
}

/* ================= topbar ================= */
.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 18px;
  padding: 22px 26px 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

/* stats card */
.stats-card {
  justify-self: start;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
  width: 285px;
  max-width: 34vw;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}
.stat-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #6f6551;
}
.stat-value {
  font-family: 'Chakra Petch', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.bar {
  height: 12px;
  border-radius: 8px;
  background: var(--track);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.07);
}
.bar-fill {
  height: 100%;
  border-radius: 8px;
  width: 60%;
  min-width: 12px;
}
.bar-fill.hunger { background: linear-gradient(90deg, #ffc25e, #f59e0b); }
.bar-fill.happiness { background: linear-gradient(90deg, #7ce87c, #22c55e); }
.bar-fill.fit { background: linear-gradient(90deg, #7fb1ff, #2f6fe4); }
.bar-fill.low { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* center block */
.center-block {
  justify-self: center;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.center-block h1 {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1;
}
.center-block h1 .lvl { color: #b3810a; }
.chain-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid #e7ddcc;
  background: rgba(255,255,255,.6);
  border-radius: 999px;
  padding: 4px 12px;
}
.claim-card {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  padding: 8px 8px 8px 18px;
}
.claim-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.claim-amount {
  font-family: 'Chakra Petch', monospace;
  font-size: 17px;
  font-weight: 700;
}
.claim-usd {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  min-height: 14px;
}
.claim-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.claim-btn:hover {
  background: #12833c;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(22, 163, 74, .35);
}
.claim-btn:active { transform: translateY(0); }
.pool-line {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.pool-line b { color: var(--ink); font-weight: 700; }
.modal-chain a { color: var(--green); text-decoration: none; }
.modal-chain a:hover { text-decoration: underline; }
.xp-wrap { width: 170px; margin-top: 2px; }
.xp-bar {
  height: 5px;
  background: #eee4d2;
  border-radius: 4px;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d9c7ff, #a97ff5);
  border-radius: 4px;
}

/* wallet */
.wallet-block {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.connect {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-soft);
}
.connect:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(60, 45, 20, .25); }
.connect.connected {
  background: var(--card);
  color: var(--ink);
  font-family: 'Chakra Petch', monospace;
  font-size: 14px;
  cursor: default;
}
.connect.connected::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 8px;
  vertical-align: 1px;
}
.connect.connected:hover { transform: none; box-shadow: var(--shadow-soft); }
.wallet-balance {
  font-family: 'Chakra Petch', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ================= pet ================= */
#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}
#pet-shadow {
  position: absolute;
  width: 220px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(90, 65, 30, .28) 0%, rgba(90, 65, 30, 0) 68%);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}
#pet-wrap {
  position: absolute;
  left: 50%;
  top: 58%;
  width: min(340px, 52vw);
  transform: translate(-50%, -50%);
  cursor: grab;
  will-change: left, top;
  z-index: 2;
}
#pet-wrap.dragging { cursor: grabbing; }
#pet-wrap.dead { cursor: default; }
#pet {
  width: 100%;
  display: block;
  pointer-events: none;
  animation: breathe 3.2s ease-in-out infinite;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 4px 10px rgba(120, 85, 40, .10));
}
#pet-wrap.dragging #pet, #pet-wrap.dead #pet { animation: none; }
@keyframes breathe {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.015, .985) rotate(-.6deg); }
  70% { transform: scale(.99, 1.01) rotate(.6deg); }
}

/* ================= strawberry ================= */
#berry-zone {
  position: fixed;
  right: 36px;
  bottom: 32px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
#strawberry {
  width: 110px;
  cursor: grab;
  transition: transform .15s ease;
  filter: drop-shadow(0 8px 14px rgba(160, 40, 40, .22));
  animation: bob 3.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
#strawberry:hover { transform: scale(1.08); animation-play-state: paused; }
#strawberry.dragging {
  cursor: grabbing;
  transition: none;
  animation: none;
  position: fixed;
  z-index: 13;
}
.berry-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ================= how / ticker ================= */
.how {
  position: fixed;
  left: 26px;
  bottom: 26px;
  z-index: 10;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease;
}
.how:hover { transform: translateY(-1px); }

.ticker {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 9;
  font-family: 'Chakra Petch', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .4px;
  white-space: nowrap;
}
.ticker .up { color: var(--green); }
.ticker .down { color: #dc2626; }

/* ================= particles ================= */
.eth-particle {
  position: fixed;
  width: 26px;
  z-index: 5;
  pointer-events: none;
  animation: floatUp 2.6s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(.7); }
  15% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-150px) scale(1.05); }
}
.heart-particle {
  position: fixed;
  width: 20px;
  z-index: 5;
  pointer-events: none;
  animation: heartUp 1.4s ease-out forwards;
}
@keyframes heartUp {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--hx), -110px) scale(1.1) rotate(var(--hr)); }
}
.crumb {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d64545;
  z-index: 5;
  pointer-events: none;
  animation: crumbFall .9s ease-in forwards;
}
@keyframes crumbFall {
  0% { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(var(--dx), 90px) rotate(120deg); }
}

/* ================= overlays ================= */
.hidden { display: none !important; }

#death-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(255, 250, 240, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16vh;
}
.death-box {
  text-align: center;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  padding: 28px 34px;
  max-width: 380px;
}
.death-title {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.death-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
}
#revive-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
#revive-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(22, 163, 74, .35); }
#revive-btn span {
  font-family: 'Chakra Petch', monospace;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 6px;
}

#how-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(30, 22, 10, .40);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--card);
  border-radius: 22px;
  max-width: 520px;
  width: calc(100% - 40px);
  padding: 30px 32px;
  box-shadow: 0 24px 60px rgba(40, 25, 5, .25);
}
.modal-box h2 {
  font-family: 'Chakra Petch', sans-serif;
  margin-bottom: 16px;
}
.modal-box ul { list-style: none; }
.modal-box li {
  margin-bottom: 10px;
  font-size: 15px;
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
}
.modal-box li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0c060;
}
.modal-chain {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  font-family: 'Chakra Petch', monospace;
}
#how-close {
  margin-top: 18px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 26px;
  cursor: pointer;
}

/* ================= toast ================= */
#toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  max-width: 80vw;
  text-align: center;
  box-shadow: 0 10px 26px rgba(30, 20, 5, .30);
  animation: toastIn .25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ================= mobile ================= */
@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "stats wallet"
      "center center";
    padding: 14px 16px 0;
    gap: 12px;
  }
  .stats-card { grid-area: stats; width: 100%; max-width: 54vw; padding: 12px 14px; gap: 8px; }
  .wallet-block { grid-area: wallet; }
  .center-block { grid-area: center; }
  .center-block h1 { font-size: 26px; }
  .connect { font-size: 13px; padding: 10px 16px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 11px; }
  .bar { height: 10px; }
  #pet-wrap { width: min(280px, 72vw); }
  #strawberry { width: 84px; }
  #berry-zone { right: 18px; bottom: 24px; }
  .how { font-size: 12px; padding: 9px 14px; left: 16px; bottom: 20px; }
  .ticker { display: none; }
}
