:root {
  --pink-50: #fff0f8;
  --pink-100: #ffe0f2;
  --pink-200: #ffc2e6;
  --pink-300: #ff9bd6;
  --pink-400: #ff6cc4;
  --pink-500: #f947af;
  --pink-600: #d92b95;
  --lavender-300: #d9c6ff;
  --lavender-400: #c19bff;
  --amber-400: #ffb648;
  --amber-600: #d98a1a;
  --mint-400: #7fd9c4;
  --ink: #5a3358;
  --ink-soft: #8a6a89;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 40px -12px rgba(150, 40, 120, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 8%, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 35%),
    radial-gradient(circle at 85% 12%, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 30%),
    linear-gradient(160deg, #ffd6ef 0%, #ffb8e6 22%, #f6a3e8 45%, #d9a3ff 68%, #c6b0ff 100%);
  position: relative;
  overflow-x: hidden;
}

/* ---------- ambient sparkle / hearts field ---------- */

.sparkle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sparkle-field .bit {
  position: absolute;
  opacity: 0.5;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.6));
  animation: bob ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.28; }
  50% { transform: translateY(-18px) rotate(8deg); opacity: 0.65; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 0.9; transform: scale(1.15); }
}

/* ---------- shared card look ---------- */

.lock-card, .calendar-card, .history-card, .predict-card, .storm-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
  z-index: 1;
}

/* ---------- logo ---------- */

.logo-drip {
  width: 76px;
  height: 98px;
  margin: 0 auto 6px;
  filter: drop-shadow(0 8px 14px rgba(217, 43, 149, 0.35));
}

.logo-drip svg { width: 100%; height: 100%; display: block; }

.logo-drip.small { width: 42px; height: 54px; margin: 0; flex-shrink: 0; }

.app-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin: 4px 0 2px;
  background: linear-gradient(90deg, var(--pink-600), var(--lavender-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}

.app-title.small { font-size: 1.05rem; text-align: left; margin: 0; }

.app-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 22px;
  font-style: italic;
}

.app-subtitle.small { text-align: left; margin: 1px 0 0; font-size: 0.68rem; }

/* ---------- lock screen ---------- */

.lock-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lock-screen[hidden] { display: none; }

.lock-card {
  width: 100%;
  max-width: 360px;
  padding: 36px 28px 30px;
  text-align: center;
}

.pin-form { position: relative; }

.pin-dots {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 6px 0 10px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--pink-400);
  background: transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}

.pin-dot.filled {
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-400));
  transform: scale(1.1);
}

.pin-dot.shake { animation: shakeDot 0.4s; }

@keyframes shakeDot {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.pin-input-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  opacity: 0;
  font-size: 16px; /* prevents iOS zoom on focus */
  border: none;
  background: transparent;
}

.pin-error {
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--pink-600);
  margin: 4px 0 0;
}

.unicorn-row {
  margin: 22px 0 0;
  font-size: 1.1rem;
  opacity: 0.85;
}

/* ---------- tab bar ---------- */

.tab-bar {
  display: flex;
  gap: 8px;
  padding: 0 4px 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 2px 8px rgba(217,43,149,0.1);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--pink-500), var(--lavender-400));
  color: #fff;
  box-shadow: 0 4px 12px rgba(217,43,149,0.35);
}

.tab-btn:active { transform: scale(0.97); }

/* ---------- app shell ---------- */

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 90px;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 20px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.main-content[hidden] {
  display: none;
}

/* ---------- predicted period card ---------- */

.predict-card {
  padding: 16px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255,214,239,0.85), rgba(214,183,255,0.85));
}

.predict-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pink-600);
  font-weight: 700;
}

.predict-date {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.predict-sub {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

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

.calendar-card { padding: 18px 14px 16px; }

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
}

.month-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.7);
  color: var(--pink-600);
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(217,43,149,0.18);
}

.nav-btn:active { transform: scale(0.92); }

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.68rem;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 0 2px 6px;
}

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

.day-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-cell.empty { visibility: hidden; }

.day-btn {
  width: 78%;
  height: 78%;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  font-weight: 600;
}

.day-btn:active { transform: scale(0.9); }

.day-cell.today .day-btn {
  box-shadow: inset 0 0 0 2px var(--pink-500);
}

.day-cell.selecting-start .day-btn,
.day-cell.range-start .day-btn,
.day-cell.range-end .day-btn,
.day-cell.single-day .day-btn {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-400));
  color: #fff;
  box-shadow: 0 4px 10px rgba(217,43,149,0.4);
}

.day-cell.range-mid .day-btn {
  background: transparent;
  color: var(--pink-600);
  font-weight: 700;
}

/* the connecting pill bar behind range days */
.day-cell.range-start::after,
.day-cell.range-mid::after,
.day-cell.range-end::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 66%;
  background: linear-gradient(90deg, rgba(255,140,205,0.35), rgba(255,140,205,0.5));
  z-index: 1;
}

.day-cell.range-start::after { left: 50%; right: 0; border-radius: 999px 0 0 999px; }
.day-cell.range-mid::after { left: 0; right: 0; }
.day-cell.range-end::after { left: 0; right: 50%; border-radius: 0 999px 999px 0; }

.day-cell.predicted .day-btn {
  box-shadow: inset 0 0 0 2px var(--lavender-400);
  color: var(--lavender-400);
}

.select-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 12px 0 2px;
}

/* ---------- storm tracker ---------- */

.storm-current { padding: 20px 20px 18px; text-align: center; }

.storm-location {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--pink-600);
  text-transform: uppercase;
}

.storm-now-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.storm-icon { font-size: 3rem; line-height: 1; }

.storm-temp-block { text-align: left; }

.storm-temp {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.storm-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.storm-sub {
  margin: 10px 0 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.storm-gauge-card { padding: 18px 22px 20px; text-align: center; }

.storm-gauge-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pink-600);
}

.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-svg { width: 100%; max-width: 240px; height: auto; }

.gauge-zones {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 200px;
  margin-top: -6px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.storm-pressure-value {
  margin: 4px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
}

.storm-pressure-trend {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.scale-heading {
  margin: 16px 0 6px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
}

.pressure-scale {
  display: flex;
  gap: 6px;
}

.scale-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 2px 8px;
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.scale-chip-label {
  font-size: 0.7rem;
  font-weight: 800;
}

.scale-chip-range {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.scale-chip-note {
  font-size: 0.56rem;
  color: var(--ink-soft);
}

.scale-chip-low {
  background: rgba(255,108,196,0.12);
  box-shadow: inset 0 -3px 0 var(--pink-400);
}
.scale-chip-low .scale-chip-label { color: var(--pink-600); }

.scale-chip-normal {
  background: rgba(255,224,242,0.55);
  box-shadow: inset 0 -3px 0 var(--pink-200);
}
.scale-chip-normal .scale-chip-label { color: var(--ink-soft); }

.scale-chip-high {
  background: rgba(193,155,255,0.16);
  box-shadow: inset 0 -3px 0 var(--lavender-400);
}
.scale-chip-high .scale-chip-label { color: var(--lavender-400); }

.scale-chip.current {
  transform: scale(1.06);
  box-shadow: inset 0 -3px 0 var(--pink-500), 0 0 0 2px var(--pink-500), 0 4px 10px rgba(217,43,149,0.25);
}

.storm-gauge-explain {
  margin: 12px 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}

.storm-gauge-explain em { color: var(--pink-600); font-style: normal; font-weight: 700; }

.storm-forecast-card { padding: 18px 18px 8px; }

.storm-forecast-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}

.storm-day-list { display: flex; flex-direction: column; }

.storm-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px 12px 12px;
  border-top: 1px solid rgba(217, 43, 149, 0.12);
  border-left: 4px solid transparent;
  border-radius: 10px;
}

.storm-day-row:first-child { border-top: none; }

.storm-day-date { font-size: 0.85rem; font-weight: 700; color: var(--ink); }

.storm-day-temp { font-size: 0.74rem; color: var(--ink-soft); margin-top: 2px; }

.storm-day-right { text-align: right; }

.storm-day-drop { font-size: 0.72rem; color: var(--ink-soft); }

.storm-day-risk { font-size: 0.76rem; font-weight: 700; margin-top: 2px; }

.storm-day-row.risk-low { border-left-color: var(--mint-400); }
.storm-day-row.risk-low .storm-day-risk { color: var(--mint-400); }

.storm-day-row.risk-moderate { border-left-color: var(--amber-400); background: rgba(255,182,72,0.08); }
.storm-day-row.risk-moderate .storm-day-risk { color: var(--amber-600); }

.storm-day-row.risk-high { border-left-color: var(--pink-500); background: rgba(249,71,175,0.08); }
.storm-day-row.risk-high .storm-day-risk { color: var(--pink-600); }

/* ---------- history ---------- */

.history-card { padding: 18px 18px 6px; }

.history-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}

.history-list { display: flex; flex-direction: column; }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  border-top: 1px solid rgba(217, 43, 149, 0.12);
}

.history-row:first-child { border-top: none; }

.history-dates { font-size: 0.85rem; font-weight: 600; }

.history-duration { font-size: 0.72rem; color: var(--ink-soft); }

.history-delete {
  border: none;
  background: rgba(217,43,149,0.08);
  color: var(--pink-600);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.history-delete:active { transform: scale(0.9); }

.empty-state {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 16px 8px 20px;
}

/* ---------- logout / footer ---------- */

.logout-link {
  display: block;
  margin: 22px auto 0;
  background: none;
  border: none;
  font-size: 0.7rem;
  color: rgba(90, 51, 88, 0.45);
  text-decoration: underline;
}

.secret-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  color: rgba(90, 51, 88, 0.18);
  padding: 6px 0 18px;
  user-select: none;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: rgba(90, 51, 88, 0.92);
  color: #fff;
  font-size: 0.78rem;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 480px) {
  .app { padding-top: 32px; }
}
