:root {
    --bg-color: #fdfaf5;
    --text-main: #3d2b1f;
    --text-muted: #8c7b6c;
    --accent-color: #a67b5b;
    --accent-hover: #8b6241;
    --white: #ffffff;
    --font-serif: 'Noto Serif KR', serif;
    --font-sans: 'Noto Sans KR', sans-serif;
    --font-display: 'Playfair Display', serif;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    word-break: keep-all;
    overflow-wrap: break-word;
}

* {
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    padding: 40px 0;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    margin: 0;
    color: var(--accent-color);
}

.subtitle {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.auth-box .btn-login-google {
    background: white;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-box .btn-login-google:hover {
    background: #f8f8f8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.user-profile-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-nickname {
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.btn-logout-small {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Banner */
.banner {
    background: linear-gradient(135deg, #a67b5b 0%, #8b6241 100%);
    color: white;
    padding: 80px 60px;
    border-radius: 32px;
    margin-bottom: 60px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    position: relative;
    overflow: hidden;
}

.banner::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: 0;
}

.banner-content {
    flex: 1;
    z-index: 1;
}

.banner-content h1 {
    font-family: var(--font-serif);
    font-size: 3rem;
    margin: 0 0 15px;
    letter-spacing: -1px;
}

.banner-content p {
    font-size: 1.3rem;
    opacity: 0.95;
    margin: 0;
}

.banner-books {
    flex: 1.5;
    display: flex;
    gap: 40px;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    min-height: 250px;
}

.banner-empty-state {
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 30px 45px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 100%;
}

.banner-empty-state p {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin: 0 0 8px;
    font-weight: 600;
}

.banner-empty-state span {
    font-size: 1rem;
    opacity: 0.85;
}

.banner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.banner-item:hover {
    transform: translateY(-15px) scale(1.08);
}

.banner-book-img {
    height: 220px;
    width: auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 15px 25px 40px rgba(0, 0, 0, 0.4);
}

.banner-book-info {
    margin-top: 15px;
    text-align: center;
}

.banner-book-title {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.9;
    display: block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-badge,
.pick-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: var(--banner-bg);
    color: #fff;
    width: auto;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
    font-family: var(--font-serif);
}

.pick-badge {
    background: var(--accent-color);
}

/* Action Section */
.action-section {
    text-align: center;
    margin-bottom: 60px;
}

.btn-register {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(166, 123, 91, 0.3);
    transition: all 0.2s;
}

.btn-register:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Feed Grid */
/* Feed Tabs & Header */
.feed-header {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feed-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 2px solid #f0e6d6;
    padding-bottom: 5px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #a0937d;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--accent-color);
}

.tab-btn.active {
    color: var(--accent-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.library-info {
    background: var(--bg-color);
    padding: 20px 25px;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--accent-color);
    animation: fadeInDown 0.5s ease-out;
}

.library-info h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--text-dark);
    margin: 0;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    padding-bottom: 100px;
}

.book-card {
    background: var(--bg-color);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(166, 123, 91, 0.08);
    transition: transform 0.2s;
}

.book-card:hover {
    transform: translateY(-5px);
}

.book-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    margin-bottom: 15px;
    position: relative;
}

.book-info h3 {
    font-size: 1.1rem;
    margin: 0 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-meta {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.user-name {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-tag {
    background: #f0ebe5;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent-color);
}

/* Status Badges */
.status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.status-toread {
    background: #607D8B;
}

.status-reading {
    background: #4CAF50;
}

.status-finished {
    background: var(--accent-color);
}

.status-stopped {
    background: #E53935;
}

/* Library Filters */
.library-filters {
    scrollbar-width: none;
}

.library-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #fdfaf5;
    border-color: var(--accent-color);
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Registration Modal Toggles and Radio */
.status-options {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.status-radio {
    display: none;
}

.status-label {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-radio:checked+.status-label {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-input:checked+.toggle-slider {
    background-color: var(--accent-color);
}

.toggle-input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.fullscreen {
    background: #fff;
    align-items: flex-start;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: 80px;
}

.modal-overlay.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    padding: 60px 40px;
    animation: modalSlideUp 0.4s ease-out;
}

/* PWA Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    animation: splashPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.splash-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 24px;
}

.splash-loader {
    width: 40px;
    height: 3px;
    background: #f0f0f0;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.splash-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-color, #a67b5b);
    animation: loaderMove 1.5s infinite ease-in-out;
}

@keyframes splashPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes loaderMove {
    0% {
        left: -100%;
    }

    50% {
        left: 0;
    }

    100% {
        left: 100%;
    }
}

body.loading {
    overflow: hidden;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 25px;
    position: relative;
}

.detail-comment p.no-comment {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
    word-break: keep-all;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text-main);
    margin: 0;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    z-index: 100;
}

.modal-overlay.fullscreen .close-modal {
    top: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    font-size: 28px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.close-modal:hover {
    background: #eee;
    color: var(--text-main);
    transform: rotate(90deg);
}

.search-box {
    display: flex;
    gap: 10px;
    background: #f1f1f1;
    padding: 8px 8px 8px 20px;
    border-radius: 40px;
    margin-bottom: 30px;
    transition: all 0.2s;
}

.search-box:focus-within {
    background: #eee;
    box-shadow: 0 0 0 2px rgba(166, 123, 91, 0.2);
}

.search-box input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    font-size: 1rem;
    padding: 10px 0;
    outline: none;
    color: var(--text-main);
}

.btn-search {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-search:hover {
    background: var(--accent-hover);
}

.btn-install-pwa {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--banner-bg);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 30px;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
}

.btn-install-pwa:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(166, 123, 91, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: var(--text-muted);
    border: 1px solid #ddd;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #eee;
    color: var(--text-main);
    border-color: #ccc;
}

#search-results {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #fdfaf5;
    transform: translateX(5px);
}

.search-result-item img {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-info h4 {
    margin: 0 0 5px;
    font-size: 1.05rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-hint {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

/* Admin Persona Section */
#admin-only-section {
    background: #fdf2e9;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    margin-top: 20px;
}

#admin-author-input {
    transition: border-color 0.2s, box-shadow 0.2s;
}

#admin-author-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(166, 123, 91, 0.1);
}


/* Modal Footer */
.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.modal-footer button {
    flex: 1;
}

#book-comment {
    width: 100%;
    height: 180px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 16px;
    background: #fafafa;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.2s;
    margin-top: 15px;
}

#book-comment:focus {
    background: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(166, 123, 91, 0.1);
}

.char-counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Auth Styles */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    padding: 20px;
}

.auth-card {
    background: var(--bg-color);
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-family: var(--font-display);
    color: var(--text-main);
    font-size: 2.2rem;
    margin: 0 0 5px;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form .form-group input {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.auth-form .form-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(166, 123, 91, 0.1);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

.btn-text:hover {
    color: var(--accent-hover);
}

/* Responsive */
@media (max-width: 1024px) {
    .banner-content h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header {
        padding: 25px 0;
    }

    .brand h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    /* Banner Mobile */
    .banner {
        flex-direction: column;
        padding: 40px 20px;
        text-align: center;
        gap: 30px;
        margin-bottom: 40px;
    }

    .banner-content h1 {
        font-size: 1.6rem;
        /* ~24px to 26px */
        margin-bottom: 10px;
    }

    .banner-content p {
        font-size: 1.1rem;
    }

    .banner-books {
        justify-content: flex-start;
        width: calc(100% + 40px);
        margin: 0 -20px;
        padding: 10px 20px;
        gap: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    /* Hide scrollbar for banner-books */
    .banner-books::-webkit-scrollbar {
        display: none;
    }

    .banner-books {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .banner-item {
        flex: 0 0 130px;
    }

    .banner-book-img {
        height: 180px;
    }

    .rank-badge {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        top: -10px;
        left: -10px;
    }

    /* Feed Grid Mobile (2 Columns) */
    .feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .book-card {
        padding: 10px;
        border-radius: 12px;
    }

    .book-info h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    /* Bestseller Section Mobile */
    .bestseller-section {
        padding: 60px 0;
    }

    .bestseller-section .section-header h2 {
        font-size: 1.5rem;
        margin-bottom: 30px;
        padding: 0 10px;
    }

    .bestseller-slider-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
        margin: 0 -15px;
        /* Offset container padding to allow edge-to-edge scroll */
        padding-left: 15px;
        padding-right: 15px;
    }

    .bestseller-list-wrapper {
        overflow: visible;
        /* Prevent clipping that blocks parent scroll */
    }

    /* Hide nav buttons on mobile */
    .carousel-nav-btn {
        display: none;
    }

    .bestseller-slider {
        gap: 15px;
        transition: none !important;
        /* Disable JS transition for native swipe */
        transform: none !important;
    }
}

/* Load More Button (Global) */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 60px;
}

.btn-load-more {
    width: 100%;
    max-width: 400px;
    padding: 16px 0;
    background-color: #f0ebe5;
    color: #5d4037;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-load-more:hover {
    background-color: #e5dfd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-load-more:active {
    transform: translateY(0);
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* Detail Modal Specifics */
.detail-modal-content {
    padding: 0;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

/* Custom Scrollbar for Detail Modal */
.detail-modal-content::-webkit-scrollbar {
    width: 6px;
}

.detail-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.detail-modal-content::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
    border: 2px solid transparent;
}

.detail-header {
    display: flex;
    gap: 25px;
    padding: 30px;
    background: #fdfaf5;
    border-bottom: 1px solid #eee;
}

.detail-cover {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    background: #f8f8f8;
}

.detail-cover img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.detail-meta {
    flex: 1;
    text-align: left;
}

.detail-title-area {
    margin-bottom: 5px;
}

/* 관리자 버튼 스타일 */
.detail-admin-row {
    padding: 10px 30px;
    display: flex;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detail-admin-btns {
    display: flex;
    gap: 8px;
}

.btn-edit-book,
.btn-add-log,
.btn-delete-book {
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-log {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-add-log:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.btn-edit-book {
    background: #fdfaf5;
    color: var(--text-main);
    border: 1px solid #ddd;
}

.btn-edit-book:hover {
    background: #f0ebe5;
    border-color: var(--accent-color);
}

.btn-delete-book {
    background: #fffafa;
    border-color: #ffdce0;
    color: #d32f2f;
}

.btn-delete-book:hover {
    background: #fff0f0;
    border-color: #ffb1bb;
}


.detail-meta h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-main);
    line-height: 1.3;
    flex: 1;
}

.detail-author {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 15px;
}

.detail-user {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.detail-body-inner {
    padding: 30px;
}

.detail-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-comment-body {
    background: #fdfaf5;
    padding: 20px;
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.detail-comment {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-cream);
    word-break: keep-all;
    overflow-wrap: break-word;
}

@media (max-width: 480px) {
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 20px;
        gap: 15px;
    }

    .detail-cover {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .detail-meta h2 {
        font-size: 1.3rem;
        /* Reset margin or any specific desktop styles here if needed */
        margin-top: 10px;
    }

    .detail-admin-row {
        padding: 5px 20px 15px;
        justify-content: center;
        border-bottom: none;
    }

    .detail-admin-btns {
        width: 100%;
        justify-content: center;
    }


    .detail-body-inner {
        padding: 20px;
    }

    .detail-comment {
        font-size: 0.95rem;
        padding: 15px;
    }
}



.btn-load-more:hover {
    background-color: #e5dfd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-load-more:active {
    transform: translateY(0);
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.modal-content {
    padding: 30px 20px;
}

@media (max-width: 480px) {
    .brand h1 {
        font-size: 1.8rem;
    }

    .banner-content h1 {
        font-size: 1.4rem;
    }

    .feed-grid {
        gap: 10px;
    }

    .btn-search {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .search-box {
        padding: 6px 6px 6px 15px;
    }
}

/* Timeline Styles */
.detail-timeline {
    margin-top: 20px;
    padding-left: 10px;
    border-left: 2px solid #eee;
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
    padding-left: 25px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--bg-color);
}

.timeline-date {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.timeline-text {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    line-height: 1.6;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    word-break: break-all;
}

.register-btn-group button {
    white-space: nowrap;
}

/* Mobile adjustments for button group */
@media (max-width: 480px) {
    .register-btn-group {
        flex-direction: column;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }
}

/* In-App Browser Notice Popup */
.inapp-notice-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
}

.inapp-notice-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 500px;
    border-radius: 32px 32px 0 0;
    padding: 35px 25px 50px;
    text-align: center;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUpPopup 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpPopup {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.inapp-notice-header {
    margin-bottom: 20px;
}

.notice-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

.inapp-notice-content h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0 0 15px;
    line-height: 1.4;
}

.inapp-notice-content p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

.btn-logout-secondary {
    background: none;
    border: 1px solid #ddd;
    color: #999;
    padding: 10px 40px;
    border-radius: 25px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.btn-logout-secondary:hover {
    background: #fdf2f2;
    color: #d9534f;
    border-color: #d9534f;
}

/* Social Search View Styles */
#social-search-view {
    animation: fadeIn 0.3s ease;
}

.search-bar-sticky {
    position: sticky;
    top: 0;
    background: var(--bg-color);
    padding: 10px 0;
    z-index: 10;
    margin: -10px 0 20px 0;
}

.social-search-item {
    background: #fff;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.social-search-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.social-search-thumbnail {
    width: 70px !important;
    height: 100px !important;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
}

.social-search-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.social-search-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-family: 'Noto Serif KR', serif;
}

.social-search-comment {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 8px;
}

.social-search-meta {
    font-size: 0.78rem;
    color: var(--accent-color);
    font-weight: 500;
}

/* View Helper */
.view-content {
    width: 100%;
}

.guide-steps {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid #f0e6d6;
}

.step-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.step-item:last-child {
    margin-bottom: 0;
}

.step-num {
    background: var(--accent-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px;
}

.btn-notice-close {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-notice-close:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Bottom Navigation Bar (Mobile Only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-color);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    height: 70px;
    z-index: 1000;
    padding: 0 10px;
    box-sizing: border-box;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.03);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    height: 100%;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-item.nav-center {
    position: relative;
    top: -15px;
}

.nav-plus-icon {
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    color: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(111, 78, 55, 0.25);
    margin-bottom: 2px;
    transition: transform 0.2s;
}

.nav-item.nav-center:active .nav-plus-icon {
    transform: scale(0.9);
}

.nav-item:active {
    opacity: 0.7;
}

/* Responsive adjust */
.social-search-item {
    transition: background-color 0.2s ease;
}

.social-search-item:hover {
    background-color: #f9f9f9;
}

.social-search-item img {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1024px) {
    .bottom-nav {
        display: flex;
    }

    .container {
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    .btn-install-pwa {
        bottom: 85px;
        /* Adjust install button position */
    }

    /* Hide top header auth buttons on mobile to simplify */
    .header-main .auth-box {
        display: none;
    }

    /* Hide redundant original tabs and registration buttons on mobile */
    .action-section,
    .feed-header .feed-tabs {
        display: none;
    }

    .feed-header .library-info {
        margin-top: 0;
    }
}

/* Timeline Item Actions */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.timeline-actions {
    display: flex;
    gap: 8px;
}

.btn-log-edit,
.btn-log-delete {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-log-edit:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background-color: rgba(111, 78, 55, 0.05);
}

.btn-log-delete:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

/* Multi-field Form Styling */
.field-group {
    margin-bottom: 24px;
}

.field-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: var(--text-main);
    font-family: var(--font-display);
}

.field-group textarea,
.field-group input[type="text"] {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid #eee;
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.1rem;
    background: #fafafa;
    transition: all 0.2s;
    line-height: 1.6;
}

.field-group textarea:focus,
.field-group input[type="text"]:focus {
    border-color: var(--accent-color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 4px rgba(111, 78, 55, 0.1);
}

.field-group textarea {
    min-height: 140px;
    resize: vertical;
}

#book-note {
    min-height: 200px;
}

.field-row {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.field-row .field-group {
    flex: 1;
}

@media (max-width: 480px) {
    .field-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Enhanced Timeline Rendering */
.timeline-quote {
    position: relative;
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--accent-color);
    margin-bottom: 12px;
    padding: 15px 15px 15px 20px;
    border-left: 3px solid var(--accent-color);
    font-style: italic;
    background: rgba(111, 78, 55, 0.03);
    border-radius: 0 12px 12px 0;
    word-break: keep-all;
}

.timeline-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-item {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-note {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.7;
    word-break: keep-all;
}

/* Fullscreen Modal Specifics */
.modal-overlay.fullscreen {
    align-items: flex-start;
    padding: 0;
}

.modal-overlay.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    padding: 80px 24px 40px;
    padding-top: calc(max(60px, env(safe-area-inset-top)) + 20px);
    overflow-y: auto;
}

@media (max-width: 480px) {
    .modal-overlay.fullscreen .modal-content {
        padding: 60px 16px 30px;
        padding-top: calc(max(50px, env(safe-area-inset-top)) + 15px);
    }
}

.modal-overlay.fullscreen .modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    padding-right: 40px;
    word-break: keep-all;
    line-height: 1.3;
}

@media (max-width: 380px) {
    .modal-overlay.fullscreen .modal-header h2 {
        font-size: 1.5rem;
    }
}

.modal-overlay.fullscreen .search-box {
    margin-bottom: 25px;
}

.modal-overlay.fullscreen .search-box input {
    height: 54px;
    font-size: 1.05rem;
    padding: 0 16px;
    width: 0; /* Force shrink below placeholder width */
    flex: 1;
}

@media (max-width: 480px) {
    .modal-overlay.fullscreen .search-box {
        padding: 6px 6px 6px 16px;
        gap: 5px;
    }

    .modal-overlay.fullscreen .btn-search {
        padding: 10px 18px;
        font-size: 0.95rem;
        flex-shrink: 0;
    }
}

.modal-overlay.fullscreen #search-results {
    max-height: calc(100vh - 300px);
    margin-bottom: 30px;
}

.modal-overlay.fullscreen .field-group label {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.modal-overlay.fullscreen textarea {
    min-height: 120px;
    font-size: 1.1rem;
    padding: 18px;
    line-height: 1.6;
}

.modal-overlay.fullscreen .btn-primary,
.modal-overlay.fullscreen .btn-secondary {
    padding: 18px 24px;
    font-size: 1.1rem;
    width: 100%;
    margin-top: 10px;
}