:root {
  --bg: #14081a;
  --bg-2: #2a0f33;
  --fg: #fbf2ff;
  --muted: #cdb6d9;
  --accent: #ff4fa3;
  --accent-2: #ffd166;
  --witch: #b388ff;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.14);
  --paper: #fffaf0;
  --ink: #2b1a2f;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg) 65%) fixed;
  color: var(--fg);
  font-family: Roboto, Arial, sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}
.hidden { display: none !important; }

.view {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  text-align: center;
}
#landing, #login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.1;
  margin: 0 0 12px;
  font-weight: 500;
  color: var(--fg);
}
h2 { margin: 0 0 16px; font-size: 1.3rem; font-weight: 500; }
.subtitle { color: var(--muted); margin: 0 0 32px; font-size: 1.1rem; }

/* --- doors --- */
.doors { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 360px; }
.door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.door:hover, .door:focus-visible { transform: translateY(-4px); border-color: var(--witch); }
.door.special { border-color: rgba(255, 79, 163, 0.5); box-shadow: 0 10px 40px rgba(255, 79, 163, 0.2); }
.door.special:hover { border-color: var(--accent); }
.door-title { font-size: 1.25rem; font-weight: 500; }
.witchy { font-family: "Grenze Gotisch", serif; font-weight: 500; letter-spacing: 0.02em; }
.door.corner {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
}
.door.corner:hover, .door.corner:focus-visible { transform: none; }
/* The Witch: no box, just the sigil + name */
.door.special,
.door.special:hover,
.door.special:focus-visible {
  background: none;
  border: 0;
  box-shadow: none;
  transform: none;
  padding: 8px;
  gap: 18px;
  --bone: #e9e2cf;
  --glow: #a67cff;
}
.door.special:focus-visible { outline: 1px solid var(--bone); outline-offset: 6px; border-radius: 8px; }
.sigil { width: 150px; height: 150px; overflow: visible; transition: filter 0.4s; }
.sigil * { fill: none; stroke: var(--bone); vector-effect: non-scaling-stroke; }
.sigil-dash { stroke-width: 1; stroke-dasharray: 1 7; stroke-linecap: round; opacity: 0.7; }
.sigil-mark { fill: var(--bone); stroke: none; }
.sigil-ring { stroke-width: 1.2; opacity: 0.9; }
.sigil-ring.thin { stroke-width: 0.6; opacity: 0.45; }
.sigil-tri { stroke-width: 1.4; stroke-linejoin: round; transition: fill 0.4s; }
.sigil-spin { transform-origin: 60px 60px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.door.special:hover .sigil { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 2px var(--glow)); }
.door.special:hover .sigil-tri { fill: rgba(233, 226, 207, 0.12); }
.door.special:hover .sigil-spin { animation-duration: 12s; }
@media (prefers-reduced-motion: reduce) { .sigil-spin { animation: none; } }
.door.special .door-title { color: var(--bone);  font-family: "Grenze Gotisch", serif; font-size: 2.2rem; line-height: 1; letter-spacing: 0.02em; }

/* --- cards & forms --- */
.card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(6px);
  text-align: left;
}
#compose { max-width: 560px; margin-bottom: 40px; }
label { display: block; margin-bottom: 14px; }
label > span { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* no iOS zoom */
  color: var(--fg);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { resize: vertical; margin-bottom: 12px; }
input:focus, textarea:focus { outline: 2px solid var(--witch); outline-offset: 1px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  cursor: pointer;
}
.btn.primary { background: linear-gradient(90deg, var(--accent), #ff7a59); border: 0; color: #fff; }
.btn.primary:disabled { opacity: 0.6; cursor: wait; }
.btn.link { background: none; border: 0; color: var(--muted); padding: 8px; font-weight: 500; }
#login-form { position: relative; }
#login-form .btn { width: 100%; margin-top: 6px; }
#login-form h2 { text-align: center; }
/* The Witch: Başla is a small sigil play button, no text */
#login-form.witch #login-submit {
  display: block;
  width: 64px;
  height: 64px;
  margin: 10px auto 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #e9e2cf;
  transition: filter 0.3s;
}
#login-form.witch #login-submit svg { width: 100%; height: 100%; overflow: visible; }
#login-form.witch #login-submit svg * { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
#login-form.witch #login-submit svg .thin { stroke-width: 0.6; opacity: 0.45; }
#login-form.witch #login-submit:hover,
#login-form.witch #login-submit:focus-visible {
  outline: none;
  filter: drop-shadow(0 0 8px rgba(166, 124, 255, 0.8));
}
#login-form.witch #login-submit:hover svg path { fill: rgba(233, 226, 207, 0.15); }
#login-back { position: absolute; top: 14px; left: 14px; }
.icon-btn {
  flex: none;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--fg); border-color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.error { color: #ff8a8a; margin: 0 0 10px; }

.compose-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compose-row .primary { margin-left: auto; }
#photo-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 56px; height: 56px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.thumb-x {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; padding: 0;
  border-radius: 50%; border: 0;
  background: #000; color: #fff; font-size: 15px; line-height: 22px;
  cursor: pointer;
}

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; color: var(--muted); }

/* --- video --- */
.video-box { max-width: 900px; margin: 0 auto 48px; border-radius: 16px; overflow: hidden; background: #000; }
#video { width: 100%; display: block; max-height: 80vh; }
#video-missing { padding: 48px 16px; color: var(--muted); margin: 0; }

/* --- wall --- */
.wall-title { margin-top: 8px; }
#ozel-wall { animation: rise 0.8s ease-out; }
#replay { margin-bottom: 24px; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.wall { columns: 3 260px; column-gap: 20px; text-align: left; }
.post {
  break-inside: avoid;
  margin: 0 0 20px;
  padding: 12px 12px 10px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: rotate(var(--tilt, 0deg));
}
.post-media { position: relative; display: block; width: 100%; padding: 0; margin: 0 0 10px; border: 0; background: none; cursor: zoom-in; }
.post-photo { display: block; width: 100%; border-radius: 3px; }
.post-count {
  position: absolute; right: 8px; bottom: 8px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: 0.85rem; font-weight: 500;
}

/* --- photo carousel --- */
#viewer {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 3, 10, 0.94);
  touch-action: pan-y;
}
/* photo and note side by side (stacked on phones): the note never covers the photo */
#viewer { padding: 72px 76px 48px; }
.viewer-stage {
  margin: 0;
  width: 100%;
  max-width: 1300px;
  height: 100%;
  display: flex; gap: 24px; align-items: center; justify-content: center;
}
.viewer-img {
  display: block; min-width: 0;
  max-width: calc(100% - 380px); max-height: 100%;
  object-fit: contain; border-radius: 6px;
  user-select: none; -webkit-user-drag: none;
}
#viewer.no-note .viewer-img { max-width: 100%; }
.viewer-caption {
  flex: 0 0 340px;
  max-height: 100%; overflow-y: auto;
  padding: 20px 22px;
  border-radius: 10px;
  background: var(--paper); color: var(--ink);
  text-align: left;
}
.viewer-note { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; line-height: 1.55; }
.viewer-note.hidden + .viewer-author { display: block; }
.viewer-author { font-size: 0.9rem; color: #7a5c80; }
.viewer-btn {
  position: absolute; z-index: 1;
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.45); color: #fff; cursor: pointer;
}
.viewer-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.viewer-btn:hover, .viewer-btn:focus-visible { background: rgba(255, 255, 255, 0.15); }
.viewer-close { top: 16px; right: 16px; }
.viewer-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 16px; top: 50%; transform: translateY(-50%); }
.viewer-dots { position: absolute; top: 32px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.viewer-dots button { pointer-events: auto; }
.viewer-dots button { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.35); cursor: pointer; }
.viewer-dots button.on { background: #fff; }
#viewer.single .viewer-prev, #viewer.single .viewer-next, #viewer.single .viewer-dots { display: none; }
@media (max-width: 800px) {
  #viewer { padding: 72px 0 0; align-items: stretch; }
  .viewer-stage { flex-direction: column; gap: 0; justify-content: flex-start; }
  .viewer-img { max-width: 100%; max-height: 55vh; border-radius: 0; flex: none; }
  .viewer-caption { flex: 1 1 auto; width: 100%; border-radius: 14px 14px 0 0; margin-top: 12px; }
}
.post-note { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.02rem; line-height: 1.45; }
.post footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: #7a5c80; }
.post .btn.link { color: #b0407a; padding: 2px 4px; }
.empty { color: var(--muted); text-align: center; column-span: all; }

/* --- icon-only buttons --- */
.icon-btn { transition: color 0.2s, border-color 0.2s, background 0.2s; }
.icon-btn.big { width: 46px; height: 46px; }
.icon-btn.big svg { width: 22px; height: 22px; }
.icon-btn.small { width: 30px; height: 30px; border-color: transparent; color: #9a7aa0; }
.icon-btn.small svg { width: 16px; height: 16px; }
.icon-btn.small:hover { color: #b0407a; border-color: transparent; background: rgba(176, 64, 122, 0.1); }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn.send { margin-left: auto; color: #fff; border: 0; background: linear-gradient(135deg, var(--accent), #ff7a59); }
.icon-btn.send:hover { color: #fff; filter: brightness(1.08); }
.icon-btn.send:disabled { opacity: 0.6; cursor: wait; }
.icon-btn.busy svg { animation: pulse-icon 0.9s ease-in-out infinite; }
@keyframes pulse-icon { 50% { opacity: 0.3; transform: translate(2px, -2px); } }
label.icon-btn { margin: 0; cursor: pointer; }
#replay { margin: 0 auto 24px; }
.top .icon-btn { margin-left: auto; }
#login-form:not(.witch) #login-submit {
  display: grid; place-items: center;
  width: 52px; height: 52px; margin: 10px auto 0; padding: 0;
  border-radius: 50%;
}
#login-form:not(.witch) #login-submit svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- carousel controls: at the screen edges, faint until hovered --- */
.viewer-prev, .viewer-next {
  top: 50%; transform: translateY(-50%);
  width: 48px; height: 96px;
  border: 0; border-radius: 10px;
  background: none;
  opacity: 0.3;
  transition: opacity 0.2s, background 0.2s;
}
.viewer-prev { left: 0; }
.viewer-next { right: 0; left: auto; }
.viewer-prev:hover, .viewer-next:hover,
.viewer-prev:focus-visible, .viewer-next:focus-visible { opacity: 0.9; background: rgba(255, 255, 255, 0.06); }
.viewer-prev svg, .viewer-next svg { width: 26px; height: 26px; stroke-width: 1.5; }
.viewer-dots { gap: 6px; opacity: 0.5; }
.viewer-dots button { width: 5px; height: 5px; background: rgba(255, 255, 255, 0.35); }
.viewer-dots button.on { background: rgba(255, 255, 255, 0.85); }
#viewer { padding-left: 56px; padding-right: 56px; }
@media (max-width: 800px) { #viewer { padding-left: 0; padding-right: 0; } .viewer-prev, .viewer-next { height: 72px; } }
.viewer-video { background: #000; }

/* --- video badges + upload progress --- */
.post-media.is-video::after, .thumb.is-video::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  transform: translate(-35%, -50%);
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.thumb.is-video::after { border-width: 8px 0 8px 12px; }
.thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
video.post-photo { aspect-ratio: auto; background: #000; }
#upload-progress { height: 4px; margin-top: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#upload-progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.warn { color: var(--accent-2); margin: 10px 0 0; font-size: 0.9rem; }

/* --- notes wall: even grid, dark witchy cards, long notes clipped until opened --- */
.wall {
  columns: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  align-items: start;
}
.post {
  --bone: #e9e2cf;
  position: relative;
  margin: 0;
  padding: 14px 14px 10px;
  transform: none;
  background: #251530;
  color: #efe6f2;
  border: 1px solid rgba(233, 226, 207, 0.16);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.post:hover, .post:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: rgba(233, 226, 207, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45), 0 0 18px rgba(166, 124, 255, 0.18);
}
/* small crescent moon in the corner */
.post::before {
  content: "";
  position: absolute; top: 12px; right: 14px;
  width: 11px; height: 11px;
  border-radius: 50%;
  box-shadow: -3px 2px 0 0 var(--bone);
  opacity: 0.55;
  pointer-events: none;
}
.post-media { margin: 0 0 12px; cursor: pointer; }
.post-photo, video.post-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.post-note {
  margin: 0 18px 10px 0;
  color: #efe6f2;
  font-size: 1rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  overflow: hidden;
}
.post-media + .post-note { -webkit-line-clamp: 3; line-clamp: 3; }
.post footer {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(233, 226, 207, 0.12);
  color: rgba(233, 226, 207, 0.75);
}
.post-author { font-family: "Grenze Gotisch", serif; font-size: 1.05rem; letter-spacing: 0.02em; }
.post .icon-btn.small { color: rgba(233, 226, 207, 0.5); }
.post .icon-btn.small:hover { color: #ff8ab8; background: rgba(255, 138, 184, 0.1); }
.empty { grid-column: 1 / -1; }

/* viewer note panel matches the cards */
.viewer-caption { background: #251530; color: #efe6f2; border: 1px solid rgba(233, 226, 207, 0.16); }
.viewer-author { color: rgba(233, 226, 207, 0.75); font-family: "Grenze Gotisch", serif; font-size: 1.1rem; }
#viewer.text-only .viewer-img, #viewer.text-only .viewer-prev,
#viewer.text-only .viewer-next, #viewer.text-only .viewer-dots { display: none !important; }
#viewer.text-only .viewer-caption { flex: 0 1 640px; }

/* sister's own note: every saved photo/video with its own delete button */
.my-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}
.my-media-item { position: relative; aspect-ratio: 1; cursor: zoom-in; }
.my-media-item img, .my-media-item video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  border-radius: 8px; background: #000;
}
.my-media-item.is-video::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  transform: translate(-35%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.my-media-item .thumb-x { z-index: 1; border: 1px solid rgba(233, 226, 207, 0.4); }
.my-media-item .thumb-x:hover { background: #b0407a; }

/* sister's own photo/video cards: photo + small counter + remove button */
.post.media-card .post-media { margin-bottom: 8px; }
.post.media-card .post-author { font-family: inherit; font-size: 0.85rem; letter-spacing: 0; }
.post.media-card::before { display: none; }

/* "İyi Ki Doğdun!" above the notes on her page */
.birthday-title {
  font-family: "Pacifico", cursive;
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 1.25;
  margin: 8px 0 4px;
  color: #ffd166;
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.35), 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* Sisterlar: barely there until hovered/focused */
.door.corner {
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  background: none;
  border-color: transparent;
  box-shadow: none;
  opacity: 0.35;
  transition: opacity 0.3s, border-color 0.3s;
}
.door.corner:hover, .door.corner:focus-visible { opacity: 0.9; border-color: var(--line); }
