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

html,
body {
  height: 100%;
  overflow: hidden;
  background: #3b2b24;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 190, 100, 0.18), transparent 36%),
    radial-gradient(circle at 85% 90%, rgba(232, 84, 56, 0.14), transparent 42%),
    #2e211c;
}

#canvas-wrap {
  position: relative;
  width: auto;
  aspect-ratio: 750 / 1334;
  max-height: 100%;
  max-width: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

@media (max-width: 520px) {
  #canvas-wrap {
    border-radius: 0;
    box-shadow: none;
  }
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 35, 28, 0.44);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  z-index: 20;
  animation: fade-in 0.18s ease-out;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(82%, 360px);
  padding: 28px 24px 24px;
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 243, 220, 0.96));
  box-shadow: 0 16px 44px rgba(61, 28, 20, 0.38);
  text-align: center;
  color: #5a3a2c;
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  color: #c9452f;
  margin-bottom: 10px;
}

.modal-sub {
  font-size: 15px;
  line-height: 1.6;
  color: #8a6248;
  margin-bottom: 22px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.btn {
  height: 48px;
  border: 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 6px 14px rgba(93, 43, 27, 0.18);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(2px) scale(0.98);
}

.btn.primary {
  background: linear-gradient(180deg, #ff8a4c, #e9572f);
}

.btn.soft {
  background: linear-gradient(180deg, #f7cf86, #e79e44);
}

.ad-card {
  padding: 34px 24px;
}

.ad-badge {
  display: inline-block;
  margin: 0 auto 18px;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8a4c, #e9572f);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
}

.ad-count {
  font-size: 60px;
  font-weight: 900;
  color: #c9452f;
  line-height: 1;
}

.ad-label {
  margin-top: 12px;
  font-size: 14px;
  color: #9a7358;
}

.toast {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(70, 38, 30, 0.82);
  color: #fff5df;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  z-index: 30;
  animation: toast-in 0.22s ease-out;
}

.toast[hidden] {
  display: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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