:root {
  --pink-bg-1: #ffd6eb;
  --pink-bg-2: #f9b4db;
  --plum-deep: #3d1635;
  --plum-mid: #632756;
  --accent-pink: #ff4f9a;
  --accent-pink-dark: #e0327d;
  --accent-gold: #ffd45c;
  --card-bg: rgba(255, 245, 251, 0.9);
  --card-border: rgba(255, 130, 189, 0.55);
  --shadow-soft: 0 14px 36px rgba(102, 22, 70, 0.22);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2b0f26;
  font-family: "Quicksand", system-ui, -apple-system, sans-serif;
  color: var(--plum-deep);
}

#game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 244, 250, 0.86);
  border: 2px solid rgba(255, 136, 194, 0.55);
  box-shadow: 0 6px 18px rgba(84, 18, 56, 0.16);
  backdrop-filter: blur(8px);
  font-weight: 700;
  font-size: 0.95rem;
}

.hud-label {
  color: var(--accent-pink-dark);
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
}

.hearts-bar {
  display: inline-flex;
  gap: 4px;
  font-size: 1.05rem;
  line-height: 1;
}

.heart-full {
  color: #ff3e8a;
  text-shadow: 0 1px 4px rgba(255, 62, 138, 0.35);
}

.heart-empty {
  color: #e4bfd2;
}

.star-icon {
  color: #ffaa1d;
  font-size: 1.15rem;
  text-shadow: 0 1px 4px rgba(255, 170, 29, 0.4);
}

.icon-btn {
  background: rgba(255, 194, 224, 0.45);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s ease;
}

.icon-btn:hover {
  transform: scale(1.1);
}

/* Boss Health Bar */
#boss-hud {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 36px));
  background: rgba(255, 242, 249, 0.9);
  border: 2px solid rgba(255, 122, 186, 0.65);
  border-radius: 16px;
  padding: 8px 14px 10px;
  box-shadow: var(--shadow-soft);
  z-index: 10;
  pointer-events: none;
  animation: popIn 0.35s ease;
}

.boss-name {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 6px;
  color: var(--plum-deep);
}

.boss-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #f5d2e4;
  overflow: hidden;
}

.boss-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff4f9a, #ff8ec0, #ffd45c);
  transition: width 0.18s ease-out;
}

/* Akii 3D Avatar Chat Bubble */
#dialogue-box.chat-bubble {
  position: absolute;
  top: 120px;
  left: 18px;
  width: min(305px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 15px;
  border-radius: 22px 22px 22px 8px;
  background: rgba(255, 248, 252, 0.94);
  border: 2.5px solid rgba(255, 117, 182, 0.78);
  box-shadow: 0 12px 30px rgba(72, 14, 52, 0.22);
  backdrop-filter: blur(10px);
  z-index: 30;
  animation: popIn 0.24s ease;
}

.bubble-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble-tail {
  position: absolute;
  bottom: -11px;
  left: 22px;
  width: 18px;
  height: 18px;
  background: rgba(255, 248, 252, 0.94);
  border-right: 2.5px solid rgba(255, 117, 182, 0.78);
  border-bottom: 2.5px solid rgba(255, 117, 182, 0.78);
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
  pointer-events: none;
}

.bubble-tail.tail-left {
  bottom: auto;
  top: 24px;
  left: -11px;
  transform: rotate(135deg);
}

/* Supernova Purr Button */
.purr-btn {
  position: absolute;
  top: 64px;
  left: 14px;
  z-index: 12;
  border: 2px solid rgba(255, 134, 196, 0.65);
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(255, 244, 250, 0.86);
  color: var(--plum-mid);
  font-family: "Fredoka", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: default;
  box-shadow: 0 6px 16px rgba(84, 18, 56, 0.16);
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.purr-btn.ready {
  background: linear-gradient(135deg, #ff63aa, #ff2f83);
  color: #fff;
  border-color: #ffe37a;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 47, 131, 0.55);
  animation: pulseReady 1.1s infinite ease-in-out;
}

.purr-btn.ready:hover {
  transform: scale(1.06);
}

/* Floating Combo Toast */
.combo-toast {
  position: absolute;
  top: 66px;
  right: 16px;
  z-index: 12;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 232, 130, 0.92);
  border: 2px solid #ff70b8;
  color: var(--plum-deep);
  font-family: "Fredoka", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(102, 22, 70, 0.18);
  animation: popIn 0.25s ease;
}

.avatar-tag {
  font-family: "Fredoka", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-pink);
  color: #fff;
  letter-spacing: 0.3px;
}

.dialogue-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#dialogue-text {
  font-family: "Quicksand", system-ui, sans-serif;
  font-size: 0.96rem;
  line-height: 1.42;
  font-weight: 700;
  color: var(--plum-deep);
}

.next-btn {
  align-self: flex-end;
  border: none;
  border-radius: 999px;
  padding: 6px 15px;
  background: linear-gradient(135deg, #ff5aa2, #ff3486);
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 52, 134, 0.35);
  transition: transform 0.15s ease;
}

.next-btn:hover {
  transform: translateY(-1px) scale(1.03);
}

/* Overlays (Title & Proposal) */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at center, rgba(255, 190, 224, 0.2), rgba(43, 12, 34, 0.45));
  z-index: 25;
}

.card {
  width: min(460px, 100%);
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  border-radius: 30px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  animation: popIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: #ffe0f0;
  color: var(--accent-pink-dark);
  font-weight: 700;
  font-size: 0.84rem;
  margin-bottom: 12px;
}

.title-card h1 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2.1rem, 6vw, 2.8rem);
  color: var(--accent-pink-dark);
  text-shadow: 0 3px 0 #ffd1e6;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.04rem;
  line-height: 1.5;
  color: var(--plum-mid);
  margin-bottom: 18px;
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 223, 240, 0.65);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 22px;
  color: var(--plum-deep);
}

.primary-btn {
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  background: linear-gradient(135deg, #ff5fa4, #ff2f83);
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 47, 131, 0.38);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 26px rgba(255, 47, 131, 0.48);
}

.primary-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  border: 2px solid #f4a4ca;
  border-radius: 999px;
  padding: 11px 24px;
  background: #fff5fa;
  color: var(--plum-mid);
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.secondary-btn:hover {
  background: #ffe7f3;
}

/* Proposal Card */
#proposal-overlay {
  background: radial-gradient(circle at center, rgba(255, 190, 224, 0.08), rgba(43, 12, 34, 0.22));
}

.proposal-card {
  background: rgba(255, 245, 251, 0.88);
  border-color: rgba(255, 108, 178, 0.85);
}

.proposal-stars {
  font-size: 1.5rem;
  color: #ff4f9a;
  letter-spacing: 6px;
  margin-bottom: 8px;
}

.proposal-card h2 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  color: var(--accent-pink-dark);
  margin-bottom: 10px;
  line-height: 1.25;
}

.proposal-sub {
  font-size: 1rem;
  color: var(--plum-mid);
  margin-bottom: 22px;
  line-height: 1.45;
}

.proposal-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 58px;
}

.accepted-footer {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.accepted-msg {
  font-family: "Fredoka", sans-serif;
  font-size: 1.25rem;
  color: var(--accent-pink-dark);
  line-height: 1.45;
}

.accepted-msg span {
  font-size: 1rem;
  color: var(--plum-mid);
}

.accepted-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.exit-btn {
  padding: 11px 28px;
  font-size: 1.05rem;
}

/* Digital Girlfriend Voucher */
.date-voucher {
  width: 100%;
  border-radius: 18px;
  border: 2.5px dashed #ff68b4;
  background: linear-gradient(145deg, #fff8fc, #ffe5f3);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(255, 79, 154, 0.16);
  animation: popIn 0.45s ease;
}

.voucher-top {
  background: linear-gradient(90deg, #ff5fa4, #ff85c0);
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 6px 12px;
}

.voucher-body {
  padding: 12px 14px;
  font-size: 0.94rem;
  color: var(--plum-deep);
  line-height: 1.45;
}

.voucher-body small {
  color: var(--plum-mid);
  font-weight: 600;
}

@keyframes pulseReady {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 560px) {
  #hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .hud-pill {
    padding: 6px 10px;
    font-size: 0.82rem;
    gap: 5px;
  }

  #dialogue-box.chat-bubble {
    width: min(255px, calc(100vw - 24px));
    padding: 10px 12px;
  }

  #dialogue-text {
    font-size: 0.86rem;
  }

  .purr-btn {
    top: 52px;
    left: 10px;
    font-size: 0.78rem;
    padding: 5px 11px;
  }
}
