/* ---------- Tema: bej taban, faza göre renk ---------- */
:root {
  --bg: #F4EBDD; --surface: #FBF6EE; --surface-2: #EFE4D3; --line: #E3D5C0;
  --text: #3B2F2A; --muted: #8A7A6D; --accent: #B07D55; --accent-ink: #fff; --accent-soft: #EAD8C2;
  --period: #C83E4D; --period-soft: #F4D3D3; --pred: #E7A3A8;
  --fertile: #7FA894; --fertile-soft: #DCEBE2; --ovu: #4E8A70;
  --shadow: 0 1px 2px rgba(80, 55, 35, .06), 0 8px 24px rgba(80, 55, 35, .08);
  --radius: 22px;
  color-scheme: light;
}
:root[data-phase="menstrual"] { --bg: #F7E2DE; --surface: #FFF6F4; --surface-2: #F6DAD6; --line: #EDC9C4; --accent: #C83E4D; --accent-soft: #F4CDCD; --muted: #8E6A68; }
:root[data-phase="follicular"] { --bg: #FAF6EF; --surface: #FFFDF9; --surface-2: #F3ECE0; --line: #EAE0D0; }
:root[data-phase="ovulation"] { --bg: #F7EEE0; --surface: #FFFBF4; --accent: #C08A57; --accent-soft: #F0DEC6; }
:root[data-phase="luteal"], :root[data-phase="late"] { --bg: #EFE3D1; --surface: #F9F2E7; --surface-2: #E8DAC5; --accent: #A57650; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1714; --surface: #28211C; --surface-2: #332A24; --line: #3E342C;
    --text: #F2E8DC; --muted: #A8978A; --accent: #D6A47A; --accent-ink: #1C1714; --accent-soft: #4A3A2D;
    --period: #E2606E; --period-soft: #4A2328; --pred: #8E4A52; --fertile: #7FB79C; --fertile-soft: #24392F; --ovu: #9AD3B6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-phase="menstrual"] { --bg: #221314; --surface: #301C1D; --surface-2: #3D2325; --line: #4A2B2D; --accent: #E2606E; --accent-ink: #fff; --accent-soft: #4E2529; }
  :root:not([data-theme="light"])[data-phase="follicular"] { --bg: #1E1A16; --surface: #2B2520; }
}
:root[data-theme="dark"] {
  --bg: #1C1714; --surface: #28211C; --surface-2: #332A24; --line: #3E342C;
  --text: #F2E8DC; --muted: #A8978A; --accent: #D6A47A; --accent-ink: #1C1714; --accent-soft: #4A3A2D;
  --period: #E2606E; --period-soft: #4A2328; --pred: #8E4A52; --fertile: #7FB79C; --fertile-soft: #24392F; --ovu: #9AD3B6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}
:root[data-theme="dark"][data-phase="menstrual"] { --bg: #221314; --surface: #301C1D; --surface-2: #3D2325; --line: #4A2B2D; --accent: #E2606E; --accent-ink: #fff; --accent-soft: #4E2529; }
:root[data-theme="dark"][data-phase="follicular"] { --bg: #1E1A16; --surface: #2B2520; }

/* ---------- Temel ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: background .5s ease, color .3s;
  min-height: 100dvh;
}
h1, h2, h3, .serif { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 28px; margin: 0; line-height: 1.15; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; font-family: Nunito, sans-serif; font-weight: 800; }
p { margin: 0 0 10px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

.wrap { max-width: 520px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
.wrap.no-tabs { padding-bottom: 32px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); transition: background .5s; }
.card + .card { margin-top: 14px; }
.card.soft { background: var(--surface-2); box-shadow: none; }

/* ---------- Butonlar ---------- */
.btn { appearance: none; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 800; cursor: pointer; background: var(--surface-2); color: var(--text); display: inline-flex; gap: 8px; align-items: center; justify-content: center; transition: transform .1s, filter .2s, background .3s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.period { background: var(--period); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: var(--period); border: 1.5px solid var(--period-soft); }
.btn.block { width: 100%; }
.btn.big { padding: 18px 20px; font-size: 18px; border-radius: 20px; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Form ---------- */
label.field { display: block; }
label.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 90px; resize: vertical; }
.error { color: var(--period); font-weight: 700; font-size: 14px; min-height: 20px; }
.stepper { display: flex; align-items: center; gap: 14px; justify-content: center; }
.stepper button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 800; cursor: pointer; }
.stepper output { font-family: Fraunces, serif; font-size: 40px; min-width: 70px; text-align: center; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 30px; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting b { display: block; }
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow); }

/* ---------- Splash / giriş ---------- */
.splash { min-height: 100dvh; display: grid; place-items: center; position: relative; }
.drop { width: 44px; height: 44px; background: var(--period); border-radius: 0 50% 50% 50%; transform: rotate(45deg); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: rotate(45deg) scale(.85); opacity: .7; } }
.hero { text-align: center; padding: 28px 8px 18px; }
.hero .logo { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; box-shadow: var(--shadow); }
.hero h1 { font-size: 34px; }
.hero p { color: var(--muted); max-width: 340px; margin: 8px auto 0; }
.promises { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.promises div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; font-size: 13px; font-weight: 700; }

/* ---------- Bugün ---------- */
.greet { display: flex; justify-content: space-between; align-items: flex-start; margin: 4px 2px 16px; }
.greet .date { color: var(--muted); font-weight: 700; font-size: 14px; }
.ring-card { text-align: center; padding: 22px 18px 20px; }
.ring { position: relative; width: 236px; height: 236px; margin: 0 auto 6px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .in { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 30px; }
.ring .big { font-family: Fraunces, serif; font-size: 54px; line-height: 1; font-weight: 600; }
.ring .lbl { font-weight: 800; margin-top: 4px; }
.ring .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 700; }
.chip.conf-yüksek { background: var(--fertile-soft); }
.actions { display: grid; gap: 10px; margin-top: 16px; }
.phase { display: flex; gap: 14px; align-items: flex-start; }
.phase .emo { font-size: 30px; line-height: 1; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats div { background: var(--surface-2); border-radius: 16px; padding: 12px 6px; }
.stats b { display: block; font-family: Fraunces, serif; font-size: 26px; font-weight: 600; }
.stats span { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- Takvim ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { margin: 0; text-transform: capitalize; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; font-weight: 800; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.day { position: relative; aspect-ratio: 1; border: 0; background: transparent; border-radius: 50%; font-weight: 700; cursor: pointer; display: grid; place-items: center; font-size: 15px; padding: 0; }
.day.out { opacity: .3; }
.day.period { background: var(--period); color: #fff; }
.day.pred { background: var(--period-soft); outline: 2px dashed var(--pred); outline-offset: -3px; }
.day.fertile { background: var(--fertile-soft); }
.day.ovu { background: var(--fertile-soft); outline: 2px solid var(--ovu); outline-offset: -3px; }
.day.today { box-shadow: 0 0 0 2px var(--text); }
.day.has-log::after { content: ""; position: absolute; bottom: 12%; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day.period.has-log::after { background: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 5px; }
.history li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history { list-style: none; padding: 0; margin: 0; }
.history li:last-child { border: 0; }

/* ---------- Alt sayfa (sheet) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(30, 20, 15, .38); z-index: 40; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; animation: up .25s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px; font-weight: 700; font-size: 14px; cursor: pointer; transition: .15s; }
.opt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.mood { display: flex; flex-direction: column; align-items: center; border-radius: 16px; padding: 8px 6px; min-width: 70px; font-size: 12px; }
.opt.mood span { font-size: 24px; }
.section { margin-top: 18px; }

/* ---------- Notlar ---------- */
.tl-month { font-family: Fraunces, serif; font-size: 18px; margin: 20px 4px 8px; text-transform: capitalize; }
.tl-item { display: flex; gap: 12px; cursor: pointer; }
.tl-date { flex: none; width: 50px; text-align: center; background: var(--surface-2); border-radius: 14px; padding: 6px 0; }
.tl-date b { display: block; font-family: Fraunces, serif; font-size: 22px; line-height: 1.1; }
.tl-date span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.tag.red { background: var(--period-soft); }
mark { background: var(--accent-soft); color: inherit; border-radius: 4px; }

/* ---------- Sekmeler ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); pointer-events: none; }
.tabs nav { pointer-events: auto; display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 24px; padding: 6px; width: 100%; max-width: 440px; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 18px; padding: 8px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; font-weight: 800; color: var(--muted); }
.tabs button .ic { font-size: 20px; line-height: 1.2; filter: grayscale(.6); }
.tabs button.on { background: var(--accent-soft); color: var(--text); }
.tabs button.on .ic { filter: none; }

/* ---------- Bildirim balonu ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: max(14px, env(safe-area-inset-top)); z-index: 60; display: flex; justify-content: center; padding: 0 14px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 440px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 40px rgba(40, 25, 15, .22); padding: 14px 16px; display: flex; gap: 12px; animation: drop .35s cubic-bezier(.2, 1.4, .4, 1); }
.toast .ti { width: 38px; height: 38px; border-radius: 11px; flex: none; }
.toast.err { border-color: var(--period); }
@keyframes drop { from { transform: translateY(-120%); opacity: 0; } }
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 70; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- PIN ---------- */
.pin { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px; }
.dots { display: flex; gap: 14px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.dots i.on { background: var(--accent); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keys button { height: 72px; border-radius: 50%; border: 0; background: var(--surface); font-size: 26px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }
.keys button.blank { visibility: hidden; }

.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.steps i { width: 28px; height: 5px; border-radius: 5px; background: var(--line); }
.steps i.on { background: var(--accent); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { .wrap { padding-top: 28px; } }
