:root {
  --cream: #FDF3E3;
  --cream-deep: #F6E7CE;
  --ink: #3B2E25;
  --ink-soft: #7A6A5C;
  --terra: #E8743B;
  --terra-deep: #C95A26;
  --sage: #7FA678;
  --busy: #E3D5C2;
  --busy-text: #B5A48F;
  --card: #FFFBF4;
  --radius: 22px;
  --shadow: 0 6px 24px rgba(75, 50, 25, 0.10);
}

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

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

body {
  font-family: 'Karla', sans-serif;
  background:
    radial-gradient(circle at 85% -5%, #FAE3C0 0%, transparent 45%),
    radial-gradient(circle at -10% 30%, #FBEAD3 0%, transparent 40%),
    var(--cream);
  color: var(--ink);
  min-height: 100vh;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

.paw-bg {
  position: fixed;
  font-size: 300px;
  opacity: 0.045;
  top: -60px;
  right: -100px;
  transform: rotate(-25deg);
  pointer-events: none;
  z-index: 0;
}

/* ---------- hero ---------- */

.hero {
  text-align: center;
  padding: 36px 0 22px;
  position: relative;
  z-index: 1;
  animation: rise 0.5s ease both;
}

.hero-badge {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  background: var(--terra);
  border-radius: 50% 50% 50% 12px;
  display: grid;
  place-items: center;
  font-size: 38px;
  box-shadow: var(--shadow);
  transform: rotate(-6deg);
}

h1 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: clamp(2.1rem, 9vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 10px;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- cards ---------- */

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  animation: rise 0.5s ease both;
}

.card:nth-child(2) { animation-delay: 0.07s; }
.card:nth-child(3) { animation-delay: 0.14s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.step-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.step-num {
  background: var(--ink);
  color: var(--cream);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  flex: none;
}

/* ---------- calendar ---------- */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
}

.cal-nav {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--cream-deep);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s;
}

.cal-nav:active { transform: scale(0.92); }
.cal-nav:disabled { opacity: 0.25; cursor: default; }

.cal-weekdays, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 6px 0;
}

.cal-day {
  aspect-ratio: 1;
  border: none;
  background: var(--cream-deep);
  border-radius: 12px;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, background 0.15s, color 0.15s;
}

.cal-day:active:not(:disabled) { transform: scale(0.9); }

.cal-day.empty { background: transparent; pointer-events: none; }

.cal-day:disabled {
  background: var(--busy);
  color: var(--busy-text);
  cursor: default;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.cal-day.past:disabled {
  background: transparent;
  text-decoration: none;
  color: #CDBFAD;
}

.cal-day.in-range {
  background: #F7CBAE;
  color: var(--terra-deep);
  border-radius: 0;
}

.cal-day.range-start, .cal-day.range-end {
  background: var(--terra);
  color: #fff;
  font-weight: 700;
}

.cal-day.range-start { border-radius: 12px 0 0 12px; }
.cal-day.range-end { border-radius: 0 12px 12px 0; }
.cal-day.range-start.range-end { border-radius: 12px; }

.cal-grid.shake { animation: shake 0.4s ease; }

@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.cal-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.cal-legend span { display: flex; align-items: center; gap: 5px; }

.dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.dot-free { background: var(--cream-deep); }
.dot-busy { background: var(--busy); }
.dot-sel { background: var(--terra); }

.range-summary {
  text-align: center;
  margin-top: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  min-height: 1.4em;
  transition: color 0.2s;
}

.range-summary.has-range { color: var(--terra-deep); }

/* ---------- form fields ---------- */

.time-row { display: flex; gap: 12px; }
.time-row .field { flex: 1; }

.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

.field > span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.field > span small {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--cream-deep);
  border-radius: 14px;
  background: #fff;
  font-family: 'Karla', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus {
  outline: none;
  border-color: var(--terra);
}

/* ---------- buttons & messages ---------- */

.big-btn {
  width: 100%;
  padding: 17px;
  border: none;
  border-radius: 18px;
  background: var(--terra);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--terra-deep);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s;
}

.big-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--terra-deep);
}

.big-btn:disabled { opacity: 0.45; cursor: default; }

.big-btn.ghost {
  background: transparent;
  color: var(--terra-deep);
  box-shadow: none;
  border: 2px solid var(--terra);
  margin-top: 18px;
}

.form-error {
  background: #FBE3DC;
  color: #A8401F;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: center;
}

.fine-print {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 0 12px;
}

/* ---------- status view ---------- */

.status-card { text-align: center; padding: 32px 22px; }

.status-emoji { font-size: 60px; animation: bounce 1.2s ease infinite; }

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

.status-card h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.7rem;
  margin: 12px 0 8px;
}

#status-detail { color: var(--ink-soft); margin-bottom: 16px; }

.status-summary {
  background: var(--cream-deep);
  border-radius: 16px;
  padding: 14px;
  font-weight: 700;
  line-height: 1.7;
  margin-bottom: 14px;
}

/* ---------- misc ---------- */

.loading {
  text-align: center;
  padding: 50px 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.loading-paw { display: inline-block; animation: bounce 1s ease infinite; }

.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  padding-top: 34px;
  opacity: 0.8;
}

[hidden] { display: none !important; }
