/* ============ Kitaplık ============ */
.library-view {
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 30px) clamp(16px, 4vw, 52px) 40px;
}
.lib-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.lib-title .hello { font-size: 15px; margin-bottom: 4px; animation: rise .7s var(--ease-out) both; }
.lib-title h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 600; font-variation-settings: 'SOFT' 50, 'opsz' 96; animation: rise .8s .05s var(--ease-out) both; }
.lib-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.today-pill {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 16px 0 6px;
  border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  transition: background .2s;
}
.today-pill:hover { background: var(--surface-2); }
.mini-ring {
  --p: 0;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), color-mix(in srgb, var(--accent) 20%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 12px, #000 12.5px);
          mask: radial-gradient(circle, transparent 12px, #000 12.5px);
  position: relative;
}
.mini-ring span { display: none; }
.today-txt { display: flex; flex-direction: column; line-height: 1.15; }
.today-txt b { font-size: 14px; }
.today-txt small { color: var(--muted); font-size: 12px; }
.streak { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--accent); padding-left: 10px; border-left: 1px solid var(--line); }
.streak.pending { color: var(--faint); }
.add-btn { height: 48px; }

/* ---- Devam et ---- */
.hero-wrap:empty { display: none; }
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 48px); align-items: center;
  padding: clamp(22px, 4vw, 40px);
  border-radius: 28px;
  border: 1px solid var(--line);
  margin-bottom: 34px;
  isolation: isolate;
  animation: rise .8s .1s var(--ease-out) both;
}
.hero-bg {
  position: absolute; inset: -40px; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(50px) saturate(1.3) brightness(.55);
  transform: scale(1.2);
  animation: drift 20s ease-in-out infinite alternate;
}
:root[data-ui="gunduz"] .hero-bg { filter: blur(50px) saturate(1.1) brightness(1.25) opacity(.55); }
@keyframes drift { to { transform: scale(1.35) translate(20px, -10px); } }
.hero-book { width: clamp(120px, 18vw, 190px); perspective: 1000px; }
.hero-info { min-width: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.hero-info h2 { font-size: clamp(24px, 3.4vw, 36px); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-progress { display: flex; align-items: center; gap: 12px; margin: 18px 0 8px; max-width: 420px; }
.hero-progress .bar { flex: 1; height: 6px; border-radius: 9px; background: color-mix(in srgb, var(--text) 14%, transparent); overflow: hidden; }
.hero-progress .bar i { display: block; height: 100%; border-radius: 9px; background: var(--accent); animation: grow-x 1.2s .4s var(--ease-out) both; transform-origin: left; }
.hero-progress span { font-weight: 700; font-size: 14px; }
@keyframes grow-x { from { transform: scaleX(0); } }
.hero-meta { font-size: 14px; }
.hero-btns { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.small { font-size: 13px; }
@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero-progress { margin-inline: auto; }
  .hero-btns { justify-content: center; }
}

/* ---- Araç çubuğu ---- */
.lib-toolbar { position: sticky; top: 0; z-index: 20; margin: 0 -8px 18px; padding: calc(var(--safe-top) + 8px) 8px 10px; }
.lib-toolbar::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(var(--bg) 70%, transparent); opacity: .96; }
.tb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip .count { font-size: 11.5px; opacity: .65; font-weight: 700; }
.tb-right { display: flex; gap: 8px; align-items: center; flex: 0 1 380px; }
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search .ico { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); outline: none; transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.sort { height: 40px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); outline: none; }
.sort option { background: var(--bg-2); }
@media (max-width: 700px) { .tb-right { flex-basis: 100%; } }

/* ---- Raflar ---- */
.shelf-loading { display: grid; place-items: center; padding: 80px; }
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  column-gap: 0;
  row-gap: 30px;
  padding-bottom: 20px;
}
@media (max-width: 520px) { .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }

.shelf-item { position: relative; display: flex; flex-direction: column; animation: book-in .7s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); }
@keyframes book-in { from { opacity: 0; transform: translateY(26px); } }
.shelf-stage { position: relative; padding: 22px 15% 0; perspective: 1100px; }
/* Ahşap raf: yan yana kartların rafları birleşir */
.shelf-stage::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -16px; height: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), transparent 30%),
    repeating-linear-gradient(90deg, transparent 0 37px, rgba(0,0,0,.06) 37px 39px, transparent 39px 83px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2));
  border-bottom: 5px solid var(--wood-edge);
  box-shadow: 0 16px 22px -10px rgba(0, 0, 0, .55);
  z-index: 0;
}
.shelf-stage::before { /* kitabın rafa düşen gölgesi */
  content: ''; position: absolute; left: 18%; right: 12%; bottom: -4px; height: 14px;
  background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
  z-index: 1; filter: blur(2px);
  transition: transform .5s var(--ease-out), opacity .5s;
}
.shelf-item:hover .shelf-stage::before { transform: scaleX(.85); opacity: .6; }

/* 3B kitap */
.book3d {
  position: relative; z-index: 2; display: block; width: 100%;
  aspect-ratio: 2 / 3;
  transform-style: preserve-3d;
  transform: rotateY(-18deg);
  transform-origin: 40% 50%;
  transition: transform .6s var(--ease-out);
  border-radius: 2px 6px 6px 2px;
}
.book3d::after { /* cilt kıvrımı ve ışık */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.38) 0, rgba(255,255,255,.22) 2.6%, rgba(0,0,0,.12) 5.5%, transparent 10%),
    linear-gradient(115deg, rgba(255,255,255,.14) 0%, transparent 35%, transparent 80%, rgba(0,0,0,.18));
  transform: translateZ(.5px);
}
.book3d-pages { /* sayfa kenarı */
  position: absolute; top: 2.5%; height: 95%; left: calc(100% - 2px); width: 18px;
  transform-origin: left center; transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #f3ead8 0 1px, #d9ccb3 1px 2px);
  border-radius: 0 2px 2px 0;
  box-shadow: inset -4px 0 6px -3px rgba(0,0,0,.3);
}
.book3d.big .book3d-pages { width: 26px; }
.shelf-item:hover .book3d, .book3d:focus-visible { transform: rotateY(-4deg) translateY(-10px) scale(1.04); }
.shelf-item:active .book3d { transform: rotateY(-2deg) translateY(-4px) scale(1.01); transition-duration: .2s; }
.hero-book .book3d { transform: rotateY(-22deg); box-shadow: 30px 30px 50px -20px rgba(0,0,0,.7); animation: float 6s ease-in-out infinite; }
.hero-book:hover .book3d { transform: rotateY(-6deg) scale(1.03); }
@keyframes float { 50% { translate: 0 -8px; } }

.cover-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 8px 10px 20px -8px rgba(0,0,0,.6);
  background: #3a2c20;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.cover-img.reveal { animation: cover-reveal .9s var(--ease-spring) both; }
@keyframes cover-reveal { from { opacity: 0; transform: scale(.85) rotateY(30deg); } }
.cover-ph {
  --hue: 30;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 14%;
  background:
    linear-gradient(115deg, rgba(255,255,255,.08), transparent 40%),
    linear-gradient(160deg, hsl(var(--hue) 38% 34%), hsl(var(--hue) 42% 20%));
  color: hsl(var(--hue) 60% 88%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(12px, 1.3vw, 17px);
  line-height: 1.2;
  overflow: hidden;
}
.cover-ph span { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.cover-ph.loading::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }

.cover-progress { position: absolute; left: 8%; right: 8%; bottom: 6%; height: 4px; border-radius: 4px; background: rgba(0,0,0,.45); overflow: hidden; transform: translateZ(1px); backdrop-filter: blur(4px); }
.cover-progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.fav-badge, .done-badge {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; transform: translateZ(2px);
  background: rgba(20, 12, 8, .65); backdrop-filter: blur(6px); color: #ffb4a2;
}
.done-badge { right: auto; left: 10px; color: var(--good); }
.fav-badge svg { fill: currentColor; }

.book-meta { display: flex; align-items: flex-start; gap: 2px; margin-top: 28px; padding: 0 6px 0 12%; }
.meta-text { flex: 1; min-width: 0; }
.book-title { font-family: var(--font-ui); font-size: 14px; font-weight: 600; line-height: 1.3; letter-spacing: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-meta .more { width: 34px; height: 34px; color: var(--faint); margin-top: -6px; }

.shelf-empty { padding-top: 40px; }
.empty-books { display: flex; gap: 6px; align-items: flex-end; height: 90px; margin-bottom: 10px; }
.empty-books i { width: 22px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); animation: empty-bob 2.4s ease-in-out infinite; }
.empty-books i:nth-child(1) { height: 70px; }
.empty-books i:nth-child(2) { height: 86px; animation-delay: .2s; background: linear-gradient(90deg, #6b8f71, #8fbf7f); }
.empty-books i:nth-child(3) { height: 62px; animation-delay: .4s; transform-origin: bottom left; rotate: 12deg; background: linear-gradient(90deg, #6f6aa8, #9a95d6); }
@keyframes empty-bob { 50% { translate: 0 -6px; } }

/* ============ Kitap ekleme ============ */
.add-tabs { margin-bottom: 18px; width: 100%; }
.add-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; }
.add-form { display: flex; flex-direction: column; gap: 12px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; border-radius: var(--radius);
  border: 2px dashed var(--line-2); background: var(--surface);
  cursor: pointer; transition: all .25s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); transform: scale(1.01); }
.drop-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); margin-bottom: 4px; }

.prog-view { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 0 10px; text-align: center; }
.prog-label { font-weight: 600; font-size: 16px; }
.prog-bar { width: 100%; max-width: 360px; height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; position: relative; }
.prog-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9px; transition: width .4s var(--ease-out); }
.prog-bar.indeterminate i { width: 35% !important; position: absolute; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { left: -35%; } to { left: 100%; } }
.prog-book { position: relative; width: 60px; height: 46px; perspective: 400px; margin-bottom: 8px; }
.prog-book i { position: absolute; top: 0; left: 50%; width: 30px; height: 46px; background: #f3e8d4; border-radius: 0 4px 4px 0; transform-origin: left center; box-shadow: inset 3px 0 6px -3px rgba(0,0,0,.3); animation: page-turn 1.4s ease-in-out infinite; }
.prog-book i:nth-child(2) { animation-delay: .25s; background: #ecdfc7; }
.prog-book i:nth-child(3) { animation-delay: .5s; background: #e5d6bb; }
.prog-book::before { content: ''; position: absolute; top: 0; left: 0; width: 30px; height: 46px; background: #e5d6bb; border-radius: 4px 0 0 4px; }
@keyframes page-turn { 0%, 15% { transform: rotateY(0); } 70%, 100% { transform: rotateY(-180deg); } }

.added { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-top: 8px; }
.added h3 { font-size: 22px; margin-top: 14px; }
.added-stage { position: relative; width: 150px; perspective: 800px; }
.added-cover { width: 150px; aspect-ratio: 2/3; object-fit: cover; border-radius: 3px 8px 8px 3px; box-shadow: 0 24px 40px -14px rgba(0,0,0,.7); animation: added-in 1s var(--ease-spring) both; position: relative; }
@keyframes added-in { from { opacity: 0; transform: rotateY(-90deg) scale(.7); } }
.added-sparkles i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0; animation: sparkle 1s var(--d) var(--ease-out) forwards; }
@keyframes sparkle {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(130px) scale(.2); }
}
.dialog-actions.center { justify-content: center; }

/* ============ Kitap detayı ============ */
.detail-top { display: flex; gap: 20px; align-items: flex-start; }
.detail-cover { width: 110px; flex-shrink: 0; aspect-ratio: 2/3; object-fit: cover; border-radius: 3px 8px 8px 3px; box-shadow: 0 16px 30px -12px rgba(0,0,0,.6); position: relative; }
.detail-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.detail-info h2 { font-size: 23px; }
.detail-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.detail-section { margin-top: 24px; }
.detail-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 0 0 10px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.mini-stat b { font-size: 16px; font-weight: 650; }
.mini-stat span { font-size: 12px; color: var(--muted); }
.chart-cap { margin: 16px 0 4px; }
.edit-box { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.detail-foot { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.danger-text { color: var(--danger); }
@media (max-width: 420px) { .mini-stats { grid-template-columns: repeat(2, 1fr); } }

/* ============ Kapak uçuşu ============ */
.fly-overlay { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
.fly-book { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform-style: preserve-3d; perspective: 2200px; }
.fly-page { position: absolute; inset: 0; border-radius: 2px 6px 6px 2px; background: #f5ecd9; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), inset 6px 0 14px -6px rgba(0,0,0,.25); }
.fly-cover { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; }
.fly-front, .fly-back { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 2px 6px 6px 2px; backface-visibility: hidden; -webkit-backface-visibility: hidden; object-fit: cover; }
.fly-front { box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); font-size: 28px; }
.fly-back { transform: rotateY(180deg); background: linear-gradient(90deg, #e9dcc3, #f5ecd9); }
