/* ===== kitobdagimen.uz — dizayn tizimi ===== */
:root {
    --primary: #1B4D3E;
    --primary-soft: rgba(27, 77, 62, 0.08);
    --accent: #E8703A;
    --accent-dark: #d2602d;
    --bg: #FAF6EE;
    --surface: #FFFDF8;
    --text: #1F2A24;
    --text-secondary: #6B7568;
    --border: #E5DFD0;
    --danger: #ba1a1a;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 9999px;
    --shadow: 0 4px 20px rgba(27, 77, 62, 0.07);
    --shadow-lg: 0 8px 30px rgba(27, 77, 62, 0.12);
    --navbar-h: 72px;
    --maxw: 1100px;
    --serif: "Lora", Georgia, "Times New Roman", serif;
    --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
/* Navbar havolalari bosilganda bo'limlar tepada biroz nafas oladigan joy bilan to'xtaydi */
#imkoniyatlar, #qanday, #savol { scroll-margin-top: 24px; }

/* ===== Sahifa yuklanish loaderi ===== */
.page-loader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    transition: opacity .4s ease, visibility .4s ease;
}
.page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loader-box { position: relative; width: 72px; height: 72px; display: grid; place-items: center; }
.page-loader-logo { width: 34px; height: 34px; animation: pl-pulse 1.4s ease-in-out infinite; }
.page-loader-ring {
    position: absolute; inset: 0;
    border: 3px solid var(--primary-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pl-spin .8s linear infinite;
}
@keyframes pl-spin { to { transform: rotate(360deg); } }
@keyframes pl-pulse { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .page-loader-ring { animation-duration: 1.6s; }
    .page-loader-logo { animation: none; opacity: 1; transform: none; }
}

body {
    font-family: var(--sans);
    background-color: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--primary); margin: 0 0 .5rem; line-height: 1.25; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
}

/* ===== Layout helpers ===== */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
/* Faqat vertikal padding — chap/o'ng bo'shliq `.container` dan keladi (header bilan bir xil 24px).
   Shorthand ishlatilsa `.container` ning gorizontal paddingini bekor qilib, bo'shliqni yo'qotadi. */
.page { padding-top: 32px; padding-bottom: 64px; }
.muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ===== Navbar ===== */
.navbar {
    height: var(--navbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.navbar-inner {
    height: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px; min-width: 0;
    font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--primary); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
/* Tor ekranda navbar hech qachon toshib ketmasligi uchun nom matni qisqaradi (ellipsis) */
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 15px;
}
.nav-links a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav-msg-link { position: relative; }
.nav-msg-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px;
    border-radius: 999px; background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle;
}
.nav-msg-badge[hidden] { display: none; }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-pill);
    background: transparent; border: none; color: var(--text-secondary); cursor: pointer;
}
.nav-icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.avatar {
    width: 40px; height: 40px; border-radius: var(--radius-pill);
    object-fit: cover; background: var(--primary-soft);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--primary); font-weight: 700; border: 1px solid var(--border);
}
.avatar.sm { width: 32px; height: 32px; font-size: 14px; }
.avatar.lg { width: 96px; height: 96px; font-size: 36px; }
.burger { display: none; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--sans); font-weight: 600; font-size: 15px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #163f33; color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(186,26,26,.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-icon { padding: 10px; line-height: 0; }
.btn-icon.btn-sm { padding: 7px; }
.btn-icon svg { width: 20px; height: 20px; display: block; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ===== Cards & forms ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.card + .card { margin-top: 20px; }

label { font-weight: 600; font-size: 14px; color: var(--text); display: block; margin-bottom: 6px; }
.input, textarea.input, select.input {
    width: 100%; padding: 11px 14px; font-family: var(--sans); font-size: 15px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus, select.input:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea.input { resize: vertical; min-height: 90px; }
.field + .field { margin-top: 16px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 4px; }
.form-error { background: rgba(186,26,26,.08); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: var(--radius-pill); padding: 3px 10px; font-size: 13px; font-weight: 600;
}
.badge-accent { background: rgba(232,112,58,.12); color: var(--accent-dark); }

/* Asoschi (founder) — oltin nishon, faqat platforma asoschisi uchun. Hamma ko'radi. */
.founder-badge {
    background: linear-gradient(135deg, #f7cf5a, #e3a128);
    color: #4a2e00; font-size: 12px; padding: 2px 9px; vertical-align: middle;
    box-shadow: 0 1px 3px rgba(199,142,20,.4);
}
.founder-badge .material-symbols-outlined { font-size: 15px; line-height: 1; }
.founder-badge-mini {
    color: #e3a128; font-size: 16px; vertical-align: middle;
    font-variation-settings: 'FILL' 1; margin-left: 2px;
}

/* ===== Pagination ===== */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }

/* ===== Landing ===== */
.landing {
    min-height: calc(100vh - 0px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 100px 100px; background-position: center;
}
.landing-card {
    width: 100%; max-width: 440px; text-align: center;
    background: rgba(255, 253, 248, 0.9); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 48px 40px;
}
.landing-card h1 { font-size: 40px; letter-spacing: -.02em; }
.landing-card .lead { color: var(--text-secondary); font-size: 18px; margin-bottom: 32px; }
.google-btn {
    width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 20px; font-weight: 600; color: var(--primary); cursor: pointer;
}
.google-btn:hover { background: var(--primary-soft); text-decoration: none; }
.landing-card .terms { color: var(--text-secondary); font-size: 12px; margin-top: 28px; opacity: .85; }

/* ===== Landing page (informational) ===== */
.lp {
    max-width: var(--maxw); margin: 0 auto; padding: 0 24px 64px;
}
.lp-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; height: var(--navbar-h);
}
.lp-nav-links { display: flex; align-items: center; gap: 22px; }
.lp-nav-links a { color: var(--text-secondary); font-weight: 600; font-size: 15px; }
.lp-nav-links a:hover { color: var(--primary); text-decoration: none; }
.lp-nav-links a.btn { color: #fff; }

.lp-alert {
    max-width: 560px; margin: 8px auto 0; padding: 12px 18px;
    background: rgba(186,26,26,.08); color: var(--danger);
    border-radius: var(--radius-sm); font-size: 14px; text-align: center;
}

.lp-hero {
    text-align: center; max-width: 760px; margin: 0 auto;
    padding: 56px 0 64px;
}
.lp-eyebrow {
    display: inline-block; padding: 6px 16px; margin-bottom: 20px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: var(--radius-pill); font-weight: 600; font-size: 14px;
}
.lp-hero h1 { font-size: 52px; letter-spacing: -.02em; line-height: 1.1; }
.lp-sub { color: var(--text-secondary); font-size: 19px; margin: 20px auto 0; max-width: 620px; }
.lp-hero-actions { display: flex; justify-content: center; margin-top: 32px; }
.lp-google { width: auto; padding: 13px 28px; box-shadow: var(--shadow); }
.lp-terms { color: var(--text-secondary); font-size: 12px; margin-top: 18px; opacity: .85; }

.lp-section { padding: 56px 0; }
.lp-section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.lp-section-head h2 { font-size: 34px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-grid-3 { grid-template-columns: repeat(3, 1fr); }
.lp-feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px 24px; transition: box-shadow .2s, transform .2s;
}
.lp-feature:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.lp-feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: var(--radius-sm);
    background: var(--primary-soft); color: var(--primary); margin-bottom: 16px;
}
.lp-feature-icon .material-symbols-outlined { font-size: 28px; }
.lp-feature h3 { font-size: 20px; }
.lp-feature p { color: var(--text-secondary); margin: 6px 0 0; }

.lp-steps { background: var(--primary-soft); border-radius: var(--radius); margin-top: 32px; }
.lp-step { text-align: center; padding: 16px; }
.lp-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: var(--radius-pill);
    background: var(--accent); color: #fff; font-family: var(--serif);
    font-weight: 700; font-size: 22px; margin-bottom: 14px;
}
.lp-step h3 { font-size: 20px; }
.lp-step p { color: var(--text-secondary); margin: 6px 0 0; }

.lp-cta {
    text-align: center; background: var(--primary); color: #fff;
    border-radius: var(--radius); padding: 56px 32px; margin: 56px 0 0;
}
.lp-cta h2 { color: #fff; font-size: 32px; }
.lp-cta p { color: rgba(255,255,255,.85); font-size: 18px; margin: 8px 0 28px; }

/* Hero ikkilamchi tugma + ishonch qatori */
.lp-hero-actions { gap: 14px; flex-wrap: wrap; }
.lp-cta-btn, .lp-secondary-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 26px; font-size: 15px; box-shadow: var(--shadow);
}
.lp-cta-btn .material-symbols-outlined { font-size: 20px; }
.lp-secondary-btn { box-shadow: none; }
.lp-trust {
    list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
    gap: 12px 26px; margin: 28px 0 0; padding: 0;
}
.lp-trust li {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--text-secondary); font-weight: 600; font-size: 14px;
}
.lp-trust .material-symbols-outlined { font-size: 19px; color: var(--primary); }

/* Showcase — alternativ imkoniyat kartalari */
.lp-showcase {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
.lp-show-card {
    display: flex; align-items: flex-start; gap: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    transition: box-shadow .2s, transform .2s;
}
.lp-show-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.lp-show-icon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; border-radius: var(--radius-sm);
    background: var(--accent-soft, var(--primary-soft)); color: var(--accent);
}
.lp-show-icon .material-symbols-outlined { font-size: 30px; }
.lp-show-card h3 { font-size: 19px; }
.lp-show-card p { color: var(--text-secondary); margin: 6px 0 0; }

/* FAQ — yig'iladigan savollar */
.lp-faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.lp-faq-item {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 20px;
}
.lp-faq-item summary {
    cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; font-size: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-item summary::after {
    content: "add"; font-family: 'Material Symbols Outlined'; font-size: 22px;
    color: var(--primary); transition: transform .2s; flex: 0 0 auto;
}
.lp-faq-item[open] summary::after { content: "remove"; }
.lp-faq-item p { color: var(--text-secondary); margin: 0 0 16px; line-height: 1.6; }

.lp-cta-btn-lg { display: inline-block; padding: 14px 36px; font-size: 16px; }

.lp-footer {
    display: grid; grid-template-columns: 1.4fr 1fr; align-items: start;
    gap: 24px; padding-top: 40px; margin-top: 56px;
    border-top: 1px solid var(--border);
}
.lp-footer-brand .brand { margin-bottom: 10px; }
.lp-footer-brand .muted { font-size: 14px; max-width: 320px; }
.lp-footer-links {
    display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: flex-end;
}
.lp-footer-links a { color: var(--text-secondary); font-weight: 600; font-size: 14px; }
.lp-footer-links a:hover { color: var(--primary); text-decoration: none; }
.lp-copy { grid-column: 1 / -1; font-size: 13px; margin: 4px 0 0; }

/* ===== Landing — moslashuvchanlik (1024 / 768 / 480 / 360) ===== */
@media (max-width: 1024px) {
    .lp-hero h1 { font-size: 44px; }
    .lp-sub { font-size: 18px; }
    .lp-section-head h2, .lp-cta h2 { font-size: 30px; }
    .lp-showcase { gap: 16px; }
}
@media (max-width: 768px) {
    .lp { padding: 0 16px 56px; }
    .lp-nav-links { gap: 16px; }
    .lp-nav-links a:not(.btn) { display: none; }
    .lp-hero { padding: 40px 0 48px; }
    .lp-hero h1 { font-size: 36px; }
    .lp-eyebrow { font-size: 13px; }
    .lp-sub { font-size: 16.5px; }
    .lp-section { padding: 44px 0; }
    .lp-section-head { margin-bottom: 32px; }
    .lp-section-head h2 { font-size: 27px; }
    .lp-grid, .lp-grid-3, .lp-showcase { grid-template-columns: 1fr; }
    .lp-feature { padding: 24px 20px; }
    .lp-feature h3, .lp-show-card h3, .lp-step h3 { font-size: 18px; }
    .lp-cta { padding: 44px 24px; margin-top: 44px; }
    .lp-cta h2 { font-size: 26px; }
    .lp-cta p { font-size: 16.5px; }
    .lp-footer { grid-template-columns: 1fr; gap: 16px; }
    .lp-footer-links { justify-content: flex-start; }
}
@media (max-width: 480px) {
    .lp { padding: 0 16px 48px; }
    .lp-hero { padding: 32px 0 40px; }
    .lp-hero h1 { font-size: 29px; }
    .lp-eyebrow { font-size: 12.5px; padding: 5px 14px; margin-bottom: 16px; }
    .lp-sub { font-size: 15.5px; margin-top: 16px; }
    .lp-hero-actions { flex-direction: column; align-items: stretch; }
    .lp-google, .lp-cta-btn, .lp-secondary-btn { width: 100%; justify-content: center; }
    .lp-trust { gap: 10px 18px; margin-top: 22px; }
    .lp-trust li { font-size: 13px; }
    .lp-section { padding: 36px 0; }
    .lp-section-head h2 { font-size: 24px; }
    .lp-section-head .muted { font-size: 14px; }
    .lp-feature-icon, .lp-show-icon { width: 48px; height: 48px; }
    .lp-feature-icon .material-symbols-outlined { font-size: 26px; }
    .lp-show-icon .material-symbols-outlined { font-size: 27px; }
    .lp-feature p, .lp-show-card p, .lp-step p { font-size: 14.5px; }
    .lp-show-card { padding: 20px; gap: 14px; }
    .lp-faq-item summary { font-size: 15px; }
    .lp-faq-item p { font-size: 14.5px; }
    .lp-cta { padding: 40px 20px; }
    .lp-cta h2 { font-size: 23px; }
    .lp-cta-btn-lg { width: 100%; padding: 14px 24px; }
}
@media (max-width: 360px) {
    .lp-hero h1 { font-size: 26px; }
    .lp-sub { font-size: 15px; }
    .lp-section-head h2 { font-size: 22px; }
    .lp-feature h3, .lp-show-card h3, .lp-step h3 { font-size: 17px; }
    .lp-cta h2 { font-size: 21px; }
}

/* ===== Landing — qo'llanma promo bloki ===== */
.lp-guide-promo-inner {
    display: flex; align-items: center; gap: 24px;
    background: var(--primary-soft); border-radius: var(--radius);
    padding: 32px 36px;
}
.lp-guide-promo-icon {
    flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%;
    background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
    color: var(--primary);
}
.lp-guide-promo-icon .material-symbols-outlined { font-size: 32px; }
.lp-guide-promo-text { flex: 1 1 auto; }
.lp-guide-promo-text h2 { font-size: 26px; }
.lp-guide-promo-text p { color: var(--text-secondary); margin: 8px 0 0; line-height: 1.6; }
.lp-guide-promo .lp-cta-btn { flex: 0 0 auto; }
@media (max-width: 768px) {
    .lp-guide-promo-inner { flex-direction: column; text-align: center; padding: 28px 24px; }
    .lp-guide-promo-text h2 { font-size: 22px; }
    .lp-guide-promo .lp-cta-btn { width: 100%; justify-content: center; }
}

/* ===== Qo'llanma sahifasi ===== */
.guide-hero { padding: 48px 0 32px; }
.guide-toc {
    max-width: 760px; margin: 0 auto; padding: 24px 28px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.guide-toc h2 { font-size: 20px; margin-bottom: 14px; }
.guide-toc ol { margin: 0; padding-left: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.guide-toc li { line-height: 1.5; }
.guide-toc a { color: var(--text-secondary); font-weight: 600; font-size: 15px; }
.guide-toc a:hover { color: var(--primary); }

.guide-body { max-width: 820px; margin: 8px auto 0; }
.guide-step {
    display: flex; gap: 20px; padding: 32px 0;
    border-bottom: 1px solid var(--border); scroll-margin-top: 24px;
}
.guide-step:last-child { border-bottom: none; }
.guide-step-num {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 18px;
    display: inline-flex; align-items: center; justify-content: center;
}
.guide-step-content { flex: 1 1 auto; min-width: 0; }
.guide-step-content h2 { font-size: 24px; margin-bottom: 10px; }
.guide-step-content > p { color: var(--text-secondary); line-height: 1.7; }
.guide-list { margin: 14px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.guide-list li {
    position: relative; padding-left: 28px; color: var(--text-secondary); line-height: 1.6;
}
.guide-list li::before {
    content: "check_circle"; font-family: 'Material Symbols Outlined'; font-size: 18px;
    color: var(--primary); position: absolute; left: 0; top: 1px;
}
.guide-list li strong { color: var(--text); }
.guide-inline-icon { font-size: 18px; vertical-align: -3px; color: var(--primary); }
.guide-tip {
    display: flex; align-items: flex-start; gap: 10px; margin-top: 16px;
    padding: 12px 16px; background: var(--primary-soft); border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 14.5px; line-height: 1.6;
}
.guide-tip .material-symbols-outlined { font-size: 20px; color: var(--primary); flex: 0 0 auto; }
.guide-cta { margin-top: 40px; }

@media (max-width: 768px) {
    .guide-hero h1 { font-size: 32px; }
    .guide-toc ol { grid-template-columns: 1fr; }
    .guide-step-content h2 { font-size: 21px; }
}
@media (max-width: 480px) {
    .guide-toc { padding: 20px; }
    .guide-toc a { font-size: 14px; }
    .guide-step { gap: 14px; padding: 24px 0; }
    .guide-step-num { width: 38px; height: 38px; font-size: 16px; }
    .guide-step-content h2 { font-size: 19px; }
    .guide-step-content > p, .guide-list li { font-size: 15px; }
    .guide-tip { font-size: 14px; }
}

/* ===== Onboarding — genre grid ===== */
.onboarding { max-width: 880px; margin: 0 auto; padding: 48px 24px 80px; }
.onboarding-head { text-align: center; margin-bottom: 40px; }
.onboarding-head h1 { font-size: 32px; }
.onboarding-warning {
    display: flex; align-items: center; gap: 10px;
    max-width: 560px; margin: 0 auto 24px; padding: 14px 18px;
    background: #fff8e6; border: 1px solid #f0d27a; border-radius: var(--radius);
    color: #8a6d1a; font-weight: 600;
}
.onboarding-warning .material-symbols-outlined { font-size: 22px; color: #c79a16; }
.genre-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.genre-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; height: 140px; padding: 16px; cursor: pointer; text-align: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    transition: all .2s ease; user-select: none;
}
.genre-card .material-symbols-outlined { font-size: 36px; color: rgba(27,77,62,.55); transition: color .2s; }
.genre-card .genre-name { font-family: var(--serif); font-weight: 600; color: rgba(27,77,62,.85); }
.genre-card:hover { border-color: rgba(27,77,62,.3); box-shadow: var(--shadow); }
.genre-card input { position: absolute; opacity: 0; pointer-events: none; }
.genre-card.selected { border: 2px solid var(--accent); box-shadow: var(--shadow); transform: scale(1.02); }
.genre-card.selected .material-symbols-outlined { color: var(--accent); }
.genre-card.selected .genre-name { color: var(--primary); }

/* ===== Feed / posts ===== */
.feed { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

/* Cheksiz skroll: yuklash indikatori + karta kirish animatsiyasi */
.infinite-loader { display: flex; justify-content: center; padding: 8px 0 20px; }
/* `hidden` atributi `display:flex` dan kuchli bo'lishi uchun — aks holda spinner doim ko'rinadi */
.infinite-loader[hidden] { display: none; }
.infinite-loader .spinner {
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid rgba(27, 77, 62, 0.16);
    border-top-color: var(--primary);
    animation: infiniteSpin 0.7s linear infinite;
}
@keyframes infiniteSpin { to { transform: rotate(360deg); } }

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
.card-enter { animation: cardEnter 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

@media (prefers-reduced-motion: reduce) {
    .card-enter { animation: none; }
    .infinite-loader .spinner { animation-duration: 1.4s; }
}

/* Composer */
.composer { padding: 20px 24px; }
.composer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.composer-head h3 { margin: 0; font-size: 18px; }
.composer-book { display: flex; gap: 8px; align-items: center; }
.composer-book .input { flex: 1; }
.composer-book-toggle {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    background: var(--primary-soft); color: var(--primary); font-weight: 600;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; cursor: pointer;
}
.composer-book-toggle:hover { background: var(--primary); color: #fff; }
.composer-book-toggle .material-symbols-outlined { font-size: 20px; }
.composer-newbook { margin-top: 12px; padding: 14px; background: var(--primary-soft); border-radius: var(--radius-sm); }
/* Composer ichidagi barcha bo'limlar orasiga yagona oraliq */
#quoteForm > * + * { margin-top: 16px; }
.nb-cover { display: flex; gap: 12px; align-items: center; }
.nb-cover-preview {
    width: 64px; height: 88px; flex: 0 0 auto;
    border-radius: var(--radius-sm); overflow: hidden;
    background: var(--bg); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.nb-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.nb-cover-preview .material-symbols-outlined { font-size: 28px; color: var(--text-secondary); }
.nb-cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.composer-selected {
    display: flex; align-items: center; gap: 10px;
    background: var(--primary-soft); color: var(--primary); font-weight: 600;
    border-radius: var(--radius-sm); padding: 10px 14px;
}
/* [hidden] atributi display: flex ni yenga olmaydi — shu sabab kitob tanlanmaganda
   bo'sh "tanlangan kitob" chipi ko'rinib qolardi (book iconli ikkinchi element). */
.composer-selected[hidden] { display: none; }
.composer-selected .material-symbols-outlined { font-size: 20px; }
.composer-selected span:nth-child(2) { flex: 1; }
.composer-clear {
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-secondary);
    cursor: pointer; border-radius: var(--radius-pill); width: 28px; height: 28px;
}
.composer-clear:hover { background: rgba(27,77,62,.12); color: var(--primary); }
.composer textarea { margin-top: 12px; margin-bottom: 12px; min-height: 70px; }

/* ===== Rich text muharriri (post composer + tahrirlash) ===== */
.rich-editor { margin: 12px 0; }
.composer .rich-editor { margin-top: 12px; margin-bottom: 12px; }
.rich-toolbar {
    display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
    padding: 6px 8px; background: var(--primary-soft);
    border: 1px solid var(--border); border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rich-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; border: none; background: transparent;
    border-radius: 8px; color: var(--text-secondary); cursor: pointer;
    transition: background .15s, color .15s;
}
.rich-btn .material-symbols-outlined { font-size: 20px; }
.rich-btn:hover { background: rgba(27,77,62,.12); color: var(--primary); }
.rich-btn.active { background: var(--primary); color: #fff; }
.rich-btn-mark:hover, .rich-btn-mark.active { background: rgba(232,112,58,.16); color: var(--accent); }
.rich-sep { width: 1px; align-self: stretch; margin: 4px 6px; background: var(--border); }
.rich-content {
    min-height: 84px; padding: 12px 14px; font-family: var(--sans); font-size: 15px;
    line-height: 1.6; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    outline: none; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
    transition: border-color .15s, box-shadow .15s;
}
.rich-editor:focus-within .rich-content { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rich-editor:focus-within .rich-toolbar { border-color: var(--primary); }
.rich-content.is-empty::before {
    content: attr(data-placeholder); color: var(--text-secondary); pointer-events: none;
}
.rich-content b, .rich-content strong { font-weight: 700; }
.rich-counter {
    margin-top: 4px; text-align: right; font-size: 12px; color: var(--text-secondary);
}
.rich-counter-invalid { color: var(--accent); font-weight: 600; }

/* Marker (highlighter) — composer va chiqarilgan post matnida bir xil ko'rinish */
.rich-content mark, .post-text mark, .pd-review mark, .story-detail-text mark {
    background: linear-gradient(transparent 18%, rgba(232,112,58,.34) 18%, rgba(232,112,58,.34) 92%, transparent 92%);
    color: inherit; border-radius: 2px; padding: 0 .5px; box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.post-text b, .pd-review b { font-weight: 700; }
.composer-image-picker { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.composer-image-preview {
    position: relative; width: 100%; max-height: min(280px, 32vh);
    border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border);
}
.composer-image-preview img { width: 100%; max-height: min(280px, 32vh); object-fit: cover; display: block; }
.composer-image-remove {
    position: absolute; top: 8px; right: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-pill);
    border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.composer-image-remove:hover { background: rgba(0,0,0,.75); }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Avatar editor (profile edit) */
.avatar-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-edit-preview {
    width: 96px; height: 96px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
}
.avatar-edit-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit-fallback { font-size: 40px; font-weight: 600; color: var(--primary); }
.avatar-edit-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 200px; }
.avatar-edit-hint { margin: 0; font-size: 13px; }
.book-suggestions { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 6px; overflow: hidden; }
.book-suggestions div { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.book-suggestions div:hover { background: var(--primary-soft); }

/* Empty state */
.empty-state { text-align: center; color: var(--text-secondary); padding: 48px 24px; }
.empty-state .material-symbols-outlined { font-size: 48px; color: rgba(27,77,62,.4); display: block; margin: 0 auto 12px; }
.empty-state p { margin: 0; }

/* Post card */
.post-card { padding: 0; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.post-head .meta { line-height: 1.2; min-width: 0; }
.post-head .name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-head .name { font-weight: 600; color: var(--text); }
.post-head .name:hover { color: var(--primary); }
.post-head .time { font-size: 13px; color: var(--text-secondary); }
.post-follow-btn { margin-left: auto; flex-shrink: 0; }
.badge-author { background: rgba(232,112,58,.16); color: var(--accent-dark); font-size: 12px; padding: 2px 9px; }

.post-body { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 20px; color: inherit; }
.post-body:hover { text-decoration: none; background: rgba(27,77,62,.02); }
.post-cover {
    aspect-ratio: 2 / 3; border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border); background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-cover .material-symbols-outlined { font-size: 40px; color: rgba(27,77,62,.45); }
.post-body-main { min-width: 0; }
.post-book-title { font-size: 20px; margin: 0 0 2px; color: var(--primary); }
.post-book-author { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; }
.post-text {
    color: var(--text); white-space: pre-wrap; word-break: break-word; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

.post-image-wrap {
    display: flex; align-items: center; justify-content: center;
    border-top: 1px solid var(--border); background: var(--primary-soft);
    max-height: 480px; overflow: hidden;
}
.post-image-wrap[hidden] { display: none; }
.post-image { width: 100%; max-height: 480px; object-fit: contain; display: block; }

.post-actions {
    display: flex; gap: 6px; padding: 12px 20px;
    border-top: 1px solid var(--border); background: var(--primary-soft);
}
.action-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: none; background: transparent; color: var(--text-secondary);
    border-radius: var(--radius-pill); cursor: pointer; font-size: 14px; font-weight: 600;
    text-decoration: none;
}
.action-btn:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.action-btn.liked { color: var(--accent); }
.action-btn.liked .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.action-static { cursor: default; }
.action-static:hover { background: transparent; color: var(--text-secondary); }
.action-btn .material-symbols-outlined { font-size: 20px; }
.action-btn.danger:hover { background: rgba(186,26,26,.08); color: var(--danger); }
.post-actions-end { margin-left: auto; display: flex; gap: 6px; }

/* Post tahrirlash paneli — [hidden] atributi orqali ko'rinish/tahrir almashinadi (site.js) */
.post-edit-panel { padding: 20px; }
.post-edit-panel textarea { min-height: 90px; margin-bottom: 12px; }
.post-edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* Anonim (ro'yxatdan o'tmagan) tashrif buyuruvchilar uchun chaqiruv banneri */
.anon-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 14px 20px; margin-bottom: 20px; border-radius: var(--radius);
    background: #E3EEE8; color: var(--primary); border: 1px solid rgba(27, 77, 62, 0.14);
}
.anon-banner .brand { font-weight: 700; font-size: 18px; color: var(--primary); text-decoration: none; }
.anon-banner p { margin: 0; font-size: 14px; color: var(--primary); opacity: .82; }
.anon-banner .btn-accent { flex-shrink: 0; }

/* ===== Comments (chat-bubble style) ===== */
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.comment .bubble {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    border-top-left-radius: 4px; padding: 10px 14px; max-width: 100%;
}
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment .name { font-weight: 600; font-size: 14px; }
.comment .text { font-size: 14px; line-height: 1.5; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.comment-delete {
    margin-left: auto; border: none; background: none; cursor: pointer;
    color: var(--text-secondary); padding: 2px; line-height: 0; flex-shrink: 0;
    border-radius: var(--radius-sm); transition: color .15s, background .15s;
}
.comment-delete:hover { color: var(--danger, #dc2626); background: rgba(0,0,0,.08); }
.comment-delete .material-symbols-outlined { font-size: 18px; }
.comment-footer { display: flex; align-items: center; gap: 12px; margin-top: 5px; padding-left: 2px; }
.comment-footer .time { font-size: 12px; color: var(--text-secondary); opacity: .8; }
.comment-reply-btn { border: none; background: none; cursor: pointer; padding: 0; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.comment-reply-btn:hover { color: var(--accent); }
/* Javoblar "arxitektura" thread chizig'i — har bir javob ona izohga elbow (L-shakl)
   ulagich orqali bog'lanadi, shu bilan kim kimga javob berayotgani aniq ko'rinadi. */
.comment .replies { margin-top: 12px; padding-left: 28px; display: flex; flex-direction: column; gap: 16px; }
.comment .replies > .comment { position: relative; }
.comment .replies > .comment::before {
    content: ""; position: absolute; left: -20px; top: -16px; width: 18px; height: 32px;
    border-left: 2px solid rgba(27, 77, 62, .20);
    border-bottom: 2px solid rgba(27, 77, 62, .20);
    border-bottom-left-radius: 12px;
}
.comment .replies:empty { display: none; margin: 0; padding: 0; }
.comment-reply-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-reply-form textarea { flex: 1; min-height: 56px; }

/* Post muallifining izohi — teskari joylashuv (chap o'rniga o'ng), ajratib turuvchi rang.
   `> .body >` bilan SCOPE qilingan — aks holda muallif izohiga BERILGAN javoblarning
   (ichki `.replies`) matni ham oqarib, peach (#fdeee5) fonda o'qilmay qolardi. */
.comment.comment-author { flex-direction: row-reverse; }
.comment.comment-author > .body > .bubble {
    background: var(--primary); border-color: var(--primary); color: #fff;
    border-top-left-radius: var(--radius-sm); border-top-right-radius: 4px;
    align-self: flex-end;
}
.comment.comment-author > .body > .bubble .name { color: #fff; }
.comment.comment-author > .body > .bubble .text { color: rgba(255,255,255,.92); }
.comment.comment-author > .body > .bubble .comment-delete { color: rgba(255,255,255,.75); }
.comment.comment-author > .body > .bubble .comment-delete:hover { color: #fff; background: rgba(255,255,255,.18); }
.comment.comment-author > .body > .bubble .badge-author { background: rgba(255,255,255,.22); color: #fff; }
.comment.comment-author > .body > .comment-footer { align-self: flex-end; flex-direction: row-reverse; }

/* Javob (reply) izohlari — boshqa foydalanuvchilarnikidan ajralib turuvchi rang (accent tint, ~#fdeee5).
   Muallifning javobi yashil qoladi (`:not(.comment-author)` istisnosi). Matn DOIM to'q rangda
   (peach fonda o'qilishi uchun) — oq bo'lib qolmasligi kafolatlanadi. */
.comment .replies .comment:not(.comment-author) .bubble {
    background: rgba(232,112,58,.10); border-color: rgba(232,112,58,.30);
}
.comment .replies .comment:not(.comment-author) .bubble .name,
.comment .replies .comment:not(.comment-author) .bubble .text { color: var(--text); }

.comment-form { display: flex; gap: 10px; margin-top: 16px; }
.comment-form .input { flex: 1; }

/* ===== Post detail (design-reference/04-post-detail.html) ===== */
.pd-page { max-width: var(--maxw); }
.pd-back { margin-bottom: 20px; }
.pd-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 40px; align-items: start; }
.pd-article { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.pd-author { display: flex; align-items: center; gap: 14px; }
.pd-author .meta { line-height: 1.3; }
.pd-author .name { font-weight: 600; color: var(--text); font-size: 16px; }
.pd-author .time { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.pd-author .time .material-symbols-outlined { font-size: 16px; }
.pd-hero {
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow);
    background: var(--primary-soft); display: flex; align-items: center; justify-content: center; max-height: 420px;
}
.pd-hero[hidden] { display: none; }
.pd-hero img { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.pd-bookhead h1 { font-size: 38px; line-height: 1.15; letter-spacing: -.015em; margin-bottom: 6px; }
.pd-book-author { color: var(--text-secondary); font-size: 18px; margin: 0 0 14px; }
.pd-genres { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-genre {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--primary-soft); color: var(--primary);
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 5px 14px; font-size: 13px; font-weight: 600;
}
.pd-genre .material-symbols-outlined { font-size: 17px; }
.pd-review { font-size: 17px; line-height: 1.85; color: var(--text); max-width: 68ch; white-space: pre-wrap; word-break: break-word; }
.pd-stats {
    display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
    padding: 18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    color: var(--text-secondary); font-size: 14px; font-weight: 600;
}
.pd-stats span { display: inline-flex; align-items: center; gap: 6px; }
.pd-stats .material-symbols-outlined { font-size: 20px; }
.pd-actions { display: flex; gap: 12px; }
.pd-action-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
    border-radius: var(--radius-pill); border: 1px solid var(--primary); background: transparent;
    color: var(--primary); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.pd-action-btn:hover { background: var(--primary-soft); }
.pd-action-btn.liked { background: var(--accent); border-color: var(--accent); color: #fff; }
.pd-action-btn.liked:hover { background: var(--accent-dark); }
.pd-action-btn.liked .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

.pd-comments-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; }
.pd-comments-title { display: flex; align-items: center; gap: 8px; font-size: 19px; margin-bottom: 18px; flex-shrink: 0; }
.pd-comment-list { display: flex; flex-direction: column; gap: 18px; flex: 1 1 auto; min-height: 0; max-height: 60vh; overflow-y: auto; padding-right: 4px; margin-bottom: 18px; }
/* "Barcha izohlarni ko'rish" — sarlavha o'ng chetidagi to'liq ekran ikoni */
.pd-comments-expand {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text-secondary); cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.pd-comments-expand:hover { border-color: var(--primary); color: var(--primary); }
.pd-comments-expand .material-symbols-outlined { font-size: 19px; }

/* Barcha izohlar modal oynasi */
.modal-box-wide { width: min(680px, 100%); }
.pd-comments-modal-box { display: flex; flex-direction: column; padding: 0; max-height: calc(100dvh - 32px); }
.pd-comments-modal-head {
    display: flex; align-items: center; gap: 8px; padding: 20px 24px;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.pd-comments-modal-head .modal-title { display: flex; align-items: center; gap: 8px; margin: 0; flex: 1; }
.pd-comments-modal-head .modal-title .muted { font-size: 15px; font-weight: 400; }
.pd-comments-modal-body { padding: 20px 24px; overflow-y: auto; }
.pd-comments-modal-body .pd-comment-list { max-height: none; margin-bottom: 0; padding-right: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; border-radius: 10px;
    background: transparent; color: var(--text-secondary); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text-primary); }

.pd-comment-form { border-top: 1px solid var(--border); padding-top: 18px; flex-shrink: 0; }
.pd-comment-form textarea { margin-bottom: 10px; }
/* Bo'sh `required` izoh maydonida brauzerning qizil "invalid" porlashini o'chirib,
   brend yashil chegarasini qoldirish (Firefox `:-moz-ui-invalid`). */
.pd-comment-form textarea:-moz-ui-invalid,
.comment-reply-form textarea:-moz-ui-invalid { box-shadow: none; border-color: var(--border); }

@media (min-width: 1025px) {
    .pd-comments { position: sticky; top: calc(var(--navbar-h) + 24px); }
    /* Karta balandligi ekran balandligiga moslashadi; izohlar ko'paysa karta ichida scroll bo'ladi. */
    .pd-comments-card { max-height: calc(100vh - var(--navbar-h) - 48px); }
    .pd-comment-list { max-height: none; }
}
/* ===== Post detail — planshet va telefon uchun moslashuvchanlik =====
   Muallif sarlavhasi, kitob sarlavhasi/janr, sharh matni, hero rasm, statistika +
   amal tugmalari (yoqdi/ulashish/tahrir/o'chirish), izohlar kartasi (sarlavha,
   pufakchalar, forma) va "Barcha izohlar" modali — har bir qurilmada shrift, tugma,
   avatar va ikonlar bosqichma-bosqich kichrayadi; gorizontal overflow yo'q.
   ≥1025px da izohlar yopishqoq yon ustun (yuqoridagi blok); ≤1024 da grid 1 ustunga
   tushadi va izohlar maqola ostiga keladi. */

/* Planshet landshaft (≤1024px) */
@media (max-width: 1024px) {
    .pd-grid { grid-template-columns: 1fr; gap: 32px; }
    .pd-article { gap: 22px; }
    .pd-bookhead h1 { font-size: 32px; }
    .pd-book-author { font-size: 16.5px; }
    .pd-review { font-size: 16.5px; line-height: 1.8; }
    .pd-hero img { max-height: 360px; }
    .pd-comments-card { padding: 20px; }
}

/* Planshet portret / katta telefon (≤768px) */
@media (max-width: 768px) {
    .pd-back { margin-bottom: 16px; }
    .pd-article { gap: 20px; }

    /* Muallif sarlavhasi */
    .pd-author { gap: 12px; }
    .pd-author .avatar { width: 44px; height: 44px; font-size: 16px; }
    .pd-author .name { font-size: 15px; }
    .pd-author .time { font-size: 12.5px; }

    /* Kitob sarlavhasi + janr */
    .pd-bookhead h1 { font-size: 29px; }
    .pd-book-author { font-size: 15.5px; margin-bottom: 12px; }
    .pd-genre { font-size: 12.5px; padding: 5px 12px; }
    .pd-genre .material-symbols-outlined { font-size: 16px; }

    /* Sharh matni + hero */
    .pd-review { font-size: 16px; line-height: 1.75; }
    .pd-hero img { max-height: 320px; }

    /* Statistika + amal tugmalari */
    .pd-stats { gap: 18px; padding: 14px 0; font-size: 13.5px; }
    .pd-stats .material-symbols-outlined { font-size: 18px; }
    .pd-actions { gap: 10px; flex-wrap: wrap; }
    .pd-action-btn { padding: 9px 15px; font-size: 13.5px; }
    .pd-action-btn .material-symbols-outlined { font-size: 20px; }

    /* Izohlar */
    .pd-comments-title { font-size: 18px; margin-bottom: 16px; }
    .pd-comments-expand { width: 32px; height: 32px; }
    .pd-comments-expand .material-symbols-outlined { font-size: 18px; }
    .pd-comment-list { gap: 16px; }
    .comment .name, .comment .text { font-size: 13.5px; }
}

/* Telefon (≤480px) */
@media (max-width: 480px) {
    /* Anonim banner (ro'yxatdan o'tmagan ko'rinish) + orqaga tugmasi */
    .anon-banner { padding: 16px; gap: 10px; }
    .anon-banner .brand { font-size: 16px; }
    .anon-banner p { font-size: 13px; }
    .pd-back { font-size: 13px; margin-bottom: 14px; }

    /* Muallif */
    .pd-author .avatar { width: 42px; height: 42px; font-size: 15px; }
    .pd-author .name { font-size: 14.5px; }
    .pd-author .time { font-size: 12px; }

    /* Kitob sarlavhasi */
    .pd-bookhead h1 { font-size: 25px; }
    .pd-book-author { font-size: 14.5px; }
    .pd-genre { font-size: 12px; padding: 4px 11px; }
    .pd-genre .material-symbols-outlined { font-size: 15px; }

    /* Sharh + hero */
    .pd-review { font-size: 15px; line-height: 1.7; }
    .pd-hero img { max-height: 260px; }

    /* Statistika + amallar */
    .pd-stats { gap: 14px; padding: 12px 0; font-size: 13px; }
    .pd-stats .material-symbols-outlined { font-size: 17px; }
    .pd-actions { gap: 8px; }
    .pd-action-btn { padding: 8px 13px; gap: 6px; font-size: 13px; }
    .pd-action-btn .material-symbols-outlined { font-size: 18px; }

    /* Izohlar kartasi + pufakchalar */
    .pd-comments-card { padding: 16px 14px; }
    .pd-comments-title { font-size: 17px; margin-bottom: 14px; }
    .pd-comment-list { gap: 14px; }
    .comment { gap: 8px; }
    .comment .avatar { width: 36px; height: 36px; font-size: 14px; }
    .comment .bubble { padding: 9px 12px; }
    .comment .name, .comment .text { font-size: 13.5px; }
    .comment-delete .material-symbols-outlined { font-size: 17px; }
    .comment .replies { padding-left: 20px; gap: 12px; }
    .comment-reply-form textarea { min-height: 48px; }

    /* Izoh yozish formasi */
    .pd-comment-form { padding-top: 14px; }
    .pd-comment-form textarea { font-size: 14px; }
    .pd-comment-form .btn { font-size: 14px; }

    /* "Barcha izohlar" modali */
    .pd-comments-modal-head { padding: 16px 18px; }
    .pd-comments-modal-head .modal-title { font-size: 18px; }
    .pd-comments-modal-body { padding: 16px 18px; }
}

/* Kichik telefon (≤360px) */
@media (max-width: 360px) {
    .pd-bookhead h1 { font-size: 22px; }
    .pd-book-author { font-size: 13.5px; }
    .pd-review { font-size: 14.5px; }
    .pd-stats { gap: 12px; font-size: 12.5px; }
    .pd-action-btn { padding: 7px 11px; font-size: 12.5px; }
    .pd-action-btn .material-symbols-outlined { font-size: 17px; }
    .pd-comments-card { padding: 14px 12px; }
    .pd-comments-title { font-size: 16px; }
    .comment .avatar { width: 34px; height: 34px; }
    .comment .name, .comment .text { font-size: 13px; }
    .comment .replies { padding-left: 16px; }
}

/* ===== Profile ===== */
.profile-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.profile-head .info { flex: 1; min-width: 200px; }
.profile-head h1 { font-size: 28px; margin-bottom: 4px; }
.profile-bio { color: var(--text-secondary); margin: 8px 0 16px; }
.profile-stats { display: flex; gap: 28px; margin: 12px 0; }
.profile-stats a { color: inherit; text-align: center; }
.profile-stats .num { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--primary); display: block; }
.profile-stats .lbl { font-size: 13px; color: var(--text-secondary); }
.follow-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.follow-row .info { flex: 1; }
.follow-row .name { font-weight: 600; }
.section-title { font-family: var(--serif); font-size: 22px; margin: 28px 0 16px; }

/* ===== Profile redesign (05-profil) ===== */
.profile-hero { display: flex; gap: 32px; align-items: flex-start; margin-bottom: 40px; flex-wrap: wrap; }
.profile-ring {
    width: 128px; height: 128px; border-radius: 50%;
    border: 2px solid var(--accent); padding: 4px; flex-shrink: 0;
    display: inline-flex;
}
.profile-ring .avatar.lg { width: 100%; height: 100%; font-size: 44px; border: none; }
.profile-hero .profile-avatar-wrap { flex-shrink: 0; }
.profile-hero .profile-avatar-wrap .avatar.lg { width: 116px; height: 116px; font-size: 44px; }
.profile-hero-info { flex: 1; min-width: 260px; }
.profile-hero-info h1 { font-size: 36px; margin-bottom: 6px; }
.profile-motto { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--text-secondary); margin: 0 0 18px; }
.profile-statbar { display: flex; align-items: stretch; margin-bottom: 20px; }
.profile-statbar > div, .profile-statbar > a {
    display: flex; flex-direction: column; gap: 2px;
    padding: 0 18px; color: inherit; border-left: 1px solid var(--border);
}
.profile-statbar > :first-child { padding-left: 0; border-left: none; }
.profile-statbar a:hover { text-decoration: none; }
.profile-statbar .lbl { font-size: 13px; color: var(--text-secondary); }
.profile-statbar .num { font-weight: 700; font-size: 20px; color: var(--primary); }

.profile-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; align-items: start; }

.profile-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.profile-tab {
    padding-bottom: 10px; margin-bottom: -1px;
    font-weight: 600; font-size: 15px; color: var(--text-secondary);
    background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent;
}
.profile-tab:hover { color: var(--primary); text-decoration: none; }
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.post-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.post-tile {
    position: relative; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); display: block;
}
.post-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-tile:hover img { transform: scale(1.05); }
.post-tile-fallback {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; gap: 8px; padding: 16px; text-align: center; color: var(--primary);
}
.post-tile-fallback .material-symbols-outlined { font-size: 38px; }
.post-tile-fallback .t {
    font-family: var(--serif); font-size: 14px; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-tile-overlay {
    position: absolute; inset: 0; background: rgba(27, 77, 62, .55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; gap: 28px;
    opacity: 0; transition: opacity .25s ease;
}
.post-tile:hover .post-tile-overlay { opacity: 1; }
.post-tile-overlay .stat { display: flex; flex-direction: column; align-items: center; color: #fff; font-weight: 700; }
.post-tile-overlay .material-symbols-outlined { font-variation-settings: 'FILL' 1; margin-bottom: 2px; }

.reading-now {
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    padding: 24px; box-shadow: var(--shadow); position: sticky; top: calc(var(--navbar-h) + 20px);
}
.reading-now h3 { font-size: 20px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.reading-now-count {
    font-size: 13px; font-weight: 700; color: var(--accent); background: var(--primary-soft);
    min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center;
}
.reading-now-list { display: flex; flex-direction: column; gap: 24px; }
.reading-now-list .reading-now-inner + .reading-now-inner {
    padding-top: 24px; border-top: 1px solid var(--border);
}
.reading-now-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.reading-now-cover {
    width: 128px; height: 192px; border-radius: 10px; overflow: hidden;
    box-shadow: var(--shadow-lg); background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.reading-now-cover img { width: 100%; height: 100%; object-fit: cover; }
.reading-now .title { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--primary); margin: 0; }
.reading-now .author { color: var(--text-secondary); font-size: 14px; margin: 2px 0 0; }
.reading-now-ring {
    width: 96px; height: 96px; border-radius: 50%; position: relative; margin-top: 4px;
    background: conic-gradient(var(--accent) var(--p, 0%), var(--border) 0deg);
}
.reading-now-ring .inner {
    position: absolute; inset: 6px; background: var(--surface); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--primary);
}
.reading-now-goal {
    font-size: 13px; font-weight: 600; color: var(--accent);
    background: var(--primary-soft); padding: 8px 16px; border-radius: var(--radius-pill); margin: 4px 0 0;
}

/* Story tiles (profile "Storylar" tab) */
.story-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.story-tile {
    display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}
.story-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.story-tile-img {
    position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.story-tile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.story-tile:hover .story-tile-img img { transform: scale(1.05); }
.story-tile-fallback {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; gap: 8px; padding: 16px; text-align: center; color: var(--primary);
}
.story-tile-fallback .material-symbols-outlined { font-size: 38px; }
.story-tile-fallback .t {
    font-family: var(--serif); font-size: 14px; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.story-tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; }
.story-tile-date { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.story-tile-stats { display: flex; gap: 12px; }
.story-tile-stats .stat { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.story-tile-stats .material-symbols-outlined { font-size: 15px; font-variation-settings: 'FILL' 1; }

@media (max-width: 900px) {
    .profile-layout { grid-template-columns: 1fr; }
    .reading-now { position: static; }
}
@media (max-width: 600px) {
    .story-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 700px) {
    .profile-hero { gap: 20px; }
    .profile-hero-info h1 { font-size: 28px; }
}
@media (max-width: 600px) {
    .post-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ===== Reading goals ===== */
.goal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.goal-card .goal-top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.goal-cover {
    width: 52px; height: 70px; border-radius: 8px; background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0;
}
.goal-card .title { font-family: var(--serif); font-weight: 600; }
.progress-bar { height: 10px; background: var(--primary-soft); border-radius: var(--radius-pill); overflow: hidden; margin: 10px 0 6px; }
.progress-bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width .3s; }
.goal-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.goal-log { display: flex; gap: 8px; margin-top: 14px; }
.goal-log .input { width: 90px; }
/* [hidden] atributi `display: flex` ni yenga olmaydi (xuddi .composer-selected dagidek, ~381-qator).
   Shu qoidasiz yashirin input+"Qo'shish" qatori DOIM ko'rinib, "Betlarni yangilash" tugmasi
   ostida bo'sh joy egallaydi — ayniqsa telefon ustun-layoutida ko'zga tashlanadi. */
.goal-log[hidden] { display: none; }

/* ===== Reading books (kitob maqsadlari) ===== */
.rb-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}
.rb-header h1 { font-size: 34px; }
.rb-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

.book-rows { display: flex; flex-direction: column; gap: 18px; }

/* Yangi dizayn: faol kitob kartasi (muqova · progress · amallar) */
.book-row {
    position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
    padding: 18px 22px; box-shadow: 0 6px 24px rgba(27, 77, 62, .06);
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    overflow: hidden;
}
.book-row::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    opacity: .75;
}
.book-row:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(27, 77, 62, .12);
    border-color: rgba(27, 77, 62, .18);
}
.book-row.is-done::before { background: var(--primary); opacity: .9; }

/* Muqova + suzuvchi foiz nishoni */
.rb-cover {
    position: relative; width: 86px; height: 128px; border-radius: 12px; flex-shrink: 0;
    overflow: visible; display: flex; align-items: center; justify-content: center;
    color: var(--primary);
}
.rb-cover img,
.rb-cover > .material-symbols-outlined {
    width: 100%; height: 100%; border-radius: 12px;
    box-shadow: 0 8px 18px rgba(27, 77, 62, .18);
}
.rb-cover img { object-fit: cover; }
.rb-cover > .material-symbols-outlined {
    display: flex; align-items: center; justify-content: center;
    font-size: 38px; background: var(--primary-soft); border: 1px solid var(--border);
}
.rb-pct-badge {
    position: absolute; right: -10px; bottom: 10px;
    background: var(--accent); color: #fff; font-weight: 700; font-size: 12px;
    padding: 4px 9px; border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(232, 112, 58, .4);
    border: 2px solid var(--surface); white-space: nowrap;
}
.book-row.is-done .rb-pct-badge { background: var(--primary); box-shadow: 0 4px 12px rgba(27, 77, 62, .35); }

/* Markaziy ma'lumot bloki */
.rb-body { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.rb-head { min-width: 0; }
.rb-title {
    display: block; font-family: var(--serif); font-weight: 600; font-size: 21px;
    color: var(--primary); line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rb-title:hover { text-decoration: underline; }
.rb-author { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.rb-track {
    height: 10px; background: var(--primary-soft); border-radius: var(--radius-pill);
    overflow: hidden;
}
.rb-track-fill {
    display: block; height: 100%; border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width .8s cubic-bezier(.22, 1, .36, 1);
}
.book-row.is-done .rb-track-fill { background: var(--primary); }

.rb-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.rb-stat {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; color: var(--text-secondary);
}
.rb-stat strong { color: var(--text); font-weight: 700; }
.rb-stat .material-symbols-outlined { font-size: 17px; color: var(--accent); }

/* Amallar ustuni */
.rb-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; flex-shrink: 0; min-width: 168px; }
.btn-pill { border-radius: var(--radius-pill); }
.rb-actions .goal-log-toggle { justify-content: center; gap: 4px; }
.rb-actions .goal-log-toggle .material-symbols-outlined { font-size: 18px; }
.rb-actions .goal-log { margin: 0; }
.rb-actions .goal-log .input { flex: 1; width: auto; }
.rb-done-pill {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-pill);
    background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px;
}
.rb-done-pill .material-symbols-outlined { font-size: 18px; }
.rb-delete {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 12px; border-radius: var(--radius-pill);
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    font-family: inherit; transition: background .2s, color .2s;
}
.rb-delete:hover { background: rgba(208, 96, 45, .1); color: var(--accent-dark); }
.rb-delete .material-symbols-outlined { font-size: 17px; }

/* Finished books grid (library + profile) */
.finished-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px 16px;
}
.finished-book { position: relative; display: block; color: inherit; }
.finished-link { display: block; color: inherit; }
.finished-link:hover { text-decoration: none; }
.finished-book:hover .finished-cover { transform: translateY(-3px); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.12)); }
.finished-delete-btn {
    position: absolute; top: 8px; left: 8px;
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s ease, background .15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.finished-book:hover .finished-delete-btn,
.finished-delete-btn:focus-visible { opacity: 1; }
.finished-delete-btn:hover { background: #e0245e; }
.finished-delete-btn .material-symbols-outlined { font-size: 17px; color: #fff; }
@media (hover: none) { .finished-delete-btn { opacity: 1; } }
.finished-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    transition: transform .2s ease, box-shadow .2s ease;
}
.finished-cover img { width: 100%; height: 100%; object-fit: cover; }
.finished-cover .material-symbols-outlined { font-size: 40px; color: var(--primary); }
.finished-badge {
    position: absolute; top: 8px; right: 8px;
    width: 26px; height: 26px; border-radius: 50%;
    background: #34c759; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.finished-badge .material-symbols-outlined { font-size: 18px; color: #fff; }
.finished-title {
    margin-top: 8px; font-family: var(--serif); font-weight: 600; font-size: 15px;
    color: var(--primary); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.finished-author { font-size: 13px; margin-top: 2px; }
.finished-pages { font-size: 12px; margin-top: 2px; }

/* ===== Quotes ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.quote-grid { columns: 2; column-gap: 20px; }
.quote-card { break-inside: avoid; margin-bottom: 20px; overflow: hidden; }
.quote-text { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--text); overflow-wrap: break-word; word-break: break-word; }
.quote-text::before { content: "“"; color: var(--accent); font-size: 28px; margin-right: 2px; }
.quote-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.quote-source { font-size: 14px; color: var(--text-secondary); min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.quote-source strong { color: var(--primary); }
.quote-mark, .search-mark { background: rgba(22, 163, 74, .18); color: #15803d; border-radius: 3px; padding: 0 2px; font-weight: 600; }

/* Feed qidiruv paneli */
.feed-search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.feed-search-form { flex: 1; }

/* ===== Chat 2.0 ===== */
.chat { display: grid; grid-template-columns: 340px 1fr; gap: 0; height: calc(100vh - var(--navbar-h)); overflow: hidden; }
.chat-sidebar { border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); display: flex; flex-direction: column; }

/* People search */
.chat-search { padding: 16px 16px 8px; position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border); }
.search-box { position: relative; }
.search-box .input { width: 100%; padding-left: 38px; }
.search-box .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; display: inline-flex; }
.search-box .search-ico svg { width: 18px; height: 18px; }
.chat-search-results { display: none; flex-direction: column; }
.chat-search-results.show { display: flex; }
.search-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-card .meta { flex: 1; min-width: 0; }
.search-card .name { font-weight: 600; color: var(--text); }
.search-card .uname { font-size: 12px; color: var(--text-secondary); }
.search-card .bio { font-size: 13px; color: var(--text-secondary); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-card .presence { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.search-card .conn-btn { white-space: nowrap; flex-shrink: 0; }
.search-empty { padding: 16px; color: var(--text-secondary); font-size: 14px; }

.chat-list-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); padding: 14px 16px 6px; font-family: var(--sans); font-weight: 700; }

/* Avatar + online dot */
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-wrap.has-story { padding: 2px; border-radius: var(--radius-pill); background: linear-gradient(135deg, #ffb347, var(--accent), #ff5e7e); }
.avatar-wrap.has-story .avatar { border: 2px solid var(--surface); }
.online-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: #34c759; border: 2px solid var(--surface); display: none; }
.online-dot.on { display: block; }

.conv-item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv-item:hover, .conv-item.active { background: var(--primary-soft); text-decoration: none; }
.conv-item .info { flex: 1; min-width: 0; }
.conv-item .name { font-weight: 600; color: var(--text); }
.conv-item .last { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-badge { background: var(--accent); color: #fff; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

.chat-main { display: flex; flex-direction: column; background: var(--bg); min-width: 0; min-height: 0; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; }
.chat-header .info { display: flex; flex-direction: column; line-height: 1.2; }
.chat-header .name { font-weight: 600; }
.chat-header .presence { font-size: 12px; color: var(--text-secondary); }
.chat-header .presence.online { color: #2a9d4a; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; }
.msg { position: relative; width: fit-content; max-width: 72%; padding: 5px 9px 5px 11px; border-radius: 14px; font-size: 14.5px; line-height: 1.25; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.msg .msg-text { white-space: pre-wrap; }
.msg.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
/* Ulashilgan post — ixcham, responsive mini-karta */
.msg .shared-card { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 7px 9px; border-radius: 10px;
    background: rgba(0,0,0,.05); color: inherit; max-width: 240px; text-decoration: none; }
.msg.out .shared-card { background: rgba(255,255,255,.18); }
.msg .shared-card:hover { background: rgba(0,0,0,.09); }
.msg.out .shared-card:hover { background: rgba(255,255,255,.28); }
.msg .shared-ico { flex-shrink: 0; display: inline-flex; opacity: .9; }
.msg .shared-ico svg { width: 18px; height: 18px; }
.msg .shared-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.msg .shared-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .shared-author { font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Vaqt + tick — Telegram uslubi: pufakchaning o'ng-pastiga "yopishadi", matn joy bo'shatadi */
.msg .meta-row { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 0 0 -1px 8px; vertical-align: bottom; position: relative; top: 4px; }
.msg-time { font-size: 11px; opacity: .6; letter-spacing: .01em; white-space: nowrap; }
.msg.out .msg-time { color: rgba(255,255,255,.8); opacity: .85; }
.msg .ticks { display: inline-flex; align-items: center; color: rgba(255,255,255,.7); }
.msg .ticks .tick-svg { width: 14px; height: 9px; }
.msg .ticks .tick-svg.dbl { width: 16px; }
.msg.out .ticks.read { color: #7fe0ff; }
.msg .msg-edited { font-size: 10.5px; font-style: italic; opacity: .7; margin-right: 1px; }
.msg.in .msg-edited { color: var(--text-secondary); }

/* O'z xabari ustidagi tahrirlash/o'chirish tugmalari (hoverda yoki teginishda) */
.msg-actions { position: absolute; top: 50%; transform: translateY(-50%); right: 100%; padding-right: 6px;
    display: flex; gap: 2px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.msg.out:hover .msg-actions, .msg.out.show-actions .msg-actions { opacity: 1; pointer-events: auto; }
.msg-act { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
    border-radius: 50%; cursor: pointer; padding: 0; box-shadow: var(--shadow); }
.msg-act:hover { color: var(--primary); background: var(--primary-soft); }
.msg-act .act-svg { width: 15px; height: 15px; }

/* Inline tahrirlash maydoni (faqat o'z — yashil — bubble ustida ochiladi) */
.msg.editing .msg-content, .msg.editing .meta-row, .msg.editing .msg-actions { display: none; }
.msg-edit { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.msg-edit .msg-edit-input { width: 100%; resize: vertical; font-size: 14px; color: var(--text); background: #fff; }
.msg-edit .msg-edit-acts { display: flex; gap: 6px; justify-content: flex-end; }
.msg-edit .msg-edit-acts .btn { padding: 5px 12px; }
.msg-edit .msg-edit-acts [data-edit-cancel] { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.msg-edit .msg-edit-acts [data-edit-cancel]:hover { background: rgba(255,255,255,.15); color: #fff; }
.msg-edit .msg-edit-acts [data-edit-save] { background: #fff; color: var(--primary); }
.msg-edit .msg-edit-acts [data-edit-save]:hover { background: rgba(255,255,255,.9); color: var(--primary); }
.msg-form { display: flex; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--border); background: var(--surface); flex-direction: column; }
.msg-form .row { display: flex; gap: 10px; }
.msg-form .input { flex: 1; }
.char-count { font-size: 11px; color: var(--text-secondary); text-align: right; }
.char-count.over { color: var(--danger); }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); text-align: center; padding: 20px; }

/* Kelgan takliflar — suhbatlar ro'yxati tepasida (faqat taklif bo'lganda ko'rinadi) */
.chat-requests { border-bottom: 1px solid var(--border); background: var(--primary-soft); }
.chat-requests .chat-list-title { color: var(--primary); }
.chat-requests #requestsList { padding: 0 16px 8px; }
.req-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.req-item:last-child { border-bottom: none; }
.req-item .meta { flex: 1; min-width: 0; }
.req-item .name { font-weight: 600; font-size: 14px; }
.req-item .req-time { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.req-item .acts { display: flex; gap: 6px; }
.req-empty { font-size: 13px; color: var(--text-secondary); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .genre-grid { grid-template-columns: repeat(3, 1fr); }
    .goal-grid { grid-template-columns: 1fr; }
    .rb-form-grid { grid-template-columns: 1fr; }
    .book-row { flex-direction: column; align-items: stretch; gap: 18px; }
    .rb-cover { align-self: center; }
    .rb-pct-badge { right: -8px; }
    .rb-title { white-space: normal; }
    /* Ustun-layoutda `flex: 1 1 240px` ning 240px `flex-basis`i ENDI asosiy o'q = BALANDLIK
       bo'lib qoladi — natijada `.rb-body` o'z kontentidan (~140px) balandroq (240px) cho'zilib,
       statistika bilan "Betlarni yangilash" tugmasi orasida katta bo'sh joy qolardi. Kontent
       balandligiga qaytaramiz. */
    .rb-body { flex: 0 0 auto; }
    .rb-actions { min-width: 0; }
    .rb-actions .goal-log-toggle { width: 100%; }
    .chat { grid-template-columns: 340px 1fr; }
}
@media (max-width: 768px) {
    .nav-links, .nav-actions .desktop-only { display: none; }
    .burger { display: inline-flex; }
    .nav-links.open {
        display: flex; flex-direction: column; align-items: stretch; gap: 4px;
        position: absolute; top: var(--navbar-h); left: 0; right: 0;
        background: var(--surface); border-bottom: 1px solid var(--border);
        padding: 12px 24px; box-shadow: var(--shadow);
    }
    .genre-grid { grid-template-columns: repeat(2, 1fr); }
    .landing-card { padding: 36px 24px; }
    .landing-card h1 { font-size: 32px; }

    /* Chat: mobil ko'rinishda ro'yxat yoki suhbatdan biri ko'rinadi */
    .chat { grid-template-columns: 1fr; height: calc(100vh - var(--navbar-h)); }
    .chat.has-active .chat-sidebar { display: none; }
    .chat:not(.has-active) .chat-main { display: none; }
    .chat-sidebar { border-right: none; }
}
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .navbar-inner { padding: 0 16px; }
    /* Notification qo'ng'irog'i mobil/planshetda ham ko'rinadi — ikonlarni sal kichraytirib joy ochamiz.
       Navbar (brand "kitobdagimen.uz" + 4 ta amal ikoni) ~390px (iPhone 12/13/14) da toshib,
       o'ngda sariq chiziq chiqib qolardi. Endi brand + ikonlar sal kichrayib, to'liq nom
       (ellipsissiz) ALL telefon kengliklarida (360–480) marja bilan sig'adi. */
    .navbar-inner { gap: 10px; }
    .brand { font-size: 17px; gap: 6px; }
    .brand-logo { width: 28px; height: 28px; }
    .nav-actions { gap: 6px; }
    .nav-actions .avatar { width: 32px; height: 32px; font-size: 13px; }
    .nav-icon-btn { width: 34px; height: 34px; }
    .genre-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .card { padding: 18px; }
    .profile-stats { gap: 18px; }
    .msg { max-width: 85%; }
}

/* ===== /feed — planshet va telefon uchun moslashuvchanlik =====
   Maqsad: har bir qurilmada feed kartalari (composer + post kartalari + qidiruv)
   chiroyli tushishi; shrift, tugma va ikonlar bosqichma-bosqich kichrayadi.
   Feed kengligi 680px, shuning uchun asosiy ish ≤768px dan boshlanadi. */

/* Planshet va kichik laptop */
@media (max-width: 768px) {
    .page { padding-top: 24px; padding-bottom: 48px; }
    .feed { gap: 18px; }

    /* Composer (post yaratish) */
    .composer { padding: 18px; }
    .composer-head { gap: 10px; margin-bottom: 14px; }
    .composer-head h3 { font-size: 16px; }
    .composer-book { flex-wrap: wrap; }
    .composer-book .input { flex: 1 1 100%; }
    .composer-book .btn { flex-shrink: 0; }
    .composer-actions { gap: 10px; }

    /* Post karta */
    .post-head { padding: 14px 16px; gap: 10px; }
    .post-body { grid-template-columns: 84px 1fr; gap: 16px; padding: 18px 16px; }
    .post-book-title { font-size: 18px; }
    .post-text { font-size: 14.5px; }
    .post-actions { padding: 10px 14px; gap: 4px; }
    .action-btn { padding: 6px 10px; font-size: 13px; }
    .action-btn .material-symbols-outlined { font-size: 19px; }
}

/* Telefon */
@media (max-width: 480px) {
    .feed { gap: 14px; }

    /* Qidiruv paneli */
    .feed-search-bar { gap: 8px; margin-bottom: 12px; }
    .feed-search-bar .btn-sm { padding: 6px 10px; font-size: 13px; }
    .search-box .input { font-size: 14px; }

    /* Composer */
    .composer { padding: 16px 14px; }
    .composer-head h3 { font-size: 15px; }
    .composer-head .avatar { width: 36px; height: 36px; font-size: 14px; }
    .composer-newbook { padding: 12px; }
    .composer-actions { flex-direction: column; align-items: stretch; }
    .composer-actions .btn { width: 100%; }
    .composer-actions #composerHint { order: 2; text-align: center; }

    /* Post karta — sarlavha */
    .post-head { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
    .post-head .avatar, .post-avatar-wrap .avatar { width: 36px; height: 36px; font-size: 14px; }
    .post-head .meta { flex: 1 1 auto; min-width: 120px; }
    .post-head .name { font-size: 14.5px; }
    .post-head .time { font-size: 12px; }
    .post-follow-btn { font-size: 13px; padding: 5px 11px; }

    /* Post karta — tana */
    .post-body { grid-template-columns: 64px 1fr; gap: 12px; padding: 14px; }
    .post-cover .material-symbols-outlined { font-size: 30px; }
    .post-book-title { font-size: 16px; }
    .post-book-author { font-size: 12px; margin-bottom: 8px; }
    .post-text { font-size: 14px; -webkit-line-clamp: 5; }
    .post-image-wrap, .post-image { max-height: 360px; }

    /* Post karta — amallar (like/izoh/ko'rish/ulashish/tahrir/o'chirish) */
    .post-actions { padding: 8px 10px; gap: 2px; }
    .action-btn { padding: 6px 8px; gap: 4px; font-size: 12.5px; }
    .action-btn .material-symbols-outlined { font-size: 18px; }
    .post-actions-end { gap: 2px; }
}

/* Kichik telefon (≤360px) — eng tor ekranlarda ham amallar bir qatorga sig'adi */
@media (max-width: 360px) {
    .navbar-inner { padding: 0 12px; gap: 8px; }
    /* Sahifa chetidagi bo'shliq header bilan bir xil bo'lishi uchun container ham 12px */
    .container { padding: 0 12px; }
    /* Eng tor ekran — brand yana sal kichrayadi, to'liq nom ellipsissiz sig'adi */
    .brand { font-size: 16px; gap: 6px; }
    .brand-logo { width: 26px; height: 26px; }
    .nav-actions { gap: 6px; }
    .nav-actions .avatar { width: 30px; height: 30px; font-size: 12px; }
    .nav-icon-btn { width: 34px; height: 34px; }
    .composer { padding: 14px 12px; }
    .post-head .name { font-size: 14px; }
    .post-body { grid-template-columns: 56px 1fr; gap: 10px; padding: 12px; }
    .post-book-title { font-size: 15px; }
    .post-text { font-size: 13.5px; }
    .post-actions { padding: 8px 6px; gap: 0; }
    .action-btn { padding: 5px 7px; gap: 3px; font-size: 12px; }
    .action-btn .material-symbols-outlined { font-size: 17px; }
}

/* ===== /reading-books (Kutubxona) — planshet va telefon uchun moslashuvchanlik =====
   Sarlavha, "yangi kitob" formasi, faol kitob kartalari va tugatilgan kitoblar
   gridi — har bir qurilmada shrift, tugma va ikonlar bosqichma-bosqich kichrayadi.
   Karta layout'i ≤1024px da vertikal stack'ga o'tadi (yuqoridagi umumiy blok);
   `.page` padding va `.composer-*` / `.composer-book` moslashuvi /feed blokidan keladi. */

/* Planshet (≤768px) */
@media (max-width: 768px) {
    .rb-header h1 { font-size: 27px; }
    .rb-header .btn { padding: 9px 18px; font-size: 14.5px; }
    .section-title { font-size: 19px; margin: 24px 0 14px; }

    /* "Yangi kitob qo'shish" formasi */
    #newGoalForm { padding: 18px; }
    .nb-cover-preview { width: 60px; height: 84px; }
    .nb-cover-preview .material-symbols-outlined { font-size: 24px; }

    /* Faol kitob kartasi */
    .book-row { padding: 18px; }
    .rb-cover { width: 78px; height: 116px; }
    .rb-cover > .material-symbols-outlined { font-size: 34px; }
    .rb-title { font-size: 19px; }
    .rb-author { font-size: 13.5px; }
    .rb-stat { font-size: 12.5px; }
    .rb-stat .material-symbols-outlined { font-size: 16px; }
    .rb-actions .goal-log-toggle,
    .rb-done-pill { font-size: 13.5px; }

    /* Tugatilgan kitoblar gridi */
    .finished-books { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 18px 14px; }
    .finished-title { font-size: 14.5px; }
}

/* Telefon (≤480px) */
@media (max-width: 480px) {
    .rb-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .rb-header h1 { font-size: 23px; }
    .rb-header .btn { width: 100%; padding: 11px 18px; font-size: 14px; }
    .section-title { font-size: 18px; margin: 22px 0 12px; }

    /* Forma */
    #newGoalForm { padding: 16px 14px; }
    #newGoalForm h3 { font-size: 16px; }
    .field label { font-size: 14px; }
    .nb-cover-actions .btn { font-size: 13px; }

    /* Faol kitob kartasi */
    .book-row { padding: 16px 14px; gap: 14px; border-radius: 18px; }
    .rb-cover { width: 70px; height: 104px; }
    .rb-cover > .material-symbols-outlined { font-size: 30px; }
    .rb-pct-badge { font-size: 11px; padding: 3px 8px; }
    .rb-title { font-size: 17.5px; }
    .rb-author { font-size: 13px; }
    .rb-track { height: 8px; }
    .rb-stats { gap: 6px 14px; }
    .rb-stat { font-size: 12px; }
    .rb-stat .material-symbols-outlined { font-size: 15px; }
    .rb-actions .goal-log-toggle,
    .rb-done-pill { font-size: 13px; padding: 8px 12px; }
    .rb-actions .goal-log-toggle .material-symbols-outlined,
    .rb-done-pill .material-symbols-outlined { font-size: 16px; }
    .rb-delete { font-size: 12.5px; }
    .rb-delete .material-symbols-outlined { font-size: 16px; }

    /* Tugatilgan kitoblar */
    .finished-books { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px 12px; }
    .finished-title { font-size: 14px; }
    .finished-author { font-size: 12px; }
    .finished-pages { font-size: 11px; }
    .finished-cover .material-symbols-outlined { font-size: 32px; }
    .finished-badge { width: 22px; height: 22px; }
    .finished-badge .material-symbols-outlined { font-size: 15px; }
}

/* Kichik telefon (≤360px) */
@media (max-width: 360px) {
    .rb-header h1 { font-size: 21px; }
    .section-title { font-size: 17px; }
    .book-row { padding: 14px 12px; }
    .rb-cover { width: 64px; height: 95px; }
    .rb-cover > .material-symbols-outlined { font-size: 28px; }
    .rb-title { font-size: 16.5px; }
    .rb-author { font-size: 12.5px; }
    .rb-stat { font-size: 11.5px; }
    .finished-books { grid-template-columns: repeat(2, 1fr); }
    .finished-title { font-size: 13.5px; }
}

/* ===== /quotes (Iqtiboslar) — planshet va telefon uchun moslashuvchanlik =====
   Sarlavha + amal tugmalari (qidiruv / "Yangi iqtibos"), tablar, qidiruv formasi,
   "Yangi iqtibos" formasi va iqtibos kartalari (matn, manba, saqlash/o'chirish) —
   har bir qurilmada shrift, tugma va ikonlar bosqichma-bosqich kichrayadi.
   `.section-title` va `.action-btn` (saqlash/o'chirish) /reading-books va /feed
   bloklaridan keladi; `.composer-*` /feed blokidan. Bu yerda iqtibosga xos qism.
   Grid masonry: tabletda 2 ustun, telefonda 1 ustun. */

/* Planshet (≤768px) */
@media (max-width: 768px) {
    .quote-grid { column-gap: 16px; }
    .quote-card { margin-bottom: 16px; }
    .quote-text { font-size: 17.5px; line-height: 1.55; }
    .quote-text::before { font-size: 26px; }
    .quote-foot { gap: 10px; margin-top: 12px; }
    .quote-source { font-size: 13.5px; }

    /* Sarlavha amallari */
    #newQuoteToggle { font-size: 14px; padding: 9px 16px; }

    /* Tablar */
    .tabs { gap: 6px; margin-bottom: 18px; }
    .tabs .btn-sm { font-size: 13.5px; padding: 6px 11px; }

    /* "Yangi iqtibos" formasi */
    #newQuoteForm { padding: 18px; }
    #newQuoteForm h3 { font-size: 16px; }
    .composer-book-toggle { font-size: 14px; }
    .composer-selected { font-size: 14px; }
}

/* Telefon (≤600px) — har bir iqtibos karta bir qatorda (bittadan) */
@media (max-width: 600px) {
    .quote-grid { columns: 1; column-gap: 0; }
    .quote-card { margin-bottom: 14px; }
    .quote-text { font-size: 16.5px; line-height: 1.55; }
    .quote-text::before { font-size: 24px; }
    .quote-foot { gap: 8px; margin-top: 12px; }
    .quote-source { font-size: 13px; }
    .quote-card .muted { font-size: 12.5px !important; }

    /* Sarlavha amallari — qidiruv ikoni + "Yangi iqtibos" tor ekranda ham sig'adi */
    #newQuoteToggle { font-size: 13.5px; padding: 8px 14px; }

    /* Tablar — uchchovi bir qatorda */
    .tabs { gap: 6px; margin-bottom: 16px; }
    .tabs .btn-sm { font-size: 13px; padding: 6px 10px; flex: 1; }

    /* Qidiruv formasi */
    #quoteSearchForm .input { font-size: 14px; }
    #quoteSearchClear { font-size: 13px; padding: 6px 10px; }

    /* "Yangi iqtibos" formasi */
    #newQuoteForm { padding: 16px 14px; }
    #newQuoteForm h3 { font-size: 15px; }
    #newQuoteForm textarea.input { font-size: 14px; }
    .composer-book-toggle { font-size: 13.5px; padding: 9px 12px; }
    .composer-book-toggle .material-symbols-outlined { font-size: 18px; }
    .composer-selected { font-size: 13.5px; }
    .composer-selected .material-symbols-outlined { font-size: 18px; }
}

/* Kichik telefon (≤360px) */
@media (max-width: 360px) {
    .quote-text { font-size: 15.5px; }
    .quote-text::before { font-size: 22px; }
    .quote-source { font-size: 12.5px; }
    #newQuoteToggle { font-size: 13px; padding: 8px 12px; }
    .tabs .btn-sm { font-size: 12.5px; padding: 6px 8px; }
    #newQuoteForm h3 { font-size: 14.5px; }
}

/* ===== /chat (Xabarlar) — planshet va telefon uchun moslashuvchanlik =====
   Suhbatlar paneli, qidiruv kartalari, suhbat sarlavhasi, xabar pufakchalari va
   yozish formasi — har bir qurilmada shrift, tugma, avatar va ikonlar bosqichma-
   bosqich kichrayadi; gorizontal overflow yo'q. Layout collapse (3→2→1 ustun) va
   layout collapse yuqoridagi umumiy ≤1024/≤768 bloklardan keladi; bu yerda
   chat'ga xos vizual scaling. Sensorli qurilmada avatar/tugmalar tegishga qulay
   o'lchamda qoldiriladi. */

/* Orqaga ("←") tugmasi faqat bitta ustunli (mobil) ko'rinishda kerak —
   keng ekranda suhbatlar ro'yxati doim yonda turadi, shuning uchun yashiriladi. */
.chat-header [data-back] { display: none; }

/* Keng desktop oralig'i (≤1200px) — suhbatlar paneli sal toraytiriladi */
@media (max-width: 1200px) {
    .chat { grid-template-columns: 300px 1fr; }
}

/* Planshet landshaft (≤1024px) — suhbatlar paneli toraytiriladi,
   xabar maydoniga ko'proq joy. */
@media (max-width: 1024px) {
    .chat { grid-template-columns: 300px 1fr; }
    .chat-search { padding: 14px 14px 8px; }
    .search-card { padding: 12px 14px; }
    .conv-item { padding: 13px 14px; }
    .messages { padding: 14px 16px; }
}

/* Planshet portret / katta telefon (≤768px) — bitta ustun (ro'yxat YOKI suhbat) */
@media (max-width: 768px) {
    /* MUHIM: yuqoridagi ≤1024/≤1200 bloklar `.chat`ga `300px 1fr` beradi va ular manba
       tartibida shu yerdan oldin kelgani uchun telefon kengligida ham YUTADI. Natijada
       yashirin (display:none) sidebar o'rniga 300px ustun band qolib, chat-main faqat
       birinchi trekka tushadi va o'ngda bo'sh 1fr (≈90px) joy ortib qoladi. Bu yerda
       qayta bitta ustunga majburlaymiz — chat butun ekran kengligini egallaydi. */
    .chat { grid-template-columns: 1fr; }
    .chat-header [data-back] { display: inline-flex; }

    .chat-search { padding: 14px 14px 8px; }
    .chat-list-title { font-size: 12.5px; padding: 12px 14px 6px; }

    .search-card .name { font-size: 15px; }
    .search-card .conn-btn { font-size: 13px; padding: 6px 11px; }

    .conv-item { padding: 13px 14px; gap: 11px; }
    .conv-item .avatar { width: 46px; height: 46px; font-size: 17px; }
    .conv-item .name { font-size: 15px; }
    .conv-item .last { font-size: 13px; }

    .chat-header { padding: 12px 14px; gap: 10px; }
    .chat-header .avatar { width: 42px; height: 42px; font-size: 16px; }
    .chat-header .name { font-size: 15.5px; }
    .chat-header .presence { font-size: 12px; }

    .messages { padding: 12px 14px; }
    .msg { max-width: 80%; }
    .msg-form { padding: 10px 14px 14px; }
}

/* Telefon (≤480px) — shrift/ikon/tugmalar yana kichrayadi, pufakcha kengayadi */
@media (max-width: 480px) {
    .chat-search { padding: 12px 12px 8px; }
    .search-box .input { font-size: 14px; }
    .search-box .search-ico svg { width: 17px; height: 17px; }

    .search-card { padding: 11px 12px; gap: 10px; }
    .search-card .avatar { width: 44px; height: 44px; font-size: 16px; }
    .search-card .name { font-size: 14.5px; }
    .search-card .uname, .search-card .bio, .search-card .presence { font-size: 12px; }
    .search-card .conn-btn { font-size: 12.5px; padding: 5px 10px; }

    .chat-list-title { font-size: 12px; padding: 12px 12px 6px; }
    .conv-item { padding: 12px; gap: 10px; }
    .conv-item .avatar { width: 44px; height: 44px; font-size: 16px; }
    .conv-item .name { font-size: 14.5px; }
    .conv-item .last { font-size: 12.5px; }
    .unread-badge { font-size: 11px; min-width: 18px; height: 18px; }
    .online-dot { width: 11px; height: 11px; }

    .chat-header { padding: 10px 12px; gap: 10px; }
    .chat-header [data-back] svg { width: 22px; height: 22px; }
    .chat-header .avatar { width: 40px; height: 40px; font-size: 15px; }
    .chat-header .name { font-size: 15px; }
    .chat-header .presence { font-size: 11.5px; }

    .messages { padding: 10px 12px; }
    .msg { max-width: 85%; font-size: 14px; padding: 5px 8px 5px 10px; }
    .msg-time { font-size: 10.5px; }
    .msg .ticks .tick-svg { width: 13px; height: 8px; }
    .msg .ticks .tick-svg.dbl { width: 15px; }
    .msg .shared-card { max-width: 200px; padding: 6px 8px; }
    .msg .shared-ico svg { width: 16px; height: 16px; }
    .msg .shared-title { font-size: 12.5px; }
    .msg .shared-author { font-size: 10.5px; }
    .msg-act { width: 26px; height: 26px; }
    .msg-act .act-svg { width: 14px; height: 14px; }

    .msg-form { padding: 8px 12px 12px; gap: 8px; }
    .msg-form .row { gap: 8px; }
    .msg-form .input { font-size: 14px; }
    .msg-form .btn-icon { padding: 9px; }
    .msg-form .btn-icon svg { width: 20px; height: 20px; }
    .char-count { font-size: 10.5px; }
}

/* Kichik telefon (≤360px) — eng tor ekran, hammasi sig'adi */
@media (max-width: 360px) {
    .chat-search { padding: 10px 10px 6px; }
    .chat-list-title { padding: 11px 10px 6px; }
    .search-card { padding: 10px; }
    .search-card .avatar { width: 40px; height: 40px; font-size: 15px; }
    .conv-item { padding: 11px 10px; gap: 9px; }
    .conv-item .avatar { width: 40px; height: 40px; font-size: 15px; }
    .conv-item .name { font-size: 14px; }
    .conv-item .last { font-size: 12px; }

    .chat-header { padding: 9px 10px; gap: 8px; }
    .chat-header .avatar { width: 38px; height: 38px; font-size: 14px; }
    .chat-header .name { font-size: 14.5px; }

    .messages { padding: 9px 10px; }
    .msg { max-width: 88%; font-size: 13.5px; }
    .msg-form { padding: 8px 10px 10px; }
    .msg-form .input { font-size: 13.5px; }
}

/* ===== /profile (Profil) — planshet va telefon uchun moslashuvchanlik =====
   Sarlavha (avatar + ism/username + motto + statbar + amal tugmalari), tablar,
   post/story plitalari, iqtibos kartalari va "Hozir o'qiyapti" yon paneli — har
   bir qurilmada shrift, tugma, avatar va ikonlar bosqichma-bosqich kichrayadi;
   gorizontal overflow yo'q. Layout grid kollapsi (2 ustun → 1 ustun) ≤900px da,
   plita gridlari (3 → 2 ustun) ≤600px da yuqoridagi profil bloklaridan keladi —
   bu yerda faqat profilga xos vizual scaling. Iqtibos kartalari (profil "Iqtiboslar"
   tabi) `.quote-*` bloklaridan, `.section-title` /reading-books blokidan moslanadi.
   Anonim ko'rinishdagi `.public-bar` ham moslanadi. */

/* Planshet landshaft (≤1024px) — ikki ustunli layout saqlanadi, avatar va yon
   panel sal kichrayadi. */
@media (max-width: 1024px) {
    .profile-hero { gap: 26px; margin-bottom: 32px; }
    .profile-ring { width: 116px; height: 116px; }
    .profile-ring .avatar.lg { font-size: 40px; }
    .profile-hero .profile-avatar-wrap .avatar.lg { width: 104px; height: 104px; font-size: 40px; }
    .profile-hero-info h1 { font-size: 32px; }

    .profile-layout { gap: 24px; }
    .reading-now { padding: 20px; }
    .reading-now-cover { width: 112px; height: 168px; }
    .reading-now-ring { width: 86px; height: 86px; }
}

/* Planshet portret / katta telefon (≤768px) */
@media (max-width: 768px) {
    .profile-hero { gap: 20px; margin-bottom: 28px; }
    .profile-ring { width: 104px; height: 104px; padding: 3px; }
    .profile-ring .avatar.lg { font-size: 36px; }
    .profile-hero .profile-avatar-wrap .avatar.lg { width: 96px; height: 96px; font-size: 36px; }
    .profile-hero-info { min-width: 220px; }
    .profile-hero-info h1 { font-size: 28px; }
    .profile-motto { font-size: 16.5px; margin-bottom: 16px; }
    .profile-statbar { margin-bottom: 16px; }
    .profile-statbar > div, .profile-statbar > a { padding: 0 14px; }
    .profile-statbar .num { font-size: 19px; }
    .profile-statbar .lbl { font-size: 12.5px; }

    /* Amal tugmalari (kuzatish / xabar / ulashish / tahrir / o'chirish) */
    .profile-actions .btn { padding: 8px 16px; font-size: 14px; }
    .profile-actions .btn-sm { padding: 7px 13px; font-size: 13.5px; }

    /* Tablar */
    .profile-tabs { gap: 20px; margin-bottom: 18px; }
    .profile-tab { font-size: 14.5px; }

    /* Post / story plitalari */
    .post-tiles, .story-tiles { gap: 12px; }
    .post-tile, .story-tile { border-radius: 16px; }
    .post-tile-fallback .material-symbols-outlined,
    .story-tile-fallback .material-symbols-outlined { font-size: 34px; }

    /* "Hozir o'qiyapti" yon paneli */
    .reading-now { padding: 20px; }
    .reading-now h3 { font-size: 18px; margin-bottom: 16px; }
    .reading-now-cover { width: 104px; height: 156px; }
    .reading-now .title { font-size: 17px; }
    .reading-now-ring { width: 84px; height: 84px; }
    .reading-now-ring .inner { font-size: 18px; }
}

/* Telefon (≤480px) — sarlavha markazlashtiriladi (avatar tepada, matn ostida) */
@media (max-width: 480px) {
    .profile-hero { flex-direction: column; align-items: center; text-align: center; gap: 16px; margin-bottom: 24px; }
    .profile-ring { width: 100px; height: 100px; }
    .profile-ring .avatar.lg { font-size: 34px; }
    .profile-hero .profile-avatar-wrap .avatar.lg { width: 92px; height: 92px; font-size: 34px; }
    .profile-hero-info { min-width: 0; width: 100%; }
    .profile-hero-info h1 { font-size: 25px; }
    .profile-hero-info > p.muted { margin-left: 0; }
    .profile-motto { font-size: 15px; margin-bottom: 14px; }

    /* Statbar — markazda, teng taqsimlangan */
    .profile-statbar { justify-content: center; margin-bottom: 16px; }
    .profile-statbar > div, .profile-statbar > a { padding: 0 16px; }
    .profile-statbar .num { font-size: 18px; }
    .profile-statbar .lbl { font-size: 12px; }

    /* Amal tugmalari — markazda, sig'masa o'raladi; ikonlar (inline style) kichrayadi */
    .profile-actions { justify-content: center; gap: 8px; }
    .profile-actions .btn { padding: 9px 14px; font-size: 13.5px; }
    .profile-actions .btn-sm { padding: 8px 12px; font-size: 13px; }
    .profile-actions .material-symbols-outlined { font-size: 17px !important; }

    /* Tablar — uchchovi teng kenglikda bir qatorga */
    .profile-tabs { gap: 0; justify-content: space-between; }
    .profile-tab { flex: 1; font-size: 13.5px; padding-bottom: 9px; }

    /* Plitalar (2 ustun ≤600 blokdan) — nozik sozlash */
    .post-tiles, .story-tiles { gap: 8px; }
    .post-tile, .story-tile { border-radius: 14px; }
    .post-tile-fallback .material-symbols-outlined,
    .story-tile-fallback .material-symbols-outlined { font-size: 30px; }
    .post-tile-fallback .t, .story-tile-fallback .t { font-size: 13px; }
    .post-tile-overlay { gap: 20px; }
    .story-tile-meta { padding: 8px 10px; }
    .story-tile-date { font-size: 11.5px; }
    .story-tile-stats .stat { font-size: 12px; }
    .story-tile-stats .material-symbols-outlined { font-size: 14px; }

    /* "Hozir o'qiyapti" */
    .reading-now { padding: 18px 16px; }
    .reading-now h3 { font-size: 17px; margin-bottom: 14px; }
    .reading-now-list { gap: 20px; }
    .reading-now-list .reading-now-inner + .reading-now-inner { padding-top: 20px; }
    .reading-now-cover { width: 96px; height: 144px; }
    .reading-now .title { font-size: 16px; }
    .reading-now .author { font-size: 13px; }
    .reading-now-ring { width: 76px; height: 76px; }
    .reading-now-ring .inner { font-size: 17px; }
    .reading-now-goal { font-size: 12px; padding: 7px 14px; }

    /* Anonim yuqori panel (public profil) */
    .public-bar { padding: 12px 16px; }
}

/* Kichik telefon (≤360px) */
@media (max-width: 360px) {
    .profile-hero { gap: 14px; }
    .profile-ring { width: 88px; height: 88px; }
    .profile-ring .avatar.lg { font-size: 30px; }
    .profile-hero .profile-avatar-wrap .avatar.lg { width: 80px; height: 80px; font-size: 30px; }
    .profile-hero-info h1 { font-size: 22px; }
    .profile-motto { font-size: 14px; }
    .profile-statbar > div, .profile-statbar > a { padding: 0 12px; }
    .profile-statbar .num { font-size: 17px; }
    .profile-statbar .lbl { font-size: 11.5px; }
    .profile-actions .btn { padding: 8px 12px; font-size: 13px; }
    .profile-actions .btn-sm { font-size: 12.5px; }
    .profile-tab { font-size: 12.5px; }
    .post-tiles, .story-tiles { gap: 7px; }
    .reading-now-cover { width: 88px; height: 132px; }
    .reading-now .title { font-size: 15.5px; }
    .reading-now-ring { width: 70px; height: 70px; }
    .reading-now-ring .inner { font-size: 16px; }
}

/* ===== Bildirishnoma qo'ng'irog'i va toast (16-bosqich, SignalR) ===== */
.notif-bell { position: relative; }
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg, #fff);
}

/* ===== Bildirishnomalar paneli (qo'ng'iroq dropdown) ===== */
.notif-wrap { position: relative; }
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    max-height: 70vh;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 60;
}
.notif-panel[hidden] { display: none; }
.notif-panel-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.notif-list { overflow-y: auto; }
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}
.notif-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
a.notif-item:hover { background: var(--primary-soft); }
.notif-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.notif-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
}
.notif-meta { flex: 1; min-width: 0; }
.notif-msg { display: block; font-size: 13.5px; line-height: 1.35; color: var(--text); }
.notif-time { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.toast-host {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 40px));
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface, #fff);
    color: var(--text, #1a1a1a);
    border: 1px solid var(--border, #e5e2dc);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    font-size: 14px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--accent); }
.toast-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .toast-host { left: 12px; right: 12px; bottom: 12px; max-width: none; }
    /* Notification paneli: telefonlarda qo'ng'iroq chap chetda bo'lganda dropdown ekrandan
       chiqib ketmasligi uchun viewport bo'ylab (fixed) joylashtiramiz. */
    .notif-panel {
        position: fixed;
        top: calc(var(--navbar-h) + 6px);
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }
}

/* ===== Story halqasi (avatar gradient ring) ===== */
.post-avatar-wrap,
.profile-avatar-wrap { display: inline-flex; border-radius: 50%; }
.post-avatar-wrap.has-story,
.profile-avatar-wrap.has-story {
    padding: 3px;
    cursor: pointer;
    position: relative;
    /* Ozgina yorqin, statik gradient halqa (aylanmaydi) */
    background: linear-gradient(135deg, #ffb347, var(--accent), #ff5e7e);
    box-shadow: 0 0 6px rgba(232, 112, 58, 0.35);
}
.post-avatar-wrap.has-story .avatar,
.profile-avatar-wrap.has-story .avatar {
    border: 2px solid var(--surface);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}
.profile-avatar-wrap.has-story { padding: 4px; }

/* ===== Story ko'rish oynasi ===== */
body.no-scroll { overflow: hidden; }

.story-viewer {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: rgba(20, 16, 12, 0.92); padding: 16px;
}
.story-viewer[hidden] { display: none; }
.story-stage {
    position: relative; width: min(420px, 100%); height: min(78vh, 720px);
    background: var(--surface); border-radius: var(--radius);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg);
}
.story-progress { display: flex; gap: 4px; padding: 10px 12px 0; }
.story-seg { flex: 1; height: 3px; border-radius: 3px; background: rgba(0,0,0,0.12); }
.story-seg.active, .story-seg.seen { background: var(--primary); }
.story-author { padding: 10px 12px; }
.story-author-inner { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.story-author-meta { display: flex; flex-direction: column; line-height: 1.2; }
.story-author-meta .name { font-weight: 600; font-size: 14px; }
.story-author-meta .time { font-size: 12px; color: var(--text-secondary); }
.story-image-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: #1c1814; overflow: hidden; min-height: 0;
}
.story-image { width: 100%; height: 100%; object-fit: contain; }
.story-image-wrap.noimg {
    background: linear-gradient(135deg, var(--primary), var(--accent));
}
.story-image-wrap.noimg::after {
    content: "menu_book"; font-family: "Material Symbols Outlined";
    font-size: 96px; color: rgba(255,255,255,0.85);
}
.story-caption { padding: 12px 14px; }
.story-book-title { font-family: var(--serif); font-weight: 600; font-size: 17px; }
.story-book-author { color: var(--text-secondary); font-size: 13px; }
.story-footer {
    display: flex; align-items: center; gap: 18px;
    padding: 10px 14px; border-top: 1px solid var(--border);
}
.story-stat {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: default; color: var(--text-secondary);
    font-size: 14px; font-family: var(--sans);
}
.story-like-btn { cursor: pointer; }
.story-like-btn.liked { color: var(--danger); }
.story-like-btn.liked .material-symbols-outlined { font-variation-settings: "FILL" 1; }
.story-delete-btn { cursor: pointer; margin-left: auto; color: var(--danger); }
/* `hidden` atributi (deleteBtn.hidden = !isMine) class display:inline-flex'dan ustun bo'lishi uchun */
.story-stat[hidden] { display: none; }
.story-close, .story-nav {
    background: rgba(255,255,255,0.15); color: #fff; border: none; cursor: pointer;
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.story-close { position: absolute; top: 16px; right: 16px; }
.story-nav:hover, .story-close:hover { background: rgba(255,255,255,0.28); }

/* Planshet — story oynasini desktopga nisbatan kichikroq qilamiz */
@media (max-width: 1024px) {
    .story-stage { width: min(360px, 62vw); height: min(70vh, 600px); }
}

/* Telefon — yana kichikroq, navigatsiya tugmalari ekran ichida */
@media (max-width: 540px) {
    .story-nav {
        position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
        width: 38px; height: 38px;
    }
    .story-prev { left: 8px; } .story-next { right: 8px; }
    .story-close { width: 38px; height: 38px; top: 10px; right: 10px; }
    .story-stage { width: min(330px, 86vw); height: min(68vh, 540px); }
    .story-image-wrap.noimg::after { font-size: 72px; }
}

/* ===== Umumiy modal (delete account, story composer) ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(20, 16, 12, 0.55);
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    width: min(460px, 100%); background: var(--surface);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px;
    max-height: calc(100dvh - 32px); overflow-y: auto;
}
.modal-title { font-family: var(--serif); font-size: 20px; margin: 0 0 10px; }
.modal-box p { color: var(--text-secondary); margin: 0 0 14px; }
.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
    position: sticky; bottom: -24px;
    margin-left: -24px; margin-right: -24px; margin-bottom: -24px;
    padding: 14px 24px; background: var(--surface);
    border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}

.story-duration { display: flex; gap: 8px; margin-top: 8px; }
.story-duration-opt {
    flex: 1; padding: 9px 6px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text-secondary); font: inherit; font-size: 14px;
    cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.story-duration-opt:hover { border-color: var(--primary); }
.story-duration-opt.is-active {
    border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 600;
}

.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-text { color: var(--danger); }

/* ===== Username / inline status xabarlari ===== */
.username-status { margin: 8px 0 0; font-size: 13px; }
.username-status[data-state="ok"] { color: #2e7d32; }
.username-status[data-state="bad"] { color: var(--danger); }
.username-status[data-state="checking"] { color: var(--text-secondary); }

/* ===== Anonim sahifalar uchun yengil yuqori panel (public profil / story) ===== */
.public-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 24px; max-width: 1100px; margin: 0 auto;
    border-bottom: 1px solid var(--border);
}

/* ===== Story detal sahifasi (/stories/{id}) ===== */
.story-detail { max-width: 640px; margin: 0 auto; }
.story-detail-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-secondary); font-weight: 600; font-size: 14px; margin-bottom: 16px;
}
.story-detail-back:hover { color: var(--accent); }
.story-detail-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; overflow: hidden;
}
.story-detail-author {
    display: flex; align-items: center; gap: 12px; color: var(--text); margin-bottom: 18px;
}
.story-detail-author-meta { display: flex; flex-direction: column; line-height: 1.3; }
.story-detail-author-meta .name { font-weight: 600; }
.story-detail-author-meta .time { font-size: 13px; color: var(--text-secondary); }
.story-detail-image {
    border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 18px;
    background: var(--bg);
}
.story-detail-image img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.story-detail-title { font-family: "Lora", serif; font-size: 26px; margin: 0 0 12px; }
.story-detail-text { font-size: 17px; line-height: 1.7; white-space: pre-wrap; margin: 0 0 20px; }
.story-detail-footer {
    display: flex; align-items: center; gap: 22px;
    padding-top: 16px; border-top: 1px solid var(--border);
}
.story-detail-stat {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: default; padding: 0;
    color: var(--text-secondary); font-size: 15px; font-weight: 600;
}
button.story-detail-stat { cursor: pointer; }
.story-detail-like:hover { color: var(--accent); }
.story-detail-like.liked { color: var(--accent); }
.story-detail-like.liked .material-symbols-outlined { font-variation-settings: "FILL" 1; }
.story-detail-cta { margin-top: 22px; padding: 22px; }
.story-detail-cta p { margin: 0 0 14px; color: var(--text-secondary); }

/* ===== Kun/tun rejimi (dark mode) ===== */
html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #5cc2a0;          /* o'qiladigan yashil — sarlavha/havola/matn uchun */
    --primary-soft: rgba(92, 194, 160, 0.13);
    --accent: #f0824e;
    --accent-dark: #e0703c;
    --bg: #13120e;               /* iliq, deyarli qora fon */
    --surface: #1d1b15;          /* iliq to'q sirt */
    --text: #ece7db;             /* iliq oq matn */
    --text-secondary: #9d978a;
    --border: #322e25;
    --danger: #ff6b5e;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* To'q rejimda yashil "to'liq fon" elementlarida oq matn o'qilishi uchun
   --primary yorqinlashtirilgan, shu sabab bu joylarga to'qroq yashil fon beriladi */
html[data-theme="dark"] .btn-primary { background: #2f7d65; color: #fff; }
html[data-theme="dark"] .btn-primary:hover { background: #266654; color: #fff; }
html[data-theme="dark"] .lp-cta { background: #245848; }

/* Qattiq kodlangan ochiq fonlarni to'q rejimga moslash */
html[data-theme="dark"] .onboarding-warning {
    background: rgba(240, 210, 122, 0.10);
    border-color: rgba(240, 210, 122, 0.28);
    color: #e6c869;
}
html[data-theme="dark"] .onboarding-warning .material-symbols-outlined { color: #e6c869; }

/* Janr kartalari: tun rejimida ikonka va matn oq ko'rinsin (kunduzgi to'q-yashil
   qattiq kodlangan ranglar tun fonida ko'rinmaydi) */
html[data-theme="dark"] .genre-card .material-symbols-outlined { color: rgba(236, 231, 219, .75); }
html[data-theme="dark"] .genre-card .genre-name { color: var(--text); }
html[data-theme="dark"] .genre-card.selected .material-symbols-outlined { color: var(--accent); }
html[data-theme="dark"] .genre-card.selected .genre-name { color: #fff; }
html[data-theme="dark"] .anon-banner {
    background: rgba(92, 194, 160, 0.10);
    border-color: rgba(92, 194, 160, 0.22);
}
html[data-theme="dark"] .msg-edit .msg-edit-input { background: var(--surface); }
html[data-theme="dark"] .msg-edit .msg-edit-acts [data-edit-save] { background: var(--surface); }

/* Rejim almashganda yumshoq o'tish (JS qisqa vaqtga klass qo'shadi) */
html.theme-transition,
html.theme-transition * {
    transition: background-color .25s ease, border-color .25s ease, color .2s ease, box-shadow .25s ease !important;
}

/* ===== Kun/tun almashtirish tugmasi (icon swap) ===== */
.theme-icon-light { display: none; }
.theme-icon-dark { display: inline-flex; }
html[data-theme="dark"] .theme-icon-light { display: inline-flex; }
html[data-theme="dark"] .theme-icon-dark { display: none; }

.theme-toggle .material-symbols-outlined { font-size: 22px; transition: transform .3s ease; }
.theme-toggle:hover .material-symbols-outlined { transform: rotate(-18deg); }

/* Navbarsiz sahifalar (landing, onboarding) uchun suzuvchi tugma */
.theme-fab {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: color .15s, border-color .15s, transform .3s ease;
}
.theme-fab:hover { color: var(--primary); border-color: var(--primary); }
.theme-fab .material-symbols-outlined { font-size: 22px; }
@media (max-width: 860px) {
    .theme-fab { width: 42px; height: 42px; top: 12px; right: 12px; }
}
