:root {
  color-scheme: dark;
  --bg: #070613;
  --bg-soft: #0d1020;
  --surface: rgba(16, 17, 34, 0.84);
  --surface-strong: rgba(24, 20, 45, 0.96);
  --surface-muted: rgba(255, 255, 255, 0.055);
  --text: #fff8fc;
  --muted: #b9b4c9;
  --line: rgba(226, 186, 255, 0.18);
  --pink: #ff5fd2;
  --violet: #b35cff;
  --cyan: #27e9f2;
  --gold: #ffc978;
  --green: #74edbd;
  --danger: #ff7f9f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius-lg: 26px;
  --radius-md: 18px;
  --nav-height: 76px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #fff7f5;
  --bg-soft: #f8eff6;
  --surface: rgba(255, 252, 251, 0.9);
  --surface-strong: rgba(255, 249, 249, 0.98);
  --surface-muted: rgba(78, 32, 75, 0.055);
  --text: #301c34;
  --muted: #786b7d;
  --line: rgba(133, 66, 135, 0.16);
  --pink: #d92ba3;
  --violet: #8e48d2;
  --cyan: #008f9c;
  --gold: #aa6e1c;
  --green: #138561;
  --danger: #b42650;
  --shadow: 0 22px 54px rgba(108, 66, 89, 0.15);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; min-height: 100dvh; overflow-x: hidden; background: radial-gradient(circle at 76% -8%, rgba(213, 75, 255, 0.18), transparent 32%), radial-gradient(circle at -10% 55%, rgba(39, 233, 242, 0.12), transparent 34%), var(--bg); color: var(--text); }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.ambient { position: fixed; z-index: -1; width: 38vw; height: 38vw; border-radius: 50%; filter: blur(90px); opacity: .2; pointer-events: none; }
.ambient-one { top: 12%; right: -18%; background: var(--pink); }
.ambient-two { bottom: 4%; left: -22%; background: var(--cyan); }
.app-shell { width: min(100%, 1100px); min-height: 100dvh; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) clamp(14px, 3vw, 32px) calc(var(--nav-height) + max(34px, env(safe-area-inset-bottom))); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 2px 2px 14px; }
.brand-word { margin: 0 0 5px; color: #f8b9dd; font-family: Georgia, "Times New Roman", serif; font-size: .78rem; letter-spacing: .22em; }
body[data-theme="light"] .brand-word { color: #8e385f; }
.topbar h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.85rem, 7vw, 2.7rem); line-height: 1.05; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.status-pill, .access-chip { display: inline-flex; align-items: center; min-height: 32px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: var(--surface-muted); color: var(--muted); font-size: .72rem; white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.status-pill.offline::before { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.icon-button, .avatar-button, .close-button { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); }
.avatar-button { background: linear-gradient(145deg, rgba(255, 95, 210, .32), rgba(39, 233, 242, .18)); box-shadow: 0 0 22px rgba(255, 95, 210, .18); }
.access-banner { min-height: 0; margin: 0 0 12px; }
.access-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 10px 13px; background: linear-gradient(110deg, rgba(179, 92, 255, .12), rgba(39, 233, 242, .06)); font-size: .82rem; }
.access-panel strong { color: var(--pink); }
.view { outline: none; }
.hero-card, .card, .stat-card, .world-card, .list-card, .privacy-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface), rgba(16, 14, 34, .7)); box-shadow: var(--shadow); }
body[data-theme="light"] .hero-card, body[data-theme="light"] .card, body[data-theme="light"] .stat-card, body[data-theme="light"] .world-card, body[data-theme="light"] .list-card, body[data-theme="light"] .privacy-card { background: linear-gradient(145deg, var(--surface), rgba(249, 236, 241, .9)); }
.hero-card { min-height: 170px; padding: clamp(20px, 5vw, 34px); background-image: radial-gradient(circle at 90% 20%, rgba(255, 95, 210, .28), transparent 32%), radial-gradient(circle at 8% 110%, rgba(39, 233, 242, .18), transparent 34%), linear-gradient(145deg, var(--surface), rgba(31, 14, 47, .88)); }
.hero-card::after { content: "✦"; position: absolute; right: 8%; top: 18%; color: var(--pink); font-size: clamp(3rem, 12vw, 7rem); opacity: .28; filter: drop-shadow(0 0 18px var(--pink)); }
.hero-card h2 { max-width: 620px; margin: 0 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 5.5vw, 2.1rem); font-weight: 500; }
.hero-card p { max-width: 560px; margin: 0; color: var(--muted); line-height: 1.55; }
.hero-action { position: relative; z-index: 1; margin-top: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--pink); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 2px 11px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.15rem, 4vw, 1.5rem); font-weight: 500; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.quick-card { min-width: 0; min-height: 104px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; background: var(--surface); text-align: left; }
.quick-card span { display: block; margin-bottom: 14px; color: var(--cyan); font-size: 1.3rem; }
.quick-card strong { display: block; overflow-wrap: anywhere; font-size: .86rem; }
.stat-card { grid-column: span 4; min-height: 122px; padding: 16px; box-shadow: none; }
.stat-card .value { display: block; margin: 10px 0 2px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 5vw, 2rem); }
.stat-card .compact-value { font-size: clamp(1rem, 3.8vw, 1.35rem); overflow-wrap: anywhere; }
.stat-card small { color: var(--muted); }
.progress { width: 100%; height: 5px; margin-top: 13px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--cyan)); box-shadow: 0 0 12px var(--pink); }
.progress-native { display: block; width: 100%; height: 5px; margin-top: 13px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: var(--surface-muted); }
.progress-native::-webkit-progress-bar { border-radius: inherit; background: var(--surface-muted); }
.progress-native::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--cyan)); box-shadow: 0 0 12px var(--pink); }
.progress-native::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--cyan)); box-shadow: 0 0 12px var(--pink); }
.list { display: grid; gap: 9px; }
.list-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 13px 14px; border-radius: var(--radius-md); box-shadow: none; }
.date-badge { display: grid; place-items: center; width: 45px; min-height: 47px; border-radius: 14px; background: linear-gradient(145deg, rgba(255, 95, 210, .2), rgba(39, 233, 242, .13)); color: var(--text); font-weight: 700; }
.list-card h3 { margin: 0 0 4px; overflow-wrap: anywhere; font-size: .93rem; }
.list-card p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.4; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 4px; }
.mini-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--surface-muted); color: var(--muted); }
.mini-button.danger { color: var(--danger); }
.mini-button.is-complete { background: rgba(116, 237, 189, .17); color: var(--green); box-shadow: inset 0 0 0 1px rgba(116, 237, 189, .25); }
.list-card.completed h3 { text-decoration: line-through; opacity: .7; }
.empty-state { border: 1px dashed var(--line); border-radius: var(--radius-md); padding: 26px 18px; color: var(--muted); text-align: center; }
.calendar-card { padding: 16px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.calendar-head .mini-button { flex: 0 0 48px; width: 48px; min-width: 48px; height: 48px; }
.calendar-head strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-grid span { display: grid; place-items: center; min-width: 0; aspect-ratio: 1; border-radius: 11px; font-size: clamp(.68rem, 2.8vw, .82rem); }
.calendar-grid .weekday { aspect-ratio: auto; min-height: 24px; color: var(--muted); font-size: .65rem; }
.calendar-grid .outside { opacity: .25; }
.calendar-grid .today { background: linear-gradient(145deg, var(--violet), var(--pink)); color: white; box-shadow: 0 0 18px rgba(255, 95, 210, .4); }
.calendar-grid .has-items:not(.today) { border: 1px solid var(--pink); }
.world-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.world-card { min-height: 146px; padding: 18px; box-shadow: none; }
.world-card::after { content: attr(data-symbol); position: absolute; right: 13px; bottom: 4px; color: var(--pink); font-size: 3.2rem; opacity: .19; }
.world-card:nth-child(2n)::after { color: var(--cyan); }
.world-card h3 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; }
.world-card p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.world-card .count { position: absolute; left: 18px; bottom: 15px; color: var(--pink); font-size: .75rem; }
.world-card > .mini-button { position: absolute; right: 12px; top: 12px; z-index: 1; }
.mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 12px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.mode-tabs button { min-width: 0; min-height: 44px; border: 0; border-radius: 13px; padding: 7px; background: transparent; color: var(--muted); font-size: .74rem; }
.mode-tabs button[aria-pressed="true"] { background: linear-gradient(120deg, var(--violet), var(--pink)); color: white; box-shadow: 0 6px 20px rgba(225, 65, 198, .22); }
.medical-note, .payment-notice { margin: 12px 0; border: 1px solid rgba(255, 201, 120, .3); border-radius: var(--radius-md); padding: 14px 16px; background: rgba(255, 201, 120, .08); color: var(--muted); font-size: .78rem; line-height: 1.5; }
.medical-note strong { color: var(--gold); }
.payment-notice { border-color: rgba(116, 237, 189, .3); background: rgba(116, 237, 189, .09); color: var(--text); }
.pregnancy-progress { margin-top: 12px; }
.pregnancy-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; }
.pregnancy-summary > div { min-width: 0; }
.pregnancy-summary strong, .pregnancy-summary small { display: block; overflow-wrap: anywhere; }
.pregnancy-summary small { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.big-week { display: block; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 10vw, 5rem); line-height: .9; color: var(--pink); }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { padding: clamp(17px, 4vw, 24px); box-shadow: none; }
.card.full { grid-column: 1 / -1; }
.card h2, .card h3 { margin-top: 0; }
.card p { color: var(--muted); line-height: 1.5; }
.privacy-card { padding: 18px; border-color: rgba(39, 233, 242, .3); box-shadow: none; }
.privacy-card strong { color: var(--cyan); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; max-width: 100%; border: 1px solid transparent; border-radius: 14px; padding: 10px 16px; text-decoration: none; font-weight: 700; line-height: 1.2; text-align: center; }
.button.primary { background: linear-gradient(120deg, var(--violet), var(--pink)); color: white; box-shadow: 0 10px 28px rgba(225, 65, 198, .22); }
.button.secondary { border-color: rgba(39, 233, 242, .36); background: rgba(39, 233, 242, .12); color: var(--cyan); }
.button.ghost { border-color: var(--line); background: var(--surface-muted); color: var(--text); }
.button.danger { border-color: rgba(255, 127, 159, .3); background: rgba(255, 127, 159, .1); color: var(--danger); }
.button:disabled, .fab:disabled { cursor: not-allowed; filter: grayscale(.65); opacity: .5; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.text-button { display: inline-flex; align-items: center; min-width: 44px; min-height: 48px; border: 0; padding: 10px 4px; background: transparent; color: var(--pink); text-align: left; }
.fab { position: fixed; z-index: 21; right: max(18px, calc((100vw - 1060px) / 2)); bottom: calc(var(--nav-height) + max(16px, env(safe-area-inset-bottom))); display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; background: linear-gradient(145deg, var(--violet), var(--pink)); color: white; font-size: 1.65rem; box-shadow: 0 0 28px rgba(255, 95, 210, .38); }
.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(100%, 720px); min-height: var(--nav-height); padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; background: color-mix(in srgb, var(--bg-soft) 88%, transparent); box-shadow: 0 -10px 38px rgba(0,0,0,.25); backdrop-filter: blur(20px); }
.bottom-nav button { min-width: 0; min-height: 54px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); }
.bottom-nav button span, .bottom-nav button small { display: block; }
.bottom-nav button span { margin-bottom: 2px; font-size: 1.2rem; }
.bottom-nav button small { overflow: hidden; font-size: clamp(.55rem, 2.3vw, .68rem); text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav button[aria-current="page"] { background: linear-gradient(145deg, rgba(179, 92, 255, .22), rgba(255, 95, 210, .16)); color: var(--pink); box-shadow: inset 0 0 0 1px rgba(255, 95, 210, .18); }
.modal { width: min(calc(100% - 24px), 680px); max-height: min(88dvh, 800px); margin: auto; overflow: auto; border: 1px solid var(--line); border-radius: 24px; padding: 0; background: var(--surface-strong); color: var(--text); box-shadow: 0 28px 90px rgba(0,0,0,.58); }
.modal::backdrop { background: rgba(2, 3, 12, .72); backdrop-filter: blur(10px); }
.modal > form, .modal > div { padding: clamp(18px, 5vw, 28px); }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.modal h2, .modal h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; }
.modal label { display: grid; gap: 7px; margin-bottom: 13px; color: var(--muted); font-size: .8rem; }
.modal input, .modal select, .modal textarea { width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; background: var(--surface-muted); color: var(--text); outline: none; }
.modal input[type="file"] { min-height: 52px; padding-block: 12px; }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 95, 210, .12); }
.form-grid, .auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-grid form { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 17px; background: var(--surface-muted); }
.auth-grid h3 { margin-bottom: 14px; }
.field-hint, .privacy-note { margin: -4px 0 13px; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--nav-height) + max(24px, env(safe-area-inset-bottom))); width: min(calc(100% - 28px), 520px); padding: 13px 16px; transform: translate(-50%, 24px); border: 1px solid var(--line); border-radius: 15px; background: var(--surface-strong); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.offline-page { display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); }
.offline-card { width: min(100%, 480px); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px; background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.offline-card img { border-radius: 26px; }
.offline-card p { color: var(--muted); line-height: 1.55; }

@media (max-width: 700px) {
  .profile-grid { grid-template-columns: 1fr; }
  .card.full { grid-column: auto; }
  .status-pill { display: none; }
}

@media (max-width: 520px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-card:last-child { grid-column: 1 / -1; }
  .stat-card { grid-column: span 6; }
  .stat-card:last-child { grid-column: 1 / -1; }
  .world-grid { gap: 8px; }
  .world-card { min-height: 132px; padding: 14px; }
  .world-card .count { left: 14px; }
  .form-grid, .auth-grid { grid-template-columns: 1fr; }
  .access-panel { align-items: flex-start; flex-direction: column; }
  .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pregnancy-summary { grid-template-columns: 1fr 1fr; }
  .pregnancy-summary > div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  :root { --nav-height: 72px; }
  .topbar-actions { gap: 5px; }
  .icon-button, .avatar-button { width: 44px; height: 44px; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-card:last-child { grid-column: auto; }
  .world-grid { grid-template-columns: 1fr; }
  .list-card { grid-template-columns: auto minmax(0, 1fr); }
  .card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .bottom-nav button small { overflow: visible; font-size: .5rem; line-height: 1.05; text-overflow: clip; white-space: normal; }
}

@media (min-width: 760px) {
  .view { padding-bottom: 24px; }
  .hero-card { min-height: 210px; }
  .world-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
