:root {
  --bg: #fff7fc;
  --surface: #ffffff;
  --surface-pink: #ffd3ec;
  --pink: #f59ed2;
  --pink-hot: #ed74bd;
  --pink-deep: #b84888;
  --ink: #171116;
  --muted: #8c647b;
  --line: #f4c4df;
  --lavender: #eee5ff;
  --cream: #fffaf1;
  --read: #fff0f8;
  --danger: #d74772;
  --shadow: 0 18px 46px rgba(184, 72, 136, 0.16);
  --radius: 8px;
  --topbar: 74px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #fffafd 0%, var(--bg) 46%, #fff1fa 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar);
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(16px, 4vw, 56px);
  background: rgba(247, 235, 243, 0.97);
  border-bottom: 1px solid rgba(228, 177, 207, 0.98);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; min-width: 132px; }
.brand img { width: 210px; max-height: 52px; object-fit: contain; object-position: left center; }
.brand-mark { width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-pink); color: var(--pink-deep); font-weight: 950; }
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: var(--radius); color: var(--muted); font-weight: 850; white-space: nowrap; }
.main-nav a:hover, .main-nav a.is-active { background: #ffe1f2; color: var(--pink-deep); }
.title-search { justify-self: end; width: min(420px, 100%); position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--pink-deep); }
.search-icon { color: var(--pink-hot); font-weight: 950; }
.title-search input { width: 100%; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); outline: 0; }
.title-search:focus-within { border-color: var(--line); box-shadow: none; }
.session-slot { position: relative; justify-self: end; }
.login-button, .primary-button, .ghost-button, .danger-button, .user-dropdown button, .social-links a, .user-trigger { transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.login-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--pink); color: white; font-weight: 950; box-shadow: 0 10px 24px rgba(237, 116, 189, 0.26); }
.login-button:hover, .primary-button:hover { background: var(--pink-hot); transform: translateY(-1px); }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff0f8; color: var(--pink-deep); font-weight: 900; }
.ghost-button:hover { border-color: var(--pink); transform: translateY(-1px); }
.danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--danger); color: white; font-weight: 900; }
.social-links { justify-self: end; display: flex; gap: 8px; }
.social-links a { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--pink-deep); font-weight: 950; box-shadow: 0 8px 18px rgba(184, 72, 136, 0.08); }
.social-links a:hover { background: #fff0f8; transform: translateY(-1px); }
.user-menu { position: relative; }
.user-trigger { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--pink-deep); font-weight: 950; }
.user-trigger:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(184, 72, 136, 0.11); }
.user-menu-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 228px; display: none; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.user-dropdown.is-open { display: grid; gap: 4px; }
.user-dropdown button { display: flex; align-items: center; min-height: 38px; padding: 0 10px; border: 0; border-radius: 6px; background: white; color: var(--ink); text-align: left; font-weight: 850; }
.user-dropdown button:hover { background: #fff0f8; color: var(--pink-deep); }
.is-hidden { display: none !important; }

main { padding: 34px clamp(16px, 4vw, 56px) 58px; }
.view { display: none; }
.view.is-active { display: block; }
.hero-panel, .counter-band, .home-grid, .team-section, .translation-grid, .filters-panel, .list-toolbar, .panel-heading, #titleDetail, #readerDetail, #profileDetail, .footer > * { max-width: 1280px; margin-inline: auto; }
h1, h2, h3, p { margin-top: 0; }
.hero-copy h1, .list-toolbar h1, .panel-heading h1 { max-width: 760px; margin: 0 0 16px; font-size: clamp(2rem, 5vw, 3.9rem); line-height: 1.08; color: var(--ink); }
.soft-label { margin: 0 0 8px; color: var(--pink-deep); font-size: 0.78rem; font-weight: 950; text-transform: uppercase; letter-spacing: 0; }

.hero-panel { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr); align-items: center; gap: clamp(24px, 5vw, 72px); min-height: 500px; padding: 18px 0 34px; background: transparent; border: 0; box-shadow: none; }
.hero-copy p:last-child { max-width: 620px; margin: 0; color: #6d4d61; font-size: 1.08rem; line-height: 1.65; }
.welcome-bunny { margin: 0; justify-self: center; width: min(500px, 100%); aspect-ratio: auto; }
.welcome-bunny img { width: 100%; border-radius: var(--radius); filter: drop-shadow(0 18px 34px rgba(237, 116, 189, 0.22)); }
.bunny-head, .bunny-face { display: none; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; margin-bottom: 46px; }
.latest-strip { min-width: 0; }
.latest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.latest-card, .random-title, .profile-tile, .form-shell, .filters-panel, .title-info-block, .role-card, .discord-note, .team-manager { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.92); box-shadow: 0 12px 28px rgba(184, 72, 136, 0.08); }
.latest-card { min-height: 196px; overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.latest-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.latest-card > .latest-title-button { width: 100%; min-height: 196px; display: grid; grid-template-columns: 132px minmax(0, 1fr); border: 0; background: linear-gradient(90deg, white, #fffafd); padding: 0; text-align: left; color: inherit; }
.latest-card > .latest-title-button img { width: 132px; height: 100%; min-height: 196px; object-fit: cover; object-position: center; }
.latest-card-body { display: grid; align-content: center; padding: 18px; min-width: 0; }
.latest-card h3, .random-title h3, .translation-card h2 { margin: 0 0 8px; color: var(--pink-deep); line-height: 1.18; }
.latest-card p { display: inline-flex; width: fit-content; min-height: 28px; align-items: center; margin: 0 0 7px; padding: 0 9px; border-radius: 999px; background: #fff0f8; color: var(--muted); font-size: 0.9rem; font-weight: 800; }
.latest-card-body .latest-series { color: var(--pink-deep); font-weight: 850; }
.latest-empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--muted); }
.random-title { position: sticky; top: 94px; align-self: start; overflow: hidden; padding: 18px; }
.random-title-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.random-title-heading span { color: #000; font-weight: 950; text-transform: none; font-size: 1.35rem; }
.random-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.random-refresh { min-height: 38px; padding: 0 12px; font-size: 0.88rem; }
.random-actions .primary-button, .random-actions .random-refresh { flex: 0 1 auto; }
.random-title img { width: 100%; height: 240px; object-fit: cover; object-position: center; border-radius: var(--radius); margin-bottom: 14px; }
.random-title p { color: var(--muted); line-height: 1.55; }

.important-numbers { max-width: 1280px; margin: 0 auto 46px; }
.important-numbers .home-section-heading { margin-bottom: 14px; }
.important-numbers .home-section-heading h2 { margin: 0; color: var(--pink-deep); font-size: clamp(1.45rem, 3vw, 2rem); }
.counter-band { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 46px; }
.counter-band article { min-height: 112px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 12px 26px rgba(184, 72, 136, 0.08); text-align: left; }
.counter-band span { display: block; color: var(--pink-deep); font-size: 2rem; font-weight: 950; }
.counter-band p { margin: 0; color: var(--muted); font-weight: 850; }

.team-section { margin-top: 8px; padding: 24px 0 10px; }
.team-title { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 20px; }
.team-title span { width: 32px; height: 4px; background: var(--pink); }
.team-title h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); font-weight: 950; letter-spacing: 0; color: #0f0b0f; }
.team-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 34px; }
.team-tabs button { min-height: 38px; padding: 0 24px; border: 1px solid var(--pink); border-radius: 4px; background: white; color: var(--pink); font-weight: 950; }
.team-tabs button.is-active { background: var(--pink); color: white; }
.team-carousel { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 12px; }
.team-track { position: relative; overflow: hidden; padding: 16px 4px 28px; }
.team-track-inner { display: flex; gap: 24px; width: 100%; will-change: transform; }
.team-track .team-card { flex: 0 0 calc((min(100%, 1280px) - 48px) / 3); }
.team-empty { min-height: 290px; display: grid; place-items: center; color: var(--muted); font-weight: 850; border: 1px dashed var(--line); border-radius: var(--radius); background: #fffafd; }
.team-card { position: relative; scroll-snap-align: center; min-height: 290px; display: grid; justify-items: center; align-content: center; gap: 18px; padding: 34px 22px; border: 0; border-radius: 4px; background: var(--surface-pink); box-shadow: var(--shadow); color: var(--pink-deep); text-align: center; }
.team-avatar { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; overflow: hidden; background: linear-gradient(145deg, #f59ed2, #ffd6ea); }
.team-card h3 { margin: 0; color: var(--pink-deep); font-size: 1.18rem; }
.team-card p { margin: 8px 0 0; color: #bd6497; font-size: 0.86rem; font-style: italic; }
.team-arrow { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 4px; background: var(--pink); color: white; font-size: 30px; line-height: 1; }
.team-manager { margin-top: 22px; padding: 22px; background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,240,248,0.82)); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading h2, .section-heading h3, .discord-note h2 { margin: 0 0 6px; color: var(--pink-deep); }
.section-heading p, .panel-heading p, .discord-note p { margin: 0; color: var(--muted); line-height: 1.55; }
.editor-grid { display: grid; grid-template-columns: minmax(210px, 1.2fr) minmax(190px, 1fr) minmax(150px, 0.7fr) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.team-admin-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 18px; }
.team-admin-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; cursor: grab; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; }
.team-admin-item.is-dragging { opacity: 0.55; cursor: grabbing; }
.team-admin-item.is-drag-over { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(245,158,210,0.2); }
.team-drag-handle { flex: 0 0 auto; color: var(--pink); font-size: 1.25rem; font-weight: 950; letter-spacing: -3px; user-select: none; cursor: grab; }
.team-admin-item img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 18px rgba(184,72,136,0.12); }
.team-admin-item > div:not(.mini-actions) { flex: 1 1 170px; min-width: 0; }
.team-admin-item small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.mini-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 6px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--pink-deep); font-weight: 950; }
.team-admin-action { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--pink-deep); font-weight: 900; }
.team-admin-action:hover { background: #fff0f8; border-color: var(--pink); }
.team-admin-action.is-danger { color: #b83665; }

.list-toolbar, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.filters-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; margin-bottom: 28px; background: white; }
label, fieldset { display: grid; gap: 7px; color: var(--ink); font-weight: 850; }
fieldset { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
legend { padding: 0 8px; font-weight: 900; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; color: var(--ink); outline: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(245, 158, 210, 0.24); }
select[multiple] { min-height: 116px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; color: var(--ink); cursor: pointer; }
.checkbox-row input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-height: 20px; margin: 0; flex: 0 0 20px; border: 2px solid var(--pink); border-radius: 6px; background: white; display: grid; place-content: center; cursor: pointer; transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease; }
.checkbox-row input::before { content: ""; width: 10px; height: 6px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) scale(0); transform-origin: center; transition: transform 0.12s ease; }
.checkbox-row input:checked { background: var(--pink-hot); border-color: var(--pink-hot); box-shadow: 0 4px 10px rgba(237, 116, 189, 0.22); }
.checkbox-row input:checked::before { transform: rotate(-45deg) scale(1); }
.checkbox-row input:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(245, 158, 210, 0.28); }
.checkbox-row:has(input:checked) { border-color: var(--pink); background: #fff0f8; }
.translation-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.translation-card { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 12px 28px rgba(184, 72, 136, 0.08); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.translation-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.translation-card button { width: 100%; display: grid; border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.translation-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center; background: #ffe1f2; }
.translation-card h2 { min-height: 58px; display: grid; place-items: center; margin: 0; padding: 10px 12px; color: var(--pink-deep); font-size: 1rem; text-align: center; }

.back-button { margin-bottom: 18px; }
.title-detail { display: grid; gap: 18px; }
.title-hero { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.title-banner { width: 100%; height: clamp(240px, 32vw, 390px); object-fit: cover; object-position: center; background: var(--surface-pink); }
.title-main { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; padding: 0 24px 24px; align-items: start; }
.title-cover { width: 210px; aspect-ratio: 2 / 3; margin-top: -74px; border: 6px solid white; border-radius: var(--radius); object-fit: cover; object-position: center; box-shadow: var(--shadow); }
.title-copy { padding-top: 20px; }
.title-copy h1 { margin: 0 0 12px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; }
.title-copy p { color: var(--muted); line-height: 1.65; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 999px; background: #fff0f8; color: var(--pink-deep); font-size: 0.8rem; font-weight: 900; }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.title-info-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 18px; }
.title-info-block { padding: 18px; }
.title-info-block h2 { margin: 0 0 12px; color: var(--pink-deep); }
.staff-list { display: grid; gap: 10px; }
.staff-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; }
.staff-row b { color: var(--pink-deep); }
.chapter-list { display: grid; gap: 10px; }
.chapter-card { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 78px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: inherit; text-align: left; }
.chapter-card.is-read { background: var(--read); color: #a06488; }
.chapter-card:hover { border-color: var(--pink); }
.chapter-thumb { width: 68px; aspect-ratio: 2 / 3; border-radius: 6px; object-fit: cover; object-position: center; }
.chapter-info { min-width: 0; }
.chapter-info h3 { margin: 0; color: var(--pink-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-info p, .chapter-date { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.heart-button { min-width: 58px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--pink-deep); font-weight: 950; padding: 8px 10px; }
.heart-button.is-liked { background: var(--pink); color: white; }

.reader-shell { max-width: 980px; margin-inline: auto; }
.reader-bar { position: sticky; top: 86px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.94); box-shadow: 0 12px 28px rgba(184,72,136,0.08); backdrop-filter: blur(14px); }
.reader-title h1 { margin: 0; font-size: clamp(1.35rem, 3vw, 2.25rem); }
.reader-title p { margin: 4px 0 0; color: var(--muted); }
.reader-pages { display: grid; gap: 0; background: white; }
.reader-page { display: block; margin: 0; border: 0; background: white; }
.reader-page img { width: 100%; display: block; margin: 0; border: 0; }
.reader-page-fallback { min-height: 900px; display: grid; place-items: center; background: linear-gradient(145deg, #ffe2f3, #fffafd 52%, #f5dff0); color: var(--pink-deep); font-size: 1.4rem; font-weight: 950; }

.form-shell { display: grid; gap: 14px; padding: 18px; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.side-admin-button { margin-top: 16px; }
.upload-list { display: grid; gap: 8px; }
.upload-item { grid-template-columns: minmax(0, 1fr) auto; }
.role-panel { margin-top: 20px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.role-card { padding: 16px; }
.role-card h3 { margin: 0 0 8px; color: var(--pink-deep); }
.role-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.discord-note { margin-top: 20px; padding: 18px; }
.discord-note code { background: #fff0f8; color: var(--pink-deep); padding: 2px 5px; border-radius: 4px; }

.profile-shell { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.profile-banner { height: clamp(210px, 30vw, 330px); background: var(--surface-pink); }
.profile-banner img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.profile-body { padding: 0 clamp(18px, 4vw, 38px) 34px; }
.profile-header-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: end; margin-top: -62px; }
.profile-avatar { width: 150px; height: 150px; border: 7px solid white; border-radius: 50%; object-fit: cover; background: #ffd6ea; box-shadow: var(--shadow); }
.profile-names { padding-bottom: 16px; }
.profile-names h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); }
.profile-names p { margin: 4px 0 10px; color: var(--muted); font-weight: 800; }
.profile-content { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; margin-top: 18px; }
.profile-tile { padding: 18px; }
.profile-tile h2 { margin: 0 0 12px; color: var(--pink-deep); }
.profile-description textarea { min-height: 140px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.library-item { overflow: hidden; display: grid; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: inherit; text-align: left; }
.library-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center; }
.library-item h3 { margin: 0; padding: 10px; color: var(--pink-deep); font-size: 0.9rem; text-align: center; }

.footer { display: grid; justify-items: center; gap: 12px; padding: 28px 18px 34px; border-top: 1px solid var(--line); background: white; }
.footer div { display: flex; flex-wrap: wrap; gap: 18px; }
.footer button { border: 0; background: transparent; color: var(--pink-deep); font-weight: 850; }
.footer p { margin: 0; color: var(--muted); font-weight: 850; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
  .main-nav, .title-search { grid-column: 1 / -1; justify-self: stretch; }
  .title-search { width: 100%; }
  .home-grid, .title-info-grid, .profile-content { grid-template-columns: 1fr; }
  .random-title { position: static; }
  .translation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  main { padding-top: 22px; }
  .hero-panel, .title-main, .profile-header-row { grid-template-columns: 1fr; }
  .hero-panel { min-height: auto; }
  .welcome-bunny { width: min(380px, 100%); }
  .counter-band, .filters-panel, .latest-grid, .two-columns, .role-grid { grid-template-columns: 1fr 1fr; }
  .team-track .team-card { flex-basis: calc((100% - 24px) / 2); }
  .title-cover { margin-top: -50px; }
  .profile-avatar { width: 132px; height: 132px; }
  .chapter-card { grid-template-columns: 62px minmax(0, 1fr) auto; }
  .chapter-date { grid-column: 2 / -1; }
}
@media (max-width: 560px) {
  .brand img { width: 170px; }
  .topbar { grid-template-columns: 1fr auto auto; }
  .main-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .main-nav a { justify-content: center; padding-inline: 8px; }
  .counter-band, .filters-panel, .latest-grid, .translation-grid, .two-columns, .editor-grid, .role-grid, .profile-content { grid-template-columns: 1fr; }
  .latest-card > .latest-title-button { grid-template-columns: 112px minmax(0, 1fr); }
  .latest-card > .latest-title-button img { width: 112px; min-height: 170px; }
  .team-carousel { grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .team-track .team-card { flex-basis: calc(100% - 8px); }
  .chapter-card { grid-template-columns: 58px minmax(0, 1fr); }
  .chapter-date, .heart-button { justify-self: start; grid-column: 2; }
  .reader-bar, .list-toolbar, .panel-heading, .section-heading { display: grid; justify-items: start; }
}
.home-section-title { margin: 0 0 22px; }
.home-section-title h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
.important-numbers .home-section-title { margin-bottom: 22px; }

/* Seria — media i edycja inline */
.translation-cover,
.title-cover,
.library-cover { aspect-ratio: 3 / 4; object-fit: cover; object-position: center; }
.title-banner { aspect-ratio: 16 / 9; height: auto; min-height: 0; object-fit: cover; object-position: center; display: block; }
.random-title-banner { width: 100%; height: auto !important; aspect-ratio: 16 / 9; object-fit: cover; object-position: center; display: block; background: var(--surface-pink); border-radius: var(--radius); margin-bottom: 14px; }
.icon-text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.action-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.danger-button.icon-text-button { color: #b83665; }

.inline-editor { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); scroll-margin-top: 96px; }
.inline-editor.is-hidden { display: none; }
.inline-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.inline-editor-head h2 { margin: 0 0 5px; color: var(--pink-deep); }
.inline-editor-head p { margin: 0; color: var(--muted); }
.series-editor-form { display: grid; gap: 18px; }
.media-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.media-editor-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; }
.media-editor-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--ink); }
.media-editor-label span { color: var(--pink-deep); font-size: .8rem; font-weight: 950; }
.media-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fceaf5; margin-bottom: 12px; }
.media-preview.cover-preview { aspect-ratio: 3 / 4; }
.media-preview.banner-preview { aspect-ratio: 16 / 9; }
.media-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.file-picker { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 12px; border: 1px dashed var(--pink); border-radius: var(--radius); background: #fff0f8; color: var(--pink-deep); cursor: pointer; text-align: center; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.people-editor-section { display: grid; gap: 10px; padding-top: 4px; }
.editor-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-section-heading h3 { margin: 0; color: var(--pink-deep); }
.editor-help { color: var(--muted); font-size: .9rem; }
.people-editor-list { display: grid; gap: 9px; }
.person-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 150px auto; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fffafd; }
.icon-button.is-small { width: 36px; height: 36px; min-width: 36px; padding: 0; }
.pretty-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.pretty-check { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fffafd; cursor: pointer; font-weight: 850; }
.pretty-check input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pretty-check-box { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; border: 2px solid var(--pink); border-radius: 6px; background: white; }
.pretty-check-box::after { content: ""; width: 9px; height: 5px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) scale(0); transition: transform .12s ease; }
.pretty-check:has(input:checked) { border-color: var(--pink); background: #fff0f8; color: var(--pink-deep); }
.pretty-check:has(input:checked) .pretty-check-box { background: var(--pink-hot); border-color: var(--pink-hot); box-shadow: 0 4px 10px rgba(237,116,189,.18); }
.pretty-check:has(input:checked) .pretty-check-box::after { transform: rotate(-45deg) scale(1); }
.editor-pickers-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.editor-picker { border: 1px solid var(--line); border-radius: 10px; background: #fffafd; overflow: hidden; }
.editor-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; cursor: pointer; list-style: none; font-weight: 900; color: var(--ink); }
.editor-picker summary::-webkit-details-marker { display: none; }
.editor-picker summary span { color: var(--pink-deep); font-size: .86rem; font-weight: 850; text-align: right; }
.editor-picker-list { display: grid; gap: 7px; padding: 0 9px 9px; }
.inline-editor-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.person-link { color: var(--pink-deep); font-weight: 850; text-decoration: none; }
.person-link:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .media-edit-grid, .editor-pickers-grid { grid-template-columns: 1fr; }
  .person-editor-row { grid-template-columns: 1fr; }
}
.latest-card > .latest-title-button { grid-template-columns: 147px minmax(0, 1fr); }
.latest-card > .latest-title-button img { width: 147px; height: 196px; min-height: 0; aspect-ratio: 3 / 4; }
@media (max-width: 620px) {
  .latest-card > .latest-title-button { grid-template-columns: 112px minmax(0, 1fr); }
  .latest-card > .latest-title-button img { width: 112px; height: 149px; }
}

/* Tytuł — modal edycji i potwierdzenie usunięcia */
body.modal-open { overflow: hidden; }
.inline-editor {
  position: fixed;
  inset: 18px;
  z-index: 120;
  width: auto;
  max-width: none;
  max-height: calc(100vh - 36px);
  margin: 0;
  padding: clamp(18px, 2.5vw, 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.985);
  box-shadow: 0 30px 90px rgba(92, 38, 72, 0.28);
}
.inline-editor::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(23, 17, 22, 0.42);
  backdrop-filter: blur(2px);
}
.inline-editor-head { position: sticky; top: -1px; z-index: 3; padding-bottom: 16px; background: rgba(255,255,255,0.985); border-bottom: 1px solid var(--line); }
.inline-editor-head .icon-button { flex: 0 0 40px; width: 40px; height: 40px; font-size: 1.4rem; }
.editor-adult-check { margin-top: -4px; }

.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(23, 17, 22, 0.46);
  backdrop-filter: blur(4px);
}
.confirm-modal {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 30px 90px rgba(92, 38, 72, 0.28);
  text-align: center;
}
.confirm-modal-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff0f8;
  color: var(--pink-deep);
}
.confirm-modal-icon .action-icon { width: 25px; height: 25px; }
.confirm-modal h2 { margin: 0 0 8px; color: var(--ink); font-size: 1.35rem; }
.confirm-modal p { margin: 0; color: var(--muted); }
.confirm-modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.confirm-modal-actions button { min-width: 112px; }
.confirm-danger { background: var(--danger); color: white !important; }
.confirm-danger:hover { background: #c93562; }

/* Karty tytułów — bez dodatkowego białego efektu przy najechaniu */
.translation-card:hover { transform: none; box-shadow: 0 12px 28px rgba(184, 72, 136, 0.08); }
.translation-card button:hover,
.translation-card button:focus,
.translation-card button:focus-visible { background: transparent; outline: none; box-shadow: none; }
.translation-card button:focus-visible { box-shadow: inset 0 0 0 3px rgba(245,158,210,0.3); }

/* Filtr 18+ — zawsze równy kwadrat */
.checkbox-row input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 4px;
  aspect-ratio: 1 / 1;
}

/* Rozdziały bez okładek */
.chapter-card { grid-template-columns: minmax(0, 1fr) auto auto; }
.chapter-thumb { display: none; }

@media (max-width: 820px) {
  .inline-editor { inset: 10px; max-height: calc(100vh - 20px); }
  .confirm-modal { padding: 24px 18px; }
}
body.modal-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(23, 17, 22, 0.42);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.inline-editor::before { display: none; }
.danger-button.icon-text-button { color: #fff; }

/* Rozdziały — menu akcji */
.chapter-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.chapter-main-button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-width: 0; padding: 8px 4px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.chapter-main-button:hover { background: transparent; }
.chapter-card-actions { display: flex; align-items: center; gap: 8px; }
.chapter-menu-wrap { position: relative; }
.chapter-menu-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); cursor: pointer; }
.chapter-menu-button:hover { color: var(--pink-deep); border-color: var(--pink); background: #fff6fb; }
.chapter-menu-button .action-icon { width: 19px; height: 19px; }
.chapter-menu { position: absolute; right: 0; top: calc(100% + 7px); z-index: 20; min-width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 16px 40px rgba(92,38,72,.16); }
.chapter-menu.is-hidden { display: none; }
.chapter-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 800; text-align: left; cursor: pointer; }
.chapter-menu button:hover { background: #fff0f8; color: var(--pink-deep); }
.chapter-menu button:last-child:hover { color: #c93562; background: #fff1f3; }
.chapter-menu .action-icon { width: 17px; height: 17px; }

.chapter-edit-modal { width: min(560px, 100%); text-align: left; }
.chapter-edit-modal > .confirm-modal-icon { margin-left: 0; }
.chapter-edit-modal h2 { text-align: left; }
.chapter-edit-form { display: grid; gap: 13px; margin-top: 18px; }
.chapter-edit-form label { display: grid; gap: 6px; color: var(--ink); font-weight: 850; }
.chapter-edit-form input, .chapter-edit-form select { width: 100%; box-sizing: border-box; }
.chapter-edit-form select { min-height: 120px; }
.chapter-edit-form .confirm-modal-actions { margin-top: 8px; justify-content: flex-end; }

.bunbun-toast {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.97);
  color: var(--ink);
  box-shadow: 0 16px 42px rgba(92,38,72,.18);
  font-weight: 800;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.bunbun-toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff0f8;
  color: var(--pink-deep);
  border: 1px solid rgba(184,72,136,.22);
  font-weight: 950;
}

@media (max-width: 620px) {
  .chapter-main-button { grid-template-columns: 1fr; }
  .chapter-date { text-align: left; }
  .chapter-card-actions { align-self: start; }
  .bunbun-toast { left: 14px; bottom: 14px; max-width: calc(100vw - 28px); }
}

.latest-chapters { display: grid; gap: 3px; padding: 8px 16px 14px; }
.latest-chapter-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 800; text-align: left; cursor: pointer; }
.latest-chapter-link:hover { background: #fff0f8; color: var(--pink-deep); }
.latest-chapter-link span:last-child { color: var(--muted); font-size: .88rem; font-weight: 750; }

.chapter-edit-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.chapter-edit-form input[type="number"], .chapter-edit-form input[type="date"] { min-height: 46px; }
.date-input-wrap { position: relative; display: block; }
.pretty-date-input { padding-right: 48px !important; appearance: auto; }
.date-input-icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; color: var(--pink-deep); pointer-events: none; }
.date-input-icon .action-icon { width: 20px; height: 20px; }
.chapter-translator-fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffafd; }
.chapter-translator-fieldset legend { padding: 0 7px; color: var(--pink-deep); font-weight: 900; }
.chapter-translator-checks { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.chapter-translator-checks .pretty-check { min-height: 42px; }
.bunbun-toast .toast-icon { display: grid; place-items: center; }
.bunbun-toast .toast-icon .action-icon { width: 15px; height: 15px; }

@media (max-width: 1000px) {
  .counter-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .counter-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-edit-two-columns { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .counter-band { grid-template-columns: 1fr; }
}

/* Global search */
.title-search { overflow: visible; z-index: 80; }
.search-icon { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 22px; }
.search-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.global-search-results { position: absolute; top: calc(100% + 9px); left: 0; right: 0; z-index: 200; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.98); box-shadow: 0 22px 50px rgba(92,38,72,.18); backdrop-filter: blur(14px); }
.global-search-result { width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
.global-search-result:hover { background: #fff0f8; }
.global-search-result img { width: 42px; height: 56px; flex: 0 0 42px; border-radius: 7px; object-fit: cover; aspect-ratio: 3 / 4; }
.global-search-result span { min-width: 0; display: grid; gap: 2px; }
.global-search-result b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.global-search-result small { color: var(--muted); }
.global-search-empty { padding: 15px 12px; color: var(--muted); font-weight: 800; text-align: center; }

/* New chapters: preserve the original card layout while making each chapter clickable. */
.latest-card { display: grid; grid-template-rows: auto auto; }
.latest-title-button:hover { background: linear-gradient(90deg, white, #fffafd); }
.latest-chapters { display: grid; gap: 3px; padding: 8px 12px 12px; border-top: 1px solid #f7ddeb; }
.latest-chapter-link { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 5px 9px; border: 0; border-radius: 8px; background: #fff0f8; color: var(--ink); text-align: left; font-weight: 800; }
.latest-chapter-link:hover { background: #ffe1f2; color: var(--pink-deep); }
.latest-chapter-number { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-chapter-date { color: var(--muted); font-size: .84rem; font-weight: 750; white-space: nowrap; }

/* Title editor: fixed header + independently scrolling body, with a matching scrollbar. */
.inline-editor { display: flex; flex-direction: column; overflow: hidden; padding: 0; border-radius: 18px; }
.inline-editor-head { position: relative; top: auto; flex: 0 0 auto; padding: clamp(18px, 2.5vw, 28px) clamp(18px, 2.5vw, 32px) 16px; background: rgba(255,255,255,.985); border-bottom: 1px solid var(--line); }
.series-editor-form { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px clamp(18px, 2.5vw, 32px) 30px; scrollbar-width: thin; scrollbar-color: var(--pink) #fff0f8; }
.series-editor-form::-webkit-scrollbar { width: 10px; }
.series-editor-form::-webkit-scrollbar-track { margin: 8px 2px 8px 0; border-radius: 999px; background: #fff0f8; }
.series-editor-form::-webkit-scrollbar-thumb { border: 3px solid #fff0f8; border-radius: 999px; background: var(--pink); }
.series-editor-form::-webkit-scrollbar-thumb:hover { background: var(--pink-hot); }
.inline-editor-head, .series-editor-form { border-radius: 0; }
.inline-editor-head { border-top-left-radius: 18px; border-top-right-radius: 18px; }
.series-editor-form { border-bottom-left-radius: 18px; border-bottom-right-radius: 18px; }
.inline-editor-actions { padding-bottom: 2px; }

/* Bookmark button */
.icon-text-button { gap: 8px; }
.icon-text-button .action-icon { width: 18px; height: 18px; flex: 0 0 18px; }

/* Profile roles */
.profile-content .tag-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* Global search — dropdown is anchored directly under the search field. */
.title-search { overflow: visible; z-index: 120; }
.search-icon { width: 21px; height: 21px; display: grid; place-items: center; flex: 0 0 21px; color: var(--pink-deep); }
.search-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.global-search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 500; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.98); box-shadow: 0 18px 45px rgba(92,38,72,.18); backdrop-filter: blur(12px); }
.global-search-results.is-hidden { display: none; }
.global-search-result { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.global-search-result:hover { background: #fff0f8; }
.global-search-result img { width: 42px; height: 56px; flex: 0 0 42px; object-fit: cover; aspect-ratio: 3/4; border-radius: 7px; }
.global-search-result span { min-width: 0; display: grid; gap: 2px; }
.global-search-result b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result small { color: var(--muted); }
.global-search-empty { padding: 14px 10px; color: var(--muted); text-align: center; font-weight: 800; }

/* New chapters — same visual card style as the earlier version. */
.latest-card { min-height: 196px; overflow: hidden; }
.latest-card > .latest-title-button { width: 100%; min-height: 196px; display: grid; grid-template-columns: 132px minmax(0,1fr); border: 0; background: linear-gradient(90deg, white, #fffafd); padding: 0; text-align: left; color: inherit; cursor: pointer; }
.latest-card > .latest-title-button img { width: 132px; height: 100%; min-height: 196px; object-fit: cover; object-position: center; }
.latest-card-body { display: grid; align-content: center; padding: 18px; min-width: 0; }
.latest-chapter-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; background: transparent; color: var(--muted); text-align: left; font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer; }
.latest-chapter-row:hover { color: var(--pink-deep); }
.latest-card-body .latest-chapter-row + .latest-chapter-row { border-top: 1px solid #f7ddeb; }
.latest-chapter-row span:first-child { color: var(--pink-deep); }
.latest-chapter-row span:last-child { white-space: nowrap; }

.social-links a svg { width: 20px; height: 20px; display: block; }
.profile-shell { overflow: hidden; }
.profile-banner { min-height: 240px; }
.profile-body { padding-top: 0; }
.profile-header-row { position: relative; z-index: 2; min-height: 130px; }
.profile-names { padding-top: 70px; padding-bottom: 16px; }
.profile-names h1, .profile-names p { overflow-wrap: anywhere; }
#libraryDetail { margin-top: 18px; }

.profile-translated-section { max-width: 1280px; margin: 30px auto 0; text-align: center; }
.profile-translated-section h2 { margin: 0 0 18px; color: #0f0b0f; font-size: clamp(1.7rem, 3vw, 2.5rem); font-weight: 950; }
.translated-title-grid { text-align: left; }
.discord-social-link svg { width: 21px; height: 21px; display: block; }

/* Chapter editor: scrollable dialog body with a polished date picker. */
.chapter-edit-modal { max-height: min(86vh, 820px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--pink) #fff0f8; border-radius: 18px; }
.chapter-edit-modal::-webkit-scrollbar { width: 10px; }
.chapter-edit-modal::-webkit-scrollbar-track { margin: 10px 3px; border-radius: 999px; background: #fff0f8; }
.chapter-edit-modal::-webkit-scrollbar-thumb { border: 3px solid #fff0f8; border-radius: 999px; background: var(--pink); }
.chapter-edit-form input[type="date"] { appearance: none; -webkit-appearance: none; min-height: 48px; padding-right: 48px; }
.chapter-edit-form input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer; }
.date-input-wrap { position: relative; display: block; }
.date-input-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none; border: 2px solid var(--pink-deep); border-radius: 4px; box-sizing: border-box; }
.date-input-wrap::before { content: ""; position: absolute; z-index: 1; right: 17px; top: calc(50% - 5px); width: 12px; height: 2px; background: var(--pink-deep); pointer-events: none; }

/* Profile / translated titles */
.profile-translated-section h2 { font-family: inherit; font-size: clamp(1.8rem, 3vw, 2.7rem); color: #111; font-weight: 950; }
.translated-title-grid .library-item h3 { font-size: 1.05rem; }

/* Chapter editor: rounded outer shell; only inner form scrolls. */
.chapter-edit-modal { max-height: min(86vh, 820px); overflow: hidden !important; border-radius: 20px !important; }
.chapter-edit-modal .chapter-edit-form { max-height: calc(min(86vh, 820px) - 105px); overflow-y: auto; padding-right: 12px; scrollbar-width: thin; scrollbar-color: var(--pink) #fff0f8; border-bottom-left-radius: 18px; border-bottom-right-radius: 18px; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar { width: 9px; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-track { margin: 4px 2px 8px; border-radius: 999px; background: #fff0f8; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-thumb { border: 2px solid #fff0f8; border-radius: 999px; background: var(--pink); }

/* Custom date picker */
.custom-date-picker { position: relative; }
.pretty-date-display { width: 100%; min-height: 48px; padding: 12px 52px 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fffafd; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; box-sizing: border-box; }
.pretty-date-display::placeholder { color: var(--muted); }
.date-picker-toggle { position: absolute; right: 8px; top: 7px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--pink-deep); cursor: pointer; }
.date-picker-toggle:hover { background: #ffe7f3; }
.date-picker-toggle svg { width: 19px; height: 19px; }
.custom-calendar { position: absolute; z-index: 1000; left: 0; top: calc(100% + 7px); width: min(330px, 100%); padding: 12px; border: 1px solid #efb9d5; border-radius: 16px; background: #fff; box-shadow: 0 18px 45px rgba(80,30,60,.18); }
.custom-calendar.is-hidden { display: none; }
.custom-calendar-head { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 5px; margin-bottom: 10px; text-align: center; color: var(--ink); }
.custom-calendar-head button, .custom-calendar-foot button { border: 0; background: #fff0f8; color: var(--pink-deep); border-radius: 9px; min-height: 32px; font: inherit; font-weight: 900; cursor: pointer; }
.custom-calendar-head button:hover, .custom-calendar-foot button:hover { background: #ffd9eb; }
.custom-calendar-week, .custom-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.custom-calendar-week { margin-bottom: 4px; color: var(--muted); font-size: .76rem; font-weight: 900; text-align: center; }
.calendar-day { min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-weight: 750; cursor: pointer; }
.calendar-day:hover { background: #ffe5f1; color: var(--pink-deep); }
.calendar-day.is-selected { background: var(--pink); color: #fff; }
.calendar-day.is-today { box-shadow: inset 0 0 0 1.5px var(--pink); }
.calendar-day.is-muted { color: #c5a9b8; }
.custom-calendar-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.custom-calendar-foot button { padding: 6px 10px; }

/* Final visual corrections */
.latest-card > .latest-title-button { appearance: none; -webkit-appearance: none; }
.latest-card > .latest-title-button:hover { background: linear-gradient(90deg, white, #fffafd); }
.latest-chapter-inline { display: block; width: fit-content; max-width: 100%; margin: 0 0 7px; padding: 0 9px; min-height: 28px; border: 0; border-radius: 999px; background: #fff0f8; color: var(--muted); font-size: .9rem; font-weight: 800; text-align: left; cursor: pointer; }
.latest-chapter-inline:hover { color: var(--pink-deep); background: #ffe4f3; }
.team-profile-button { appearance: none; -webkit-appearance: none; width: 100%; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.team-profile-button:hover h3 { color: var(--pink-deep); }
.team-profile-button:hover { color: var(--pink-deep); }
.team-profile-button h3 { transition: color .16s ease; }
.library-page-heading { margin: 0 0 22px; }
.library-content { padding: 0; }
.library-empty, .library-login-message { margin: 0; padding: 28px; text-align: center; color: var(--muted); font-weight: 800; }
.profile-translated-section { max-width: none; margin: 30px 0 0; }
.profile-translated-section .home-section-title { margin-bottom: 22px; }
.profile-translated-section .translated-title-grid .library-item h3 { font-size: 1.15rem; padding: 12px; }
.chapter-edit-modal { display: flex; flex-direction: column; max-height: min(88vh, 850px); overflow: hidden !important; border-radius: 20px !important; padding: 24px 22px 20px; box-sizing: border-box; }
.chapter-edit-modal h2, .chapter-edit-modal > .confirm-modal-icon { flex: 0 0 auto; }
.chapter-edit-modal .chapter-edit-form { min-height: 0; max-height: none; overflow-y: auto; padding: 2px 12px 8px 0; margin-top: 12px; scrollbar-width: thin; scrollbar-color: var(--pink) #fff0f8; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar { width: 9px; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-track { margin: 3px 1px; border-radius: 999px; background: #fff0f8; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-thumb { border: 2px solid #fff0f8; border-radius: 999px; background: var(--pink); }
.chapter-edit-modal .confirm-modal-actions { position: sticky; bottom: 0; z-index: 3; padding: 12px 0 2px; margin-top: 4px; background: rgba(255,255,255,.98); border-top: 1px solid #f7ddeb; }
.custom-date-picker { position: relative; }
.pretty-date-display { cursor: pointer; }
.custom-calendar { position: absolute; left: 0; top: calc(100% + 8px); z-index: 50; width: min(320px, calc(100vw - 80px)); padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 18px 42px rgba(92,38,72,.18); }
.custom-calendar.is-hidden { display: none; }
.custom-calendar-head { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 5px; margin-bottom: 10px; }
.custom-calendar-head button, .custom-calendar-foot button { border: 0; border-radius: 9px; background: #fff0f8; color: var(--pink-deep); font-weight: 900; cursor: pointer; }
.custom-calendar-head button { min-height: 32px; font-size: 1.25rem; }
.custom-calendar-head strong { text-align: center; text-transform: capitalize; }
.custom-calendar-week, .custom-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.custom-calendar-week span { padding: 5px 0; color: var(--muted); text-align: center; font-size: .75rem; font-weight: 900; }
.calendar-day { min-height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; font-weight: 800; }
.calendar-day:hover { background: #fff0f8; color: var(--pink-deep); }
.calendar-day.is-muted { color: #b8a9b1; }
.calendar-day.is-selected { background: var(--pink); color: #fff; }
.calendar-day.is-today:not(.is-selected) { box-shadow: inset 0 0 0 2px var(--pink); color: var(--pink-deep); }
.custom-calendar-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.custom-calendar-foot button { padding: 7px 10px; }

/* --- corrections 10 --- */
.team-profile-button { appearance:none; -webkit-appearance:none; width:100%; border:0; font:inherit; color:inherit; text-align:left; cursor:pointer; }
.team-profile-button:hover h3 { color:var(--pink-deep); }
.team-profile-button:hover { color:var(--pink-deep); }
.team-profile-button h3 { transition:color .15s ease; }
.profile-translated-section { max-width:1280px; margin:30px auto 0; text-align:center; }
.profile-translated-section .home-section-title { margin-bottom:22px; }
.profile-translated-section .translated-title-grid .library-item h3 { font-size:1.15rem; padding:12px; }
.library-page-heading { margin-bottom:22px; }
.library-empty,.library-login-message { margin:0; padding:28px; text-align:center; color:var(--muted); font-weight:800; }
.latest-card-inner { width:100%; height:100%; }
.latest-chapters-list { display:grid; gap:7px; }
.latest-chapter-row { display:flex; justify-content:space-between; align-items:center; gap:12px; width:fit-content; min-width:190px; max-width:100%; padding:0 9px; min-height:28px; border:0; border-radius:999px; background:#fff0f8; color:var(--muted); font-size:.9rem; font-weight:800; text-align:left; cursor:pointer; }
.latest-chapter-row:hover { color:var(--pink-deep); background:#ffe4f3; }
.chapter-edit-modal { display:flex; flex-direction:column; max-height:min(88vh,850px); overflow:hidden !important; border-radius:20px !important; box-sizing:border-box; }
.chapter-edit-modal .chapter-edit-form { min-height:0; max-height:none; overflow-y:auto; padding-right:12px; scrollbar-width:thin; scrollbar-color:var(--pink) #fff0f8; }
.chapter-edit-modal .confirm-modal-actions { position:sticky; bottom:0; z-index:3; padding:12px 0 2px; margin-top:4px; background:rgba(255,255,255,.98); border-top:1px solid #f7ddeb; }
.custom-date-picker { position:relative; }
.pretty-date-display { cursor:pointer; }
.custom-calendar { position:absolute; left:0; top:calc(100% + 8px); z-index:100; width:min(320px,calc(100vw - 80px)); padding:12px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 18px 42px rgba(92,38,72,.18); }
.custom-calendar.is-hidden { display:none; }

.chapter-edit-modal { border-radius:20px !important; overflow:hidden !important; }
.chapter-edit-modal .chapter-edit-form { overflow-y:auto; overflow-x:hidden; border-radius:0 0 16px 16px; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar { width:9px; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-track { margin:3px 1px; border-radius:999px; background:#fff0f8; }
.chapter-edit-modal .chapter-edit-form::-webkit-scrollbar-thumb { border:2px solid #fff0f8; border-radius:999px; background:var(--pink); }

/* --- final corrections --- */
.team-card { text-align:center; }
.team-card-copy { display:grid; justify-items:center; gap:4px; }
.team-profile-name { display:inline-block; border:0; padding:0; background:transparent; color:var(--ink); font:inherit; font-size:1.08rem; font-weight:950; cursor:pointer; text-align:center; transition:color .16s ease; }
.team-card p { margin:0; text-align:center; }
@media (hover:hover) and (pointer:fine) {
  .team-profile-name:hover { color:var(--pink-deep); }
}
.latest-card { display:grid; grid-template-rows:auto auto; min-height:0; overflow:hidden; }
.latest-card > .latest-title-button { width:100%; min-height:196px; display:grid; grid-template-columns:112px minmax(0,1fr); border:0; background:linear-gradient(90deg,white,#fffafd); padding:0; text-align:left; color:inherit; cursor:pointer; }
.latest-card > .latest-title-button img { width:112px; height:149px; min-height:149px; object-fit:cover; object-position:center; aspect-ratio:3/4; }
.latest-card-body { display:grid; align-content:center; padding:18px; min-width:0; }
.latest-card h3 { margin:0; }
.latest-chapters { display:grid; gap:3px; padding:8px 12px 12px; border-top:1px solid #f7ddeb; }
.latest-chapter-link { min-height:34px; display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:5px 9px; border:0; border-radius:8px; background:#fff0f8; color:var(--ink); text-align:left; font-weight:800; cursor:pointer; }
.latest-chapter-link:hover { background:#ffe1f2; color:var(--pink-deep); }
.latest-chapter-link span:last-child { color:var(--muted); font-size:.84rem; font-weight:750; white-space:nowrap; }
.latest-chapter-number { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.latest-empty { grid-column:1/-1; padding:28px; border:1px solid var(--line); border-radius:var(--radius); background:rgba(255,255,255,.92); text-align:center; color:var(--muted); font-weight:800; }
.profile-translated-section .home-section-title { margin-bottom:18px; }
.profile-translated-section .home-section-title h2 { font-size:clamp(1.6rem,2.6vw,2.25rem); }
.profile-translated-section .translated-title-grid { grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:18px; }
.profile-translated-section .translated-title-grid .library-cover { width:100%; aspect-ratio:3/4; object-fit:cover; }
.profile-translated-section .translated-title-grid .library-item h3 { font-size:1.12rem; padding:13px 10px 15px; }
.chapter-edit-modal { border-radius:20px !important; overflow:hidden !important; }
.chapter-edit-modal .chapter-edit-form { overflow-y:auto; overflow-x:hidden; border-radius:0; }
.chapter-edit-actions { flex:0 0 auto; margin-top:0; border-radius:0 0 16px 16px; }
.custom-date-picker .custom-calendar { position:fixed !important; z-index:10000; }

/* --- final corrections: latest chapters, Discord banners, descriptions, footer, search --- */
body { min-height:100vh; display:flex; flex-direction:column; }
body > main { flex:1 0 auto; width:100%; }
.footer { margin-top:auto; flex:0 0 auto; width:100%; }
.title-description { white-space:pre-line; }
.profile-banner.has-color-banner { background:var(--discord-banner-color,#ffd0e9); }
.profile-banner.has-color-banner span { display:block; width:100%; height:100%; }
.library-grid .library-item h3,
.profile-translated-section .translated-title-grid .library-item h3 { font-size:1.15rem; padding:12px; }
.title-search input,
.title-search input:focus,
.title-search input:focus-visible,
.title-search input:active {
  outline:none !important;
  border:0 !important;
  box-shadow:none !important;
  background:transparent !important;
  -webkit-appearance:none;
  appearance:none;
}
.title-search:focus-within { outline:none !important; box-shadow:none !important; }
.title-search input:-webkit-autofill,
.title-search input:-webkit-autofill:hover,
.title-search input:-webkit-autofill:focus {
  -webkit-text-fill-color:var(--ink);
  -webkit-box-shadow:0 0 0 1000px transparent inset !important;
  box-shadow:0 0 0 1000px transparent inset !important;
  background-color:transparent !important;
}
.latest-chapter-link {
  transition:background .16s ease, color .16s ease, transform .16s ease;
}
.latest-chapter-link:hover {
  background:#ffe1f2 !important;
  color:var(--pink-deep) !important;
}
.latest-chapter-link:focus,
.latest-chapter-link:focus-visible {
  outline:none !important;
  box-shadow:none !important;
}

/* ===== Nowe rozdziały — docelowy układ ===== */
.latest-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  align-items:stretch;
}

.latest-card {
  min-width:0;
  min-height:170px;
  display:grid;
  grid-template-columns:100px minmax(0,1fr);
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:0 8px 22px rgba(184,72,136,.07);
  transition:box-shadow .16s ease, border-color .16s ease;
}

.latest-card:hover {
  transform:none !important;
  box-shadow:0 10px 28px rgba(184,72,136,.11);
}

.latest-cover-link {
  width:100px;
  height:100%;
  min-height:170px;
  padding:0;
  border:0;
  background:#fff;
  overflow:hidden;
  cursor:pointer;
}

.latest-cover-link img {
  width:100px;
  height:100%;
  min-height:170px;
  display:block;
  object-fit:cover;
  object-position:center;
}

.latest-card-content {
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:17px 18px 16px 15px;
}

.latest-title-link {
  align-self:flex-start;
  max-width:100%;
  margin:0 0 7px;
  padding:0;
  border:0;
  background:transparent;
  color:var(--pink-deep);
  font-size:1.05rem;
  line-height:1.2;
  font-weight:950;
  text-align:left;
  cursor:pointer;
}

.latest-title-link:hover {
  color:var(--pink-hot);
}

.latest-title-link:focus,
.latest-title-link:focus-visible,
.latest-cover-link:focus,
.latest-cover-link:focus-visible {
  outline:none;
  box-shadow:none;
}

.latest-chapter-list {
  display:grid;
  gap:1px;
  width:100%;
}

.latest-chapter-link {
  min-height:28px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:5px;
  width:100%;
  margin:0;
  padding:3px 7px;
  border:0;
  border-radius:6px;
  background:transparent;
  color:var(--muted);
  font-size:.9rem;
  line-height:1.25;
  font-weight:800;
  text-align:left;
  cursor:pointer;
  transition:background .14s ease,color .14s ease;
}

.latest-chapter-link span:first-child {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.latest-chapter-link span:last-child {
  flex:0 0 auto;
  color:inherit;
  font-size:inherit;
  font-weight:inherit;
}

.latest-chapter-link:hover {
  background:#fff0f8 !important;
  color:var(--pink-deep) !important;
}

.latest-chapter-link:active {
  background:#ffe1f2 !important;
}

.latest-empty {
  grid-column:1/-1;
  padding:28px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  text-align:center;
  color:var(--muted);
  font-weight:800;
}

@media (max-width:900px) {
  .latest-grid {
    grid-template-columns:1fr;
  }
}

@media (max-width:560px) {
  .latest-card {
    grid-template-columns:88px minmax(0,1fr);
    min-height:150px;
  }

  .latest-cover-link,
  .latest-cover-link img {
    width:88px;
    min-height:150px;
  }

  .latest-card-content {
    padding:13px 12px;
  }

  .latest-title-link {
    font-size:.98rem;
  }

  .latest-chapter-link {
    font-size:.82rem;
    min-height:26px;
  }
}

/* ===== Linki do nowych rozdziałów ===== */
.latest-chapter-link {
  display:flex;
  align-items:center;
  width:100%;
  min-height:32px;
  box-sizing:border-box;
  padding:5px 9px;
  border:1px solid #f2b7d8;
  border-radius:7px;
  background:#fff8fc;
  color:var(--ink);
  text-decoration:none;
  text-decoration-thickness:1px;
  text-underline-offset:2px;
  font-size:.9rem;
  font-weight:800;
  text-align:left;
  cursor:pointer;
  transition:color .15s ease, background-color .15s ease, border-color .15s ease;
}

.latest-chapter-link:hover {
  color:var(--pink-deep) !important;
  background:#fff0f8 !important;
  border-color:#e9a2c9;
}

.latest-chapter-link:focus,
.latest-chapter-link:focus-visible {
  outline:none !important;
  box-shadow:none !important;
}

.latest-chapter-link span {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Discord banner color fallback */
.profile-banner.has-color-banner {
  background: var(--discord-banner-color, #ffd0e9) !important;
  background-image: none !important;
  overflow: hidden;
}
.profile-banner.has-color-banner span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--discord-banner-color, #ffd0e9);
}

.profile-banner.has-color-banner,
.profile-banner.has-color-banner::before,
.profile-banner.has-color-banner::after {
  background-image:none !important;
}
.profile-banner.has-color-banner {
  background-color:var(--discord-banner-color,#ffd0e9) !important;
}

/* Biblioteczka i Tłumaczone tytuły — identyczny rozmiar okładek */
.library-grid .library-item .library-cover,
.profile-translated-section .translated-title-grid .library-item .library-cover {
  width: 100% !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  min-height: 0 !important;
  object-fit: cover !important;
  display: block;
}
.library-grid .library-item,
.profile-translated-section .translated-title-grid .library-item {
  width: 100%;
}

/* Biblioteczka — cały kafelek ma identyczny rozmiar jak w „Tłumaczone tytuły” */
.library-grid .library-item,
.profile-translated-section .translated-title-grid .library-item {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

.library-grid .library-item .library-cover,
.profile-translated-section .translated-title-grid .library-item .library-cover {
  width: 100% !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  min-height: 0 !important;
  object-fit: cover !important;
  display: block !important;
}

.library-grid .library-item h3,
.profile-translated-section .translated-title-grid .library-item h3 {
  min-height: 3.1em;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 1.15rem !important;
  line-height: 1.25;
  padding: 12px !important;
}

/* Biblioteczka = dokładnie ten sam układ kafelków co „Tłumaczone tytuły” */
.library-grid.translated-title-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  gap: 18px !important;
}

.library-grid.translated-title-grid .library-item {
  width: 100% !important;
  min-width: 0 !important;
  display: grid !important;
  grid-template-rows: auto auto !important;
  align-content: start !important;
}

.library-grid.translated-title-grid .library-cover {
  width: 100% !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  min-height: 0 !important;
  object-fit: cover !important;
}

.library-grid.translated-title-grid .library-item h3 {
  min-height: 3.1em !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 12px 10px 15px !important;
  font-size: 1.15rem !important;
  line-height: 1.25 !important;
}

/* FINAL: Biblioteczka uses the exact same card/grid dimensions as Tłumaczone tytuły */
#libraryView .library-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  gap: 18px !important;
}
#libraryView .library-item {
  width: 100% !important;
  min-width: 0 !important;
  display: grid !important;
  grid-template-rows: auto auto !important;
}
#libraryView .library-cover {
  width: 100% !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  min-height: 0 !important;
  object-fit: cover !important;
}
#libraryView .library-item h3 {
  min-height: 3.1em !important;
  margin: 0 !important;
  padding: 12px 10px 15px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.15rem !important;
  line-height: 1.25 !important;
}

/* ===== Final chapter date picker ===== */
.custom-date-picker { position: relative; }
.custom-date-picker .pretty-date-display {
  width: 100%;
  min-height: 50px;
  box-sizing: border-box;
  padding: 12px 52px 12px 15px;
  border: 1px solid #efb6d5;
  border-radius: 13px;
  background: #fffafd;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.custom-date-picker .pretty-date-display:hover {
  border-color: var(--pink);
  background: #fff7fb;
}
.custom-date-picker .pretty-date-display:focus,
.custom-date-picker .pretty-date-display:focus-visible {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(237,116,189,.12);
}
.custom-calendar {
  position: fixed !important;
  z-index: 999999 !important;
  box-sizing: border-box;
  width: min(330px, calc(100vw - 32px)) !important;
  padding: 14px !important;
  border: 1px solid #edb4d3 !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 22px 55px rgba(78,35,65,.22) !important;
}
.custom-calendar-head {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 38px;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.custom-calendar-head strong {
  text-align: center;
  color: var(--ink);
  font-size: .98rem;
  font-weight: 950;
  text-transform: capitalize;
}
.custom-calendar-head button {
  width: 38px;
  height: 38px;
  min-height: 38px !important;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border: 1px solid #f0c1da !important;
  border-radius: 10px !important;
  background: #fff4fa !important;
  color: var(--pink-deep) !important;
  font-size: 1.35rem;
  line-height: 1;
}
.custom-calendar-head button:hover {
  background: #ffe2f1 !important;
  border-color: var(--pink) !important;
}
.custom-calendar-week,
.custom-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  gap: 4px;
}
.custom-calendar-week {
  margin-bottom: 5px;
}
.custom-calendar-week span {
  padding: 5px 0;
  color: var(--muted);
  text-align: center;
  font-size: .72rem;
  font-weight: 950;
}
.calendar-day {
  min-height: 35px;
  padding: 0;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--ink) !important;
  font: inherit;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
}
.calendar-day:hover {
  background: #ffe5f2 !important;
  color: var(--pink-deep) !important;
}
.calendar-day.is-selected {
  background: var(--pink) !important;
  color: #fff !important;
  box-shadow: 0 5px 12px rgba(237,116,189,.25);
}
.calendar-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 2px var(--pink);
  color: var(--pink-deep) !important;
}
.calendar-day.is-muted {
  color: #c8aabd !important;
}
.custom-calendar-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f5dce9;
}
.custom-calendar-foot button {
  min-height: 34px !important;
  padding: 6px 11px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: #fff0f8 !important;
  color: var(--pink-deep) !important;
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
}
.custom-calendar-foot button:hover {
  background: #ffddec !important;
}

/* =========================================================
   FINAL CHAPTER DATE PICKER
   ========================================================= */
.custom-date-picker {
  position: relative !important;
  width: 100%;
}

.custom-date-picker .pretty-date-display {
  width: 100% !important;
  height: 50px !important;
  min-height: 50px !important;
  padding: 0 52px 0 15px !important;
  border: 1px solid #efb6d5 !important;
  border-radius: 13px !important;
  background: #fffafd !important;
  color: #171116 !important;
  font: inherit !important;
  font-weight: 850 !important;
  cursor: pointer !important;
  outline: none !important;
}

.custom-date-picker .pretty-date-display:hover {
  border-color: #ed74bd !important;
  background: #fff6fb !important;
}

.custom-date-picker .pretty-date-display:focus,
.custom-date-picker .pretty-date-display:focus-visible {
  outline: none !important;
  border-color: #ed74bd !important;
  box-shadow: 0 0 0 3px rgba(237,116,189,.12) !important;
}

.custom-date-picker .date-picker-toggle {
  position: absolute !important;
  right: 7px !important;
  top: 7px !important;
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #b84888 !important;
}

.custom-date-picker .date-picker-toggle:hover {
  background: #ffe5f2 !important;
}

.custom-date-picker .date-picker-toggle svg {
  width: 20px !important;
  height: 20px !important;
}

/* The calendar is portaled to <body> while open. */
.custom-calendar {
  position: fixed !important;
  z-index: 2147483647 !important;
  box-sizing: border-box !important;
  width: 330px !important;
  max-width: calc(100vw - 24px) !important;
  padding: 15px !important;
  border: 1px solid #efb6d5 !important;
  border-radius: 18px !important;
  background: #ffffff !important;
  box-shadow: 0 22px 55px rgba(78,35,65,.24) !important;
  color: #171116 !important;
}

.custom-calendar.is-hidden {
  display: none !important;
}

.custom-calendar-head {
  display: grid !important;
  grid-template-columns: 38px minmax(0,1fr) 38px !important;
  align-items: center !important;
  gap: 7px !important;
  margin: 0 0 12px !important;
}

.custom-calendar-head strong {
  text-align: center !important;
  color: #171116 !important;
  font-size: .98rem !important;
  font-weight: 950 !important;
  text-transform: capitalize !important;
}

.custom-calendar-head button {
  width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  border: 1px solid #f0c1da !important;
  border-radius: 10px !important;
  background: #fff2f9 !important;
  color: #b84888 !important;
  font-size: 1.35rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.custom-calendar-head button:hover {
  background: #ffddec !important;
  border-color: #ed74bd !important;
}

.custom-calendar-week,
.custom-calendar-grid {
  display: grid !important;
  grid-template-columns: repeat(7,minmax(0,1fr)) !important;
  gap: 4px !important;
}

.custom-calendar-week {
  margin: 0 0 5px !important;
}

.custom-calendar-week span {
  padding: 5px 0 !important;
  color: #8c647b !important;
  text-align: center !important;
  font-size: .72rem !important;
  font-weight: 950 !important;
}

.custom-calendar-grid .calendar-day {
  width: 100% !important;
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #171116 !important;
  font: inherit !important;
  font-size: .84rem !important;
  font-weight: 800 !important;
}

.custom-calendar-grid .calendar-day:hover {
  background: #ffe5f2 !important;
  color: #b84888 !important;
}

.custom-calendar-grid .calendar-day.is-selected {
  background: #ed74bd !important;
  color: #ffffff !important;
  box-shadow: 0 5px 12px rgba(237,116,189,.25) !important;
}

.custom-calendar-grid .calendar-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 2px #ed74bd !important;
  color: #b84888 !important;
}

.custom-calendar-grid .calendar-day.is-muted {
  color: #c8aabd !important;
}

.custom-calendar-foot {
  display: flex !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin: 12px 0 0 !important;
  padding-top: 10px !important;
  border-top: 1px solid #f5dce9 !important;
}

.custom-calendar-foot button {
  min-height: 34px !important;
  padding: 6px 11px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: #fff0f8 !important;
  color: #b84888 !important;
  font: inherit !important;
  font-size: .82rem !important;
  font-weight: 900 !important;
}

.custom-calendar-foot button:hover {
  background: #ffddec !important;
}

/* No decorative circle in the page background */
body {
  background: linear-gradient(180deg, #fffafd 0%, var(--bg) 46%, #fff1fa 100%) !important;
}

/* Add-title only: visually matches the existing inline title editor */
#addTitleView .add-title-heading { margin-bottom:22px; }
#addTitleView .add-title-heading h1 { margin-bottom:6px; }
#addTitleView .add-title-editor {
  max-width:1120px;
  margin:0 auto;
  padding:26px;
  border:1px solid var(--line);
  border-radius:20px;
  background:rgba(255,255,255,.97);
  box-shadow:0 18px 50px rgba(87,34,70,.09);
}
#addTitleView .add-title-editor .people-editor-section {
  padding:20px;
  margin-top:20px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fffafd;
}
#addTitleView .add-title-editor .media-preview {
  position:relative;
  overflow:hidden;
}
#addTitleView .add-title-editor .media-preview img {
  width:100%;
  height:100%;
  object-fit:cover;
}
#addTitleView .add-title-editor .media-preview img:not(.is-visible) {
  display:none;
}
#addTitleView .add-title-editor .media-preview-empty {
  display:flex;
  min-height:100%;
  align-items:center;
  justify-content:center;
  padding:20px;
  color:var(--muted);
  text-align:center;
  font-weight:800;
}
#addTitleView .add-title-editor .person-editor-row {
  grid-template-columns:minmax(0,1fr) minmax(0,1.25fr) 150px 40px;
}
#addTitleView .add-title-editor .inline-editor-actions {
  position:sticky;
  bottom:0;
  z-index:3;
  margin:20px -26px -26px;
  padding:16px 26px;
  border-top:1px solid var(--line);
  border-radius:0 0 20px 20px;
  background:rgba(255,255,255,.97);
  display:flex;
  justify-content:flex-end;
}
@media (max-width:760px) {
  #addTitleView .add-title-editor { padding:18px; }
  #addTitleView .add-title-editor .person-editor-row { grid-template-columns:1fr; }
  #addTitleView .add-title-editor .inline-editor-actions {
    margin:20px -18px -18px;
    padding:14px 18px;
  }
}

.add-editor-by-id {
  display:flex;
  gap:10px;
  align-items:center;
  margin:14px 0 8px;
}
.add-editor-by-id input { flex:1; min-width:0; }
#newTitleEditorByIdMessage { min-height:20px; margin-bottom:8px; }
