/* Day Out with Hiva — mobile-first styles */

:root {
  color-scheme: light;

  --bg: #fff6f1;
  --bg-2: #fdeee6;
  --surface: #ffffff;
  --ink: #3d2c29;
  --ink-soft: #6f5853;
  --muted: #a08d88;
  --line: #f2e2da;

  --rose: #e8798c;
  --rose-deep: #c9566c;
  --rose-soft: #fde6ea;
  --peach: #f7c59f;

  --work-bg: #fde4e1;
  --work-ink: #b4473f;
  --work-line: #f6c4be;

  --free-bg: #e2f4e6;
  --free-ink: #2f7a4a;
  --free-line: #bfe3c8;

  --holiday-bg: #d3efda;
  --holiday-ink: #24683d;
  --gold: #e7b04b;

  --past-bg: #f3efed;
  --past-ink: #c2b6b2;

  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(201, 86, 108, 0.1), 0 2px 6px rgba(61, 44, 41, 0.04);
  --shadow-lg: 0 24px 60px rgba(61, 44, 41, 0.22);

  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #ffe3e8 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #ffeedd 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid rgba(232, 121, 140, 0.55); outline-offset: 2px; }

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(242, 226, 218, 0.7);
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 0;
  font-weight: 800;
  font-size: 16px;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--rose) 0%, #f29a7e 100%);
  box-shadow: 0 8px 20px rgba(232, 121, 140, 0.35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(232, 121, 140, 0.45); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }
.btn-ghost { background: var(--bg-2); color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: #fbe2d6; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-2);
  color: var(--rose-deep);
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: none;
  transition: background 0.2s, transform 0.15s var(--ease);
}
.icon-btn:hover { background: #fbdcd0; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--soft { color: var(--ink-soft); font-size: 24px; }

.link-btn {
  background: none;
  border: 0;
  padding: 8px 4px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
}
.link-btn:hover { color: var(--rose-deep); }

/* ---------------------------------------------------------------- Alerts */
.alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.alert--error { background: #fde4e1; color: #9c2f28; border: 1px solid #f6c4be; }
.alert--info { background: #fff3dc; color: #7a5513; border: 1px solid #f6dfae; }

/* ---------------------------------------------------------------- Login */
.login-page { display: grid; }
.login-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: hidden;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 32px 24px 28px;
  animation: rise 0.6s var(--ease) both;
}
.login-emoji { font-size: 52px; text-align: center; line-height: 1; animation: float 4s ease-in-out infinite; }
.login-title {
  margin: 14px 0 4px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.15;
}
.login-sub { margin: 0 0 22px; text-align: center; color: var(--muted); font-size: 15px; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  pointer-events: none;
}
.blob--1 { width: 280px; height: 280px; background: #ffc9d3; top: -60px; right: -80px; }
.blob--2 { width: 260px; height: 260px; background: #ffe0bf; bottom: -70px; left: -70px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.input,
.textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fffcfa;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus,
.textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(232, 121, 140, 0.15); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }

/* ---------------------------------------------------------------- Layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 246, 241, 0.85);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--rose-deep); }

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 12px calc(32px + env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}

.hero {
  margin: 8px 4px 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 6.4vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
  animation: rise 0.6s var(--ease) both;
}

/* ---------------------------------------------------------------- Calendar */
.calendar-card { padding: 14px 10px 16px; animation: rise 0.6s 0.08s var(--ease) both; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 12px; }
.cal-title { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 700; text-align: center; }

.cal-weekdays,
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekdays { margin-bottom: 6px; }
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.cal-weekdays span:nth-child(n + 6) { color: var(--free-ink); }

.cal-grid.is-changing { animation: fadeSwap 0.35s var(--ease); }
.cal-loading { grid-column: 1 / -1; text-align: center; padding: 40px 0; color: var(--muted); }

.day {
  position: relative;
  min-height: 56px;
  aspect-ratio: 1 / 1.08;
  padding: 5px 2px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
  overflow: hidden;
  text-align: center;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.day:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(61, 44, 41, 0.1); }
.day:not(:disabled):active { transform: scale(0.95); }
.day-num { font-weight: 800; font-size: 15px; line-height: 1.2; }
.day-label {
  font-size: 8.5px;
  line-height: 1.15;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}
.day-tag { font-size: 8.5px; font-weight: 700; opacity: 0.75; }
.day-plan { position: absolute; right: 2px; bottom: 1px; font-size: 11px; line-height: 1; }

.day--work { background: var(--work-bg); color: var(--work-ink); border-color: var(--work-line); }
.day--free { background: var(--free-bg); color: var(--free-ink); border-color: var(--free-line); }
.day--holiday { background: var(--holiday-bg); color: var(--holiday-ink); border-color: #a9d9b6; }
.day--holiday::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.day--past {
  background: var(--past-bg);
  color: var(--past-ink);
  border-color: transparent;
  opacity: 0.85;
}
.day--past.day--holiday::after { background: var(--past-ink); }
.day--today {
  border-color: var(--rose);
  box-shadow: 0 0 0 2px var(--rose), 0 6px 16px rgba(232, 121, 140, 0.3);
}
.day--today .day-num::after {
  content: 'today';
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rose-deep);
}
.day-empty { min-height: 56px; }

.cal-note { margin: 12px 4px 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- Legend */
.legend,
.holidays { padding: 18px 18px 14px; animation: rise 0.6s 0.16s var(--ease) both; }
.legend-title { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.legend-list,
.holiday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.legend-list li,
.holiday-list li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-soft); line-height: 1.35; }
.legend-list strong { color: var(--ink); }

.swatch {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.swatch--work { background: var(--work-bg); border-color: var(--work-line); }
.swatch--free { background: var(--free-bg); border-color: var(--free-line); }
.swatch--holiday { background: var(--holiday-bg); border-color: #a9d9b6; }
.swatch--holiday::after { content: ''; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.swatch--today { background: #fff; border-color: var(--rose); box-shadow: 0 0 0 2px var(--rose); }
.swatch--past { background: var(--past-bg); }
.swatch--plan { background: var(--rose-soft); }

.holiday-date {
  flex: none;
  min-width: 54px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--holiday-bg);
  color: var(--holiday-ink);
  font-weight: 800;
  font-size: 13px;
  text-align: center;
}
.holiday-list .is-past { opacity: 0.55; }
.holiday-local { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(61, 44, 41, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.25s ease both;
}
.sheet {
  position: relative;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  animation: sheetUp 0.42s var(--ease) both;
}
.modal.is-closing .sheet { animation: sheetDown 0.25s ease-in both; }
.modal.is-closing .modal-backdrop { animation: fadeOut 0.25s ease-in both; }

.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 2px auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 800; color: var(--rose-deep); letter-spacing: 0.01em; }
.sheet-title { margin: 2px 0 0; font-family: var(--font-display); font-size: 23px; line-height: 1.2; }

.progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 6px; }
.progress[hidden] { display: none; }
.progress-text { font-size: 13px; font-weight: 700; color: var(--muted); }
.progress-dots { display: flex; gap: 6px; }
.progress-dots span {
  width: 22px;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.3s var(--ease), width 0.3s var(--ease);
}
.progress-dots span.is-done { background: #f3b2bd; }
.progress-dots span.is-current { background: var(--rose); width: 34px; }

.step-viewport { overflow-x: hidden; overflow-y: auto; margin: 0 -18px; padding: 8px 18px 4px; flex: 1 1 auto; overscroll-behavior: contain; }
.step.enter-forward { animation: stepInRight 0.38s var(--ease) both; }
.step.enter-back { animation: stepInLeft 0.38s var(--ease) both; }

.step-hint { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); }
.step-hint--work { color: var(--work-ink); }
.step-hint--free { color: var(--free-ink); }

.sheet-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding-top: 14px; }
.sheet-actions.is-single { grid-template-columns: 1fr; }
.sheet-actions.is-single #backBtn { display: none; }

/* Step 1: time slots */
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.slot {
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--free-line);
  background: var(--free-bg);
  color: var(--free-ink);
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.slot:not(:disabled):active { transform: scale(0.94); }
.slot.is-selected {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
  box-shadow: 0 6px 14px rgba(232, 121, 140, 0.35);
}
.slot--busy {
  background: var(--work-bg);
  border-color: var(--work-line);
  color: var(--work-ink);
  opacity: 0.75;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.slot--past { background: var(--past-bg); border-color: transparent; color: var(--past-ink); }

/* Step 2: indoor / outdoor */
.choice-big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-btn {
  min-height: 150px;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--line);
  background: #fffaf7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.big-btn .big-emoji { font-size: 46px; line-height: 1; transition: transform 0.3s var(--ease); }
.big-btn small { font-weight: 600; font-size: 13px; color: var(--muted); }
.big-btn:active { transform: scale(0.97); }
.big-btn.is-selected { border-color: var(--rose); background: var(--rose-soft); box-shadow: 0 8px 20px rgba(232, 121, 140, 0.2); }
.big-btn.is-selected .big-emoji { transform: scale(1.12) rotate(-4deg); }

/* Step 3: activities */
.options { display: grid; grid-template-columns: 1fr; gap: 8px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: #fffaf7;
  text-align: left;
  font-weight: 700;
  font-size: 16px;
  transition: transform 0.12s var(--ease), border-color 0.2s, background 0.2s;
}
.option:active { transform: scale(0.98); }
.option .opt-emoji { font-size: 22px; width: 28px; text-align: center; flex: none; }
.option.is-selected { border-color: var(--rose); background: var(--rose-soft); }
.option .opt-check { margin-left: auto; color: var(--rose); font-size: 18px; opacity: 0; transform: scale(0.5); transition: 0.2s var(--ease); }
.option.is-selected .opt-check { opacity: 1; transform: scale(1); }
.custom-wrap { overflow: hidden; animation: expand 0.3s var(--ease) both; }
.custom-wrap .input { margin-top: 2px; }
.char-count { display: block; text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Step 4: summary */
.summary {
  margin: 0 0 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff5f0, #fff0f3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.summary-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row dt { flex: none; width: 96px; color: var(--muted); font-size: 14px; font-weight: 700; }
.summary-row dd { margin: 0; font-weight: 800; font-size: 15px; word-break: break-word; }

/* Success */
.success { text-align: center; padding: 8px 0 4px; }
.success-emoji { font-size: 64px; line-height: 1; display: inline-block; animation: pop 0.6s var(--ease) both, float 4s 0.6s ease-in-out infinite; }
.success h4 { margin: 12px 0 4px; font-family: var(--font-display); font-size: 26px; }
.success p { margin: 0 0 16px; color: var(--ink-soft); }
.success .summary { text-align: left; }
.hearts { position: relative; height: 0; }
.hearts span {
  position: absolute;
  left: 50%;
  top: 30px;
  font-size: 18px;
  animation: heart 1.6s ease-out both;
}

/* ---------------------------------------------------------------- Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes fadeSwap { from { opacity: 0.2; transform: scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }
@keyframes popIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes popOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(16px) scale(0.97); } }
@keyframes stepInRight { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes stepInLeft { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes expand { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 140px; } }
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes heart {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -140px) scale(1.1) rotate(var(--rot)); }
}

/* ---------------------------------------------------------------- Larger screens */
@media (min-width: 420px) {
  .day-label, .day-tag { font-size: 9.5px; }
  .slots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 640px) {
  .wrap { padding: 16px 24px 48px; gap: 20px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .calendar-card { padding: 22px 20px 22px; }
  .cal-weekdays, .cal-grid { gap: 8px; }
  .cal-weekdays span { font-size: 12px; }
  .day { min-height: 78px; aspect-ratio: auto; padding: 8px 6px 6px; align-items: flex-start; text-align: left; border-radius: 14px; }
  .day-num { font-size: 17px; }
  .day-label, .day-tag { font-size: 11px; }
  .day-plan { font-size: 14px; right: 6px; bottom: 5px; }
  .day--today .day-num::after { font-size: 9.5px; }
  .options { grid-template-columns: 1fr 1fr; }
  .legend-list { grid-template-columns: 1fr 1fr; column-gap: 20px; }

  .modal { align-items: center; padding: 24px; }
  .sheet {
    max-width: 560px;
    max-height: min(760px, 90vh);
    border-radius: 28px;
    padding: 20px 26px 22px;
    animation: popIn 0.38s var(--ease) both;
  }
  .modal.is-closing .sheet { animation: popOut 0.2s ease-in both; }
  .sheet-grip { display: none; }
  .step-viewport { margin: 0 -26px; padding: 8px 26px 4px; }
  .slots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (hover: none) {
  .day:not(:disabled):hover { transform: none; box-shadow: none; }
  .day--today:not(:disabled):hover { box-shadow: 0 0 0 2px var(--rose), 0 6px 16px rgba(232, 121, 140, 0.3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
