* { box-sizing: border-box; }

html {
  /* Everything else is sized in rem, so this one change scales every
     component (text, buttons, icons, cards) up proportionally — the
     previous 16px default was reading as "very small" on-device. */
  font-size: 18px;
  height: 100%;
}

body { min-height: 100%; }

:root {
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #1F2430;
  --text-muted: #6B7280;
  --border: #E7EAF3;
  --accent: #3B7DDD;
  --accent-light: #6AA9F4;
  --accent-gradient: linear-gradient(135deg, #6AA9F4 0%, #3B7DDD 100%);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lift: 0 14px 34px rgba(59, 125, 221, 0.28);
  --radius-card: 20px;
  --radius-pill: 999px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 1.5rem;
  padding-bottom: 6.5rem;
}

.hidden { display: none !important; }

#update-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  width: auto;
  margin: -0.5rem -0.25rem 1rem auto;
  display: block;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  border: none;
  box-shadow: var(--shadow-lift);
}

h1 { font-size: 1.6rem; margin-bottom: 1rem; font-weight: 700; }
h2 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

section { margin-bottom: 2rem; }

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

input, textarea, button {
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  width: 100%;
  margin-bottom: 0.75rem;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(106, 169, 244, 0.2);
}

button {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lift);
}

button:active { opacity: 0.85; }

ul { list-style: none; padding: 0; margin: 0; }

li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

li button {
  width: auto;
  padding: 0.4rem 1rem;
  margin-bottom: 0;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.empty { color: var(--text-muted); padding: 0.5rem 0; box-shadow: none; background: none; }
.error { color: #dc2626; font-size: 0.85rem; }

#login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
}

#login-form { width: 100%; max-width: 320px; text-align: center; }
#login-form h1 { text-align: center; }

.voice-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  width: 100%;
}

.hero-card {
  background: var(--card);
  border: 1.5px dashed #C7D4EF;
  border-radius: var(--radius-card);
  padding: 2rem 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-soft);
}

.hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #DCEBFF, #AFCBF7);
  font-size: 1.8rem;
  margin: 0 auto 0.5rem;
  box-shadow: 0 8px 20px rgba(106, 169, 244, 0.35);
}

.hero-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.voice-btn.recording .hero-icon {
  animation: voice-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 8px 20px rgba(106, 169, 244, 0.35); }
  50% { box-shadow: 0 8px 30px rgba(220, 38, 38, 0.45); }
}

#voice-status { text-align: center; }

.picker-trigger {
  text-align: left;
  font-weight: 400;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}

#call-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #EAF1FD 0%, #F4F6FB 100%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 2rem;
  color: var(--text);
}

#call-overlay h1 { margin: 0; }

#call-avatar {
  font-size: 4rem;
  width: 6rem;
  height: 6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-lift);
  animation: call-ring 1.4s ease-in-out infinite;
}

@keyframes call-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 125, 221, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(59, 125, 221, 0); }
}

#call-status { color: var(--text-muted); margin-bottom: 1.5rem; }

#call-done { width: auto; padding: 0.75rem 2.5rem; }

#picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: flex-end;
  z-index: 160; /* above #delay/#done/#edit-overlay (150) — it's opened from within them */
}

#picker-sheet {
  position: relative;
  width: 100%;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 1.5rem 1rem 2rem;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.15);
}

#picker-custom-date {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

#picker-custom-date input[type="date"] {
  margin-bottom: 0;
  color-scheme: light;
}

#picker-days {
  display: flex;
  gap: 0.5rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.picker-day-chip {
  flex: 1;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  margin-bottom: 0;
}

.picker-day-chip.selected {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

.picker-wheels-wrap {
  position: relative;
}

.picker-wheels {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  height: 176px;
}

.picker-wheel {
  width: 64px;
  height: 176px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  text-align: center;
  scrollbar-width: none;
}
.picker-wheel::-webkit-scrollbar { display: none; }

.picker-wheel-item {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  color: #B4BCCC;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s, font-size 0.15s;
}

.picker-wheel-item.selected {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
}

.picker-wheel-sep {
  height: 176px;
  display: flex;
  align-items: center;
  color: #B4BCCC;
  font-size: 1.4rem;
  font-weight: 600;
}

.picker-wheel-highlight {
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 66px;
  height: 44px;
  border-top: 1px solid #D6E4FA;
  border-bottom: 1px solid #D6E4FA;
  background: rgba(59, 125, 221, 0.06);
  pointer-events: none;
  border-radius: 8px;
}

#picker-done { margin-top: 1.5rem; margin-bottom: 0; }

#day-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 0.25rem;
  scrollbar-width: none;
}
#day-strip::-webkit-scrollbar { display: none; }

.day-chip {
  flex-shrink: 0;
  width: 3.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.6rem 0.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  margin-bottom: 0;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.day-chip.selected {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-lift);
}

.day-chip-month {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.day-chip-day {
  font-size: 1.1rem;
  font-weight: 700;
}

ul.timeline { display: flex; flex-direction: column; gap: 0.75rem; }

.end-of-list {
  background: none;
  box-shadow: none;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem 0 0.5rem;
  margin-bottom: 0;
}

.timeline-item {
  display: block;
  background: var(--card);
  border-left: 4px solid var(--accent, #3B7DDD);
  border-radius: var(--radius-card);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 0;
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.2rem;
}

.timeline-summary {
  font-size: 0.95rem;
  font-weight: 700;
}

.timeline-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.timeline-reminder {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.35rem;
}

.timeline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.timeline-actions .icon-btn {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  margin-bottom: 0;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-actions .icon-btn:active { opacity: 0.7; }

/* ---- Delay / Done overlays ---- */

#delay-overlay, #done-overlay, #edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: flex-end;
  z-index: 150;
}

#delay-sheet, #done-sheet, #edit-sheet {
  width: 100%;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 1.5rem 1rem 2rem;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.15);
}

.delay-option {
  background: var(--bg);
  color: var(--text);
  box-shadow: none;
  text-align: left;
}

#done-message {
  resize: none;
  font-family: inherit;
}

#done-confirm { background: var(--accent-gradient); }

/* ---- Bottom navigation ---- */

#bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.6rem 0.5rem calc(0.6rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.06);
  z-index: 50;
}

.nav-item {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  width: auto;
  margin-bottom: 0;
}

.nav-item.selected { color: var(--accent); }

.nav-icon { font-size: 1.3rem; }

.nav-fab {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-lift);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -1.6rem;
  margin-bottom: 0;
  padding: 0;
  flex-shrink: 0;
}

.nav-fab-icon {
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
}

#logout-btn { max-width: 200px; }

/* ---- Responsive ----
   Everything above is written mobile-first. On wider viewports (tablet,
   desktop browser, folded-out phones) the content and nav are centered
   into a fixed-width column instead of stretching edge to edge, and the
   bottom-sheet overlays (picker/delay/done/edit) become centered modal
   cards instead of full-width bars glued to the bottom — a full-width
   bottom sheet only makes sense when the viewport itself is phone-width. */

#app, #bottom-nav {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 640px) {
  body { padding: 2rem 1.5rem 7rem; }

  #picker-overlay, #delay-overlay, #done-overlay, #edit-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }

  #picker-sheet, #delay-sheet, #done-sheet, #edit-sheet {
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  }

  #call-overlay { padding: 3rem; }
}

@media (max-width: 360px) {
  body { padding: 1rem; padding-bottom: 6rem; }
  h1 { font-size: 1.35rem; }
  .hero-card { padding: 1.5rem 1rem; }
}

/* ---- Landscape phones — short viewport height, needs tighter vertical
   rhythm so content isn't squeezed and the fixed nav/overlays still fit ---- */

@media (orientation: landscape) {
  #app, #bottom-nav { max-width: 720px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  body { padding: 1rem; padding-bottom: 4.5rem; }
  h1 { font-size: 1.25rem; margin-bottom: 0.5rem; }
  section { margin-bottom: 1rem; }

  #bottom-nav {
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom));
  }
  .nav-item { font-size: 0.55rem; }
  .nav-icon { font-size: 1.1rem; }
  .nav-fab { width: 2.6rem; height: 2.6rem; margin-top: -1rem; }
  .nav-fab-icon { font-size: 1.3rem; }

  .hero-card { padding: 1rem; }
  .hero-icon { width: 3rem; height: 3rem; font-size: 1.4rem; }

  #picker-overlay, #delay-overlay, #done-overlay, #edit-overlay {
    align-items: center;
  }
  #picker-sheet, #delay-sheet, #done-sheet, #edit-sheet {
    max-height: 85vh;
    overflow-y: auto;
  }

  #call-overlay { padding: 1rem; gap: 0.4rem; }
  #call-avatar { width: 4rem; height: 4rem; font-size: 2.5rem; }
}
