:root {
  --cp-bg: #09111f;
  --cp-panel: #121b2e;
  --cp-text: #edf3ff;
  --cp-muted: #8ea0c6;
  --cp-line: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--cp-text);
  background: radial-gradient(1000px 480px at 10% -10%, #163b63 0%, var(--cp-bg) 58%);
}

.cp-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.cp-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.cp-hero p,
.cp-muted {
  color: var(--cp-muted);
  line-height: 1.5;
}

.cp-card {
  background: color-mix(in srgb, var(--cp-panel) 94%, black);
  border: 1px solid var(--cp-line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  margin-top: 1rem;
}

.hidden { display: none; }

.cp-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.cp-code {
  display: block;
  margin: 0.75rem 0;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--cp-line);
  background: #081121;
  word-break: break-all;
}

.cp-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--cp-line);
  background: #17243e;
  color: var(--cp-text);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.btn--primary {
  background: linear-gradient(135deg, #22d3ee, #7c3aed);
  border-color: transparent;
  color: #06111f;
  font-weight: 700;
}

.cp-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.3rem 0 0.9rem;
}

.cp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cp-mapping {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1.6fr 1fr 1fr 1fr auto;
  align-items: end;
  border-top: 1px solid var(--cp-line);
  padding: 1rem 0;
}

.cp-mapping:first-child {
  border-top: 0;
  padding-top: 0.25rem;
}

.cp-field label {
  display: block;
  font-size: 0.88rem;
  color: var(--cp-muted);
  margin-bottom: 0.35rem;
}

.cp-field input,
.cp-field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--cp-line);
  background: #081121;
  color: var(--cp-text);
  font: inherit;
}

.cp-remove {
  background: #3c1620;
  color: #fecdd3;
}

.cp-status {
  min-height: 1.2rem;
  color: var(--cp-muted);
}

@media (max-width: 900px) {
  .cp-mapping {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .cp-mapping {
    grid-template-columns: 1fr;
  }
}

.cp-overlay-body {
  margin: 0;
  background: transparent;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.cp-overlay-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.cp-overlay-stack {
  position: absolute;
  inset: 0;
}

.cp-event {
  position: absolute;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: min(82vw, 760px);
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(7, 13, 24, 0.82);
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.cp-event__title {
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 800;
}

.cp-event__meta {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  opacity: 0.86;
}

.cp-event__input {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  opacity: 0.95;
}

.anim-burst { animation: cpBurst 4.5s ease both; }
.anim-confetti { animation: cpConfetti 4.5s ease both; }
.anim-stamp { animation: cpStamp 4.5s ease both; }
.anim-glow { animation: cpGlow 4.5s ease both; }

@keyframes cpBurst {
  0% { opacity: 0; transform: translate(-50%, -30px) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  82% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.9); }
}

@keyframes cpConfetti {
  0% { opacity: 0; transform: translate(-50%, -10px) rotate(-8deg) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, 5px) rotate(3deg) scale(1); }
  85% { opacity: 1; transform: translate(-50%, 5px) rotate(-2deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) rotate(8deg) scale(0.88); }
}

@keyframes cpStamp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(1.6); }
  22% { opacity: 1; transform: translate(-50%, 0) scale(0.94); }
  30% { transform: translate(-50%, 0) scale(1.02); }
  85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 8px) scale(0.95); }
}

@keyframes cpGlow {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.94); box-shadow: 0 0 0 rgba(255,255,255,0); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); box-shadow: 0 0 42px rgba(255,255,255,0.22); }
  85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 0) scale(0.97); box-shadow: 0 0 0 rgba(255,255,255,0); }
}
