:root {
  --ink: #17221d;
  --muted: #68766f;
  --line: #d9e3dd;
  --paper: #ffffff;
  --bg: #f3f7f5;
  --mint: #42b98b;
  --mint-dark: #147451;
  --coral: #f27761;
  --yellow: #f4c84c;
  --danger: #b64b3c;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); letter-spacing: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #f4c84c; outline-offset: 2px; }

.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 900; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--ink); border-radius: 50%; background: #dff5eb; }
.brand-mark img { width: 46px; height: 46px; object-fit: cover; object-position: 50% 26%; transform: translateY(5px) scale(1.42); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.network { font-size: .86rem; font-weight: 800; white-space: nowrap; }
.network i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #aeb8b2; }
.network i.online { background: var(--mint); box-shadow: 0 0 0 4px rgba(66, 185, 139, .14); }
.wallet-button { border: 0; border-radius: 7px; padding: 11px 16px; background: var(--ink); color: white; font-weight: 900; }
.wallet-button:hover { background: #2b4439; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 22px 56px; }
.official-token {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 15px 18px;
  border: 1px solid #c8d8cf;
  border-left: 5px solid var(--mint-dark);
  background: #fff;
}
.official-token span { display: block; margin-bottom: 5px; color: var(--mint-dark); font-size: .78rem; font-weight: 900; }
.official-token strong { display: block; font-size: 1rem; overflow-wrap: anywhere; }
.official-token-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.official-token-actions button, .official-token-actions a { min-height: 38px; padding: 9px 12px; border-radius: 6px; font-size: .78rem; font-weight: 900; text-decoration: none; }
.official-token-actions button { border: 1px solid var(--line); background: white; color: var(--ink); }
.official-token-actions a { display: grid; place-items: center; background: var(--ink); color: white; }
.game-shell { min-height: 650px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .72fr); border: 1px solid var(--line); background: var(--paper); box-shadow: 0 18px 55px rgba(31, 62, 48, .1); }
.room { position: relative; overflow: hidden; padding: 32px 40px 26px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #effbf5 0 68%, #ddecf4 68%); }
.room::before { content: ""; position: absolute; inset: 0 0 32%; opacity: .24; background-image: radial-gradient(#5eb994 1.2px, transparent 1.2px); background-size: 24px 24px; }
.room-head { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--mint-dark); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.room h1 { margin: 0; font: 800 2.05rem Georgia, "Songti SC", serif; }
.room h1 span { padding: 6px 9px; vertical-align: middle; border-radius: 6px; background: var(--yellow); font: 900 .88rem Inter, sans-serif; }
.mode-pill { padding: 7px 10px; border: 1px solid #b8cec3; border-radius: 99px; background: rgba(255, 255, 255, .85); font-size: .78rem; font-weight: 900; white-space: nowrap; }

.pet-stage { height: 420px; position: relative; display: grid; place-items: center; }
.pet-stage img { width: min(78%, 390px); max-height: 372px; object-fit: contain; z-index: 2; filter: drop-shadow(0 16px 12px rgba(40, 84, 66, .14)); animation: breathe 3s ease-in-out infinite; }
.pet-stage img.eating { animation: eating .72s ease 3; }
.pet-stage img.happy { animation: hop .55s ease 3; }
.pet-stage img.hungry { animation: droop 1.4s ease-in-out infinite; filter: saturate(.78) drop-shadow(0 12px 10px rgba(40, 84, 66, .12)); }
.pet-speech { position: absolute; right: 2%; top: 18%; z-index: 4; max-width: 220px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 8px 24px rgba(28, 70, 53, .1); font-size: .86rem; font-weight: 800; line-height: 1.45; }
.floor-shadow { position: absolute; bottom: 34px; width: 50%; height: 30px; border-radius: 50%; background: rgba(51, 105, 82, .16); filter: blur(8px); }
.spark { position: absolute; z-index: 1; color: var(--yellow); font-size: 1.8rem; }
.s1 { left: 11%; top: 24%; }
.s2 { right: 10%; bottom: 25%; font-size: 1.2rem; }
.action-fx { position: absolute; z-index: 5; display: flex; gap: 24px; opacity: 0; pointer-events: none; }
.action-fx span { color: var(--coral); font-size: 1.45rem; }
.action-fx.play { animation: hearts 1.8s ease forwards; }

.meters { position: relative; z-index: 3; padding: 17px 20px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .9); }
.meter-row + .meter-row { margin-top: 14px; }
.meter-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: .84rem; }
.meter-label span { font-weight: 900; }
.meter-label strong { color: var(--muted); }
.meter-track { height: 10px; overflow: hidden; border-radius: 99px; background: #e7eeea; }
.meter-track div { height: 100%; transition: width .4s ease; }
.meter-track.hunger div { width: 0; background: var(--coral); }
.meter-track.xp div { width: 0; background: var(--mint-dark); }

.control-panel { padding: 30px; display: flex; flex-direction: column; background: white; }
.setup-banner { margin-bottom: 24px; padding: 11px 13px; border-left: 3px solid var(--yellow); background: #fff7d8; color: #775c05; font-size: .82rem; font-weight: 800; line-height: 1.4; }
.setup-banner.ready { border-left-color: var(--mint); background: #eaf8f1; color: var(--mint-dark); }
.balance-block > span, .section-title > span { color: var(--muted); font-size: .84rem; font-weight: 900; }
.balance-block > strong { display: block; margin: 7px 0 4px; font: 800 2.15rem Georgia, serif; overflow-wrap: anywhere; }
.balance-block small { font: 900 .78rem Inter, sans-serif; }
.balance-block p { margin: 0; color: var(--muted); font-size: .82rem; }
.primary, .adopt-button, .feed-button { width: 100%; border: 0; border-radius: 7px; font-weight: 900; }
.primary { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 20px; padding: 15px 16px; background: var(--mint-dark); color: white; }
.primary b { font-size: .72rem; opacity: .82; }
button:disabled { cursor: not-allowed; opacity: .45; }
.action-box { padding-top: 19px; border-top: 1px solid var(--line); }
.section-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.section-title b { font-size: .85rem; }
.adopt-panel { padding: 15px; border: 1px solid #dfe9e4; background: #f8fbf9; }
.adopt-panel strong, .adopt-panel span, .feed-row strong, .feed-row span { display: block; }
.adopt-panel strong, .feed-row strong { font-size: .92rem; }
.adopt-panel span, .feed-row span { margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.adopt-button { margin-top: 14px; padding: 12px; background: var(--coral); color: white; }
.feed-panel { padding-top: 2px; }
.feed-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feed-selector { display: grid; grid-template-columns: repeat(3, 34px); flex: none; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.feed-selector button { width: 34px; height: 32px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--muted); font-weight: 900; }
.feed-selector button:last-child { border-right: 0; }
.feed-selector button.selected { background: var(--ink); color: white; }
.feed-button { margin-top: 14px; padding: 13px; background: var(--coral); color: white; }
.feed-button.attention { animation: attention 1.3s ease-in-out infinite; }
.auto-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; }
.auto-row strong, .auto-row span { display: block; }
.auto-row strong { font-size: .86rem; }
.auto-row span { margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cbd5cf; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + span { background: var(--mint-dark); }
.switch input:checked + span::before { transform: translateX(20px); }
.chain-band { padding: 42px 0 28px; }
.economy-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.economy-head h2 { margin: 0; font: 800 1.72rem Georgia, "Songti SC", serif; }
.economy-head a { color: var(--mint-dark); font-size: .82rem; font-weight: 900; text-decoration: none; }
.economy-head a:hover { text-decoration: underline; }
.pool-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: white; }
.pool-grid article { min-height: 128px; padding: 21px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.pool-grid article:last-child { border-right: 0; }
.pool-grid span, .pool-grid small { color: var(--muted); font-size: .75rem; }
.pool-grid strong { margin: 8px 0 4px; font: 800 1.35rem Georgia, serif; overflow-wrap: anywhere; }
.pool-grid .running { color: var(--mint-dark); }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.levels article { min-height: 118px; position: relative; display: grid; gap: 7px; padding: 22px 18px; border-right: 1px solid var(--line); }
.levels article:last-child { border-right: 0; }
.levels article > span { position: absolute; right: 17px; top: 14px; color: #c6d2cc; font: 800 1.8rem Georgia, serif; }
.levels strong { font-size: .86rem; }
.levels b { font: 800 1.25rem Georgia, serif; }
.levels small { color: var(--muted); font-size: .75rem; }
.admin-panel { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(0, 1.25fr); gap: 34px; margin-top: 30px; padding: 28px; border: 1px solid var(--line); background: #fff; }
.admin-copy h2 { margin: 0 0 10px; font: 800 1.55rem Georgia, "Songti SC", serif; }
.admin-copy > p:last-child, .admin-controls > p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.admin-controls label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 900; }
.admin-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 8px; }
.admin-input-row input { width: 100%; min-width: 0; padding: 12px; border: 1px solid #b9c9c0; border-radius: 6px; color: var(--ink); background: white; }
.admin-input-row button, .start-mining-button { border: 0; border-radius: 6px; font-weight: 900; }
.admin-input-row button { background: var(--ink); color: white; }
.start-mining-button { width: 100%; margin: 10px 0; padding: 13px; background: var(--mint-dark); color: white; }
.admin-fees { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-fees > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: .82rem; }
.admin-fees > div span { color: var(--muted); font-weight: 900; }
.admin-fees input { width: 100%; padding: 12px; border: 1px solid #b9c9c0; border-radius: 6px; }
.admin-fees button { width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: 6px; background: var(--coral); color: white; font-weight: 900; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 40; max-width: min(520px, calc(100vw - 28px)); padding: 12px 17px; transform: translate(-50%, 18px); opacity: 0; border-radius: 7px; background: var(--ink); color: white; font-size: .84rem; font-weight: 800; white-space: pre-wrap; transition: .22s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

[hidden] { display: none !important; }

@keyframes breathe { 50% { transform: translateY(-7px) scale(1.01); } }
@keyframes eating { 35% { transform: translateY(-11px) rotate(-3deg); } 70% { transform: translateY(-5px) rotate(3deg); } }
@keyframes hop { 45% { transform: translateY(-25px) rotate(-2deg); } }
@keyframes droop { 50% { transform: translateY(7px) rotate(1deg); } }
@keyframes hearts { 0% { opacity: 0; transform: translateY(30px) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-100px) scale(1.15); } }
@keyframes attention { 50% { box-shadow: 0 0 0 5px rgba(242, 119, 97, .18); } }

@media (max-width: 850px) {
  main { padding: 18px 14px 42px; }
  .game-shell { grid-template-columns: 1fr; }
  .room { border-right: 0; border-bottom: 1px solid var(--line); padding: 26px 24px 22px; }
  .control-panel { min-height: 530px; }
  .pool-grid { grid-template-columns: 1fr 1fr; }
  .pool-grid article:nth-child(2) { border-right: 0; }
  .pool-grid article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .admin-panel { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 560px) {
  .topbar { height: 64px; padding: 0 13px; }
  .brand { font-size: .9rem; }
  .brand-mark { width: 32px; height: 32px; }
  .network { display: none; }
  .wallet-button { padding: 9px 11px; font-size: .8rem; }
  main { padding: 12px 0 36px; }
  .official-token { align-items: flex-start; margin: 0 13px 12px; padding: 13px; }
  .official-token strong { font-size: .78rem; }
  .official-token-actions { align-items: stretch; flex-direction: column; }
  .official-token-actions button, .official-token-actions a { min-height: 34px; padding: 7px 9px; font-size: .7rem; }
  .game-shell { border-left: 0; border-right: 0; }
  .room { padding: 22px 15px 18px; }
  .room h1 { font-size: 1.55rem; }
  .pet-stage { height: 330px; }
  .pet-stage img { width: min(88%, 330px); }
  .pet-speech { right: 0; top: 11%; max-width: 175px; font-size: .74rem; }
  .meters { padding: 15px; }
  .control-panel { min-height: 520px; padding: 25px 18px; }
  .balance-block > strong { font-size: 1.78rem; }
  .chain-band { padding: 34px 14px 22px; }
  .economy-head { align-items: flex-start; }
  .pool-grid { grid-template-columns: 1fr; }
  .pool-grid article { min-height: 104px; border-right: 0; border-bottom: 1px solid var(--line); }
  .pool-grid article:last-child { border-bottom: 0; }
  .levels { grid-template-columns: 1fr; margin: 0 14px; }
  .levels article { border-right: 0; border-bottom: 1px solid var(--line); }
  .levels article:last-child { border-bottom: 0; }
  .admin-panel { margin: 26px 14px 0; padding: 20px 16px; }
  .admin-input-row { grid-template-columns: 1fr; }
  .admin-input-row button { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
