@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

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

:root {
  --bg: #1a1428;
  --panel: #2a2040;
  --panel-light: #3a3060;
  --border: #5a4880;
  --text: #f0e8ff;
  --text-dim: #a898c8;
  --accent: #ffd060;
  --shadow: rgba(0, 0, 0, 0.5);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DotGothic16', 'MS Gothic', monospace;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: background 0.6s ease;
}

body.bg-land {
  background-color: #2a1e10;
  background-image: url('../背景/land.png');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.bg-fire {
  background-color: #2a0808;
  background-image: url('../背景/fire.png');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.bg-water {
  background-color: #050f1a;
  background-image: url('../背景/water.png');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.bg-sky {
  background-color: #0f2038;
  background-image: url('../背景/sky.png');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.bg-water::before,
body.bg-sky::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body.bg-water::before {
  background: rgba(0, 8, 22, 0.52);
}

body.bg-sky::before {
  background: rgba(6, 14, 28, 0.48);
}

body.bg-plant {
  background-color: #102818;
  background-image: url('../背景/plant.png');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.screen {
  width: 100%;
  max-width: 900px;
}

/* Title */
.title-screen {
  text-align: center;
  padding-top: 16px;
  position: relative;
  overflow: hidden;
}

.egg-parade {
  padding: 20px 16px 12px;
  margin: 0 auto 24px;
  max-width: 640px;
}

.egg-parade-inner {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-height: 110px;
}

.parade-egg {
  animation: egg-float 3s ease-in-out infinite;
  animation-delay: var(--delay);
  transform-origin: bottom center;
}

.parade-egg img {
  width: calc(64px * var(--scale));
  height: calc(64px * var(--scale));
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px var(--shadow));
}

@keyframes egg-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.start-btn {
  font-size: 1.2rem;
  padding: 14px 48px;
  margin-bottom: 12px;
}

.game-title {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 400;
  background: linear-gradient(165deg, #fff8d0 0%, #ffd700 35%, #f0c030 65%, #c8a020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(128, 96, 32, 0.5)) drop-shadow(0 0 18px rgba(255, 215, 0, 0.45));
  line-height: 1.3;
  letter-spacing: 5px;
  position: relative;
  z-index: 1;
}

.title-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
  padding: 20px 40px;
}

.title-sparkle {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 0.75rem;
  color: #ffd700;
  text-shadow: 0 0 6px #fff8c0, 0 0 12px #ffd700, 0 0 20px #f0c040;
  pointer-events: none;
  animation: sparkle-twinkle 2s ease-in-out infinite;
  animation-delay: var(--delay);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle)));
  opacity: 0;
  z-index: 0;
}

@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle))) scale(0.4); }
  50% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) translateX(calc(var(--radius) + 4px)) rotate(calc(-1 * var(--angle))) scale(1.2); }
}

.subtitle {
  color: var(--text-dim);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.egg-select {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.egg-btn {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  cursor: pointer;
  width: 150px;
  transition: transform 0.1s, border-color 0.15s;
  color: var(--text);
  font-family: inherit;
}

.egg-btn:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.egg-btn img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
}

.egg-name {
  display: block;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Gacha */
.gacha-screen {
  text-align: center;
  padding-top: 24px;
}

.gacha-title {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.gacha-machine {
  background: var(--panel);
  border: 4px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  margin: 24px auto;
  max-width: 280px;
  transition: border-color 0.3s;
}

.gacha-machine.revealed {
  border-color: var(--accent);
  animation: gacha-flash 0.6s ease;
}

@keyframes gacha-flash {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 30px rgba(255, 208, 96, 0.5); }
}

.gacha-slot {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gacha-mystery {
  font-size: 5rem;
  color: var(--border);
  animation: mystery-pulse 1s ease-in-out infinite;
}

@keyframes mystery-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.gacha-egg {
  max-width: 120px;
  max-height: 120px;
  image-rendering: pixelated;
}

.gacha-egg.reveal {
  animation: egg-pop 0.5s ease;
}

@keyframes egg-pop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.gacha-result {
  margin-bottom: 20px;
}

.gacha-result h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.gacha-rates {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.gacha-rates p { margin-bottom: 6px; }

.gacha-spin-btn {
  font-size: 1.1rem;
  padding: 12px 36px;
}

/* Hatch */
.hatch-screen .hatch-info-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}

.hatch-info-panel h3 {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.hatch-tips {
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.hatch-tips li {
  padding: 4px 0;
  padding-left: 12px;
  position: relative;
}

.hatch-tips li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.hatch-progress-wrap {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 70px 1fr 50px;
  align-items: center;
  gap: 8px;
}

.hatch-items {
  margin-top: 16px;
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}

.item-select-screen {
  text-align: center;
  padding-top: 24px;
}

.hatch-monster-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 20px 0 28px;
}

.hatch-monster-preview img {
  max-width: 100px;
  max-height: 100px;
  image-rendering: pixelated;
}

.item-choice-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.item-choice-btn {
  font-family: inherit;
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px 10px;
  width: 140px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, border-color 0.15s;
}

.item-choice-btn:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.item-choice-btn img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
}

.item-choice-name {
  font-size: 0.7rem;
  line-height: 1.3;
}

/* Item merge evolution */
.item-merge-screen {
  text-align: center;
  padding-top: 32px;
}

.merge-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  min-height: 220px;
  margin: 40px auto;
}

.merge-actor {
  position: relative;
  z-index: 2;
  animation: merge-approach 2s ease-in-out forwards;
}

.merge-actor img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.merge-item {
  animation-name: merge-approach-item;
}

.merge-flash {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 220, 120, 0.6) 35%, transparent 70%);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  animation: merge-flash 2s ease-in-out forwards;
}

@keyframes merge-approach {
  0% { transform: translateX(-30px) scale(1); opacity: 1; }
  45% { transform: translateX(24px) scale(1.05); opacity: 1; }
  70% { transform: translateX(24px) scale(0.2); opacity: 0; }
  100% { transform: translateX(24px) scale(0); opacity: 0; }
}

@keyframes merge-approach-item {
  0% { transform: translateX(30px) scale(1); opacity: 1; }
  45% { transform: translateX(-24px) scale(1.05); opacity: 1; }
  70% { transform: translateX(-24px) scale(0.2); opacity: 0; }
  100% { transform: translateX(-24px) scale(0); opacity: 0; }
}

@keyframes merge-flash {
  0%, 40% { opacity: 0; transform: scale(0.4); }
  55% { opacity: 1; transform: scale(1.4); }
  75% { opacity: 0.6; transform: scale(2); }
  100% { opacity: 0; transform: scale(2.5); }
}

/* Evolution reveal */
.evolution-reveal-screen {
  text-align: center;
  padding: 28px 16px 36px;
}

.evolution-title {
  animation: evolution-title-pop 0.6s ease-out both;
}

.evolution-halo-wrap {
  position: relative;
  width: 400px;
  height: 400px;
  margin: 16px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.evolution-sparkle {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1rem;
  color: #ffe880;
  text-shadow: 0 0 8px #fff8c0, 0 0 14px #ffd700, 0 0 24px #f0c040;
  pointer-events: none;
  z-index: 4;
  animation: evolution-sparkle-twinkle 2.2s ease-in-out infinite;
  animation-delay: var(--delay);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle)));
  opacity: 0;
}

@keyframes evolution-sparkle-twinkle {
  0%, 100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle))) scale(0.3);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(calc(var(--radius) + 6px)) rotate(calc(-1 * var(--angle))) scale(1.3);
  }
}

.evolution-rays {
  position: absolute;
  inset: -40px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 230, 140, 0.15) 20deg,
    transparent 40deg,
    rgba(255, 230, 140, 0.12) 60deg,
    transparent 80deg,
    rgba(255, 230, 140, 0.15) 100deg,
    transparent 120deg,
    rgba(255, 230, 140, 0.12) 140deg,
    transparent 160deg,
    rgba(255, 230, 140, 0.15) 180deg,
    transparent 200deg,
    rgba(255, 230, 140, 0.12) 220deg,
    transparent 240deg,
    rgba(255, 230, 140, 0.15) 260deg,
    transparent 280deg,
    rgba(255, 230, 140, 0.12) 300deg,
    transparent 320deg,
    rgba(255, 230, 140, 0.15) 340deg,
    transparent 360deg
  );
  animation: evolution-rays-spin 10s linear infinite;
  pointer-events: none;
}

.evolution-halo {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 180, 0.85) 0%, rgba(255, 200, 80, 0.35) 40%, transparent 72%);
  animation: evolution-halo-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

.evolution-halo-wrap.element-fire .evolution-halo {
  background: radial-gradient(circle, rgba(255, 200, 120, 0.9) 0%, rgba(255, 100, 60, 0.35) 45%, transparent 72%);
}

.evolution-halo-wrap.element-water .evolution-halo {
  background: radial-gradient(circle, rgba(160, 220, 255, 0.9) 0%, rgba(60, 140, 255, 0.35) 45%, transparent 72%);
}

.evolution-halo-wrap.element-land .evolution-halo {
  background: radial-gradient(circle, rgba(210, 180, 120, 0.9) 0%, rgba(120, 90, 50, 0.35) 45%, transparent 72%);
}

.evolution-halo-wrap.element-sky .evolution-halo {
  background: radial-gradient(circle, rgba(200, 255, 200, 0.9) 0%, rgba(100, 200, 120, 0.35) 45%, transparent 72%);
}

.evolution-halo-wrap.element-plant .evolution-halo {
  background: radial-gradient(circle, rgba(180, 255, 160, 0.9) 0%, rgba(80, 180, 60, 0.35) 45%, transparent 72%);
}

.evolution-sprite-frame {
  position: relative;
  z-index: 3;
  margin: 0 auto;
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: evolution-sprite-rise 0.8s ease-out both;
}

.evolution-sprite {
  width: 280px;
  height: 280px;
  max-width: 280px;
  max-height: 280px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 20px rgba(255, 220, 120, 0.9));
}

.evolution-name {
  font-size: 1.5rem;
  margin: 8px 0 12px;
  animation: evolution-title-pop 0.6s 0.2s ease-out both;
}

.evolution-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 28px;
  animation: evolution-title-pop 0.6s 0.35s ease-out both;
}

@keyframes evolution-rays-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes evolution-halo-pulse {
  0%, 100% { opacity: 0.75; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes evolution-sprite-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.7); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes evolution-title-pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}


@keyframes rankup-title-pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.rankup-reveal-screen {
  text-align: center;
  padding: 28px 16px 36px;
}

.rankup-title {
  animation: rankup-title-pop 0.6s ease-out both;
  color: #ffd060;
  text-shadow: 0 0 12px rgba(255, 208, 96, 0.6);
}

.rankup-key-msg {
  color: #ffe080;
  font-size: 0.95rem;
  margin: -8px 0 12px;
  animation: rankup-title-pop 0.6s 0.1s ease-out both;
}

.loot-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: -4px 0 8px;
}

.rankup-orb-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rankup-rays {
  position: absolute;
  inset: -20px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 220, 80, 0.18) 25deg,
    transparent 50deg,
    rgba(255, 220, 80, 0.14) 75deg,
    transparent 100deg,
    rgba(255, 220, 80, 0.18) 125deg,
    transparent 150deg,
    rgba(255, 220, 80, 0.14) 175deg,
    transparent 200deg,
    rgba(255, 220, 80, 0.18) 225deg,
    transparent 250deg,
    rgba(255, 220, 80, 0.14) 275deg,
    transparent 300deg,
    rgba(255, 220, 80, 0.18) 325deg,
    transparent 360deg
  );
  animation: evolution-rays-spin 8s linear infinite;
  pointer-events: none;
}

.rankup-halo {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 140, 0.9) 0%, rgba(255, 180, 60, 0.35) 45%, transparent 72%);
  animation: evolution-halo-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

.rankup-sparkle {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1rem;
  color: #ffe880;
  text-shadow: 0 0 8px #fff8c0, 0 0 14px #ffd700;
  pointer-events: none;
  z-index: 4;
  animation: evolution-sparkle-twinkle 2.2s ease-in-out infinite;
  animation-delay: var(--delay);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle)));
  opacity: 0;
}

.rankup-orb {
  position: relative;
  z-index: 3;
  font-size: 5rem;
  animation: rankup-orb-rise 0.8s ease-out both;
  filter: drop-shadow(0 0 20px rgba(255, 200, 60, 0.9));
}

.rankup-number {
  position: absolute;
  bottom: 24px;
  z-index: 4;
  font-size: 1.6rem;
  font-weight: bold;
  color: #ffd060;
  text-shadow: 2px 2px 0 var(--shadow);
  animation: rankup-title-pop 0.6s 0.15s ease-out both;
}

.rankup-label {
  font-size: 1.4rem;
  margin: 8px 0 16px;
  animation: rankup-title-pop 0.6s 0.25s ease-out both;
}

.rankup-details {
  margin-bottom: 28px;
  animation: rankup-title-pop 0.6s 0.35s ease-out both;
}

.rankup-detail {
  color: var(--text-dim);
  margin: 6px 0;
  font-size: 0.95rem;
}

.rankup-detail strong {
  color: var(--accent);
}

@keyframes rankup-orb-rise {
  from { opacity: 0; transform: translateY(20px) scale(0.6); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.inline-log h3 {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.item-grid-large {
  gap: 12px;
}

.item-btn-large {
  width: 72px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
}

.item-btn-large img {
  width: 48px;
  height: 48px;
}

.item-rarity {
  font-size: 0.55rem;
  margin-top: 2px;
  line-height: 1;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 24px;
  border: 3px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  background: var(--panel-light);
  color: var(--text);
  transition: background 0.15s;
}

.btn:hover { background: var(--border); }
.btn.primary { background: #6040a0; border-color: var(--accent); }
.btn.primary:hover { background: #8060c0; }
.btn.secondary { margin-top: 8px; }
.btn.small { font-size: 0.8rem; padding: 4px 12px; }

/* Play screen */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.day-label {
  font-size: 1.1rem;
  color: var(--accent);
}

.main-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .main-area { grid-template-columns: 1fr; }
}

.monster-panel {
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background-color: var(--panel);
}

.element-panel {
  background-color: transparent;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.element-panel.element-land { background-image: url('../背景/land.png'); }
.element-panel.element-fire { background-image: url('../背景/fire.png'); }
.element-panel.element-water { background-image: url('../背景/water.png'); }
.element-panel.element-sky { background-image: url('../背景/sky.png'); }
.element-panel.element-plant { background-image: url('../背景/plant.png'); }

.element-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(18, 14, 32, 0.25);
  z-index: 0;
  pointer-events: none;
}

.element-panel.element-water::before {
  background: rgba(0, 10, 24, 0.58);
}

.element-panel.element-sky::before {
  background: rgba(8, 14, 28, 0.55);
}

.element-panel > * {
  position: relative;
  z-index: 1;
}

.element-panel .sprite-frame {
  background: rgba(18, 14, 32, 0.45);
  border-color: rgba(255, 255, 255, 0.15);
}

.element-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 8px;
  color: var(--accent);
}

.sprite-frame {
  background: #120e20;
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 12px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sprite-frame.egg {
  animation: wobble 2s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}

.monster-sprite {
  max-width: 140px;
  max-height: 140px;
  object-fit: contain;
  image-rendering: pixelated;
}

.play-screen .sprite-frame {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 300px;
  margin-bottom: 12px;
}

.play-screen .element-panel .sprite-frame {
  background: none;
  border: none;
}

.play-screen .monster-sprite {
  width: 280px;
  height: 280px;
  max-width: 280px;
  max-height: 280px;
}

.monster-name {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.rarity-badge {
  font-size: 0.85rem;
  font-weight: bold;
}

.boost-badge {
  display: inline-block;
  background: #4060a0;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.75rem;
  margin-left: 8px;
}

.hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Stats */
.stats-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.stat-row {
  display: grid;
  grid-template-columns: 60px 1fr 36px;
  align-items: center;
  gap: 8px;
}

.stat-label { font-size: 0.85rem; color: var(--text-dim); }
.stat-value { font-size: 0.85rem; text-align: right; }

.stat-bar {
  height: 14px;
  background: #120e20;
  border: 2px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  transition: width 0.3s ease;
}

/* Actions */
.actions-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.actions-heading {
  font-size: 0.85rem;
  color: var(--accent);
  text-align: left;
  margin-bottom: -4px;
}

.care-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.train-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.care-btn, .train-btn {
  font-size: 0.78rem;
  padding: 10px 6px;
}

.play-log-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.rank-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.adventure-tier-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 520px;
  margin: 20px auto;
}

.adventure-tier-btn {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.adventure-tier-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.tier-label {
  font-size: 1rem;
}

.tier-lock {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.tier-final-hint {
  font-size: 0.68rem;
  color: #ffd060;
}

.legendary-unlock-note {
  color: #ffd060 !important;
  text-shadow: 0 0 8px rgba(255, 208, 96, 0.35);
}

.final-battle-btn {
  margin: 12px auto 8px;
  display: block;
  min-width: 240px;
  animation: evolution-title-pop 0.6s ease-out both;
}

.battle-first-run {
  text-align: center;
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 8px;
  animation: evolution-title-pop 0.6s ease-out both;
}

.enemy-projectile {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff8060 0%, #d03030 100%);
  box-shadow: 0 0 10px rgba(255, 80, 60, 0.9);
  z-index: 8;
  pointer-events: none;
}

.enemy-projectile.boss-shot {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #ffaa40 0%, #c02010 100%);
}

.battle-enemy.stunned {
  filter: brightness(1.4) hue-rotate(200deg);
}

.battle-final-run {
  text-align: center;
  color: #e080ff;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(160, 32, 240, 0.6);
  animation: evolution-title-pop 0.6s ease-out both;
}

.battle-final-screen .battle-viewport {
  box-shadow: 0 0 0 3px rgba(160, 32, 240, 0.45), inset 0 0 40px rgba(80, 0, 120, 0.25);
}

.battle-demon-king {
  width: 100px !important;
  height: 100px !important;
}

.battle-demon-king .enemy-name-tag {
  color: #e080ff;
  font-size: 0.75rem;
}

.demon-label {
  color: #e080ff !important;
  text-shadow: 0 0 8px #a020f0, 0 0 14px #ff4020 !important;
  font-size: 0.75rem !important;
}

.ranking-cleared h1 {
  color: #ffd060;
  text-shadow: 0 0 12px rgba(255, 208, 96, 0.5);
}

.ranking-clear-msg {
  color: #ffd060 !important;
  margin-bottom: 16px;
}

.adventure-access-panel {
  text-align: center;
  margin: 12px 0 8px;
}

.found-loot-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}

.found-loot-panel h3 {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.found-loot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.found-loot-col h4 {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.found-loot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--panel-light);
  border: 2px solid var(--border);
  border-radius: 4px;
}

.loot-card-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.loot-use-btn, .loot-sell-btn {
  flex: 1;
  font-size: 0.68rem;
  padding: 4px 2px;
}

.loot-sell-btn {
  background: #3a2848;
  border-color: #c8a030;
  color: #ffd060;
}

.shop-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.gold-display {
  font-size: 1.1rem;
  color: #ffd060;
  font-weight: bold;
}

.shop-note {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.shop-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
}

.shop-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shop-item-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.found-loot-btn {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--panel-light);
  border: 2px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
}

.found-loot-btn:hover {
  border-color: var(--accent);
}

.loot-item-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.loot-name {
  font-size: 0.68rem;
  line-height: 1.2;
}

.loot-rarity {
  font-size: 0.65rem;
}

.loot-icon {
  font-size: 1.4rem;
}

.loot-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.adventure-screen {
  text-align: center;
}

.adventure-btn {
  font-size: 1.2rem;
  padding: 14px 40px;
  margin: 20px auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.adventure-log {
  max-width: 600px;
  margin: 24px auto 0;
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  text-align: left;
}

.adventure-log h3 {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* Adventure Battle */
.battle-screen {
  width: 100%;
  max-width: 900px;
}

.battle-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: rgba(18, 14, 32, 0.85);
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.battle-hp-bar {
  width: 120px;
  height: 12px;
  background: #120e20;
  border: 2px solid var(--border);
  overflow: hidden;
}

.battle-hp-fill {
  height: 100%;
  background: #e06060;
  transition: width 0.2s;
}

.battle-atk-name {
  color: var(--accent);
  margin-left: auto;
}

.battle-message {
  text-align: left;
  flex: 1;
  min-height: 1.4em;
  color: var(--accent);
  font-size: 1.1rem;
  text-shadow: 0 0 8px rgba(255, 208, 96, 0.5);
}

.battle-viewport {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border: 3px solid var(--border);
  border-radius: 4px;
  background: #120e20;
}

.battle-viewport.element-bg-fire { background: linear-gradient(180deg, #4a1810 0%, #2a0808 70%); }
.battle-viewport.element-bg-water { background: linear-gradient(180deg, #1a4060 0%, #0a2030 70%); }
.battle-viewport.element-bg-sky { background: linear-gradient(180deg, #406080 0%, #203050 70%); }
.battle-viewport.element-bg-land { background: linear-gradient(180deg, #4a3828 0%, #2a1e10 70%); }
.battle-viewport.element-bg-plant { background: linear-gradient(180deg, #2a4828 0%, #142818 70%); }

.battle-world {
  position: relative;
  height: 100%;
  transition: transform 0.05s linear;
  will-change: transform;
}

.battle-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: repeating-linear-gradient(90deg, #3a3048 0px, #3a3048 32px, #2a2040 32px, #2a2040 64px);
  border-top: 3px solid #5a4880;
}

.battle-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.battle-timer {
  color: var(--accent);
  font-size: 0.95rem;
  white-space: nowrap;
}

.battle-player {
  position: absolute;
  bottom: 48px;
  width: 80px;
  height: 80px;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transition: filter 0.1s;
}

.battle-player.dodging {
  filter: drop-shadow(0 0 12px rgba(160, 220, 255, 0.9));
}

.battle-player.attacking {
  filter: drop-shadow(0 0 10px rgba(255, 208, 96, 0.8));
}

.battle-player img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transition: transform 0.1s;
}

.battle-enemy {
  position: absolute;
  width: 64px;
  height: 64px;
  z-index: 5;
  transform-origin: bottom center;
}

.battle-enemy img,
.battle-enemy .enemy-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.enemy-colorshift .enemy-sprite {
  transition: filter 0.2s;
}

.battle-boss.enemy-colorshift .enemy-sprite {
  animation: boss-pulse 1.2s ease-in-out infinite;
}

@keyframes boss-pulse {
  0%, 100% { filter: hue-rotate(-40deg) saturate(2.2) brightness(0.55) contrast(1.25) drop-shadow(0 0 6px #ff4020); }
  50% { filter: hue-rotate(-40deg) saturate(2.4) brightness(0.65) contrast(1.25) drop-shadow(0 0 14px #ff6020); }
}

.enemy-placeholder {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.enemy-name-tag {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
}

.battle-boss .enemy-name-tag {
  color: #ffd060;
  font-size: 0.65rem;
}

.battle-boss {
  width: 88px;
  height: 88px;
  z-index: 6;
}

.boss-label {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: #ffd060;
  text-shadow: 0 0 6px #ff4020;
  white-space: nowrap;
}

.boss-hp {
  height: 6px !important;
}

.boss-hp div {
  background: #ffd060 !important;
}

.effect-burst {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--efx-color), transparent 70%);
  animation: efx-burst 0.4s ease-out forwards;
}

.effect-hit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--efx-color);
  animation: efx-hit 0.3s ease-out forwards;
}

.battle-particle {
  position: absolute;
  border-radius: 50%;
  z-index: 9;
  pointer-events: none;
}

.battle-particle.element-fire { background: #ff6020; box-shadow: 0 0 6px #ff9040; }
.battle-particle.element-water { background: #60c0ff; box-shadow: 0 0 6px #a0e0ff; }
.battle-particle.element-sky { background: #a0e080; box-shadow: 0 0 6px #d0ffc0; }
.battle-particle.element-land { background: #a08060; box-shadow: 0 0 6px #c0a080; }
.battle-particle.element-plant { background: #40a030; box-shadow: 0 0 6px #80d060; }

@keyframes efx-burst {
  from { transform: scale(0.3); opacity: 1; }
  to { transform: scale(2.5); opacity: 0; }
}

@keyframes efx-hit {
  from { transform: scale(0.5); opacity: 1; }
  to { transform: scale(1.8); opacity: 0; }
}

.battle-time {
  font-size: 1rem;
  color: #a0e0ff;
}


.enemy-hp {
  height: 4px;
  background: #333;
  margin-top: 2px;
}

.enemy-hp div {
  height: 100%;
  background: #e04040;
}

.battle-effect {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.effect-projectile {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--efx-color);
  box-shadow: 0 0 12px var(--efx-color);
  animation: efx-fade 0.8s ease-out forwards;
}

.effect-breath {
  width: 200px;
  height: 60px;
  background: linear-gradient(90deg, var(--efx-color), transparent);
  border-radius: 0 50% 50% 0;
  opacity: 0.8;
  animation: efx-breath 0.5s ease-out forwards;
}

.effect-pillar,
.effect-wave {
  width: 60px;
  height: 120px;
  background: linear-gradient(180deg, transparent, var(--efx-color), transparent);
  animation: efx-pillar 0.9s ease-out forwards;
}

.effect-pillar.tier-2,
.effect-wave.tier-2 {
  width: 100px;
  height: 180px;
}

.effect-drop {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: var(--efx-color);
  animation: efx-drop 0.6s ease-in forwards;
}

.effect-vine {
  width: 8px;
  height: 80px;
  background: var(--efx-color);
  border-radius: 4px;
  box-shadow: 4px 0 0 var(--efx-color), -4px 0 0 var(--efx-color);
  animation: efx-vine 0.7s ease-out forwards;
}

.effect-thorns {
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, var(--efx-color) 20%, transparent 70%);
  animation: efx-thorns 0.7s ease-out forwards;
}

@keyframes efx-fade {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.5); }
}

@keyframes efx-breath {
  from { opacity: 0.9; transform: scaleX(0.3); }
  to { opacity: 0; transform: scaleX(1.2); }
}

@keyframes efx-pillar {
  from { opacity: 0; transform: scaleY(0); }
  50% { opacity: 1; transform: scaleY(1); }
  to { opacity: 0; transform: scaleY(1.1); }
}

@keyframes efx-drop {
  from { transform: translateY(-80px); opacity: 1; }
  to { transform: translateY(0); opacity: 0.8; }
}

@keyframes efx-vine {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes efx-thorns {
  from { transform: scale(0) rotate(0deg); opacity: 0; }
  to { transform: scale(1.2) rotate(45deg); opacity: 0.9; }
}

.battle-info {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .train-actions { grid-template-columns: repeat(3, 1fr); }
  .adventure-tier-select { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .care-actions { grid-template-columns: 1fr; }
  .train-actions { grid-template-columns: repeat(2, 1fr); }
}


.action-btn {
  font-family: inherit;
  background: var(--panel-light);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px 8px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, border-color 0.15s;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.action-icon { font-size: 1.4rem; }

/* Bottom panels */
.bottom-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .bottom-panels { grid-template-columns: 1fr; }
}

.inventory-panel, .log-panel {
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}

.inventory-panel h3, .log-panel h3 {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.item-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-btn {
  background: #120e20;
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  width: 56px;
  height: 56px;
  transition: border-color 0.15s;
}

.item-btn:hover { border-color: var(--accent); }

.item-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.empty {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.log-list {
  list-style: none;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.8rem;
}

.log-list li {
  padding: 3px 0;
  border-bottom: 1px solid rgba(90, 72, 128, 0.3);
}

.log-day {
  color: var(--accent);
  margin-right: 6px;
}

/* Result */
.result-screen {
  text-align: center;
  padding-top: 24px;
}

.result-rank {
  font-size: 4rem;
  font-weight: bold;
  margin: 16px 0;
  text-shadow: 3px 3px 0 var(--shadow);
}

.rank-S { color: #ffd700; }
.rank-A { color: #c0a0ff; }
.rank-B { color: #60a0ff; }
.rank-C { color: #60c080; }
.rank-D { color: #a0a0a0; }

.result-sprite { max-width: 200px; margin: 0 auto 16px; }

.score {
  font-size: 1.4rem;
  color: var(--accent);
  margin: 12px 0;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.result-stats span {
  background: var(--panel);
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Ranking */
.ranking-screen {
  text-align: center;
  padding: 24px 16px 32px;
  max-width: 560px;
  margin: 0 auto;
}

.ranking-list {
  list-style: none;
  margin: 20px 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 36px 48px 1fr auto 40px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 6px;
  text-align: left;
}

.ranking-item.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(255, 208, 96, 0.25);
}

.ranking-pos {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent);
  text-align: center;
}

.ranking-sprite-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.ranking-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ranking-name {
  font-size: 0.95rem;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.ranking-score {
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  white-space: nowrap;
}

.ranking-score::after {
  content: '点';
  font-size: 0.75rem;
  margin-left: 2px;
}

.ranking-rank {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
}

.ranking-empty {
  margin: 32px 0;
  color: var(--text-dim);
}
