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

body {
  font-family: 'Arial', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #87ceeb 0%, #b5e8a1 70%, #5b9a4e 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  user-select: none;
}

.game-root {
  position: relative;
  width: 100%;
  max-width: 1720px;
  padding: 8px;
  margin: auto;
}

.hidden {
  display: none !important;
}

.screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}

/* ---- Title ---- */
.title-card {
  background: rgba(0, 0, 0, 0.55);
  border: 4px solid #5b3a1e;
  border-radius: 18px;
  padding: 40px 60px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.game-title {
  font-size: 56px;
  letter-spacing: 4px;
  color: #aeea00;
  text-shadow: 3px 3px 0 #3a6b12, 6px 6px 0 rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;
}

.game-sub {
  font-size: 18px;
  color: #cde89a;
  margin-bottom: 28px;
  letter-spacing: 2px;
}

.hint {
  margin-top: 18px;
  color: #d8e8c0;
  font-size: 14px;
}

/* ---- Buttons ---- */
.btn {
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  padding: 10px 26px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #3a2a14;
  background: linear-gradient(180deg, #ffe082, #ffca28);
  box-shadow: 0 4px 0 #c08a00, inset 0 2px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 #c08a00, inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c08a00;
}

.btn-primary {
  background: linear-gradient(180deg, #aed581, #689f38);
  box-shadow: 0 4px 0 #3e6b14, inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 5px 0 #3e6b14, inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:active {
  box-shadow: 0 1px 0 #3e6b14;
}

.btn-small {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
}

.btn-big {
  font-size: 20px;
  padding: 14px 40px;
}

#start-btn {
  font-size: 24px;
  padding: 14px 48px;
  margin-bottom: 4px;
}

/* ---- Level select ---- */
.level-select-card {
  background: rgba(0, 0, 0, 0.55);
  border: 4px solid #5b3a1e;
  border-radius: 18px;
  padding: 30px 40px;
  min-width: 560px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.screen-title {
  color: #aeea00;
  font-size: 32px;
  text-shadow: 2px 2px 0 #3a6b12;
  margin-bottom: 22px;
  letter-spacing: 2px;
}

.level-list {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}

.level-card {
  width: 150px;
  height: 178px;
  border-radius: 14px;
  background: linear-gradient(180deg, #7cc95b, #58a83f);
  border: 3px solid #3e6b14;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 5px 0 #2f5210, inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.08s ease;
}

.level-card:hover {
  transform: translateY(-3px);
}

.level-card.locked {
  background: linear-gradient(180deg, #9e9e9e, #757575);
  border-color: #4a4a4a;
  box-shadow: 0 5px 0 #333;
  cursor: not-allowed;
  filter: grayscale(1);
}

.level-num {
  font-size: 40px;
  font-weight: bold;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.level-name {
  font-size: 18px;
  font-weight: bold;
}

.level-plants {
  font-size: 11px;
  color: #eaffd8;
  text-align: center;
  padding: 0 8px;
  line-height: 1.4;
}

.level-story {
  font-size: 11px;
  color: #fff6d8;
  text-align: center;
  padding: 0 6px;
  line-height: 1.35;
  font-style: italic;
}

.level-lock {
  font-size: 14px;
  color: #ddd;
}

/* ---- Game UI ---- */
#game-ui {
  background: rgba(0, 0, 0, 0.55);
  border: 4px solid #5b3a1e;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  padding: 4px 6px 12px;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sun-counter {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  padding: 4px 16px 4px 8px;
  font-size: 22px;
  font-weight: bold;
  color: #ffd54f;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sun-icon {
  font-size: 24px;
}

.hud-mid {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 16px;
  font-weight: bold;
  color: #eaffd8;
}

#wave-info {
  color: #ffe082;
  font-size: 14px;
}

#shovel-btn.active {
  background: linear-gradient(180deg, #ff8a65, #e64a19);
  box-shadow: 0 4px 0 #a62f00, inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
}

/* ---- Card bar ---- */
.card-bar {
  display: flex;
  gap: 10px;
  padding: 0 6px 12px;
  flex-wrap: wrap;
}

.plant-card {
  width: 86px;
  height: 96px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffe9a8, #ffd54f);
  border: 3px solid #a87b1a;
  color: #3a2a14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 0 #8a6214, inset 0 2px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.06s ease;
}

.plant-card:hover {
  transform: translateY(-2px);
}

.plant-card.selected {
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px #aeea00, 0 4px 0 #8a6214;
}

.plant-card.disabled {
  filter: grayscale(0.9);
  opacity: 0.55;
  cursor: not-allowed;
}

.card-sprite {
  width: 44px;
  height: 44px;
  position: relative;
  margin-bottom: 2px;
}

.card-name {
  font-size: 12px;
  font-weight: bold;
}

.card-cost {
  font-size: 11px;
  color: #6b4a1a;
}

/* CSS sprite placeholders */
.sprite {
  position: relative;
  width: 44px;
  height: 44px;
}

.sprite .stem {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 7px;
  height: 18px;
  transform: translateX(-50%);
  background: #2f8f33;
  border-radius: 3px;
}

.sprite.sunflower .petals {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, #b0712a 28%, #ffd54f 28%);
  border-radius: 50%;
  box-shadow: 0 0 0 6px #ffd54f;
}

.sprite.sunflower .core {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: #7a4a1c;
  border-radius: 50%;
}

.sprite.shooter .head {
  position: absolute;
  top: 10px;
  left: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.sprite.shooter.green .head { background: #3da83d; }
.sprite.shooter.ice .head { background: #3aa0c9; }

.sprite.shooter .muzzle {
  position: absolute;
  top: 16px;
  right: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8fd0e8;
  border: 3px solid #2f8f33;
}

.sprite.shooter .eye {
  position: absolute;
  top: 18px;
  left: 12px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1f5f24;
}

.sprite.wallnut {
  background: #c8963e;
  border: 3px solid #8a5a33;
  border-radius: 16px;
  top: 6px;
}

.sprite.wallnut .face {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 12px;
  background: #8a5a33;
  border-radius: 0 0 10px 10px;
}

.sprite.wallnut .eye {
  position: absolute;
  top: 14px;
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
}

.sprite.wallnut .eye.l { left: 8px; }
.sprite.wallnut .eye.r { right: 8px; }

.sprite.bomb .cherry {
  position: absolute;
  top: 12px;
  width: 20px;
  height: 20px;
  background: #d8362c;
  border-radius: 50%;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.15);
}

.sprite.bomb .cherry.l { left: 3px; }
.sprite.bomb .cherry.r { right: 3px; }

.sprite.bomb .stem {
  top: 2px;
  left: 50%;
  width: 6px;
  height: 12px;
}

/* ---- Board ---- */
.hint-bar {
  text-align: center;
  color: #eaffd8;
  font-size: 13px;
  padding: 4px 0 10px;
  min-height: 20px;
  transition: color 0.2s;
}

.hint-bar.flash {
  color: #ffd54f;
  font-weight: bold;
}

.board-wrap {
  border: 3px solid #3e6b14;
  border-radius: 8px;
  overflow: hidden;
  display: inline-block;
}

#game-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Overlays ---- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 16px;
}

.overlay-card {
  background: rgba(20, 40, 10, 0.92);
  border: 4px solid #5b3a1e;
  border-radius: 18px;
  padding: 34px 50px;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.result-title {
  font-size: 40px;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.win-title {
  color: #aeea00;
  text-shadow: 3px 3px 0 #3a6b12;
}

.lose-title {
  color: #ff7043;
  text-shadow: 3px 3px 0 #7a2008;
}

#result-sub {
  color: #d8e8c0;
  font-size: 15px;
}

/* ---- Hero pick ---- */
.hero-pick {
  margin-top: 22px;
  border-top: 2px dashed rgba(255, 255, 255, 0.25);
  padding-top: 16px;
}

.hero-pick-title {
  color: #ffe082;
  font-size: 17px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.hero-pick-list {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-pick-card {
  width: 150px;
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid #5b5b5b;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.hero-pick-card:hover {
  transform: translateY(-3px);
}

.hero-pick-card.selected {
  box-shadow: 0 0 0 3px #aeea00, 0 4px 0 rgba(0, 0, 0, 0.4);
}

.hero-pick-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

.hero-pick-name {
  font-size: 16px;
  font-weight: bold;
}

.hero-pick-ult {
  font-size: 13px;
  color: #ffe082;
}

.hero-pick-desc {
  font-size: 10.5px;
  color: #cde89a;
  text-align: center;
  line-height: 1.35;
}

/* ---- Hero bar (HUD) ---- */
.hero-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 10px;
}

.hero-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.08s ease;
}

.hero-avatar:hover {
  transform: scale(1.06);
}

.hero-avatar.ready {
  animation: heroReady 0.8s ease-in-out infinite;
  border-color: #ffe082;
}

.hero-avatar-name {
  color: #ffe082;
  font-size: 11px;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

@keyframes heroReady {
  0%, 100% { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 0 4px 2px #ffd54f; }
  50% { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 0 14px 6px #ffd54f; }
}

.hero-v {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-v-track {
  width: 14px;
  height: 46px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
}

.hero-charge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-radius: 8px;
  transition: height 0.15s ease;
}

.hero-v-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: #eaffd8;
  font-size: 10px;
  letter-spacing: 2px;
  opacity: 0.85;
}

.hero-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.ult-btn.ready {
  background: linear-gradient(180deg, #ffab40, #ff6d00);
  box-shadow: 0 4px 0 #c23e00, inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
  animation: heroReady 0.8s ease-in-out infinite;
}

.energy-btn {
  background: linear-gradient(180deg, #b3e5fc, #4fc3f7);
}

/* ---- Mine sprite ---- */
.sprite.mine {
  background: #8a5a2e;
  border: 3px solid #5d3a1c;
  border-radius: 50%;
  top: 8px;
}

.sprite.mine .eye {
  position: absolute;
  top: 16px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.sprite.mine .eye.l { left: 10px; }
.sprite.mine .eye.r { right: 10px; }

/* ---- Profile / Rank ---- */
.profile-panel {
  margin-bottom: 20px;
}

.profile-label {
  display: block;
  color: #ffe082;
  font-size: 13px;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.profile-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.profile-input {
  width: 200px;
  padding: 10px 14px;
  font-size: 16px;
  border: 2px solid #5b3a1e;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #3a2a14;
  outline: none;
  font-family: inherit;
}

.profile-input:focus {
  border-color: #aeea00;
  box-shadow: 0 0 0 3px rgba(174, 234, 0, 0.4);
}

.rank-panel {
  margin-top: 22px;
  border-top: 2px dashed rgba(255, 255, 255, 0.25);
  padding-top: 14px;
  text-align: left;
}

.rank-title {
  color: #ffe082;
  font-size: 15px;
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-align: center;
}

.rank-list {
  max-height: 220px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 6px 8px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  color: #eaffd8;
  font-size: 13px;
  border-radius: 6px;
}

.rank-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

.rank-medal {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4a4a4a;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-medal-1 { background: #ffd54f; color: #5b3a1e; }
.rank-medal-2 { background: #cfd8dc; color: #3a3a3a; }
.rank-medal-3 { background: #d7a06a; color: #5b3a1e; }

.rank-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-level {
  color: #ffe082;
  font-size: 12px;
}

.rank-score {
  font-weight: bold;
  color: #aeea00;
  min-width: 48px;
  text-align: right;
}

.rank-empty {
  color: #cde89a;
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

/* ---- Countdown ---- */
.countdown {
  background: rgba(180, 60, 20, 0.85);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 12px;
  border-radius: 12px;
  animation: countPulse 0.9s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 4px rgba(255, 140, 60, 0.6); }
  50% { transform: scale(1.06); box-shadow: 0 0 12px rgba(255, 140, 60, 0.9); }
}

#speech-btn.active {
  background: linear-gradient(180deg, #81c784, #43a047);
  color: #fff;
  box-shadow: 0 4px 0 #2e7d32, inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

/* ---- Mobile responsive ---- */
@media (max-width: 760px) {
  body {
    overflow-y: auto;
  }

  .title-card {
    padding: 24px 18px;
  }

  .game-title {
    font-size: 36px;
  }

  .level-select-card {
    padding: 18px 14px;
    min-width: 0;
    width: 100%;
  }

  .level-card {
    width: 104px;
    height: 104px;
  }

  .level-num {
    font-size: 28px;
  }

  #game-ui {
    padding: 6px;
  }

  .hud {
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 2px 6px;
  }

  .hud-left {
    gap: 6px;
  }

  .sun-counter {
    font-size: 17px;
    padding: 3px 10px 3px 6px;
  }

  .sun-icon {
    font-size: 18px;
  }

  .hud-mid {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
  }

  #wave-info {
    font-size: 12px;
  }

  .countdown {
    font-size: 12px;
    padding: 3px 10px;
  }

  .hero-bar {
    gap: 8px;
    padding: 5px 8px;
    margin-bottom: 6px;
    border-radius: 10px;
  }

  .hero-avatar {
    width: 38px;
    height: 38px;
    font-size: 11px;
  }

  .hero-avatar-name {
    font-size: 10px;
  }

  .hero-v-track {
    width: 12px;
    height: 40px;
  }

  .hero-v-label {
    font-size: 9px;
  }

  .hero-actions {
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
  }

  .hero-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  .card-bar {
    gap: 6px;
    padding: 0 2px 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .plant-card {
    width: 62px;
    height: 70px;
    flex-shrink: 0;
  }

  .card-sprite {
    width: 36px;
    height: 36px;
    transform: scale(0.78);
  }

  .card-name {
    font-size: 11px;
  }

  .card-cost {
    font-size: 10px;
  }

  .hint-bar {
    font-size: 11px;
    min-height: 15px;
    padding: 2px 0 6px;
  }

  .board-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 2px;
  }

  #game-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  }

  .overlay-card {
    padding: 22px 18px;
  }

  #start-btn {
    font-size: 20px;
    padding: 12px 32px;
  }
}

/* ---- Ending (romance) ---- */
.ending-card {
  background: linear-gradient(180deg, #fff3e6, #ffe3d0 60%, #fff8f0);
  border: 4px solid #e8956a;
  border-radius: 18px;
  padding: 20px 28px 26px;
  text-align: center;
  max-width: 480px;
  width: 94%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ending-scene {
  position: relative;
  width: 100%;
  height: 250px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffd9a8 0%, #ffc3a0 55%, #8fd06a 56%, #6fbc54 100%);
}

.ending-sun {
  position: absolute;
  top: 14px;
  right: 34px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 20%, #ffd54f 60%, #ffb300);
  box-shadow: 0 0 30px 10px rgba(255, 179, 0, 0.5);
  animation: sun-glow 3s ease-in-out infinite;
}

@keyframes sun-glow {
  0%, 100% { box-shadow: 0 0 24px 8px rgba(255, 179, 0, 0.42); }
  50% { box-shadow: 0 0 42px 16px rgba(255, 179, 0, 0.6); }
}

.ending-house {
  position: absolute;
  left: 20px;
  bottom: 36px;
  width: 110px;
  height: 98px;
}

.eh-roof {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 55px solid transparent;
  border-right: 55px solid transparent;
  border-bottom: 32px solid #b0593a;
}

.eh-body {
  position: absolute;
  top: 32px;
  left: 6px;
  width: 98px;
  height: 66px;
  background: #a97a4e;
  border-radius: 4px;
}

.eh-door {
  position: absolute;
  bottom: 0;
  left: 20px;
  width: 24px;
  height: 34px;
  background: #5d3d24;
  border-radius: 6px 6px 0 0;
}

.eh-window {
  position: absolute;
  top: 42px;
  right: 12px;
  width: 24px;
  height: 22px;
  background: #ffd54f;
  border: 2px solid #7a5230;
}

.couple {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
}

.person {
  position: relative;
  width: 56px;
  height: 126px;
}

.person .head {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffe3d0;
  z-index: 3;
}

.person .hair {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 32px;
  border-radius: 30px 30px 12px 12px;
  background: #3a2a1a;
  z-index: 2;
}

.girl {
  margin-right: -10px;
}

.girl .hair {
  width: 56px;
  height: 42px;
  background: #7a4a2b;
  border-radius: 30px 30px 18px 18px;
}

.girl .hair-bun {
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #7a4a2b;
  z-index: 4;
}

.girl .dress {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 62px;
  background: #f7f4ee;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  z-index: 2;
}

.man {
  margin-left: -10px;
}

.man .suit {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 62px;
  background: #5a6b8a;
  border-radius: 12px 12px 0 0;
  z-index: 2;
}

.man .hair {
  background: #2f2a22;
}

.love-heart {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: #e6507a;
  animation: heart-beat 1.1s ease-in-out infinite;
  z-index: 6;
  text-shadow: 0 0 14px rgba(230, 80, 122, 0.6);
}

@keyframes heart-beat {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.25); }
}

.float-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.fh {
  position: absolute;
  bottom: -24px;
  color: #e6507a;
  font-size: 16px;
  opacity: 0.85;
  animation: rise 4s linear infinite;
}

.fh:nth-child(1) { left: 8%; font-size: 15px; animation-delay: 0s; }
.fh:nth-child(2) { left: 26%; font-size: 20px; animation-delay: 1.2s; }
.fh:nth-child(3) { left: 48%; font-size: 17px; animation-delay: 0.6s; }
.fh:nth-child(4) { left: 70%; font-size: 14px; animation-delay: 1.8s; }
.fh:nth-child(5) { left: 88%; font-size: 19px; animation-delay: 2.4s; }

@keyframes rise {
  0% { transform: translateY(0) scale(0.8) rotate(0deg); opacity: 0; }
  12% { opacity: 0.9; }
  100% { transform: translateY(-290px) scale(1.2) rotate(18deg); opacity: 0; }
}

.ending-title {
  color: #d8486a;
  font-size: 30px;
  margin: 16px 0 4px;
  letter-spacing: 2px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
}

.ending-name {
  color: #8a5a4a;
  font-size: 17px;
  font-weight: bold;
  margin: 4px 0;
}

.ending-text {
  color: #6a4a3a;
  font-size: 14px;
  line-height: 1.75;
  margin: 6px 0 16px;
  max-width: 380px;
}

@media (max-width: 520px) {
  .ending-scene {
    height: 200px;
  }
  .couple {
    transform: translateX(-50%) scale(0.82);
    bottom: 26px;
  }
  .ending-title {
    font-size: 24px;
  }
  .ending-text {
    font-size: 13px;
  }
}
