/* ============ İşaretler (altı çizili yerler) ============ */
:root {
  --hl-sari: rgba(255, 207, 64, .5);
  --hl-yesil: rgba(130, 200, 90, .45);
  --hl-mavi: rgba(90, 170, 245, .4);
  --hl-pembe: rgba(245, 115, 170, .4);
}
.c-sari { --hl: var(--hl-sari); --hl-solid: #f2c037; }
.c-yesil { --hl: var(--hl-yesil); --hl-solid: #7cbf52; }
.c-mavi { --hl: var(--hl-mavi); --hl-solid: #4f9fe8; }
.c-pembe { --hl: var(--hl-pembe); --hl-solid: #ec6fa5; }

mark.hl { background: var(--hl); color: inherit; border-radius: 2px; padding: .05em 0; cursor: pointer; transition: background .2s, box-shadow .2s; }
mark.hl.has-note { text-decoration: underline dotted color-mix(in srgb, var(--hl-solid) 90%, black); text-decoration-thickness: 2px; text-underline-offset: 3px; }
mark.hl.active { box-shadow: 0 0 0 2px var(--hl-solid); }
mark.hl-temp { background: rgba(70, 135, 255, .32); color: inherit; border-radius: 2px; }
mark.hl-flash { background: rgba(255, 190, 60, .65); color: inherit; border-radius: 2px; animation: hl-flash 2.4s ease-out forwards; }
@keyframes hl-flash { 0%, 30% { background: rgba(255, 190, 60, .75); box-shadow: 0 0 0 4px rgba(255, 190, 60, .35); } 100% { background: transparent; box-shadow: none; } }
mark.hl-tts { background: rgba(232, 169, 94, .35); color: inherit; border-radius: 3px; box-shadow: 0 2px 0 rgba(232, 169, 94, .9); }
.theme-gece mark.hl, .theme-siyah mark.hl { background: color-mix(in srgb, var(--hl) 70%, transparent); }
/* PDF metin katmanı: yazı görünmez, işaret kâğıda "basılır" */
.textLayer mark { color: transparent; mix-blend-mode: multiply; }
.theme-gece .textLayer mark, .theme-siyah .textLayer mark { mix-blend-mode: screen; }
.page { -webkit-touch-callout: none; }
.reader.selecting .stage { cursor: text; }

/* PDF.js metin katmanı (pdf_viewer.css'ten gerekli kısım) */
.textLayer {
  position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; z-index: 1;
  text-align: initial; letter-spacing: normal; word-spacing: normal;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; transform-origin: 0% 0%; cursor: default; -webkit-user-select: none; user-select: none; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) {
  z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.textLayer .markedContent { display: contents; }
.textLayer .endOfContent { display: none; }

/* ---- Seçim menüsü ---- */
.sel-menu, .dict-pop {
  position: fixed; left: 0; top: 0; z-index: 40;
  background: var(--ui-bg); color: var(--ui-ink);
  border: 1px solid var(--ui-line); border-radius: 18px;
  box-shadow: 0 18px 50px -12px rgba(0,0,0,.6);
  opacity: 0; scale: .92; transition: opacity .18s, scale .25s var(--ease-spring);
}
.sel-menu.in, .dict-pop.in { opacity: 1; scale: 1; }
.sel-menu { display: flex; align-items: center; gap: 2px; padding: 6px 8px; }
.sel-colors { display: flex; gap: 6px; padding: 0 4px; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--hl-solid); border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .2s var(--ease-spring); }
.color-dot:hover { transform: scale(1.12); }
.color-dot.active { border-color: var(--bg-2); box-shadow: 0 0 0 2px var(--hl-solid); }
.sel-sep { width: 1px; align-self: stretch; margin: 4px 6px; background: var(--ui-line); }
.sel-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 600; color: var(--ui-ink); }
.sel-btn:hover { background: color-mix(in srgb, var(--ui-ink) 10%, transparent); }
@media (max-width: 480px) { .sel-btn span { display: none; } .sel-btn { padding: 8px; } }

.dict-pop { width: min(360px, calc(100vw - 16px)); max-height: 50vh; overflow: auto; padding: 14px 16px; }
.dict-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dict-head b { font-family: var(--font-display); font-size: 20px; }
.dict-entry + .dict-entry { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ui-line); }
.dict-entry ol { margin: 6px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.dict-ex { font-style: italic; opacity: .7; margin-top: 2px; font-size: 13px; }

/* ---- Not düzenleyici ---- */
.note-editor { display: flex; flex-direction: column; gap: 14px; }
.note-editor blockquote, .note-card blockquote {
  margin: 0; padding: 10px 14px; border-left: 4px solid var(--hl-solid, var(--accent));
  background: color-mix(in srgb, var(--hl, var(--surface)) 40%, transparent);
  border-radius: 0 12px 12px 0; font-family: var(--font-read); font-style: italic; line-height: 1.55;
}
.note-area { min-height: 120px; height: auto; padding: 12px 14px; resize: vertical; font-family: var(--font-hand); font-size: 22px; line-height: 1.3; }
.color-row { display: flex; gap: 10px; }

/* ---- Okuyucu: arama, notlar paneli ---- */
.search-panel .input { margin-bottom: 8px; }
.search-status { margin: 0 4px 6px; }
.search-hit span { font-size: 14px; line-height: 1.45; color: var(--muted); }
.search-hit mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.note-item { border-left: 4px solid var(--hl-solid); border-radius: 0 12px 12px 0; }
.note-item q { font-family: var(--font-read); font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-mini { display: block; font-family: var(--font-hand); font-style: normal; font-size: 18px; color: var(--muted); margin-top: 4px; }
.nav-seg button { font-size: 12.5px; padding: 0 8px; }

.sound-box { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.sound-box .seg { width: 100%; }
.sound-box .seg button { flex: 1; padding: 0 6px; font-size: 12.5px; }
.typo-row.disabled { opacity: .4; pointer-events: none; }
.vol-range { width: 170px; accent-color: var(--accent); }

/* ---- Sesli okuma çubuğu ---- */
.tts-bar {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 96px); z-index: 13;
  display: flex; align-items: center; gap: 4px; padding: 6px 10px;
  background: color-mix(in srgb, var(--ui-bg) 92%, transparent); color: var(--ui-ink);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--ui-line); border-radius: 999px; box-shadow: 0 14px 40px -14px rgba(0,0,0,.6);
  transform: translate(-50%, 20px); opacity: 0; transition: all .35s var(--ease-out);
}
.tts-bar.in { transform: translate(-50%, 0); opacity: 1; }
.reader.ui-hidden .tts-bar { bottom: calc(var(--safe-bottom) + 16px); }
.tts-bar .icon-btn { color: var(--ui-ink); width: 40px; height: 40px; }
.tts-bar .icon-btn.big { width: 48px; height: 48px; background: var(--accent); color: var(--accent-ink); }
.tts-ico { color: var(--accent); padding: 0 4px 0 6px; display: flex; }
.flip-x { display: inline-flex; transform: scaleX(-1); }
.tts-rate { min-width: 46px; height: 34px; border-radius: 99px; font-weight: 700; font-size: 13px; color: var(--ui-ink); border: 1px solid var(--ui-line); }
.tts-voice { max-width: 120px; height: 34px; border-radius: 99px; background: transparent; color: var(--ui-ink); border: 1px solid var(--ui-line); padding: 0 8px; font-size: 12.5px; }
.tts-voice option { background: var(--ui-bg); }
.reader.tts-on .tts-btn { color: var(--accent); }

/* ---- PDF yakınlaştırma ---- */
.zoom-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(8, 6, 4, .94); display: flex; flex-direction: column; opacity: 0; transition: opacity .25s; touch-action: pan-x pan-y pinch-zoom; }
.zoom-overlay.in { opacity: 1; }
.zoom-bar { display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-top) + 8px) 12px 8px; color: #f4eadc; justify-content: center; }
.zoom-bar .icon-btn { color: #f4eadc; font-size: 22px; }
.zoom-label { min-width: 130px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.zoom-sep { width: 1px; height: 24px; background: rgba(255,255,255,.15); margin: 0 8px; }
.zoom-scroll { flex: 1; overflow: auto; display: grid; place-items: start center; padding: 12px; -webkit-overflow-scrolling: touch; }
.zoom-canvas { display: block; height: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6); background: #fff; }
.zoom-overlay.theme-gece .zoom-canvas, .zoom-overlay.theme-siyah .zoom-canvas { filter: invert(1) hue-rotate(180deg) brightness(.85); }

/* ---- Alıntı kartı ---- */
.quote-preview { border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.quote-canvas { width: 100%; height: auto; display: block; }
.quote-styles { display: flex; gap: 10px; justify-content: center; margin: 14px 0 4px; }
.quote-style { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.quote-style.active { border-color: var(--accent); }

/* ============ Giriş sekmeleri ============ */
.auth-tabs { width: 100%; margin-bottom: 16px; }
.auth-tabs button { flex: 1; height: 36px; }

/* ============ Kütüphane ============ */
.catalog-view, .notes-view { max-width: 1320px; margin: 0 auto; padding: calc(var(--safe-top) + 30px) clamp(16px, 4vw, 52px) 40px; }
.source-seg button { height: 34px; }
.catalog-body { transition: opacity .3s; min-height: 300px; }
.catalog-body.refetch { opacity: .45; }
.catalog-note { margin: 4px 0 20px; font-size: 14px; }
.cat-row { margin-bottom: 30px; }
.cat-row h2 { font-size: 22px; margin-bottom: 12px; }
.cat-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(132px, 15vw, 168px); gap: 18px; overflow-x: auto; padding: 6px 4px 14px; margin: 0 -4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.cat-scroll > * { scroll-snap-align: start; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 20px; }
@media (max-width: 520px) { .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 20px 14px; } }
.cat-card { display: flex; flex-direction: column; gap: 10px; text-align: left; animation: book-in .6s var(--ease-out) both; animation-delay: calc(var(--i) * 30ms); }
.cat-cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 3px 8px 8px 3px; background: var(--bg-3); position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,.25), 10px 14px 24px -12px rgba(0,0,0,.7); transition: transform .4s var(--ease-out), box-shadow .4s; }
.cat-card:hover .cat-cover { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 1px 1px rgba(0,0,0,.25), 16px 22px 30px -12px rgba(0,0,0,.75); }
.cat-cover.gen { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14%; text-align: center;
  background: linear-gradient(90deg, rgba(0,0,0,.3), rgba(255,255,255,.07) 4%, transparent 9%), radial-gradient(circle at 30% 20%, rgba(255,255,255,.12), transparent 50%),
    linear-gradient(160deg, hsl(var(--hue) 42% 32%), hsl(var(--hue) 46% 18%)); }
.cat-cover.gen::before { content: ''; position: absolute; inset: 7%; border: 1px solid hsl(var(--hue) 60% 80% / .35); border-radius: 3px; pointer-events: none; }
.gen-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(14px, 1.4vw, 18px); line-height: 1.15; color: hsl(var(--hue) 70% 90%); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cat-cover.gen small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: hsl(var(--hue) 40% 78%); }
.cat-cover.big { width: 130px; flex-shrink: 0; }
.cat-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cat-meta b { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-meta span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-meta .owned-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--good); font-weight: 600; }
.cat-card.owned .cat-cover { outline: 2px solid color-mix(in srgb, var(--good) 60%, transparent); outline-offset: 3px; }
.catalog-more { display: flex; justify-content: center; padding: 24px 0; min-height: 80px; }
.cat-detail .detail-info h2 { font-size: 24px; }
.cat-desc { margin-top: 18px; line-height: 1.6; color: var(--muted); max-height: 40vh; overflow: auto; }
.license { margin-top: 14px; }
.cat-action { margin-top: 14px; }
.add-progress { display: flex; flex-direction: column; gap: 8px; min-width: 200px; font-size: 14px; font-weight: 600; }

/* ============ Notlarım ============ */
.notes-body { display: flex; flex-direction: column; gap: 26px; }
.note-book-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.note-book-head img, .note-book-head .cover-ph { width: 44px; aspect-ratio: 2/3; object-fit: cover; border-radius: 2px 5px 5px 2px; box-shadow: 0 6px 14px -6px rgba(0,0,0,.6); flex-shrink: 0; position: relative; }
.note-book-head > div { flex: 1; min-width: 0; }
.note-book-head h2 { font-size: 20px; }
.note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .note-list { grid-template-columns: 1fr; } }
.note-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i) * 25ms); }
.note-card blockquote { font-size: 16px; }
.note-book-line { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; }
.note-text { font-family: var(--font-hand); font-size: 22px; line-height: 1.25; color: var(--text); }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.note-actions { display: flex; }
.note-actions .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.note-actions .icon-btn:hover { color: var(--text); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--hl-solid); display: inline-block; }
.notes-empty { padding-top: 40px; }
.notes-illus { font-family: var(--font-read); font-style: italic; font-size: 22px; margin-bottom: 10px; color: var(--muted); }
.notes-illus mark { background: linear-gradient(var(--hl-sari), var(--hl-sari)) no-repeat; color: var(--text); padding: 0 4px; border-radius: 2px; animation: draw-hl 1.2s .4s var(--ease-out) both; background-size: 100% 100%; }
@keyframes draw-hl { from { background-size: 0 100%; } }

/* ============ Ana gezinme: 5 sekme ============ */
@media (max-width: 760px) {
  .nav-tab { padding: 10px 13px; }
  .nav-tab span:last-child { display: none; }
  .nav-tab.active span:last-child { display: inline; }
}

/* ============ Dokunmatik ekranlar (tablet/telefon) ============ */
html, body { overscroll-behavior: none; }
.view { min-height: 100dvh; }
@media (pointer: coarse) {
  .rd-bar .icon-btn { width: 46px; height: 46px; }
  .rd-slider { height: 34px; }
  .rd-slider::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  .nav-tab { padding: 12px 18px; }
  .chip { height: 38px; }
  .book-meta .more { width: 40px; height: 40px; }
  /* Dokunmatikte üzerine gelme efektleri takılı kalmasın */
  .shelf-item:hover .book3d { transform: rotateY(-18deg); }
  .shelf-item:active .book3d { transform: rotateY(-4deg) translateY(-8px) scale(1.03); }
  .cat-card:hover .cat-cover { transform: none; }
  .cat-card:active .cat-cover { transform: translateY(-4px) scale(.98); }
}
@media (max-width: 640px) { .hide-narrow { display: none; } .rd-tools .icon-btn { width: 40px; height: 40px; } }
