:root {
  --main-bg: #f3efe2;
  --main-text: #322e21;
  --panel-bg: #fff8e1;
  --secondary: #ffe57f;
  --accent: #fbc02d;
  --hero-glow: #ffe082;
  --upgrade-bg: #fffbe6;
  --box-shadow: 0 6px 32px #fbc02d44;
  --shop-glow: #ffe082;
  --shop-pink: #ff90c2;
  --shop-blue: #82e5ff;
  --shop-purple: #b695f9;
}
[data-theme="dark"] {
  --main-bg: #262a33;
  --main-text: #f9f7e4;
  --panel-bg: #353849;
  --secondary: #483c1f;
  --accent: #ffd54f;
  --hero-glow: #d0b74f;
  --upgrade-bg: #2d2e38;
  --box-shadow: 0 6px 32px #ffd54f33;
  --shop-glow: #fffbe6;
  --shop-pink: #ff90c2;
  --shop-blue: #82e5ff;
  --shop-purple: #b695f9;
}
body {
  font-family: 'Press Start 2P', Arial, sans-serif;
  background: var(--main-bg);
  color: var(--main-text);
  min-height: 100vh;
  margin: 0;
  transition: background .4s, color .4s;
}
#game-container {
  max-width: 420px;
  margin: 40px auto 18px auto;
  background: var(--panel-bg);
  border-radius: 18px;
  box-shadow: var(--box-shadow);
  border: 4px solid var(--accent);
  padding: 0 0 6px 0;
  min-height: 80vh;
  position: relative;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent);
  padding: 18px 22px 10px 22px;
  background: var(--secondary);
  border-radius: 13px 13px 0 0;
}
h1 {
  font-size: 1.25em;
  letter-spacing: 1px;
  margin: 0;
  color: #f57f17;
  text-shadow: 2px 2px 0 #fff9;
  display: flex;
  align-items: center;
  gap: 9px;
}
.pixel {
  background: #fbc02d;
  color: #fff;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.72em;
  letter-spacing: 1.5px;
  margin-left: 7px;
}
#settings-btn {
  background: #fffde7;
  border-radius: 10px;
  border: 1.4px solid var(--accent);
  color: #b99d19;
  font-size: 1.1em;
  padding: 8px 13px;
  cursor: pointer;
  transition: background .15s, box-shadow .1s;
  box-shadow: 0 1.5px 0 #fff4;
}
#settings-btn:hover {
  background: #ffe082;
}
main {
  padding: 17px 16px 0 16px;
}
#hero-section {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 15px;
  position: relative;
}
#hero-avatar {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  box-shadow: 0 0 20px 1px var(--hero-glow);
  border: 2.5px solid var(--accent);
  margin-right: 8px;
  flex-shrink: 0;
  background-color: #fff;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#hero-avatar svg {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
}
.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
.hero-info {
  font-size: 0.85em;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #b99d19;
  margin-top: 3px;
}
#money-section {
  margin: 18px 0;
  text-align: center;
}
#money-amount {
  font-size: 1.13em;
  margin-bottom: 10px;
  color: #e65100;
  text-shadow: 1px 1px 0 #fff9;
  position: relative;
  z-index: 10;
}
#collect-btn {
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #a46a06;
  border: 2px solid var(--accent);
  border-radius: 16px;
  font-size: 1.05em;
  font-family: inherit;
  font-weight: 700;
  padding: 12px 38px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff5;
  transition: background .13s, transform .09s;
  margin-top: 5px;
  position: relative;
  overflow: hidden;
  z-index: 10;
}
#collect-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
#collect-coin {
  margin-right: 9px;
  display: inline-block;
  font-size: 1.15em;
  color: #edbf2f;
  filter: drop-shadow(0 1.5px 0 #fff6);
  transition: color .13s;
}
#upgrade-section {
  margin-top: 13px;
  background: var(--upgrade-bg);
  border-radius: 10px;
  box-shadow: 0 1.5px 0 #fff7;
  border: 1.7px solid var(--accent);
  padding: 10px 12px 19px 12px;
}
#upgrade-section h3 {
  color: #b99d19;
  font-size: 0.97em;
  margin-bottom: 8px;
  margin-top: 0;
}
.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.upgrade-card {
  background: #fffde7;
  border: 1.3px solid var(--accent);
  border-radius: 8px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92em;
  box-shadow: 0 1.5px 0 #fff3;
  transition: background .14s;
}
[data-theme="dark"] .upgrade-card {
  background: #2d2e38;
}
.upgrade-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}
.upgrade-buy-btn, .upgrade-buy-btn2 {
  background: #ffd54f;
  color: #a46a06;
  border: 1.2px solid var(--accent);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.94em;
  font-weight: 700;
  padding: 4px 13px;
  margin-left: 13px;
  cursor: pointer;
  transition: background .14s, transform .11s;
  box-shadow: 0 1px 0 #fff4;
  display: inline-block;
}
.upgrade-buy-btn:active, .upgrade-buy-btn2:active {
  background: #ffe082;
  transform: scale(0.97) rotate(-1deg);
}
footer {
  font-size: 0.78em;
  color: #c6a800;
  text-align: center;
  margin-top: 13px;
}
.footer-credit a {
  color: #b99d19;
}
.modal-bg {
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(60,40,0,0.22);
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal {
  background: var(--panel-bg);
  padding: 25px 30px 20px 30px;
  border-radius: 17px;
  min-width: 260px;
  box-shadow: 0 6px 38px #fbc02d55;
  border: 2.8px solid var(--accent);
  font-family: inherit;
  position: relative;
  animation: modal-show .5s;
  z-index: 10001;
}
@keyframes modal-show {
  from { opacity: 0; transform: scale(0.93);}
  to { opacity: 1; transform: scale(1);}
}
.settings-list {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 1em;
}
#reset-game-btn {
  background: #ffebee;
  color: #d32f2f;
  border: 1.4px solid #ff8a65;
  border-radius: 7px;
  font-size: 0.97em;
  font-family: inherit;
  padding: 6px 17px;
  margin-right: 12px;
  margin-top: 7px;
  cursor: pointer;
  transition: background .14s;
}
#reset-game-btn:hover {
  background: #ffcdd2;
}
#close-settings-btn {
  background: var(--secondary);
  color: #b99d19;
  border: 1.4px solid var(--accent);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.97em;
  padding: 6px 17px;
  cursor: pointer;
  transition: background .14s;
}
.hidden { display: none !important; }
a { color: #e65100; text-decoration: underline;}
[data-theme="dark"] a { color: #ffd54f;}
#hero-name {
  font-size: 0.97em;
  margin-top: 0px;
  margin-bottom: 2px;
  text-align: left;
  color: #b99d19;
  letter-spacing: 0.4px;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1em;
}
.hero-class {
  font-size: 0.8em;
  color: #8d7005;
  opacity: 0.85;
  margin-top: 1px;
  font-weight: normal;
  letter-spacing: 0.4px;
}
.tingle-modal.hero-select-modal .tingle-modal-box {
  background: var(--panel-bg);
  border-radius: 15px;
  border: 2.5px solid var(--accent);
  box-shadow: 0 5px 30px #fbc02d33;
  font-family: inherit;
  z-index: 10010;
}

.hero-choose-list {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 13px;
  flex-wrap: wrap;
}
.hero-choose-item {
  padding: 12px 18px;
  border-radius: 10px;
  background: #fffde7;
  border: 2px solid transparent;
  transition: border .17s, box-shadow .13s, background .18s;
  box-shadow: 0 2px 12px #ffedb958;
  text-align: center;
  cursor: pointer;
  min-width: 80px;
  min-height: 60px;
  font-size: 1.04em;
  font-family: inherit;
  font-weight: bold;
  color: #b99d19;
  position: relative;
}
.hero-choose-item.selected {
  border:2px solid #fbc02d;
  background: #fff8c8;
  box-shadow:0 4px 18px #ffe57f55;
}
.hero-choose-item:hover {
  border:2px solid #ffd54f;
  background: #fffbe6;
}
.hero-choose-class {
  display: block;
  font-size: 0.91em;
  color: #8d7005;
  opacity: 0.7;
  margin-top: 2px;
  font-weight: normal;
  letter-spacing: 0.3px;
}
.coin-fx {
  pointer-events: none;
  z-index: 11000;
}
#hero-name-input {
  font-family: inherit;
  font-size: 1.05em;
  background: #fffbe6;
  border: 2px solid #fbc02d;
  border-radius: 7px;
  margin-top: 7px;
  margin-bottom: 8px;
  padding: 6px 10px;
  outline: none;
  color: #a46a06;
  transition: border .13s, box-shadow .13s;
  width: 95%;
  box-sizing: border-box;
}
#hero-name-input:focus {
  border-color: #ffd54f;
  box-shadow: 0 2px 12px #ffe08266;
}
#confirm-hero-btn {
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #a46a06;
  border: 2px solid #ffd54f;
  border-radius: 11px;
  font-size: 1.11em;
  font-family: inherit;
  font-weight: 700;
  padding: 10px 27px;
  cursor: pointer;
  box-shadow: 0 1.5px 0 #fff5;
  transition: background .14s, transform .13s;
  margin-top: 8px;
}
#confirm-hero-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
#confirm-hero-btn:disabled {
  background: #f3e6a4;
  color: #bba45b;
  cursor: not-allowed;
}
.upgrade-buy-btn2 {
  margin-left: 6px;
  background: #f2c94c;
  color: #a46a06;
  border: 1.2px solid #e2b73b;
}
.upgrade-buy-btn2:active {
  background: #ffe082;
}

/* SHOP styles */
.shop-items-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 10px;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #fffde7;
  border-radius: 13px;
  border: 2.5px solid var(--shop-pink);
  padding: 15px 18px;
  box-shadow: 0 2px 24px #ffd1f355, 0 0 22px 2px #fbc02d33;
  position:relative;
  background-image: radial-gradient(circle at 85% 15%, var(--shop-blue) 0%, transparent 70%);
}
.shop-svg {
  min-width: 42px;
  margin-right: 6px;
}
.shop-info { flex: 1; }
.shop-name { font-weight: bold; color: #c43a9f; font-size: 1.09em; letter-spacing:1px;}
.shop-desc { font-size: 0.91em; color: #8d7005; margin-bottom: 2px;}
.shop-cost { color: #a46a06; margin-bottom: 3px;}
.shop-buy-btn {
  padding: 5px 20px;
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #a46a06;
  border: 2px solid #ffd54f;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1.02em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  transition: background .14s, transform .13s;
  position:relative;
  z-index:1;
}
.shop-buy-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
.shop-buy-btn[disabled] {
  background: #e0e0e0;
  color: #bba45b;
  border: 2px solid #e0e0e0;
  cursor: not-allowed;
}
.shop-active-bonuses {
  margin-top: 12px;
  font-size: 0.98em;
  text-align: center;
  color: #b43f92;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 1px 10px #fff7;
  padding-bottom: 2px;
  border-bottom: 1px dashed #c158dc22;
}

#open-shop-btn {
  position: relative;
  overflow: visible;
}
#open-shop-btn .shop-particles {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 48%;
  width: 90px;
  height: 90px;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.shop-particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.96;
  width: 11px;
  height: 11px;
  pointer-events: none;
  background: radial-gradient(circle at 30% 30%, #fff9, #82e5ff, #ff90c2, #b695f9 90%);
  animation: shop-particle-float 1.45s infinite cubic-bezier(.7,.2,0,1.2);
  filter: blur(0.8px);
}
@keyframes shop-particle-float {
  0% { opacity:0.92; transform: scale(1) translateY(0);}
  60% { opacity:0.82;}
  100% { opacity:0; transform: scale(1.25) translateY(-38px);}
}

/* Special offer pane on left */
#special-offer-pane {
  position: fixed;
  left: 14px;
  top: 104px;
  width: 160px;
  background: radial-gradient(ellipse at 30% 20%, #fffbe7 90%, #ffd8f2 100%);
  border: 2px solid #ff90c2;
  box-shadow: 0 6px 40px #ff90c2cc, 0 0 12px #b695f966;
  border-radius: 14px;
  z-index: 10010;
  padding: 12px 11px;
  font-family: 'Press Start 2P', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 120px;
}
#special-offer-pane .special-title {
  color: #f50057;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 3px;
  letter-spacing: 1px;
}
#special-offer-pane .special-svg {
  margin: 3px 0 5px 0;
  width: 42px;
  height: 42px;
}
#special-offer-pane .special-desc {
  font-size: 0.85em;
  color: #7c2e57;
  text-align: center;
  margin-bottom: 6px;
  margin-top: 3px;
}
#special-offer-pane .special-cost {
  color: #a46a06;
  font-size: 0.93em;
  margin-bottom: 5px;
  margin-top: 2px;
}
#special-offer-pane .special-buy-btn {
  padding: 4px 18px;
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #a46a06;
  border: 2px solid #ffd54f;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.97em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  transition: background .14s, transform .13s;
  margin-bottom: 3px;
}
#special-offer-pane .special-buy-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
#special-offer-pane .special-timer {
  color: #ff4081;
  font-size: 0.88em;
  font-weight: bold;
  letter-spacing: 1px;
  margin-top: 7px;
}
@media (max-width: 600px) {
  #special-offer-pane {
    left: 2vw;
    width: 93vw;
    min-width: 0;
    max-width: 320px;
    top: unset;
    bottom: 10px;
    padding: 10px 6px;
  }
}
body.shop-open .coin-fx { display:none !important; }

#quests-pane {
  position: fixed;
  right: 14px;
  top: 104px;
  width: 200px;
  background: radial-gradient(ellipse at 70% 30%, #e0ffe7 90%, #90ffb2 100%);
  border: 2px solid #33c47a;
  box-shadow: 0 6px 40px #90ffb2cc, 0 0 12px #33c47a66;
  border-radius: 14px;
  z-index: 10012;
  padding: 12px 11px;
  font-family: 'Press Start 2P', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 120px;
}
#quests-pane .quests-title {
  color: #13b364;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
#quests-pane .quest-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quest-item {
  background: #f1fff6;
  border: 1px solid #47cf8b;
  border-radius: 8px;
  padding: 7px 7px 7px 12px;
  font-size: 0.83em;
  color: #1e7a44;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.quest-title {
  font-weight: bold;
  color: #13b364;
  margin-bottom: 2px;
}
.quest-progress {
  font-size: 0.9em;
  color: #368c5c;
}
.quest-reward {
  font-size: 0.87em;
  color: #b3880b;
}
.quest-complete {
  color: #fff;
  background: #27ae60;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.92em;
  margin-left: 6px;
}
.quest-claim-btn {
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #1e7a44;
  border: 1.5px solid #ffd54f;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.97em;
  font-weight: 700;
  padding: 3px 15px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  margin-top: 4px;
  align-self: flex-end;
  transition: background .14s, transform .13s;
}
.quest-claim-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
.quest-done {
  opacity: 0.6;
  text-decoration: line-through;
}

/* --- RANDOM EVENT --- */
.random-event-box {
  position: fixed;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  background: #fffbe7;
  border: 3px solid #fbc02d;
  box-shadow: 0 8px 40px #ffd54f77, 0 0 18px #90ffb2cc;
  border-radius: 16px;
  z-index: 20010;
  padding: 24px 28px 18px 28px;
  font-family: 'Press Start 2P', Arial, sans-serif;
  min-width: 180px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: randomEventShow .4s;
}
@keyframes randomEventShow {
  from { opacity: 0; transform: scale(0.93) translate(-50%, -50%);}
  to { opacity: 1; transform: scale(1) translate(-50%, -50%);}
}
.random-event-title {
  color: #e65100;
  font-size: 1.08em;
  font-weight: bold;
  margin-bottom: 7px;
}
.random-event-svg {
  margin-bottom: 10px;
  margin-top: 5px;
}
.random-event-desc {
  color: #b88c08;
  margin-bottom: 9px;
  font-size: 0.96em;
  text-align: center;
}
.random-event-btn {
  background: #ffd54f;
  color: #a46a06;
  border: 2px solid #ffd54f;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1.05em;
  font-weight: 700;
  padding: 7px 22px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  transition: background .14s, transform .13s;
}
.random-event-btn:active {
  background: #ffe082;
  transform: scale(0.97);
}
.random-event-timer {
  color: #d32f2f;
  font-size: 0.92em;
  margin-top: 7px;
  font-weight: bold;
}
@media (max-width: 700px) {
  #quests-pane {
    right: 2vw;
    width: 93vw;
    min-width: 0;
    max-width: 320px;
    top: unset;
    bottom: 10px;
    padding: 10px 6px;
  }
}

#open-talent-fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #33bfa4 70%, #ffe082 100%);
  border: 3px solid #33bfa4;
  border-radius: 50%;
  box-shadow: 0 4px 18px #33bfa444, 0 0 9px #ffe08299;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11005;
  cursor: pointer;
  transition: box-shadow .17s, background .14s, filter .13s;
  font-size: 2em;
  color: #18845b;
}
#open-talent-fab:hover {
  filter: brightness(1.08) drop-shadow(0 0 8px #ffe082cc);
}
#open-talent-fab .talent-fab-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  background: #ff9800;
  color: #fff;
  border-radius: 50%;
  padding: 2px 7px;
  font-size: 0.85em;
  font-weight: bold;
  box-shadow: 0 1px 6px #0002;
  border: 2px solid #fffbe7;
}
@media (max-width: 600px) {
  #open-talent-fab {
    right: 10px;
    bottom: 10px;
    width: 48px;
    height: 48px;
    font-size: 1.45em;
  }
}

/* (include your previous talent tree panel styles here, unchanged) */
#talent-pane {
  position: fixed;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 0%, #f9fbe7 90%, #d7ffea 100%);
  border: 2px solid #33bfa4;
  box-shadow: 0 6px 40px #33bfa466, 0 0 12px #b9ffd666;
  border-radius: 18px;
  z-index: 10020;
  padding: 23px 28px 18px 28px;
  font-family: 'Press Start 2P', Arial, sans-serif;
  display: none;
  flex-direction: column;
  align-items: center;
  min-width: 300px;
  max-width: 90vw;
}
#talent-pane.active { display: flex; }
.talent-title {
  color: #1aa273;
  font-weight: bold;
  font-size: 1.12em;
  margin-bottom: 11px;
  letter-spacing: 1px;
}
.talent-points {
  color: #ff9800;
  margin-bottom: 10px;
  font-size: 0.99em;
  font-weight: bold;
}
.talent-tree {
  display: flex;
  flex-direction: row;
  gap: 48px;
  justify-content: center;
}
.talent-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.talent-node {
  background: #e0ffe7;
  border: 2px solid #33bfa4;
  border-radius: 13px;
  padding: 10px 20px;
  min-width: 110px;
  min-height: 54px;
  box-shadow: 0 2px 14px #b9ffd644;
  color: #1e7a44;
  font-size: 0.85em;
  text-align: center;
  position: relative;
  transition: filter .12s, border .12s;
}
.talent-node.locked {
  opacity: 0.54;
  filter: grayscale(0.55);
}
.talent-node.unlocked {
  border-color: #ff9800;
  filter: drop-shadow(0 0 5px #ffe082cc);
}
.talent-lvl {
  color: #1aa273;
  font-weight: bold;
  font-size: 0.9em;
  position: absolute;
  right: 9px; top: 7px;
}
.talent-up-btn {
  background: linear-gradient(90deg,#ffe082 70%,#fbc02d 100%);
  color: #1e7a44;
  border: 1.5px solid #ffd54f;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.99em;
  font-weight: 700;
  padding: 3px 13px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  margin-top: 6px;
  margin-bottom: 2px;
  transition: background .14s, transform .13s;
}
.talent-up-btn:active {
  background: #ffd54f;
  transform: scale(0.97);
}
#close-talent-btn {
  background: #e0ffe7;
  color: #18845b;
  border: 1.3px solid #33bfa4;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.95em;
  padding: 6px 17px;
  cursor: pointer;
  margin-top: 18px;
  margin-bottom: 4px;
}
@media (max-width: 700px) {
  #talent-pane {
    left: 2vw;
    transform: none;
    max-width: 98vw;
    min-width: 0;
    top: 14vw;
    padding: 14px 2vw 15px 2vw;
  }
  .talent-tree {
    flex-direction: column;
    gap: 20px;
  }
}
#open-pet-btn {
  position: fixed;
  left: 18px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #8e7cc3 65%, #b7e0ff 100%);
  border: 3px solid #6757a6;
  border-radius: 50%;
  box-shadow: 0 4px 18px #6757a644, 0 0 9px #b7e0ff99;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11006;
  cursor: pointer;
  transition: box-shadow .17s, background .14s, filter .13s;
  font-size: 2.2em;
  color: #fff;
  overflow: hidden;
}
#open-pet-btn:hover {
  filter: brightness(1.08) drop-shadow(0 0 8px #8e7cc3cc);
}
#open-pet-btn .pet-fab-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  background: #6757a6;
  color: #fff;
  border-radius: 50%;
  padding: 2px 7px;
  font-size: 0.85em;
  font-weight: bold;
  box-shadow: 0 1px 6px #0002;
  border: 2px solid #fffbe7;
}
@media (max-width: 600px) {
  #open-pet-btn {
    left: 10px;
    bottom: 10px;
    width: 48px;
    height: 48px;
    font-size: 1.45em;
  }
}

#pet-pane {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(ellipse at 60% 0%, #efe9f7 85%, #d2e3f7 100%);
  border: 2.5px solid #8e7cc3;
  box-shadow: 0 6px 40px #8e7cc366, 0 0 12px #b7e0ff88;
  border-radius: 18px;
  z-index: 10030;
  padding: 24px 34px 18px 34px;
  font-family: 'Press Start 2P', Arial, sans-serif;
  display: none;
  flex-direction: column;
  align-items: center;
  min-width: 330px;
  max-width: 97vw;
  max-height: 96vh;
  overflow-y: auto;
}
#pet-pane.active { display: flex; }
.pet-title {
  color: #55418e;
  font-weight: bold;
  font-size: 1.14em;
  margin-bottom: 13px;
  letter-spacing: 1px;
  text-shadow: 0 1px 0 #fff, 0 0px 8px #b7e0ff77;
}
.pet-list {
  display: flex;
  flex-direction: row;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.pet-card {
  background: #f6f3fb;
  border: 2px solid #8e7cc3;
  border-radius: 14px;
  box-shadow: 0 2px 14px #8e7cc324;
  padding: 15px 18px;
  min-width: 112px;
  min-height: 99px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: filter .12s, border .12s;
}
.pet-card.locked {
  opacity: 0.45;
  filter: grayscale(0.85);
}
.pet-card.selected {
  border-color: #b7e0ff;
  box-shadow: 0 0 16px #8e7cc355;
}
.pet-avatar {
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  margin-top: 3px;
  filter: drop-shadow(0 0 7px #b7e0ff88);
}
.pet-name {
  font-weight: bold;
  color: #55418e;
  font-size: 1em;
  margin-bottom: 2px;
  text-shadow: 0 1px 0 #fff, 0 0 5px #b7e0ff33;
}
.pet-desc {
  color: #6c458f;
  font-size: 0.83em;
  text-align: center;
  margin-bottom: 3px;
}
.pet-level {
  color: #ba79ff;
  font-size: 0.92em;
  margin-bottom: 1px;
  font-weight: bold;
}
.pet-up-btn {
  background: linear-gradient(90deg,#ffecd2 80%,#b7e0ff 100%);
  color: #55418e;
  border: 1.5px solid #b7e0ff;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.98em;
  font-weight: 700;
  padding: 3px 17px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  margin-top: 8px;
  margin-bottom: 3px;
  transition: background .14s, transform .13s;
}
.pet-up-btn:active {
  background: #b7e0ff;
  transform: scale(0.97);
}
.pet-select-btn {
  background: #8e7cc3;
  color: #fff;
  border: 1.5px solid #b7e0ff;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.98em;
  font-weight: 700;
  padding: 2px 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 #fff7;
  margin-top: 3px;
  margin-bottom: 2px;
  transition: background .14s, transform .13s;
}
.pet-select-btn.selected, .pet-select-btn:active {
  background: #55418e;
}

#close-pet-btn {
  background: linear-gradient(90deg,#ffecd2 70%,#b7e0ff 100%);
  color: #55418e;
  border: 1.5px solid #b7e0ff;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.97em;
  font-weight: bold;
  padding: 7px 30px;
  cursor: pointer;
  margin-top: 18px;
  margin-bottom: 4px;
  box-shadow: 0 2px 0 #fff7;
  transition: background .14s, transform .13s;
}
#close-pet-btn:active {
  background: #b7e0ff;
  transform: scale(0.97);
}
@media (max-width: 700px) {
  #open-pet-btn {
    left: 10px;
    bottom: 10px;
    width: 48px;
    height: 48px;
    font-size: 1.45em;
  }
  #pet-pane {
    min-width: 0;
    width: 98vw;
    padding: 10px 2vw 10px 2vw;
  }
  .pet-list {
    gap: 10px;
  }
}
