/* OurAlbume: sıcak defter + polaroid. Sade, biraz el yapımı. */
:root {
  --paper: #f6eee2;
  --paper-dot: #eadcc7;
  --card: #fffaf2;
  --ink: #3d302b;
  --muted: #8f7d72;
  --line: #ead9c4;
  --rule: #e9dccb;          /* defter çizgisi */
  --margin: #f0b8aa;        /* defter kenar çizgisi */
  --accent: #d0644b;
  --accent-soft: #f7dcd2;
  --ok: #6c9a6e;
  --ok-soft: #dcebd8;
  --gold: #e8a93a;
  --tape: rgba(240, 214, 160, .75);
  --radius: 18px;
  --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--paper-dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom));
}
.view { display: flex; flex-direction: column; gap: 18px; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

h1, h2, h3 { font-weight: 700; margin: 0; line-height: 1.2; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--muted); }
p { margin: 0; }
a { color: var(--accent); }
.hand { font-family: var(--hand); font-weight: 700; font-size: 1.45rem; color: var(--accent); }
h3.hand { font-size: 1.5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.hide { visibility: hidden; }
.loading { padding: 64px 0; text-align: center; color: var(--muted); font-family: var(--hand); font-size: 1.4rem; }
.empty { text-align: center; padding: 28px 0 8px; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 0 rgba(61, 48, 43, .04), 0 8px 20px -14px rgba(61, 48, 43, .25);
}
.card.error, .msg.error { color: #a8321d; }
.note { background: var(--accent-soft); border-radius: 14px; padding: 10px 14px; font-size: .9rem; }

/* Defter sayfası: çizgili + kırmızı kenar çizgisi */
.lined {
  background:
    linear-gradient(90deg, transparent 30px, var(--margin) 30px, var(--margin) 31.5px, transparent 31.5px),
    repeating-linear-gradient(var(--card) 0 31px, var(--rule) 31px 32px);
  padding-left: 44px;
  line-height: 32px;
}
.lined .fields { line-height: 1.5; }

/* ---------- Formlar ---------- */
label, .label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.narrow { width: 80px; }
.code { text-transform: uppercase; letter-spacing: .2em; font-family: ui-monospace, monospace; }
.code.big { font-size: 2rem; font-weight: 700; color: var(--accent); }
.msg:empty { display: none; }
.msg { font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 0 #b44f38; }
.btn.danger { color: #a8321d; }
.btn.small { padding: 6px 12px; font-size: .85rem; font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 4px; }

.seg { display: flex; background: var(--line); border-radius: 999px; padding: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); }

/* ---------- Polaroid ---------- */
.polaroid {
  position: relative;
  display: flex; flex-direction: column;
  background: #fff;
  padding: 8px 8px 0;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 18px -10px rgba(61, 48, 43, .45);
  text-decoration: none; color: var(--ink);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform .15s;
}
.polaroid:nth-child(2n) { --tilt: 1.8deg; }
.polaroid:nth-child(3n) { --tilt: -.6deg; }
.polaroid:active { transform: rotate(0) scale(.98); }
.polaroid img, .polaroid .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f1e7da; }
.polaroid .ph { display: grid; place-items: center; font-size: 2.6rem; }
.polaroid .cap {
  font-family: var(--hand); font-size: 1.3rem; font-weight: 500; line-height: 1.1;
  padding: 8px 4px 12px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.polaroid .badge {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 1px 8px; font-size: .8rem; font-weight: 700;
}
.polaroid.taped::before {
  content: ''; position: absolute; top: -10px; left: 50%; width: 70px; height: 22px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.polaroid.taped { padding-bottom: 8px; }
.polaroid.mini {
  width: 64px; height: 76px; padding: 6px 6px 16px;
  display: grid; place-items: center; font-size: 1.8rem;
}
.polaroids { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 16px; padding: 6px 4px; }

/* ---------- Kapak (giriş/eşleşme) ---------- */
.cover { text-align: center; padding: 18px 0 4px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.cover-stack { display: flex; justify-content: center; margin-bottom: 14px; }
.cover-stack .polaroid { margin: 0 -6px; }
.cover-stack .polaroid:nth-child(1) { --tilt: -10deg; }
.cover-stack .polaroid:nth-child(2) { --tilt: 3deg; z-index: 1; transform: rotate(3deg) translateY(-8px); }
.cover-stack .polaroid:nth-child(3) { --tilt: 12deg; }
.brand { font-family: var(--hand); font-size: 3rem; color: var(--accent); font-weight: 700; }

/* ---------- Başlıklar ---------- */
.yearbar, .monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.yearbar .title { text-align: center; }
.yearbar h1 { font-family: var(--hand); font-size: 2.2rem; color: var(--accent); font-weight: 700; }
.nav {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--card); border: 1.5px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 1.4rem;
}
.monthbar .nav { width: 34px; height: 34px; background: none; border: 0; }
.monthbar h2 { text-transform: capitalize; }
.pagebar { display: flex; flex-direction: column; gap: 2px; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; }

/* ---------- Takvim: masa takvimi gibi spiralli ---------- */
.cal { padding: 22px 12px 12px; position: relative; margin-top: 8px; }
.cal::before {
  content: ''; position: absolute; top: -9px; left: 24px; right: 24px; height: 18px;
  background: radial-gradient(circle at 50% 50%, var(--paper) 4px, #b9a796 4.5px, #b9a796 5.5px, transparent 6px) 0 0 / 28px 18px space no-repeat;
}
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.wd { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.day {
  aspect-ratio: 1 / 1.12;
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  padding-top: 5px;
  text-decoration: none; color: var(--ink);
  font-size: .85rem; font-weight: 600;
  overflow: hidden;
}
.day.blank { visibility: hidden; }
.day.out { color: #d3c6b8; font-weight: 400; }
.day.has { background: var(--accent-soft); }
.day.today .n { background: var(--accent); color: #fff; border-radius: 50%; width: 1.8em; height: 1.8em; display: grid; place-items: center; }
.day.anniv { box-shadow: inset 0 0 0 2px var(--accent); }
.day.anniv::after { content: '♡'; font-size: .7rem; color: var(--accent); }
.day .marks { font-size: .78rem; line-height: 1; letter-spacing: -2px; }

/* Geçen yıl bugün */
.otd { display: flex; flex-direction: column; gap: 6px; }
.otd-row { display: flex; gap: 16px; overflow-x: auto; padding: 10px 6px 14px; scroll-snap-type: x mandatory; }
.otd-row .polaroid { flex: 0 0 140px; scroll-snap-align: start; }

/* ---------- Listeler ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px dashed var(--line); }
.list li:first-child { border-top: 0; }
.list li > a { display: flex; align-items: center; gap: 10px; flex: 1; color: inherit; text-decoration: none; margin: -12px -14px; padding: 12px 14px; }
.emoji { font-size: 1.3rem; width: 1.6em; text-align: center; }

.typegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.type { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: inherit; text-decoration: none; font-weight: 700; }
.type .emoji { font-size: 2.2rem; width: auto; }
.type:nth-child(odd) { transform: rotate(-.6deg); }
.type:nth-child(even) { transform: rotate(.6deg); }

/* ---------- Anı sayfası ---------- */
.page-memory .pagebar h1 { font-family: var(--hand); font-size: 2.1rem; color: var(--accent); }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 16px; padding: 14px 4px 4px; }
.gallery .polaroid:first-child:nth-last-child(odd) { grid-column: 1 / -1; width: 82%; justify-self: center; }
.fields { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.fields dt { color: var(--muted); font-size: .9rem; font-weight: 600; }
.fields dd { margin: 0; }
.rating { border: 0; padding: 0; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rating legend { font-size: .9rem; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 4px; }
.stars { display: inline-flex; flex-direction: row-reverse; }
.stars label { cursor: pointer; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars span { font-size: 1.9rem; color: var(--line); padding: 0 2px; }
.stars label:has(input:checked) span,
.stars label:has(input:checked) ~ label span { color: var(--gold); }
.stars-view { color: var(--gold); letter-spacing: 1px; }
.loc { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.loc label { width: 100%; }

/* Fotoğraf seçimi (düzenleme) */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; background: #fff; padding: 4px 4px 10px; border-radius: 3px; box-shadow: 0 3px 8px -4px rgba(0, 0, 0, .3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
  position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: var(--ink); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer;
}

/* ---------- Hedefler: çizgili defter listesi ---------- */
.page-goals .yearbar h1 { font-size: 2rem; }
.progress { height: 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; background: repeating-linear-gradient(45deg, var(--ok) 0 8px, #7dab7f 8px 16px); border-radius: 99px; }
.goals {
  background:
    linear-gradient(90deg, transparent 40px, var(--margin) 40px, var(--margin) 41.5px, transparent 41.5px),
    var(--card);
}
.goals li { border-top: 1px solid var(--rule); padding-left: 10px; }
.goals .tick {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid #c9b8a6;
  display: grid; place-items: center; color: var(--ok); flex: none;
  font-family: var(--hand); font-size: 1.5rem; font-weight: 700; margin-right: 8px;
}
.goals li.done .tick { border-color: var(--ok); background: var(--ok-soft); }
.goals li.done .grow { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.prog { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: .85rem; }
.chip.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }

/* ---------- Özet: kitap sayfası ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1.5px dashed var(--line); border-radius: 50%;
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stat:nth-child(1) { transform: rotate(-4deg); background: var(--accent-soft); }
.stat:nth-child(2) { transform: rotate(3deg); }
.stat:nth-child(3) { transform: rotate(-2deg); background: var(--ok-soft); }
.stat b { font-family: var(--hand); font-size: 2.4rem; line-height: 1; color: var(--accent); }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.prose p { font-size: 1.02rem; line-height: 1.7; }
.prose p:first-child::first-letter {
  font-family: var(--hand); font-size: 3.2rem; float: left; line-height: .8; margin: 6px 6px 0 0; color: var(--accent);
}

/* ---------- Ayarlar ---------- */
.invite { border-style: dashed; border-width: 2px; }

/* ---------- Alt menü ve + butonu ---------- */
#tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
  display: flex; justify-content: center;
  background: rgba(255, 250, 242, .96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 24px -14px rgba(61, 48, 43, .5);
  padding: 4px;
}
#tabbar[hidden] { display: none; }
#tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 6px 0; font-size: .7rem; font-weight: 600; color: var(--muted); text-decoration: none;
  border-radius: 999px;
}
#tabbar a span { font-size: 1.25rem; filter: grayscale(1); opacity: .55; }
#tabbar a.on { color: var(--accent); background: var(--accent-soft); }
#tabbar a.on span { filter: none; opacity: 1; }
.fab {
  position: fixed; right: max(18px, calc(50% - 262px)); bottom: calc(86px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: #fff; text-decoration: none;
  display: grid; place-items: center; font-size: 2rem; line-height: 1;
  box-shadow: 0 4px 0 #b44f38, 0 10px 20px -8px rgba(208, 100, 75, .6);
}

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem;
  max-width: calc(100% - 32px); z-index: 10;
}

/* ---------- Aktivite seçici ---------- */
.searchbar { position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 2; }
.searchbar input {
  border-radius: 999px; padding: 12px 18px 12px 42px; border-width: 2px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238f7d72' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") 16px center no-repeat;
  box-shadow: 0 6px 16px -10px rgba(61, 48, 43, .4);
}
.catjump { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.catjump .chip { white-space: nowrap; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--ink); }
.typecat { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 70px; }
.typecat[hidden], .type[hidden], .catjump[hidden] { display: none; }
.typecat .typegrid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.typecat .type {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 4px; font-size: .78rem; font-weight: 600; line-height: 1.2; transform: none;
}
.typecat .type .emoji { font-size: 1.7rem; }
.typecat .type:active { background: var(--accent-soft); }

/* ---------- Tur 3: sekmeler, dilekler, fotoğraf duvarı, aktivite yönetimi ---------- */
.seg a { flex: 1; text-align: center; padding: 8px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--card); color: var(--ink); }
.hand.big { font-size: 2.1rem; }

.wishes li { flex-wrap: nowrap; }
.wishes.done .grow { color: var(--muted); }
.wishes.done li { background: var(--ok-soft); }

.wall-month { display: flex; flex-direction: column; gap: 8px; }
.wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 10px; padding: 6px 2px 10px; }
.wall .polaroid { padding: 5px 5px 0; }
.wall .polaroid .cap { font-size: 1rem; padding: 4px 2px 6px; }
.wall .polaroid:nth-child(4n+1) { --tilt: -2.5deg; }
.wall .polaroid:nth-child(4n+2) { --tilt: 1.5deg; }
.wall .polaroid:nth-child(4n+3) { --tilt: -0.5deg; }
.wall .polaroid:nth-child(4n) { --tilt: 2.5deg; }

.navcard { color: inherit; text-decoration: none; }
.types li.off { opacity: .5; }
.types li > a { margin-right: 0; }
.fieldrow { border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.fieldrow[hidden], [data-options][hidden] { display: none; }
.narrow-emoji { width: 76px; flex: none; }
.narrow-emoji input { text-align: center; font-size: 1.4rem; padding: 6px; }
#tabbar a { font-size: .66rem; }
.wishes li .btn, .wishes li .link { flex: none; }

/* ---------- Tur 4: harita, hatırlatmalar ---------- */
a.note { display: block; color: var(--ink); text-decoration: none; }
.note.install { background: #e4ecf7; }
.note .link { float: right; }
.mapbox { height: 62vh; min-height: 360px; padding: 0; overflow: hidden; z-index: 0; }
.center-chips { justify-content: center; }
.chips .chip { font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink); }
.chips .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pin { background: none; border: 0; }
.pin span {
  display: grid; place-items: center; width: 38px; height: 38px;
  background: #fff; border: 2px solid var(--accent); border-radius: 50% 50% 50% 6px; transform: rotate(-45deg);
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .4);
}
.pin span i { font-style: normal; font-size: 19px; transform: rotate(45deg); }
.mapbox .leaflet-tile-pane { filter: saturate(.65) sepia(.18) brightness(1.03); }
.leaflet-popup-content { font-family: var(--sans); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
