:root {
  --bg: #fbf9f6;
  --surface: #ffffff;
  --border: #e7e1d6;
  --text: #211d19;
  --text-muted: #6c6255;
  --brand: #e8590c;
  --brand-dark: #b8430a;
  --brand-light: #fef1e4;
  --accent: #d97706;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(33, 29, 25, 0.07), 0 8px 24px rgba(33, 29, 25, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  position: relative; /* mobilde açılan menünün (nav.nav-open) konumlanma noktası */
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-text > span { color: var(--accent); }
.logo-img {
  height: 34px;
  width: auto;
  display: block;
}
.site-footer .logo-img {
  height: 22px;
}
nav.main-nav {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
nav.main-nav a, nav.main-nav button.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 2px;
  white-space: nowrap;
}
nav.main-nav a:hover, nav.main-nav button.link-btn:hover { color: var(--brand); }
.nav-icon { width: 16px; height: 16px; object-fit: contain; display: block; flex-shrink: 0; }

.nav-search { display: flex; order: 1; }
.nav-search input {
  width: 190px;
  max-width: 40vw;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}
.nav-search input:focus { outline: none; border-color: var(--brand); background: #fff; }
@media (max-width: 720px) {
  .nav-search { order: 10; flex-basis: 100%; }
  .nav-search input { width: 100%; max-width: none; }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--brand);
}
.btn.secondary:hover { background: var(--brand-light); }
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: #f3caca;
}
.btn.danger:hover { background: #fbe9e7; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.danger-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--text-muted);
}
.danger-link:hover { color: var(--danger); text-decoration: underline; }
.btn-icon { width: 18px; height: 18px; object-fit: contain; display: block; flex-shrink: 0; }
.btn-icon-invert { filter: brightness(0) invert(1); }
.tab-icon { width: 15px; height: 15px; object-fit: contain; display: block; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg,
      rgba(184, 67, 10, 0.94) 0%,
      rgba(216, 82, 12, 0.94) 30%,
      rgba(232, 89, 12, 0.92) 42%,
      rgba(232, 89, 12, 0.55) 60%,
      rgba(232, 89, 12, 0.18) 75%,
      rgba(232, 89, 12, 0) 86%
    ),
    url('assets/hero-bg.jpg');
  background-size: cover;
  /* 82% 55% -> yeni görseldeki tilki sağ alt köşede, bu konum onu geniş
     (masaüstü) ve dar (mobil) oranlarda da kadrajın içinde tutuyor —
     "center 30%" burada tilkiyi neredeyse tamamen kırpıyordu. */
  background-position: 82% 55%;
  color: #fff;
  border-radius: 24px;
  padding: 56px 40px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 70%);
}
.hero::before { width: 380px; height: 380px; top: -160px; right: -100px; }
.hero::after { width: 260px; height: 260px; bottom: -140px; right: 220px; }
.hero-inner { position: relative; z-index: 1; max-width: 640px; }
.hero h1 { margin: 0 0 14px; font-size: 36px; line-height: 1.15; letter-spacing: -0.01em; }
.hero p { margin: 0 0 26px; opacity: 0.88; font-size: 16px; max-width: 540px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn.on-hero {
  background: #fff; color: var(--brand-dark); font-size: 15px; padding: 12px 22px;
}
.hero-actions .btn.on-hero:hover { background: var(--brand-light); }
.hero-actions .btn.ghost.on-hero {
  color: #fff; border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.06);
}
.hero-actions .btn.ghost.on-hero:hover { background: rgba(255,255,255,0.16); }
.hero-stats { position: relative; z-index: 1; display: flex; gap: 28px; margin-top: 32px; flex-wrap: wrap; }
.hero-stats div { font-size: 22px; font-weight: 800; }
.hero-stats span { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; margin-top: 2px; }

.category-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.category-chips a {
  font-size: 13px; font-weight: 700; padding: 7px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.category-chips a:hover, .category-chips a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.section-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.sort-tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.sort-tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  font-weight: 700; color: var(--text-muted); cursor: pointer;
}
.sort-tabs button.active { background: var(--brand); color: #fff; }
.sort-tabs button.active .tab-icon-mono { filter: brightness(0) invert(1); }

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--text);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.story-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.story-card .cover-placeholder {
  height: 120px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.story-card h3 { margin: 0; font-size: 16px; }
.story-card p { margin: 0; font-size: 13px; color: var(--text-muted); flex-grow: 1; }
.story-card .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
}
/* Bir etiketi kaç yayınlanmış hikayenin kullandığı — .tag kutucuğunun
   içinde, hafif ayrışan küçük bir sayı olarak (bkz. tagChipsHtml, story.html). */
.tag-count {
  background: rgba(0, 0, 0, 0.12); color: inherit; border-radius: 999px;
  padding: 1px 6px; font-size: 10px; font-weight: 700;
}

/* ---------------------------------------------------------------------- */
/* Twitter tarzı kutucuklu etiket girişi (bkz. createTagInput, write.html) */
.tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: text;
}
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-input .tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-light); color: var(--brand-dark);
  border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; font-weight: 700;
}
.tag-chip-remove {
  background: none; border: none; cursor: pointer; color: inherit;
  font-size: 14px; line-height: 1; padding: 2px 4px; opacity: 0.7;
}
.tag-chip-remove:hover { opacity: 1; }
.tag-input-text {
  flex: 1; min-width: 120px; border: none; outline: none; padding: 4px 2px;
  font-size: 14px; font-family: inherit; background: transparent; color: var(--text);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 700; color: var(--text); }
.form-field input, .form-field textarea, .form-field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.form-field textarea { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-field { flex: 1; }

.terms-check {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px;
  font-size: 12.5px; color: var(--text-muted); line-height: 1.4; cursor: pointer;
}
.terms-check input { margin-top: 2px; flex-shrink: 0; }
.terms-check a { color: var(--brand); font-weight: 700; }

.msg { font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.msg.error { background: #fbe9e7; color: var(--danger); }
.msg.success { background: #e7f3e7; color: var(--success); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(43,38,32,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 26px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.modal-tabs button {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text-muted);
}
.modal-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.modal-close { float: right; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }

/* Story detail */
.story-header { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; }
.story-header .cover-placeholder { width: 160px; height: 220px; border-radius: 10px; flex-shrink: 0; font-size: 14px; }
.story-header .info { flex: 1; min-width: 240px; }
.story-header h1 { margin: 0 0 8px; font-size: 24px; }
.story-header .author { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.story-header .synopsis { font-size: 14px; color: var(--text); margin-bottom: 14px; }

.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px;
}
.chapter-row:hover { border-color: var(--brand); }
.chapter-row .num { color: var(--text-muted); font-size: 12px; }
.chapter-comment-count {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--danger); flex-shrink: 0;
}

/* Yorum ikonu — kullanıcının tasarladığı görsel, önceki 💬 emojisinin
   yerine her yorum sayacının/butonunun yanında kullanılıyor. Boyutu hep
   yanındaki yazıya göre (em cinsinden) ayarlanıyor ki farklı yerlerde
   (satır butonu, bölüm başlığı, akış, hikaye satırı) hep orantılı kalsın. */
.icon-comment {
  width: 1.05em;
  height: auto;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* Görüntülenme, kütüphane, bölüm sayısı, kaydet ve beğeni ikonları —
   kullanıcının tasarladığı görseller, önceki 👁️/📚/📖/🔖/❤️/🤍 emojilerinin
   yerine kullanılıyor. .icon-comment ile aynı mantık: boyut hep yanındaki
   yazıya göre (em cinsinden) ayarlanıyor ki farklı yerlerde orantılı kalsın. */
.icon-view,
.icon-library,
.icon-chapter,
.icon-bookmark,
.icon-heart {
  width: 1.05em;
  height: auto;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* Ana sayfadaki "Klasikler" başlığındaki kitap ikonu — önceki 📖 emojisinin
   yerine, kullanıcının tasarladığı görsel. Aynı em-oranlı mantık, başlık
   metniyle (h2) orantılı kalsın diye biraz daha büyük (1.2em). */
.icon-classics {
  width: 1.2em;
  height: auto;
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

/* Yönetici/moderatör işlem butonlarındaki kalkan ikonu — buton içinde
   metinle aynı satırda, metne göre biraz daha büyük (0.05em fazla) durması
   göz hizasını daha iyi tutuyor. */
.icon-shield-btn {
  width: 1.15em;
  height: auto;
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
  margin-right: 2px;
}

/* Rozet (profile-badge) ikonları — Yazar/Moderatör/Yönetici rozetlerindeki
   emoji yerine, rozetin küçük yazı boyutuna (12px) göre orantılı. */
.badge-icon-img {
  width: 1em;
  height: auto;
  display: inline-block;
  vertical-align: -0.14em;
  flex-shrink: 0;
}

/* Avatar */
.avatar-wrap {
  position: relative; display: inline-block; border-radius: 50%; overflow: hidden;
  background: var(--brand-light); flex-shrink: 0; vertical-align: middle;
}
.avatar-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--brand-dark);
}
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Reader — Wattpad'e yakın, ferah bir okuma deneyimi. ÖNEMLİ: kart/kutucuk
   görünümü (arka plan, kenarlık, gölge) BİLEREK yok — metin sayfanın
   kendisinin üzerinde akıyor, Wattpad'de olduğu gibi. max-width sadece
   satırlar çok uzayıp okunması zorlaşmasın diye (geniş ekranlarda), görsel
   bir "kutu" hissi vermeden. */
.reader-content {
  font-size: 14px; line-height: 2;
  font-family: Georgia, 'Times New Roman', serif;
  padding: 4px 0 40px;
  margin-bottom: 32px;
  max-width: 760px;
  margin-left: auto; margin-right: auto;
}
@media (max-width: 640px) {
  .reader-content { padding: 0 0 28px; font-size: 13.5px; }
}

/* Satır (paragraf) bazlı yorumlama + söz kaydetme — Wattpad'deki gibi,
   💬 + 🔖 ikonları paragrafın SAĞ kenarında bir yerde asılı durmuyor
   (bu, metni dar bir sütuna sıkıştırıp ekstra sağ boşluk gerektiriyordu).
   Bunun yerine ikonlar paragrafın HEMEN ALTINA, o paragrafla bir sonraki
   arasındaki boşluğun sonuna (sağa yaslanmış) yerleştiriliyor — normal akış
   içinde, ayrı bir yan sütun gerektirmeden. Böylece paragraf metni artık
   .reader-content'in TÜM genişliğini kullanabiliyor (dar/uzun görünmüyor)
   ve ekran genişliğine göre ayrı bir mobil/masaüstü ayrımına da gerek
   kalmıyor — tek bir düzen her ekranda aynı şekilde çalışıyor. */
.reader-line { position: relative; }
.reader-para { margin: 0.6em 0 0; white-space: pre-wrap; }
.reader-line-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin: 4px 0 12px;
}
/* Yorum rozeti — Wattpad'deki gibi, sayının içinde yazdığı küçük, koyu bir
   konuşma balonu (bir köşesi sivri, "kuyruk" hissi veren pratik bir CSS
   numarası — gerçek bir üçgen kuyruk eklemeden). Artık ayrı bir ikon +
   sayı değil: balonun kendisi zaten ikon, sayı doğrudan içinde. */
.line-comment-toggle {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  min-width: 25px; height: 22px; padding: 0 6px;
  background: var(--brand); border: none; border-radius: 8px 8px 8px 3px;
  font-size: 11.5px; line-height: 1;
  cursor: pointer; opacity: 0.65; transition: opacity 0.15s ease, transform 0.1s ease;
}
.line-comment-toggle:hover { transform: scale(1.08); }
/* Balonun şekli ikon yerine geçtiği için PNG ikonu burada gizleniyor —
   aynı ikon akış/başlık gibi diğer tüm yorum sayaçlarında kullanılmaya
   devam ediyor, sadece bu küçük rozette yer yok. */
.line-comment-toggle .icon-comment { display: none; }
.line-comment-count { color: #fff; font-weight: 800; font-size: 11.5px; }
.line-bookmark-btn {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 25px; height: 22px; background: var(--brand-light); border: 1px solid var(--border); border-radius: 8px 8px 8px 3px;
  font-size: 12px; line-height: 1;
  cursor: pointer; opacity: 0.65; transition: opacity 0.15s ease, border-color 0.15s ease;
}
.reader-line:hover .line-comment-toggle, .reader-line:hover .line-bookmark-btn,
.line-comment-toggle:hover, .line-bookmark-btn:hover, .line-comment-toggle.is-open { opacity: 1; }
.line-comment-toggle.is-open { outline: 2px solid var(--brand-dark); outline-offset: 1px; }
.line-bookmark-btn:hover, .line-bookmark-btn.is-saved { border-color: var(--brand); }
.line-bookmark-btn.is-saved { opacity: 1; background: var(--brand); }
.line-bookmark-btn:disabled { cursor: default; }

.line-comment-form { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-start; }
.line-comment-form textarea {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; resize: vertical; min-height: 40px; background: #fff;
}
.line-comment-list { display: flex; flex-direction: column; gap: 12px; }

/* Satır yorumları — Wattpad'deki gibi TEK, PAYLAŞILAN bir pencere: hangi
   satıra tıklanırsa tıklansın aynı pencere açılıyor, üstte o cümlenin
   tamamı, altında o satırın yorumları. Mobilde alttan açılan tam genişlik
   bir sayfa, masaüstünde ortalanmış bir kart (bkz. aşağıdaki min-width sorgusu). */
.line-comment-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.line-comment-modal[hidden] { display: none; }
.line-comment-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 10, 0.5); }
.line-comment-modal-panel {
  position: relative; z-index: 1; width: 100%; max-width: 480px;
  max-height: 82vh; overflow-y: auto; background: #fff;
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.22);
}
.line-comment-modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.line-comment-modal-header span { font-weight: 700; font-size: 14px; }
.line-comment-modal-close {
  border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--text-muted); padding: 2px 6px;
}
.line-comment-modal-close:hover { color: var(--text); }
.line-comment-modal-quote {
  margin: 14px 18px; padding: 14px 16px; background: var(--brand-light);
  border-radius: 10px; font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px; line-height: 1.6; color: var(--text);
}
.line-comment-modal-body { padding: 0 18px 20px; }
@media (min-width: 641px) {
  .line-comment-modal { align-items: center; }
  .line-comment-modal-panel { border-radius: 16px; max-height: 78vh; }
}

/* Bölüm sonu: Wattpad'de olduğu gibi "sonraki bölüme devam et" ve paylaş —
   okuma deneyimi metnin bittiği yerde bitmiyor, devam etme imkanı hemen
   altında duruyor. */
.chapter-end-actions {
  max-width: 720px; margin: 8px auto 28px; display: flex; flex-direction: column; gap: 10px;
}
.chapter-end-actions .btn { width: 100%; text-align: center; }
.chapter-share-btn {
  width: 100%; padding: 10px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s ease;
}
.chapter-share-btn:hover { border-color: var(--brand); }
.chapter-action-row { display: flex; gap: 10px; }
.chapter-vote-btn, .chapter-library-btn {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chapter-vote-btn:hover, .chapter-library-btn:hover { border-color: var(--brand); }
.chapter-vote-btn.is-active, .chapter-library-btn.is-active {
  background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark);
}
.chapter-vote-btn:disabled, .chapter-library-btn:disabled { opacity: 0.6; cursor: default; }

.comments-section { max-width: 720px; margin: 0 auto; }
.comments-section .section-title { font-size: 20px; }

.comment-composer {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.comment-composer form { flex: 1; }
.comment-composer textarea { min-height: 70px; }

.comment {
  display: flex; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 12px;
}
.comment .comment-main { flex: 1; min-width: 0; }
.comment .comment-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.comment .comment-meta strong { color: var(--text); font-weight: 700; }
.comment .comment-body { font-size: 15px; line-height: 1.6; margin-bottom: 8px; }
.comment .reply { margin-left: 0; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

.like-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 2px 0;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
}
.like-btn:hover { color: var(--danger); }
.like-btn.liked { color: var(--danger); }

.top-bar-actions { display: flex; gap: 10px; align-items: center; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge.draft { background: var(--brand-light); color: var(--brand-dark); }
.badge.published { background: #e7f3e7; color: var(--success); }
.badge.pending { background: #fdf0d8; color: #8a5a1a; }
.badge.action { background: #fbe9e7; color: var(--danger); }
.badge.dismissed { background: #eee; color: var(--text-muted); }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.admin-table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; }

.footer-note { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 40px; }

/* ---------------------------------------------------------------------- */
/* Geniş hikaye kartı — anasayfa, katalog ve öneriler bölümünde kullanılır */
/* Sol: dikey uzun kapak · Sağ: siyah başlık şeridi, istatistikler, taglar, özet */
/* ---------------------------------------------------------------------- */
.story-list-wide { display: flex; flex-direction: column; gap: 16px; }

/* Sayfalama */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 28px 0 8px; flex-wrap: wrap; }
.pagination button {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer;
}
.pagination button:hover:not(:disabled):not(.active) { border-color: var(--brand); color: var(--brand); }
.pagination button.active { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .pagination-dots { padding: 0 4px; color: var(--text-muted); }
.story-card-wide {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.story-card-wide:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(43,38,32,0.1), 0 14px 28px rgba(43,38,32,0.1); }
.story-cover {
  display: block;
  flex-shrink: 0;
  width: 130px;
  align-self: stretch;
  background: linear-gradient(160deg, var(--brand-light), var(--accent));
}
.story-body > a { display: block; color: inherit; text-decoration: none; }
.story-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-cover-fallback {
  width: 100%; height: 100%; min-height: 190px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: #fff; opacity: 0.85;
}
.story-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.story-title-bar { background: var(--text); padding: 14px 18px; }
.story-title-bar h3 { margin: 0; font-size: 17px; color: #fff; line-height: 1.3; }
.story-stats {
  display: flex; gap: 16px; padding: 10px 18px 0; font-size: 12.5px; font-weight: 700; color: var(--text-muted);
}
.story-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 0; }
.tag.category-tag { background: var(--brand); color: #fff; }
.tag.subcategory-tag { background: var(--brand-light); color: var(--brand-dark); border: 1px solid var(--brand); font-weight: 700; }
.story-synopsis { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; padding: 10px 18px 0; margin: 0; flex: 1; }
.story-meta-row {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted);
  padding: 12px 18px 16px; border-top: 1px solid var(--border); margin-top: 12px;
}
@media (max-width: 560px) {
  .story-cover { width: 96px; }
  .story-cover-fallback { min-height: 140px; font-size: 28px; }
  .story-title-bar h3 { font-size: 15px; }
  .story-stats, .story-tags, .story-synopsis, .story-meta-row { padding-left: 14px; padding-right: 14px; }
}

/* Katalog sayfası */
.catalog-search { display: flex; gap: 10px; margin-bottom: 20px; }
.catalog-search input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
.catalog-layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.catalog-categories { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
#categories-el, .catalog-subcategories { display: flex; flex-direction: column; gap: 4px; }
.catalog-categories button {
  text-align: left; background: none; border: none; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.catalog-categories button:hover { background: var(--brand-light); color: var(--brand-dark); }
.catalog-categories button.active { background: var(--brand); color: #fff; }
/* Alt tür pilleri, ana kategori butonlarından biraz daha küçük/soluk — ikinci
   bir katman olduğu görsel olarak da hissedilsin diye (Wattpad'deki Tür +
   Alt Tür hiyerarşisinin aynısı). */
.catalog-subcategories button { font-size: 13px; font-weight: 500; padding: 7px 12px 7px 20px; }
.catalog-subcategories:not(:empty) { border-top: 1px solid var(--border); padding-top: 12px; }
@media (max-width: 780px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-categories { flex-direction: column; position: static; }
  #categories-el, .catalog-subcategories { flex-direction: row; flex-wrap: wrap; }
  .catalog-subcategories:not(:empty) { border-top: none; padding-top: 0; }
  .catalog-subcategories button { padding: 7px 12px; }
}

/* Bölüm editörü — okuma sayfasıyla aynı dil: dar ve uzun bir "kağıt" alanı,
   geniş bir metin kutusu yerine (bkz. write.html "Yeni Bölüm" formu). */
.editor-page {
  max-width: 720px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 40px 48px; box-shadow: var(--shadow);
}
.editor-page textarea[name="content"] {
  min-height: 520px; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; line-height: 1.8;
  padding: 16px 18px;
}
@media (max-width: 640px) {
  .editor-page { padding: 24px 20px; }
}

/* Öneriler (bunları da sevebilirsiniz) — kompakt dikey kartlar */
.recommended-section { max-width: 720px; margin: 40px auto 0; }
.recommended-section .section-title { font-size: 18px; }

/* Amatörce görünmesin diye anasayfadaki basit "nasıl çalışır" şeridi */
.how-it-works { display: flex; gap: 16px; flex-wrap: wrap; margin: 28px 0 36px; }
.how-it-works .step {
  flex: 1; min-width: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow);
}
.how-it-works .step .icon { font-size: 22px; margin-bottom: 8px; }
.how-it-works .step .icon img { width: 40px; height: 40px; display: block; }
.how-it-works .step h4 { margin: 0 0 4px; font-size: 14px; }
.how-it-works .step p { margin: 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.site-footer {
  max-width: 1080px; margin: 56px auto 0; padding: 24px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: 12.5px; color: var(--text-muted);
}
.footer-legal { flex-basis: 100%; text-align: center; opacity: 0.7; font-size: 11.5px; }

/* Herkese açık profil sayfası */
.profile-header { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 28px; flex-wrap: wrap; }
.profile-header .info { flex: 1; min-width: 220px; }
.profile-header h1 { margin: 0 0 2px; font-size: 22px; }
.profile-header .username { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.profile-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800;
  padding: 4px 11px; border-radius: 999px;
}
.profile-badge.amateur { background: #eef3ea; color: var(--success); }
.profile-badge.author { background: var(--brand-light); color: var(--brand-dark); }
.profile-badge.master { background: #fdeecb; color: #8a5a1a; }
.profile-badge.moderator { background: #e3ecf7; color: #2b4f7a; }
.profile-badge.admin { background: #fdf0d8; color: #8a5a1a; }
.profile-bio { font-size: 14px; color: var(--text); line-height: 1.6; margin-bottom: 12px; max-width: 560px; }
.profile-stats { display: flex; gap: 20px; font-size: 13px; color: var(--text-muted); }
.profile-stats strong { color: var(--text); font-weight: 800; }

/* Türlerin Birincisi (leaderboard) */
.leaderboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.leaderboard-card { display: flex; flex-direction: column; }
.leader-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border);
}
.leaderboard-card .leader-row:first-of-type { border-top: none; }
.leader-rank { font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.leader-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.leader-title { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.leader-row.rank-1 .leader-title { color: var(--accent); }
.leader-story { display: block; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-likes { font-size: 13px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }

/* Kullanıcı arama sonuç kartı */
.person-card { display: flex; gap: 14px; align-items: flex-start; color: inherit; transition: border-color 0.15s ease; }
.person-card:hover { border-color: var(--brand); }
.person-card .profile-badges { min-height: 0; }

/* Profil — hazır avatar galerisi */
.avatar-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.avatar-gallery button {
  padding: 3px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; line-height: 0;
}
.avatar-gallery button.selected { border-color: var(--brand); }
.avatar-gallery img { width: 48px; height: 48px; border-radius: 50%; display: block; background: var(--brand-light); }

/* Header — profil avatarına tıklayınca açılan aşağı-doğru menü */
.nav-profile-menu { position: relative; }
.nav-profile-trigger {
  display: flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text-muted); padding: 6px 2px; font-family: inherit;
}
.nav-profile-trigger:hover { color: var(--brand); }
.nav-profile-caret { font-size: 10px; }
.nav-profile-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  min-width: 180px; padding: 6px; display: flex; flex-direction: column; z-index: 30;
}
.nav-profile-dropdown[hidden] { display: none; }
.nav-profile-dropdown a, .nav-profile-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 7px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text); font-family: inherit;
}
.nav-profile-dropdown a:hover, .nav-profile-dropdown button:hover { background: var(--brand-light); color: var(--brand-dark); }
.nav-profile-dropdown button.danger-link { color: var(--danger); font-size: 13.5px; padding: 9px 10px; }
.nav-profile-dropdown button.danger-link:hover { background: #fbe9e7; text-decoration: none; }

/* Bildirim rozeti (okunmamış mesaj sayısı) — hem menüde hem sohbet balonunda kullanılır */
.dm-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
}

/* Sağ altta yüzen DM sohbet widget'ı */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none; font-size: 22px; cursor: pointer;
  box-shadow: var(--shadow); z-index: 40; display: flex; align-items: center; justify-content: center;
}
.chat-fab:hover { background: var(--brand-dark); }
.chat-fab .dm-badge { position: absolute; top: -2px; right: -2px; }

.chat-widget {
  position: fixed; right: 22px; bottom: 88px; width: 320px; height: 440px; max-height: calc(100vh - 120px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  z-index: 40; display: flex; flex-direction: column; overflow: hidden;
}
.chat-widget[hidden] { display: none; }
.chat-widget-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--brand-light); flex-shrink: 0;
}
.chat-widget-header strong { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-widget-header button { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-muted); padding: 2px 4px; }
.chat-widget-header button:hover { color: var(--brand); }
.chat-widget-header button[hidden] { display: none; }
#chat-widget-avatar { flex-shrink: 0; display: flex; }
#chat-widget-avatar[hidden] { display: none; }
.chat-header-link { cursor: pointer; }
.chat-header-link:hover { text-decoration: underline; opacity: 0.85; }
.chat-widget-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

.chat-conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-conv-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: none; border-bottom: 1px solid var(--border);
  background: none; cursor: pointer; text-align: left; width: 100%; font-family: inherit;
}
.chat-conv-row:hover { background: var(--brand-light); }
.chat-conv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-conv-info strong { font-size: 13.5px; }
.chat-conv-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mesaj istekleri geçişi — kasıtlı olarak sessiz/göze batmayan bir tasarım:
   ana gelen kutusunun kırmızı rozetinden farklı, küçük gri bir sayaç. */
.chat-requests-toggle {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border: none; border-top: 1px solid var(--border); background: none;
  cursor: pointer; font-family: inherit; font-size: 12.5px; color: var(--text-muted); width: 100%;
}
.chat-requests-toggle:hover { background: var(--brand-light); color: var(--text); }
.chat-request-count {
  background: var(--border); color: var(--text); border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}

.chat-thread-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-bubble-row.me { justify-content: flex-end; }
.chat-bubble-row .avatar-wrap { flex-shrink: 0; }
.chat-bubble {
  max-width: 80%; padding: 8px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.4;
  background: var(--brand-light); color: var(--text); word-break: break-word;
}
.chat-bubble-row.me .chat-bubble { background: var(--brand); color: #fff; }
.chat-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-composer input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-family: inherit;
}
.upload-avatar-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* Kaydettiğim Sözler sayfası */
.saved-quote-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-bottom: 14px;
}
.saved-quote-text {
  margin: 0 0 10px; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; line-height: 1.5;
  font-style: italic; color: var(--text); border-left: 3px solid var(--brand); padding-left: 14px;
}
.saved-quote-meta { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.saved-quote-meta a { color: var(--brand); font-weight: 700; }
.saved-quote-actions { display: flex; gap: 10px; align-items: center; }

/* Akış (genel, herkese açık, Twitter benzeri) */
.feed-composer { display: flex; gap: 12px; align-items: flex-start; }
.feed-composer textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 14px; resize: vertical; min-height: 60px;
}
.feed-post-card { margin-bottom: 14px; }
/* Bir gönderinin içindeki hikaye alıntısı — normal metinden ayırt edilsin diye
   farklı arka plan + sol kenarlıkla "kutucuk" gibi görünür. */
.feed-quote-box {
  margin-top: 10px; padding: 12px 14px; background: var(--brand-light); border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 14.5px;
}
.saved-quote-pick {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); cursor: pointer; font-family: Georgia, 'Times New Roman', serif;
  font-style: italic; font-size: 13.5px; line-height: 1.4;
}
.saved-quote-pick:hover { border-color: var(--brand); background: var(--brand-light); }

/* ============================================================================
   MOBİL NAVİGASYON (hamburger menü) — dosyanın SONUNDA olması bilerek:
   .nav-profile-dropdown gibi yukarıda tanımlı, aynı özgüllükteki (specificity)
   masaüstü kurallarını ezmesi (CSS'te eşit özgüllükte kaynak sırası kazanır)
   için buraya, en sona eklendi.
   ============================================================================ */

/* Hamburger (☰) düğmesi — sadece dar ekranlarda görünür. */
.nav-hamburger-btn {
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-hamburger-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger-btn.active span:nth-child(2) { opacity: 0; }
.nav-hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dar ekranlarda menü tamamen gizlenir, hamburger düğmesiyle aşağı açılan
   tek sütunluk bir panele dönüşür — böylece tüm bağlantılar üst üste
   dizilip ana içeriği aşağı itmez (bkz. mobil ekran görüntüsü şikayeti). */
@media (max-width: 720px) {
  .nav-hamburger-btn { display: flex; }

  nav.main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: var(--shadow);
    padding: 6px 16px 14px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 20;
  }
  nav.main-nav.nav-open { display: flex; }

  nav.main-nav a, nav.main-nav button.link-btn {
    width: 100%;
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }
  .nav-search { order: 0 !important; flex-basis: auto !important; width: 100%; margin: 10px 0; }
  .nav-search input { width: 100%; max-width: none; }

  .nav-profile-menu { width: 100%; order: 20; }
  .nav-profile-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-profile-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0 0 0 14px;
    min-width: 0;
  }

  .btn.small#open-auth-btn { width: 100%; justify-content: center; margin-top: 6px; }
}
