/* ── Photo-Entry Giveaway — polaroid corkboard ──────────────────────
   Cork texture browns, white-framed instant photos at random tilts,
   red push pins, hand-lettered marker headline on masking tape. */

:root {
  --cork: #b98d5f;
  --cork-dark: #a37a4e;
  --paper: #fffef9;
  --ink: #3a2e22;
  --ink-soft: #8d7a63;
  --tape: #f5edd6;
  --pin-red: #d93b30;
  --err: #c0392b;
  --font-marker: 'Permanent Marker', cursive;
  --font-body: 'Karla', sans-serif;
}

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

.hidden { display: none !important; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.09) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 58%, rgba(70, 45, 20, 0.12) 0 2px, transparent 3px),
    radial-gradient(circle at 42% 84%, rgba(255, 255, 255, 0.07) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 88% 30%, rgba(70, 45, 20, 0.1) 0 2px, transparent 3px),
    linear-gradient(150deg, var(--cork), var(--cork-dark));
  background-size: 90px 90px, 120px 120px, 70px 70px, 110px 110px, 100% 100%;
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page { display: flex; flex-direction: column; min-height: 100vh; }

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 20px; }

main { flex: 1 0 auto; padding-bottom: 70px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 46px 0 12px; }

.tape-strip {
  display: inline-block;
  background: var(--tape);
  padding: 14px 34px;
  transform: rotate(-2deg);
  box-shadow: 0 6px 16px rgba(58, 46, 34, 0.3);
  position: relative;
}

.tape-strip::before,
.tape-strip::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 70px;
  height: 22px;
  background: rgba(245, 237, 214, 0.7);
  transform: rotate(-4deg);
}

.tape-strip::before { left: -28px; }
.tape-strip::after { right: -28px; transform: rotate(5deg); }

.tape-strip h1 {
  font-family: var(--font-marker);
  font-size: clamp(1.7rem, 6.5vw, 2.7rem);
  color: var(--ink);
  line-height: 1.15;
}

.theme-line {
  max-width: 520px;
  margin: 24px auto 0;
  color: #fff;
  font-weight: 700;
  font-size: 1.08rem;
  text-shadow: 0 2px 8px rgba(58, 46, 34, 0.5);
}

.prize-tag {
  display: inline-block;
  margin-top: 14px;
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(58, 46, 34, 0.3);
  transform: rotate(1deg);
}

.draw-note {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(58, 46, 34, 0.5);
}

/* ── Notes ────────────────────────────────────────────────────────── */
.note {
  margin: 18px auto;
  max-width: 480px;
  padding: 15px 18px;
  background: var(--paper);
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(58, 46, 34, 0.25);
}

/* ── Entry polaroid ───────────────────────────────────────────────── */
.polaroid-form {
  background: var(--paper);
  max-width: 420px;
  margin: 26px auto 0;
  padding: 16px 16px 22px;
  box-shadow: 0 18px 40px rgba(58, 46, 34, 0.4);
  transform: rotate(-1deg);
  position: relative;
}

.polaroid-form::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0736a, var(--pin-red) 65%);
  box-shadow: 0 4px 8px rgba(58, 46, 34, 0.4);
  z-index: 2;
}

/* Drop zone */
.drop {
  position: relative;
  border: 2px dashed #d9d2c0;
  background: #f6f3ea;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.drop:hover, .drop.dragover { border-color: var(--pin-red); }

.drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-inner { text-align: center; padding: 20px; }

.drop-icon { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.drop-text { font-family: var(--font-marker); font-size: 1.15rem; }

.drop-hint { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }

.preview { display: block; width: 100%; max-height: 300px; object-fit: cover; }

/* Caption area */
.polaroid-caption { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
  background: #f6f3ea;
  border: 2px solid #e4ddca;
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

input:focus { outline: none; border-color: var(--pin-red); }
input.error { border-color: var(--err); }
input::placeholder { color: var(--ink-soft); opacity: 0.75; }

.fine { text-align: center; color: var(--ink-soft); font-size: 0.8rem; }

.rules-link {
  background: none;
  border: none;
  color: var(--pin-red);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.form-error { color: var(--err); font-weight: 700; text-align: center; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-marker);
  font-size: 1.02rem;
  padding: 14px 26px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  line-height: 1.2;
}

.btn:hover:not(:disabled) { transform: translateY(-2px) rotate(-0.5deg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.btn-primary {
  background: var(--pin-red);
  color: #fff;
  box-shadow: 0 5px 0 #9c241b;
}

.btn-primary:hover:not(:disabled) { box-shadow: 0 7px 0 #9c241b; }

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(58, 46, 34, 0.3);
}

.btn-block { width: 100%; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Done card ────────────────────────────────────────────────────── */
.done-card {
  background: var(--paper);
  max-width: 420px;
  margin: 26px auto 0;
  padding: 34px 26px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(58, 46, 34, 0.4);
  transform: rotate(1deg);
  position: relative;
}

.done-card .pin {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0736a, var(--pin-red) 65%);
  box-shadow: 0 4px 8px rgba(58, 46, 34, 0.4);
}

.done-card h2 { font-family: var(--font-marker); font-size: 1.8rem; }

.done-sub { color: var(--ink-soft); font-weight: 600; margin-top: 8px; }

/* ── Wall ─────────────────────────────────────────────────────────── */
.wall-section { margin-top: 54px; }

.wall-title {
  font-family: var(--font-marker);
  font-size: 1.6rem;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 10px rgba(58, 46, 34, 0.5);
  margin-bottom: 24px;
}

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 26px 20px;
}

.polaroid {
  background: var(--paper);
  padding: 10px 10px 14px;
  box-shadow: 0 12px 26px rgba(58, 46, 34, 0.35);
  position: relative;
}

.wall .polaroid:nth-child(3n)  { transform: rotate(2deg); }
.wall .polaroid:nth-child(3n+1) { transform: rotate(-2.2deg); }
.wall .polaroid:nth-child(3n+2) { transform: rotate(0.8deg); }

.polaroid::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0736a, var(--pin-red) 65%);
  box-shadow: 0 3px 6px rgba(58, 46, 34, 0.4);
}

.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #eee7d8;
}

.polaroid-name {
  font-family: var(--font-marker);
  font-size: 0.85rem;
  text-align: center;
  padding-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(58, 46, 34, 0.5);
}

.wall-actions { text-align: center; margin-top: 28px; }

/* ── Rules modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(58, 46, 34, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  max-width: 620px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 2px solid #e4ddca;
}

.modal-head h3 { font-family: var(--font-marker); font-size: 1.2rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 26px;
  border-radius: 10px;
  font-weight: 700;
  z-index: 400;
  max-width: 92vw;
  text-align: center;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 26px 20px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
}

#wbx-powered-by-slot { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
