/* =====================================================================
 *  The Joyful Nest — Lucky Wheel
 *  Palette earthy, sang trọng, nhẹ nhàng · mobile-first
 * ===================================================================== */

:root {
  --ivory:        #FAF3E8;   /* nền chính */
  --cream:        #F7E8D3;   /* nền phụ ấm */
  --card:         #FFFDF9;   /* card trắng ngà */
  --terracotta:   #B5673E;   /* màu nhấn (logo symbol) */
  --terracotta-d: #97522F;   /* nhấn đậm (hover) */
  --clay:         #C97F55;
  --sand:         #E8D6BE;
  --brown:        #4A3527;   /* chữ nâu đậm ấm */
  --brown-soft:   #6E5645;   /* chữ phụ */
  --line:         #E7D6BE;   /* viền mềm */
  --error:        #C0483B;
  --success:      #5B7A54;

  --radius:   20px;
  --radius-s: 12px;
  --shadow:   0 18px 50px rgba(74, 53, 39, 0.10);
  --shadow-s: 0 6px 18px rgba(74, 53, 39, 0.08);

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans:  'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--brown);
  background:
    radial-gradient(1200px 600px at 50% -10%, #FFF7EC 0%, rgba(255,247,236,0) 60%),
    linear-gradient(180deg, var(--ivory) 0%, var(--cream) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ---------- Header / Logo ---------- */
.site-header {
  display: flex;
  justify-content: center;
  padding: 22px 16px 6px;
}
.logo-slot {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
}
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  font-size: 16px;
}
.logo-text {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--brown);
}

/* ---------- Layout ---------- */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

.screen { display: none; }
.screen.is-active { display: block; animation: fade-up .5s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px 26px;
}

/* ---------- Typography ---------- */
.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 2.4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--terracotta);
}
.title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--brown);
}
.subtitle {
  margin: 0 0 22px;
  color: var(--brown-soft);
  font-size: 15px;
}

/* ---------- Form fields ---------- */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 8px;
  color: var(--brown);
}
.req { color: var(--terracotta); }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"] {
  width: 100%;
  padding: 13px 14px;
  font-family: var(--sans);
  font-size: 16px;               /* >=16px để iOS không zoom */
  color: var(--brown);
  background: #FFFDF8;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none;
}
input::placeholder { color: #B9A88F; }
input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 4px rgba(181, 103, 62, 0.12);
}
input.invalid { border-color: var(--error); }

.other-input { margin-top: 10px; }
.is-hidden { display: none; }

/* ---------- Options (checkbox / radio dạng chip) ---------- */
.options { display: flex; flex-direction: column; gap: 8px; }
.options-inline { flex-direction: row; gap: 10px; }

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  background: #FFFDF8;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--brown);
  transition: border-color .16s, background .16s;
  user-select: none;
}
.options-inline .chip { flex: 1; justify-content: center; }
.chip:hover { border-color: var(--clay); }
.chip input { accent-color: var(--terracotta); width: 18px; height: 18px; flex: none; }
.chip input:checked ~ span { font-weight: 600; }
.chip:has(input:checked) {
  border-color: var(--terracotta);
  background: #FBEEE0;
}

/* ---------- Blessing ---------- */
.blessing {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  color: var(--terracotta-d);
  background: linear-gradient(180deg, #FBEEE0, #F8E6D2);
  border-radius: var(--radius-s);
  padding: 16px 18px;
  margin: 22px 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s;
}
.btn-primary {
  background: var(--terracotta);
  color: #fff;
  box-shadow: 0 10px 24px rgba(181, 103, 62, 0.32);
}
.btn-primary:hover { background: var(--terracotta-d); }
.btn-primary:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: not-allowed; box-shadow: none; }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Errors / status ---------- */
.error {
  display: none;
  margin-top: 6px;
  color: var(--error);
  font-size: 13px;
}
.error.show { display: block; }

.form-status {
  margin: 14px 0 0;
  text-align: center;
  font-size: 14px;
  min-height: 20px;
}
.form-status.err { color: var(--error); }
.form-status.ok  { color: var(--success); }

/* ---------- Lucky Wheel ---------- */
.card-wheel { text-align: center; }

.wheel-stage {
  position: relative;
  width: min(88vw, 360px);
  aspect-ratio: 1 / 1;
  margin: 6px auto 22px;
}
#wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow:
    0 0 0 10px #FFFDF9,
    0 0 0 13px var(--sand),
    var(--shadow);
  transform: rotate(0deg);
}

/* Kim chỉ ở đỉnh, hướng xuống */
.wheel-pointer {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 26px solid var(--terracotta);
  filter: drop-shadow(0 3px 3px rgba(74,53,39,.25));
  z-index: 4;
}

/* Nút quay ở tâm */
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 5px solid #FFFDF9;
  background: var(--terracotta);
  color: #fff;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.05;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(181,103,62,.4);
  z-index: 3;
  transition: transform .12s, background .18s;
}
.wheel-hub:hover { background: var(--terracotta-d); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(.96); }
.wheel-hub:disabled { opacity: .7; cursor: not-allowed; }

#spin-btn-alt { max-width: 260px; margin: 0 auto; }

/* ---------- Modal kết quả ---------- */
.modal {
  position: fixed; inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal.is-open { display: flex; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(52, 36, 25, 0.5);
  backdrop-filter: blur(3px);
}
.confetti {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 51;
}
.modal-card {
  position: relative;
  z-index: 52;
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 24px 26px;
  text-align: center;
  animation: pop-in .45s cubic-bezier(.18,.9,.32,1.4) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.85) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-badge {
  font-size: 46px;
  margin-bottom: 6px;
}
.modal-gift {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.15;
  color: var(--terracotta-d);
  margin: 4px 0 12px;
}
.modal-message {
  color: var(--brown-soft);
  font-size: 15px;
  margin: 0 0 22px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 10px 16px 26px;
  color: var(--brown-soft);
  font-size: 12px;
  opacity: .8;
}

/* ---------- Desktop tinh chỉnh ---------- */
@media (min-width: 560px) {
  .container { padding-top: 16px; }
  .card { padding: 34px 30px 30px; }
  .title { font-size: 40px; }
}
