:root {
  --bg: #f8f1e4;
  --bg-soft: #f2e3c7;
  --card: rgba(255, 252, 246, 0.92);
  --text: #4d311c;
  --muted: #826243;
  --accent: #c99532;
  --accent-dark: #7d451d;
  --border: rgba(125, 69, 29, 0.12);
  --shadow: 0 18px 40px rgba(104, 66, 25, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(100% - 24px, 980px);
  margin: 0 auto;
  padding: 22px 0 18px;
}

.hero {
  position: relative;
  padding: 18px 0 8px;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding-left: 2px;
}

.heart-pulse {
  width: 34px;
  height: 34px;
  display: inline-block;
  background: #d93a3a;
  transform: rotate(-45deg);
  border-radius: 8px 8px 0 8px;
  position: relative;
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(217, 58, 58, 0.35);
}

.heart-pulse::before,
.heart-pulse::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  background: #d93a3a;
  border-radius: 50%;
}

.heart-pulse::before {
  top: -17px;
  left: 0;
}

.heart-pulse::after {
  top: 0;
  left: 17px;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  color: var(--accent-dark);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-campaign {
  margin-top: 4px;
  color: #3f220d;
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
}

.smile-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(201, 149, 50, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.smile-eyes {
  width: 14px;
  height: 6px;
  border-top: 2px solid var(--accent-dark);
  border-radius: 999px;
  position: absolute;
  top: 11px;
}

.smile-eyes::before,
.smile-eyes::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent-dark);
  top: -1px;
}

.smile-eyes::before {
  left: -4px;
}

.smile-eyes::after {
  right: -4px;
}

.smile-mouth {
  width: 16px;
  height: 9px;
  border-bottom: 2px solid var(--accent-dark);
  border-radius: 0 0 999px 999px;
  position: absolute;
  top: 18px;
}

.container {
  display: grid;
  gap: 14px;
  padding: 8px 0 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(8px);
}

.hero-card {
  margin-top: 4px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.code-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.form-grid,
.review-form,
.single-column-form {
  display: grid;
  gap: 14px;
}

.form-grid label,
.single-column-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.full-width {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(125, 69, 29, 0.18);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(201, 149, 50, 0.6);
  box-shadow: 0 0 0 4px rgba(201, 149, 50, 0.14);
}

.char-count {
  text-align: right;
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

.btn.primary {
  background: linear-gradient(135deg, #c88f30, #e2b45b);
  color: #3b250d;
  box-shadow: 0 12px 22px rgba(201, 149, 50, 0.24);
}

.btn.secondary {
  background: #fff;
  color: var(--accent-dark);
  border-color: rgba(125, 69, 29, 0.18);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: rgba(130, 98, 67, 0.18);
}

.winner-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(201, 149, 50, 0.12);
  color: var(--accent-dark);
  font-weight: 700;
}

.winner-banner.muted,
.warning-text {
  color: #81541f;
}

.result-meta,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(125, 69, 29, 0.08);
  color: var(--muted);
  font-size: 0.92rem;
}

.pill.success {
  background: rgba(56, 138, 80, 0.12);
  color: #2f6b3f;
}

.pill.neutral {
  background: rgba(125, 69, 29, 0.08);
}

.poem-box {
  margin: 16px 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(125, 69, 29, 0.14);
  background: rgba(255, 255, 255, 0.88);
}

.poem-box pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.65;
}

.flash-stack {
  display: grid;
  gap: 10px;
}

.flash {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.flash-warning {
  background: rgba(255, 239, 200, 0.96);
}

.flash-error {
  background: rgba(255, 223, 223, 0.96);
}

.copy-feedback {
  min-height: 1.2rem;
  margin: 0;
  color: #2f6b3f;
  font-weight: 700;
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.84);
  border-radius: 16px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(125, 69, 29, 0.12);
  vertical-align: middle;
}

.admin-table th {
  background: rgba(201, 149, 50, 0.12);
}

.admin-add-one {
  margin-bottom: 18px;
}

.admin-inline-input {
  width: 100%;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 12px;
}

.admin-inline-select {
  width: 100%;
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 12px;
}

.form-hint {
  margin: -0.25rem 0 0;
  font-size: 0.9rem;
  color: rgba(82, 53, 18, 0.8);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-bulk-form {
  display: none;
}

.admin-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 14px;
}

.admin-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--muted);
}

.admin-row-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.site-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 2px 0;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.admin-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: relative;
  animation: adminSpin 3.5s linear infinite;
}

.admin-icon::before,
.admin-icon::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  background: currentColor;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.admin-icon::before {
  width: 4px;
  height: 4px;
}

.admin-icon::after {
  width: 2px;
  height: 8px;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(201, 149, 50, 0.12);
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.admin-badge-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}

.raffle-card {
  text-align: center;
}

.raffle-stage {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 1;
  margin: 14px auto 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}

.raffle-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(
    from -90deg,
    #e9c87d 0 180deg,
    #f7efe1 180deg 360deg
  );
  border: 10px solid rgba(125, 69, 29, 0.16);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.32), 0 20px 30px rgba(104, 66, 25, 0.16);
  transition: transform 5s cubic-bezier(0.14, 0.85, 0.2, 1);
  transform: rotate(0deg);
  will-change: transform;
}

.raffle-wheel.spinning {
  transform: rotate(var(--spin-angle));
}

.raffle-stage.spinning .raffle-pointer {
  animation: pointerNod 0.28s ease-in-out infinite alternate;
}

.raffle-stage.pointer-click .raffle-pointer {
  animation: pointerClick 0.22s ease-out;
}

.raffle-stage.winning .raffle-wheel {
  animation: victoryGlow 0.9s ease-in-out infinite alternate;
}

.raffle-label {
  position: absolute;
  left: 50%;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #4d311c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  z-index: 1;
  transform: translate(-50%, -50%);
}

.raffle-yes {
  top: 28%;
}

.raffle-no {
  top: 72%;
}

.raffle-center {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff8e8, #d6ab4f);
  border: 6px solid rgba(255, 255, 255, 0.7);
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 18px rgba(104, 66, 25, 0.16);
}

.raffle-pointer {
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 26px solid #d93a3a;
  position: absolute;
  top: -10px;
  z-index: 2;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.12));
  transform-origin: 50% 100%;
  pointer-events: none;
}

.raffle-next {
  margin: 16px auto 0;
}

.raffle-result {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 800;
}

.raffle-result-top {
  margin: 0 0 10px;
  min-height: 3.2rem;
  display: grid;
  place-items: center;
  font-size: clamp(1.35rem, 5vw, 2.2rem);
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  border: 1px solid transparent;
}

.raffle-result.win {
  background: linear-gradient(135deg, rgba(56, 138, 80, 0.16), rgba(255, 242, 200, 0.96));
  color: #236639;
  border-color: rgba(56, 138, 80, 0.18);
  box-shadow: 0 0 0 6px rgba(56, 138, 80, 0.06), 0 18px 28px rgba(56, 138, 80, 0.14);
  animation: resultPop 0.5s ease;
}

.raffle-result.lose {
  background: rgba(125, 69, 29, 0.08);
  color: var(--accent-dark);
}

.confetti {
  position: absolute;
  top: 10%;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  animation: confettiFall 1.8s ease-out forwards;
}

.sparkle-burst {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff3bf;
  box-shadow:
    0 -32px 0 0 #d93a3a,
    26px -18px 0 0 #e2b45b,
    34px 12px 0 0 #8d5a27,
    12px 36px 0 0 #d93a3a,
    -22px 28px 0 0 #e2b45b,
    -36px -6px 0 0 #8d5a27;
  transform: translate(-50%, -50%) scale(0.2);
  animation: sparkleBurst 0.65s ease-out forwards;
}

@keyframes pulse {
  0%,
  100% {
    transform: rotate(-45deg) scale(1);
    box-shadow: 0 0 0 0 rgba(217, 58, 58, 0.35);
  }
  50% {
    transform: rotate(-45deg) scale(1.06);
    box-shadow: 0 0 0 10px rgba(217, 58, 58, 0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes adminSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translateY(-20px) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(260px) rotate(540deg);
  }
}

@keyframes pointerClick {
  0% {
    transform: translateY(0) scale(1);
  }
  60% {
    transform: translateY(2px) scale(0.92);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes pointerNod {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(3px);
  }
}

@keyframes victoryGlow {
  from {
    filter: saturate(1) brightness(1);
    box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.32), 0 20px 30px rgba(104, 66, 25, 0.16);
  }
  to {
    filter: saturate(1.18) brightness(1.05);
    box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.32), 0 0 0 10px rgba(201, 149, 50, 0.08), 0 22px 34px rgba(104, 66, 25, 0.18);
  }
}

@keyframes resultPop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  70% {
    transform: scale(1.04);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes sparkleBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.7);
  }
}

@media (min-width: 760px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 16px, 980px);
    padding-top: 14px;
  }

  .brand-mark {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 10px;
  }

  .heart-pulse,
  .heart-pulse::before,
  .heart-pulse::after {
    width: 28px;
    height: 28px;
  }

  .heart-pulse::before {
    top: -14px;
  }

  .heart-pulse::after {
    left: 14px;
  }

  .card {
    padding: 18px;
  }

  .site-footer {
    justify-content: center;
  }

  .actions .btn {
    width: 100%;
  }

  .raffle-stage {
    width: min(250px, 82vw);
  }

  .raffle-center {
    width: 58px;
    height: 58px;
  }

  .raffle-label {
    font-size: 0.95rem;
  }
}
