:root {
  --pink-dark: #a13a5a;
  --pink: #d8588a;
  --pink-light: #ffd6e5;
  --cream: #fff7f9;
  --text: #3a2230;
  --success: #2e7d32;
  --error: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--pink-light) 0%, var(--cream) 55%, #ffe9f1 100%);
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1, h2, h3 { color: var(--pink-dark); }

a { color: var(--pink-dark); }

.card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(161, 58, 90, 0.12);
  margin-bottom: 1.5rem;
}

.login-card {
  max-width: 360px;
  margin: 4rem auto;
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(161, 58, 90, 0.15);
}

label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e3b8c8;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fffafc;
}

textarea { min-height: 120px; resize: vertical; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.checkbox-row input { width: auto; }

button, .btn {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.65rem 1.4rem;
  background: var(--pink-dark);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:hover, .btn:hover { background: #8a2f4b; }

.btn-secondary {
  background: #fff;
  color: var(--pink-dark);
  border: 1px solid var(--pink-dark);
}
.btn-secondary:hover { background: var(--pink-light); }

.btn-small {
  margin-top: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.alert-success { background: #e4f5e6; color: var(--success); }
.alert-error { background: #fbe4e2; color: var(--error); }

.clue-text {
  font-size: 1.15rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.cipher-text {
  font-family: "Courier New", monospace;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  background: var(--pink-light);
  padding: 1.25rem;
  border-radius: 12px;
  word-wrap: break-word;
  margin: 1rem 0;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-step { background: #e3e8ff; color: #33409b; }
.badge-final { background: #ffe1b3; color: #946200; }
.badge-side { background: #d6f5e3; color: #1c7a44; }

.badge-published { background: #e4f5e6; color: var(--success); }
.badge-draft { background: #eee; color: #777; }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #f1dbe4;
  vertical-align: middle;
  font-size: 0.95rem;
}

.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.center { text-align: center; }

.qr-print {
  text-align: center;
  padding: 3rem 1rem;
}
.qr-print img { max-width: 320px; }

@media print {
  .no-print { display: none; }
}

/* Heart explosion celebration, triggered on the final enigma once solved. */
.heart-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.heart-burst .heart {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.8rem;
  opacity: 0;
  will-change: transform, opacity;
  animation-name: heart-fly;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

@keyframes heart-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--spin));
  }
}
