@font-face {
  font-family: "LunaDisplay";
  src: local("Georgia"), local("Times New Roman");
  font-weight: 400 700;
}

:root {
  --rose: #e6233b;
  --rose-light: #ff5a6e;
  --rose-pale: #ffe8ee;
  --coral: #ff6b4a;
  --amber: #ffb347;
  --lavender: #a78bfa;
  --deep-purple: #5b1a8a;
  --teal: #2dd4bf;
  --fertile-green: #34d399;
  --ovulation: #f59e0b;
  --bg: #120818;
  --bg2: #1e0f2e;
  --bg3: #2a1538;
  --card: #1c0f2b;
  --text: #f9f0ff;
  --text-muted: #c4b5fd;
  --border: rgba(167, 139, 250, 0.28);
  --danger: #e6233b;
  --success: #34d399;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 0 6.25rem;
  display: none; /* Hidden by default until unlocked */
}

#lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}
#lock-screen.hidden {
  display: none;
}

.lock-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.5rem);
  }
}

.lock-logo {
  font-family: Georgia, serif;
  font-size: 2.375rem;
  color: var(--lavender);
  margin-bottom: 0.5rem;
}
.lock-logo span {
  color: var(--rose-light);
  font-style: italic;
}
.lock-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.pin-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}
.pin-dots {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.pin-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 0.0625rem solid var(--text-muted);
  background: transparent;
  transition: all 0.2s;
}
.pin-dot.filled {
  background: var(--rose);
  border-color: var(--rose);
}
.pin-dot.error {
  background: var(--danger);
  border-color: var(--danger);
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-0.375rem);
  }
  75% {
    transform: translateX(0.375rem);
  }
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 4.5rem);
  gap: 0.75rem;
  justify-content: center;
}
.num-btn {
  width: 4.5rem;
  height: 4.5rem;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  color: var(--text);
}
.num-btn:active {
  transform: scale(0.88);
  background: rgba(255, 61, 107, 0.2);
  border-color: var(--rose);
}
.num-btn.del {
  font-size: 1.125rem;
}
.num-btn.empty {
  visibility: hidden;
}

.lock-error {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--danger);
  min-height: 1.25rem;
  transition: opacity 0.3s;
}

.lock-first-time {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.lock-first-time strong {
  color: var(--lavender);
}

#onboarding {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(env(safe-area-inset-top) + 1rem) 1.5rem
    calc(env(safe-area-inset-bottom) + 1.25rem);
  gap: 0.5rem;
  text-align: center;
  overflow-y: auto;
}
#onboarding.hidden {
  display: none;
}

.onboard-moon {
  font-size: 4rem;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.onboard-logo {
  font-family: Georgia, serif;
  font-size: 2.5rem;
  color: var(--lavender);
}
.onboard-logo span {
  color: var(--rose-light);
  font-style: italic;
}
.onboard-sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
  max-width: 20rem;
}
.onboard-form {
  width: 100%;
  max-width: 21.25rem;
  text-align: left;
}
.onboard-form label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.375rem;
}
.onboard-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  margin-bottom: 1rem;
}
.onboard-form input:focus {
  border-color: rgba(255, 61, 107, 0.6);
}
.onboard-form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.pin-setup-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.5rem 0 0.375rem;
  color: var(--text);
}
.pin-setup-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.5;
}

.setup-pin-wrap {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.setup-pin-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 0.125rem solid var(--text-muted);
  background: transparent;
  transition: all 0.2s;
}
.setup-pin-dot.filled {
  background: var(--lavender);
  border-color: var(--lavender);
}

.onboard-numpad {
  display: grid;
  grid-template-columns: repeat(3, 3.75rem);
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.onboard-numpad .num-btn {
  width: 3.75rem;
  height: 3.75rem;
  font-size: 1.25rem;
}

.onboard-start {
  width: 100%;
  background: linear-gradient(135deg, var(--rose), #6366f1, var(--lavender));
  color: white;
  border: none;
  border-radius: 1rem;
  padding: 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.25rem;
}
.onboard-start:active {
  transform: scale(0.97);
}
.onboard-start:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.privacy-note {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.875rem;
  line-height: 1.6;
  max-width: 20rem;
}
.privacy-note span {
  color: var(--teal);
}

#timeout-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 0.0625rem solid rgba(245, 158, 11, 0.4);
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: var(--amber);
  display: none;
  z-index: 99;
  text-align: center;
}
#timeout-banner.visible {
  display: block;
}

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(0.5rem);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.5rem;
  padding: 1.75rem 1.5rem;
  max-width: 20rem;
  width: 100%;
  text-align: center;
  transform: translateY(1.25rem);
  transition: transform 0.25s;
}
#modal-overlay.visible .modal-box {
  transform: translateY(0);
}
.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}
.modal-title {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.modal-msg {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.375rem;
  white-space: pre-wrap;
}
.modal-btns {
  display: flex;
  gap: 0.625rem;
}
.modal-btn {
  flex: 1;
  padding: 0.8125rem;
  border-radius: 0.875rem;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-btn.primary {
  background: linear-gradient(135deg, var(--rose), #c82050);
  color: white;
}
.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.modal-btn:active {
  transform: scale(0.95);
}

.header {
  padding: 1.25rem 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: Georgia, serif;
  font-size: 1.75rem;
  color: var(--lavender);
}
.logo span {
  color: var(--rose-light);
  font-style: italic;
}

.status-card {
  margin: 1rem 1rem 0;
  background: linear-gradient(135deg, #2a1040 0%, #1a0828 100%);
  border: 0.0625rem solid var(--border);
  border-radius: 1.5rem;
  padding: 1.375rem 1.375rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.status-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.125rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.status-phase .phase-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.status-title {
  font-family: Georgia, serif;
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.status-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.125rem;
}
.status-row {
  display: flex;
  gap: 0.75rem;
}
.status-pill {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 0.875rem;
  padding: 0.625rem 0.75rem;
  text-align: center;
}
.status-pill .val {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1;
}
.status-pill .lbl {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.1875rem;
}

.cycle-bar-wrap {
  margin: 1.125rem 1rem 0;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1rem;
  padding: 1rem 1.125rem;
}
.cycle-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}
.cycle-bar {
  height: 0.625rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-marker {
  position: absolute;
  top: -0.1875rem;
  width: 0.125rem;
  height: 1rem;
  background: white;
  border-radius: 0.125rem;
}

.calendar-wrap {
  margin: 2rem 1rem 0;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cal-month {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
}
.cal-nav {
  display: flex;
  gap: 0.5rem;
}
.cal-nav-btn {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--text);
}
.cal-nav-btn:active {
  transform: scale(0.9);
  background: var(--rose);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.125rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.1875rem;
  padding: 0 0.125rem;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.18s;
  user-select: none;
}
.cal-day:active {
  transform: scale(0.85);
}
.cal-day.empty {
  pointer-events: none;
}
.cal-day.other-month {
  color: rgba(255, 255, 255, 0.2);
}
.cal-day.period {
  background: linear-gradient(
    135deg,
    rgba(255, 61, 107, 0.85),
    rgba(255, 107, 74, 0.85)
  );
  color: white;
}
.cal-day.fertile {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
  border: 0.09375rem solid rgba(52, 211, 153, 0.4);
}
.cal-day.ovulation {
  background: rgba(245, 158, 11, 0.85);
  color: white;
}
.cal-day.predicted-period {
  background: rgba(255, 61, 107, 0.15);
  color: var(--rose-light);
  border: 0.09375rem dashed rgba(255, 61, 107, 0.5);
}
.cal-day.today::after {
  content: "";
  position: absolute;
  bottom: 0.125rem;
  width: 0.25rem;
  height: 0.25rem;
  background: white;
  border-radius: 50%;
}
.cal-day.has-log::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  width: 0.3125rem;
  height: 0.3125rem;
  background: var(--lavender);
  border-radius: 50%;
}
.cal-day.selected-log {
  box-shadow: 0 0 0 0.15625rem var(--lavender);
}

.log-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.log-modal-overlay.visible {
  display: flex;
}
.log-panel {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.25rem;
  padding: 1.125rem;
  max-width: 28rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.3s ease;
  box-shadow: 0 1.25rem 3.125rem rgba(0, 0, 0, 0.5);
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(1.25rem) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: end;
  justify-content: end;
  transition: color 0.2s;
  flex-shrink: 0;
}
.close-btn:hover {
  color: var(--text);
}
.log-date-title {
  font-family: Georgia, serif;
  font-size: 1.125rem;
  flex: 1;
}
.log-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}
.log-btn {
  padding: 0.625rem 0.375rem;
  border-radius: 0.75rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 0.09375rem solid var(--border);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  user-select: none;
}
.log-btn .icon {
  font-size: 1.25rem;
  display: block;
  margin-bottom: 0.25rem;
}
#log-flow-icon {
  display: block;
  white-space: nowrap;
  letter-spacing: -0.22em;
  color: var(--rose);
}
.log-btn:active {
  transform: scale(0.93);
}
.log-btn.active-flow {
  border-color: var(--rose);
  background: rgba(255, 61, 107, 0.15);
  color: var(--rose-light);
}
.log-btn.active-symptom {
  border-color: var(--lavender);
  background: rgba(167, 139, 250, 0.15);
  color: var(--lavender);
}
.log-btn.active-mood {
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.15);
  color: var(--teal);
}
.log-btn.mood-btn {
  grid-column: auto;
}
.mood-sub {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.mood-modal-wrap {
  margin-top: 0.5rem;
}
.mood-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.mood-modal-slider {
  width: 100%;
  cursor: pointer;
}
.flow-modal-wrap {
  margin-top: 0.5rem;
}
.flow-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: -0.22em;
}
.flow-modal-slider {
  width: 100%;
  cursor: pointer;
}
.pain-modal-wrap {
  margin-top: 0.5rem;
}
.pain-modal-value {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.pain-modal-slider {
  width: 100%;
  cursor: pointer;
}
.period-markers {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 1rem;
}
.period-marker-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 0.125rem solid var(--border);
  border-radius: 0.875rem;
  padding: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.period-marker-btn .icon {
  font-size: 1.125rem;
}
.period-marker-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(167, 139, 250, 0.3);
}
.period-marker-btn.active {
  background: linear-gradient(135deg, var(--rose), #c82050);
  border-color: var(--rose);
  color: white;
}
.period-marker-btn:active {
  transform: scale(0.97);
}
.log-note {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 0.0625rem solid var(--border);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  outline: none;
  margin-bottom: 0.625rem;
}
.log-note:focus {
  border-color: rgba(167, 139, 250, 0.5);
}
.log-save-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--rose), #c82050);
  color: white;
  border: none;
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.log-save-btn:active {
  transform: scale(0.97);
}
.log-delete-btn {
  flex: 1;
  background: linear-gradient(135deg, #666, #444);
  color: white;
  border: none;
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.log-delete-btn:active {
  transform: scale(0.97);
}
.log-actions {
  display: flex;
  gap: 0.625rem;
  width: 100%;
}
.note-limit {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
}

.insights-wrap {
  margin: 1rem 1rem 0;
  display: none;
}
.insights-wrap.visible {
  display: block;
}
.insight-card {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.25rem;
  padding: 1.125rem;
  margin-bottom: 0.75rem;
  overflow: visible;
}
.insight-card h3 {
  font-family: Georgia, serif;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.875rem;
  padding: 0.875rem;
  text-align: center;
}
.stat-box .big {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-box .sm {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 0.0625rem solid var(--border);
  font-size: 0.875rem;
}
.history-row:last-child {
  border-bottom: none;
}
.history-len {
  font-weight: 600;
  padding: 0.1875rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
}
.info-box {
  background: rgba(167, 139, 250, 0.1);
  border: 0.0625rem solid rgba(167, 139, 250, 0.25);
  border-radius: 0.875rem;
  padding: 0.875rem;
  font-size: 0.8125rem;
  color: #c4b5fd;
  line-height: 1.6;
}

.settings-wrap {
  margin: 1rem 1rem 0;
  display: none;
}
.settings-wrap.visible {
  display: block;
}

/* Support tab mode: show only About + Support sections */
#view-about.support-mode .settings-section {
  display: none;
}

#view-about.support-mode #about-core-section,
#view-about.support-mode #support-section {
  display: block;
}

.settings-section {
  background: var(--card);
  border: 0.0625rem solid var(--border);
  border-radius: 1.25rem;
  padding: 1.125rem;
  margin-bottom: 0.75rem;
}
.settings-section h3 {
  font-family: Georgia, serif;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.field-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.field-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.75rem 0.875rem;
  color: white;
  font-family: inherit;
  font-size: 0.9375rem;
  outline: none;
  margin-bottom: 0.875rem;
}
.field-input:focus {
  border-color: rgba(255, 61, 107, 0.5);
}
.field-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
.apply-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--rose), #c82050);
  color: white;
  border: none;
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.apply-btn:active {
  transform: scale(0.97);
}
.danger-btn {
  width: 100%;
  background: rgba(255, 61, 107, 0.1);
  border: 0.0625rem solid rgba(255, 61, 107, 0.4);
  color: var(--rose);
  border-radius: 0.875rem;
  padding: 0.8125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.625rem;
}
.danger-btn:active {
  transform: scale(0.97);
}
.sec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(52, 211, 153, 0.12);
  border: 0.0625rem solid rgba(52, 211, 153, 0.3);
  border-radius: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  color: var(--teal);
  margin-bottom: 0.75rem;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 30rem;
  background: rgba(26, 16, 37, 0.92);
  backdrop-filter: blur(1.25rem);
  -webkit-backdrop-filter: blur(1.25rem);
  border-top: 0.0625rem solid var(--border);
  display: none; /* Hidden by default until unlocked */
  padding: 0.625rem 0 max(0.625rem, env(safe-area-inset-bottom));
  z-index: 100;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  cursor: pointer;
  font-size: 0.625rem;
  color: var(--text-muted);
  transition: all 0.2s;
  user-select: none;
  padding: 0.25rem 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bnav-item .icon {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  stroke-width: 1.5;
  fill: none;
  line-height: 1;
}

.bnav-item .icon svg {
  display: block;
  margin: auto;
}
.bnav-item.active {
  color: var(--rose-light);
}

@media (min-width: 600px) {
  #app,
  .bottom-nav {
    max-width: 37.5rem;
  }
  .cal-day {
    font-size: 0.9375rem;
  }
}

/* Logo Images */
.logo-lock {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
}

.logo-onboard {
  width: 5rem;
  height: 5rem;
  border-radius: 1.25rem;
}

/* Forgot PIN Button */
.forgot-pin-wrapper {
  text-align: center;
  margin-top: 1.25rem;
}

.forgot-pin-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Onboarding Tagline */
.onboard-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.5rem 0 1.5rem;
  text-align: center;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* Beta Warning Box */
.beta-warning {
  background: rgba(255, 179, 71, 0.12);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  max-width: 21.25rem;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: #fcd68a;
  line-height: 1.5;
}

/* Reminder Banner */
.reminder-banner {
  display: none;
  background: linear-gradient(135deg, var(--amber), #f59e0b);
  padding: 0.875rem 1.25rem;
  border-radius: 0.75rem;
  margin: 0 1.25rem 1rem;
  color: white;
  font-weight: 600;
  text-align: center;
}

/* Legend Dot Colors */
.legend-dot--rose {
  background: var(--rose);
}

.legend-dot--fertile {
  background: var(--fertile-green);
}

.legend-dot--ovulation {
  background: var(--ovulation);
}

.legend-dot--lavender {
  background: var(--lavender);
}

/* Calendar Empty State */
.calendar-empty-text {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  margin: -0.5rem 0 1rem;
}

/* Stat Box Colors */
.stat-color--rose {
  color: var(--rose);
}

.stat-color--lavender {
  color: var(--lavender);
}

.stat-color--teal {
  color: var(--teal);
}

.stat-color--fertile {
  color: var(--fertile-green);
}

/* Chart Download Button */
.chart-header-row {
  display: flex;
  justify-content: space-between;
}

.chart-download-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: color 0.2s;
}

.chart-download-btn:hover {
  color: #ccc;
}

/* Chart Controls */
.chart-controls-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.chart-select {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  color: white;
  cursor: pointer;
}

.chart-select option {
  background: #1a1a2e;
  color: white;
}

/* Chart Container */
.chart-container {
  margin: 0 -1.125rem;
  padding: 0;
}

.chart-canvas {
  width: 100%;
  max-height: 300px;
  display: block;
}

/* Chart Legend */
.chart-legend {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1.25rem;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.legend-item--period,
.legend-item--ovulation,
.legend-item--flow,
.legend-item--pain,
.legend-item--mood {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-item--period {
  color: #ff3d6b;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--ovulation {
  color: #ffd700;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--flow {
  color: #ff3d6b;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--pain {
  color: #ff6b4a;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.legend-item--mood {
  color: #8b7fe8;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
  font-weight: bold;
}

/* Empty History State */
.empty-history {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Info Box Variants */
.info-box--success {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.07);
  color: #6ee7b7;
}

.info-box--warning {
  border-color: rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.08);
  color: #fcd68a;
}

.info-box--security {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  margin-bottom: 0.625rem;
}

.info-box--data-warning {
  border-color: rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.08);
  color: #fcd68a;
  margin-bottom: 0.625rem;
}

.info-box--margin {
  margin-bottom: 0.75rem;
}

.backup-status {
  font-size: 0.85rem;
  padding: 0.5rem 0 0.25rem;
  color: #c4b5fd;
}

.backup-status--warn {
  color: #fcd68a;
  font-weight: 600;
}

.backup-status--ok {
  color: #c4b5fd;
}

/* Accessibility Link */
.accessibility-link {
  color: var(--teal);
  text-decoration: underline;
}

/* Support Link */
.support-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(50deg, #0070e0, #b9dcff);
  color: white;
  text-decoration: none;
  border-radius: 0.875rem;
  border: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.support-link:hover {
  transform: translateY(-2px);
}

.support-link:active {
  transform: translateY(0);
}

.support-link:focus-visible {
  outline: 2px solid rgba(185, 220, 255, 0.65);
  outline-offset: 2px;
}

.support-paypal-logo {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.support-paypal-logo svg {
  width: 4.6rem;
  height: auto;
  display: block;
}

/* Button Variants */
.btn--change-pin {
  background: linear-gradient(135deg, var(--lavender), #6d28d9);
  margin-bottom: 0;
}

.btn--export {
  background: linear-gradient(135deg, var(--teal), #0d9488);
  margin-top: 0.625rem;
  margin-bottom: 0.625rem;
}

.btn--import {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal);
  margin-bottom: 0.625rem;
}

/* Tab Switching Animation */
.settings-wrap,
.insights-wrap,
#view-calendar {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Optional Light Theme variables (Fallback to dark mode) */
@media (prefers-color-scheme: light) {
  /* You can expand these in the future to fully support light mode */
  /* :root {
      --bg: #ffffff;
      --card: #f9f9f9;
      --text: #333333;
  } */
}
