:root { --r: 18px; --shadow: 0 4px 16px rgba(0,0,0,.06); }
body[data-theme="kurbaga"] { --bg:#f2f8ec; --card:#ffffff; --ink:#24402a; --muted:#6f8a72; --acc:#5fae5a; --acc2:#c9e7b8; --soft:#e6f3dc; }
body[data-theme="kurt"]    { --bg:#eef0f5; --card:#ffffff; --ink:#28303f; --muted:#7a8396; --acc:#5d6d8f; --acc2:#cfd6e6; --soft:#e3e7f0; }
body[data-theme="esek"]    { --bg:#faf4ec; --card:#fffdf9; --ink:#4a3424; --muted:#9a8270; --acc:#a87b52; --acc2:#ecd8c0; --soft:#f3e7d8; }
body[data-theme="hamsi"]   { --bg:#ebf5fb; --card:#ffffff; --ink:#173a52; --muted:#6a8ba1; --acc:#2f86c0; --acc2:#c4e1f2; --soft:#dceef8; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, sans-serif; color: var(--ink); background: var(--bg);
  transition: background .4s, color .4s; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .brand, .big-count { font-family: 'Baloo 2', 'Nunito', sans-serif; }
h2 { margin: 0; font-size: 1.4rem; }
h3 { margin: 0 0 .6rem; font-size: 1.1rem; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }

#app { max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.6rem; font-weight: 700; }
.mascot-mini svg { width: 38px; height: 38px; display: block; }
.theme-pick { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: 99px; box-shadow: var(--shadow); }
.theme-pick button svg { width: 26px; height: 26px; display: block; margin: auto; }
.theme-pick button {
  border: 0; background: transparent; font-size: 1.15rem; width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; transition: transform .2s, background .2s;
}
.theme-pick button.on { background: var(--acc2); transform: scale(1.08); }

.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }

.hero { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, var(--card), var(--soft)); }
.hero-mascot svg { width: 120px; height: 120px; display: block; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
.names { font-weight: 700; color: var(--muted); }
.big-count { font-size: 3rem; line-height: 1; color: var(--acc); font-weight: 700; margin: 4px 0; }
.big-count small { display: block; font-size: 1rem; color: var(--ink); font-weight: 500; }
.sub { margin-top: 6px; }

.next { display: flex; align-items: center; gap: 14px; }
.next .emoji { font-size: 2.2rem; }
.next .left { margin-left: auto; text-align: right; }
.next .left b { font-size: 1.7rem; color: var(--acc); font-family: 'Baloo 2', system-ui, sans-serif; display: block; line-height: 1; }

.row-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 14px; }

.btn {
  border: 0; background: var(--acc); color: #fff; font: 700 .95rem 'Nunito', system-ui, sans-serif; padding: 10px 16px;
  border-radius: 12px; cursor: pointer; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.danger { color: #c4463a; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 3px; background: var(--acc2); border-radius: 3px; }
.day { position: relative; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.day::before { content: ''; position: absolute; left: -19px; top: 22px; width: 11px; height: 11px; border-radius: 50%; background: var(--acc); border: 3px solid var(--bg); }
.day .emoji { font-size: 1.6rem; }
.day .meta { font-size: .85rem; color: var(--muted); }
.day .note { margin-top: 6px; white-space: pre-wrap; }
.day .soon { margin-left: auto; text-align: right; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.day .soon b { display: block; color: var(--acc); font-size: 1.15rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.chip { border: 0; background: var(--card); color: var(--ink); padding: 8px 14px; border-radius: 99px; font: 600 .9rem 'Nunito', system-ui, sans-serif; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); }
.chip.on { background: var(--acc); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid.small { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.ph { aspect-ratio: 1; border-radius: 12px; background: var(--soft) center/cover no-repeat; cursor: pointer; transition: transform .2s; }
.ph:hover { transform: scale(1.02); }
.ph.loading { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55 } }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.note-form { display: flex; flex-direction: column; gap: 10px; }
.note-form .btn { align-self: flex-end; }
.note { position: relative; }
.note .txt { white-space: pre-wrap; font-size: 1.05rem; }
.note .by { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.note .x { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; flex: 1; }
.form small { font-weight: 400; color: var(--muted); }
.two { display: flex; gap: 10px; }
input, select, textarea {
  font: 1rem 'Nunito', system-ui, sans-serif; color: var(--ink); background: var(--bg); border: 2px solid transparent;
  border-radius: 12px; padding: 10px 12px; outline: none; width: 100%; transition: border .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc2); }
textarea { resize: vertical; }

dialog { border: 0; border-radius: var(--r); padding: 20px; width: min(460px, 92vw); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dlg-actions { display: flex; gap: 6px; align-items: center; }

.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: min(560px, calc(100% - 24px));
  display: flex; background: var(--card); border-radius: 20px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 6px; z-index: 5;
}
.tabs button { flex: 1; border: 0; background: none; font: 600 .7rem 'Nunito', system-ui, sans-serif; color: var(--muted); padding: 6px 0; border-radius: 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 1.2rem; }
.tabs button.on { background: var(--soft); color: var(--ink); }

.page { display: none; animation: fade .3s; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px) } }

.lightbox { position: fixed; inset: 0; background: rgba(10,15,20,.92); display: none; align-items: center; justify-content: center; z-index: 20; }
.lightbox.on { display: flex; }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 10px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 2rem; width: 46px; height: 64px; border-radius: 12px; cursor: pointer; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-cap { position: absolute; bottom: 18px; color: #ddd; font-size: .85rem; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .3s; z-index: 30; font-weight: 600; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Uygulama telefona göre: kart hep alt alta (masaüstü modunda da) */
.hero { flex-direction: column; text-align: center; }
@media (max-width: 480px) { .two { flex-direction: column; } }
html.narrow .two { flex-direction: column; }

/* ─── Giriş ekranı ─────────────────────────────────────────────── */
.login { min-height: 100vh; min-height: 100dvh; min-height: var(--app-h, 100dvh); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.login.on { display: flex; }
.login .hero-mascot svg { width: 7.5rem; height: 7.5rem; }
.login h1 { margin: 0; font-size: 2.2rem; }
.login p { margin: 0; max-width: 320px; }
.login-form { width: min(340px, 100%); text-align: left; margin: 0; }
.login .err { color: #c4463a; font-weight: 600; min-height: 1.2em; }
#app.hidden { display: none; }

/* ─── Telefon / APK: çentik ve alt çubuk payı ──────────────────── */
#app { padding-top: env(safe-area-inset-top); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tabs { bottom: calc(12px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.top .right { display: flex; align-items: center; gap: 8px; }

/* Fotoğraf yükleme */
.up-btns { display: flex; gap: 6px; }
.up-btns .btn { padding: 9px 12px; font-size: .88rem; }
.up-bar { display: none; position: relative; height: 26px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 10px; }
.up-bar.on { display: block; }
.up-bar > div { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--acc2); transition: width .3s; }
.up-bar span { position: relative; display: block; text-align: center; font-size: .8rem; line-height: 26px; font-weight: 700; }

/* ─── Gerçek mobil uygulama hissi ─────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-size: clamp(15px, 4.2vw, 18px);           /* her telefonda okunur boyut */
  touch-action: pan-x pan-y;                      /* kaydırma serbest, yakınlaştırma yok */
}
body {
  overflow-x: clip; min-height: var(--app-h, 100dvh);          /* yana kayma yok, dikey kaydırma serbest */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea, select, .note .txt, .day .note { -webkit-user-select: text; user-select: text; }
input, select, textarea { font-size: 16px; }    /* iOS'ta odaklanınca otomatik yakınlaşmasın */
img { -webkit-user-drag: none; }
button { -webkit-tap-highlight-color: transparent; }

#app { max-width: 640px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.top {
  position: sticky; top: 0; z-index: 4; background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top)) 0 10px; margin-top: calc(-1 * env(safe-area-inset-top));
}
.brand { font-size: 1.7rem; }
.mascot-mini svg { width: 2.4rem; height: 2.4rem; }
.theme-pick button { width: 2.5rem; height: 2.5rem; }
.theme-pick button svg { width: 1.8rem; height: 1.8rem; }
.hello { font-family: 'Baloo 2', 'Nunito', sans-serif; font-weight: 700; font-size: 1.25rem; margin: 2px 4px 10px; }
.card { padding: 1.1rem; }
.btn { font-size: 1rem; padding: .75rem 1.1rem; min-height: 44px; }
.chip { font-size: .95rem; padding: .55rem 1rem; }
.tabs { width: min(560px, calc(100% - 20px)); border-radius: 22px; }
.tabs button { font-size: .72rem; padding: 8px 0; min-height: 52px; }
.tabs button span { font-size: 1.35rem; }
.hero-mascot svg { width: 6rem; height: 6rem; }
.hello-m svg { width: 1.5em; height: 1.5em; vertical-align: -0.35em; }
.welcome.wait .hero-mascot svg { animation: bob 1.2s ease-in-out infinite; }
.big-count { font-size: 3.2rem; }
.big-count small { font-size: 1.05rem; }
.next .emoji { font-size: 2.4rem; }
dialog { max-height: 86dvh; overflow: auto; }
.lightbox { touch-action: pan-x; }

/* Hoş geldin ekranı */
.welcome {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  opacity: 0; pointer-events: none; transition: opacity .35s;
}
.welcome.on { opacity: 1; pointer-events: auto; }
.welcome .hero-mascot svg { width: 8.5rem; height: 8.5rem; }
.welcome .w-txt { font-family: 'Baloo 2', 'Nunito', sans-serif; font-weight: 700; font-size: 2rem; color: var(--ink); animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0 } }
.next > div:nth-child(2) { flex: 1; min-width: 0; }
.next .left { white-space: nowrap; flex-shrink: 0; }
.brand { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-pick { flex-shrink: 0; gap: 2px; }
html.narrow .brand { font-size: 1.35rem; gap: 6px; }
html.narrow .mascot-mini svg { width: 2rem; height: 2rem; }
html.narrow .theme-pick button { width: 2.15rem; height: 2.15rem; }
html.narrow .theme-pick button svg { width: 1.55rem; height: 1.55rem; }
@media (max-width: 360px) {
  .brand { font-size: 1.35rem; gap: 6px; }
  .mascot-mini svg { width: 2rem; height: 2rem; }
  .theme-pick button { width: 2.15rem; height: 2.15rem; }
  .theme-pick button svg { width: 1.55rem; height: 1.55rem; }
  .big-count { font-size: 2.8rem; }
}
/* Başlık + butonlar dar ekranda çakışmasın, hata kutusu ekranı kaplamasın */
.row-head { flex-wrap: wrap; gap: 10px; }
.up-btns .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.toast { max-width: calc(100% - 32px); width: max-content; text-align: center; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }