:root {
  --bg: #f6f0ea;
  --text: #2e2628;
  --muted: #71656a;
  --line: rgba(255, 255, 255, 0.55);
  --glass: rgba(255, 255, 255, 0.44);
  --cta: #c894a3;
  --cta-2: #b57a8b;
  --ink-soft: #5f4f54;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Nunito", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 540px at -6% -8%, rgba(255, 208, 198, 0.62) 0%, rgba(255, 208, 198, 0) 64%),
    radial-gradient(980px 460px at 112% 16%, rgba(226, 199, 255, 0.52) 0%, rgba(226, 199, 255, 0) 62%),
    linear-gradient(180deg, #fffaf6 0%, #f7f1eb 45%, #f5eee7 100%);
  letter-spacing: 0.01em;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
  background-image:
    radial-gradient(rgba(180, 146, 154, 0.14) 0.65px, transparent 0.65px);
  background-size: 3px 3px;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
  animation: none;
}

.orb-a {
  width: 240px;
  height: 240px;
  left: -40px;
  top: 60px;
  background: radial-gradient(circle, #ffd1bf 0%, #ffc6ef 55%, transparent 75%);
}

.orb-b {
  width: 280px;
  height: 280px;
  right: -80px;
  top: 220px;
  background: radial-gradient(circle, #ffe1a8 0%, #e4cffc 62%, transparent 78%);
}

.orb-c {
  width: 260px;
  height: 260px;
  left: 30%;
  bottom: -80px;
  background: radial-gradient(circle, #ffe6ca 0%, #f6cde1 58%, transparent 76%);
}

@keyframes drift {
  0% {
    transform: translateY(-6px) translateX(0px);
  }
  100% {
    transform: translateY(8px) translateX(6px);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 108px;
  display: grid;
  gap: 12px;
}

.hero {
  padding: 8px 8px 2px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.2px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  font-weight: 600;
}

.hero p {
  margin: 3px 0 0;
  color: var(--muted);
}

.screen-pane { }

.tab-btn {
  background: rgba(255, 255, 255, 0.72);
  color: #6a5157;
  box-shadow: none;
}

.tab-btn.active {
  background: linear-gradient(180deg, var(--cta), var(--cta-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(171, 116, 128, 0.28);
}

.tab-btn small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(760px, calc(100vw - 18px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(152, 103, 115, 0.22);
  overflow: hidden;
}

.bottom-tabs .tab-btn {
  padding: 8px 4px;
  font-size: 15px;
  border-radius: 10px;
  line-height: 1;
  min-height: 48px;
}

.nav-tab {
  position: relative;
  z-index: 2;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  border: 1px solid transparent;
}

.nav-tab.active {
  background: transparent;
  color: #503f44;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.75);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card {
  border-radius: 22px;
  padding: 15px;
  border: 1px solid var(--line);
  transition: box-shadow 180ms ease;
}

.glass {
  background: linear-gradient(145deg, rgba(255, 246, 240, 0.76), rgba(255, 255, 255, 0.42));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 14px 35px rgba(152, 101, 73, 0.13);
}

.card:hover {
  transform: none;
}

.status-top {
  display: block;
}

.status-main {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.status-phase {
  font-size: 19px;
  font-weight: 700;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  letter-spacing: 0.2px;
}

.status-ring {
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(255, 247, 249, 0.95), rgba(246, 223, 229, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 10px 25px rgba(170, 114, 126, 0.18),
    0 0 0 8px rgba(255, 255, 255, 0.28);
  display: grid;
  align-content: center;
  justify-items: center;
}

.status-ring-value {
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
  color: #6f4a52;
}

.status-ring-label {
  font-size: 12px;
  margin-top: 4px;
  color: #7c6268;
  text-transform: lowercase;
}

.status-next {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
  text-align: center;
}

h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.12px;
}

#adviceText {
  white-space: pre-wrap;
  line-height: 1.48;
  margin: 0;
}

.section-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.adv-section {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.42));
  transition: background 180ms ease, border-color 180ms ease;
}

.adv-section[open] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.5));
  border-color: rgba(200, 148, 163, 0.44);
}

.adv-section summary {
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
}

.adv-section p {
  margin: 8px 0 0;
  color: #403832;
}

.actions,
.feedback {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#adviceCard .actions {
  margin-bottom: 12px;
}

button {
  border: 0;
  background: linear-gradient(180deg, var(--cta), var(--cta-2));
  color: #fff;
  border-radius: 13px;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: 0 6px 16px rgba(171, 116, 128, 0.28);
  transition: filter 0.16s ease, opacity 0.16s ease;
}

button.is-busy {
  opacity: 0.75;
  pointer-events: none;
}

.status-main .cta {
  margin-top: 6px;
  min-width: 220px;
}

button.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: #5a4f47;
}

button:hover {
  filter: brightness(0.98);
  transform: none;
}

.history-wrap {
  display: grid;
  gap: 8px;
}

.patterns-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.pattern-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 246, 251, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  color: #6a4f56;
  box-shadow: 0 3px 8px rgba(165, 126, 137, 0.12);
}

.history-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  padding: 10px;
  transition: transform 160ms ease;
}

.history-item:active {
  transform: scale(0.995);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none;
}

.date-toggle {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sym-groups {
  display: grid;
  gap: 12px;
}

.sym-group {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  padding: 8px 10px;
}

.sym-group summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: #624f53;
  list-style: none;
}

.sym-group summary::-webkit-details-marker {
  display: none;
}

.sym-group summary::after {
  content: "▾";
  float: right;
  opacity: 0.6;
}

.sym-items {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sym-item {
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.65);
}

.sym-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
  color: #5c4c4f;
}

.sym-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #b78691;
}

.intensity {
  width: 100%;
  margin-top: 8px;
  accent-color: #c595a0;
}

.intensity-val {
  display: inline-block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.sym-item:not(.active) .intensity,
.sym-item:not(.active) .intensity-val {
  display: none;
}

.note-label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.symptoms-screen .actions {
  margin-top: 14px;
}

#saveSymptomsBtn {
  width: 100%;
}

textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 10px;
  font-family: inherit;
}

input[type="date"],
input[type="number"],
input[type="time"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 10px;
  font-family: inherit;
}

.stats-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 10px;
}

.calendar-visual {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}

.month-card {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.5));
}

.cycle-card .muted {
  margin-top: 2px;
}

.cycle-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 8px;
}

.cycle-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.cycle-dot.period {
  background: #edb8c3;
}

.cycle-dot.fertile {
  background: #bfe7c8;
}

.cycle-dot.ovulation {
  background: #d9b6e7;
}

.cycle-dot.delay {
  background: #f6d88a;
}

.cycle-dot.today {
  box-shadow: 0 0 0 2px #5f4f53 inset;
}

.month-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.day-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 11px;
  color: #8a7a7e;
  margin-bottom: 6px;
}

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

.day-cell {
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.muted-day {
  background: transparent;
}

.day-cell.period {
  background: #edb8c3;
}

.day-cell.fertile {
  background: #bfe7c8;
}

.day-cell.ovulation {
  background: #d9b6e7;
  color: #fff;
  font-weight: 700;
}

.day-cell.today {
  outline: 2px solid #b27c88;
  outline-offset: 1px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #6f6461;
}

.calendar-legend .lg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 5px;
}

.calendar-legend .period {
  background: #edb8c3;
}

.calendar-legend .fertile {
  background: #bfe7c8;
}

.calendar-legend .ovulation {
  background: #d9b6e7;
}

.calendar-legend .delay {
  background: #f6d88a;
}

#setIsNotify {
  accent-color: #b78691;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px));
  z-index: 30;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(44, 37, 39, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  max-width: calc(100vw - 28px);
  text-align: center;
}

@media (max-width: 560px) {
  .app {
    padding-bottom: 118px;
  }

  #startPeriodBtn {
    width: 100%;
    min-width: 0;
  }

  .bottom-tabs .tab-btn {
    font-size: 14px;
    padding: 8px 4px;
  }

  .tab-btn small {
    font-size: 9px;
  }

  .symptoms-screen {
    padding-bottom: 18px;
  }
}
