/* Story Page Mobile - Compact Layout */
/* Inspired by popular VN novel reading apps */
@media (max-width: 768px) {
    
    /* ===== FULL WIDTH CONTAINER ===== */
    .container.main-content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* ===== STORY INFO - Compact Row ===== */
    .story-info {
        display: flex !important;
        flex-direction: row !important;
        gap: 14px !important;
        padding: 12px !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 0 4px 0 !important;
        min-height: auto !important;
    }

    .story-cover {
        width: 110px !important;
        height: 155px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.4) !important;
        flex-shrink: 0 !important;
        font-size: 40px !important;
    }

    .story-details {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        gap: 0;
    }

    .story-title {
        font-size: 17px !important;
        font-weight: 700 !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
        min-height: auto !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Mobile author line */
    .story-details > .story-author {
        display: block !important;
        font-size: 13px;
        color: var(--text-secondary);
        margin-bottom: 6px;
    }

    .story-author a {
        color: #60a5fa;
    }

    /* Status badge - compact */
    .story-status {
        padding: 3px 10px !important;
        font-size: 11px !important;
        border-radius: 12px !important;
        margin-bottom: 6px !important;
        background: rgba(59, 130, 246, 0.2) !important;
        color: #60a5fa !important;
        border: 1px solid rgba(59, 130, 246, 0.3) !important;
        width: fit-content;
    }

    .story-status.completed {
        background: rgba(34, 197, 94, 0.2) !important;
        color: #4ade80 !important;
        border-color: rgba(34, 197, 94, 0.3) !important;
    }

    /* Tags - compact inline */
    .story-tags {
        margin-bottom: 6px !important;
        gap: 4px !important;
    }

    .story-tags .tag {
        padding: 2px 8px !important;
        font-size: 10px !important;
        background: var(--bg-secondary) !important;
        border-radius: 10px !important;
        color: var(--text-secondary) !important;
    }

    /* Hide desktop-only elements on mobile */
    .story-meta,
    .story-actions,
    .story-details .rating-section {
        display: none !important;
    }

    /* Rating form: always modal overlay */
    .rating-form-container.hidden {
        display: none !important;
    }
    .rating-form-container:not(.hidden) {
        display: flex !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 200 !important;
        background: rgba(0,0,0,0.7) !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 20px !important;
    }
    .rating-modal-card {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ===== STATS BAR - Tight ===== */
    .story-stats-bar {
        display: flex !important;
        background: var(--bg-card) !important;
        border-radius: 10px !important;
        margin: 0 12px 6px !important;
        padding: 12px 0 !important;
    }

    .stat-item {
        flex: 1;
        text-align: center;
        border-right: 1px solid var(--border);
        padding: 0 6px;
    }

    .stat-item:last-child {
        border-right: none;
    }

    .stat-value {
        font-size: 20px !important;
        font-weight: 700 !important;
        margin-bottom: 2px !important;
    }

    .stat-label {
        font-size: 11px !important;
    }

    .stat-stars {
        font-size: 12px !important;
        letter-spacing: 1px !important;
    }

    .stat-clickable {
        cursor: pointer;
        transition: background 0.2s;
        border-radius: 8px;
    }

    .stat-clickable:active {
        background: rgba(255,255,255,0.05);
    }

    /* ===== ACTION BAR - Inline ===== */
    .story-action-bar {
        display: flex !important;
        gap: 10px;
        margin: 0 12px 6px;
    }

    .story-action-bar .btn-favorite {
        flex: 1;
        height: 46px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 10px;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        cursor: pointer;
        color: var(--text);
    }

    .story-action-bar .btn-read {
        flex: 1;
        height: 46px;
        padding: 0 16px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 600;
        text-align: center;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ===== DESCRIPTION - Truncated with expand ===== */
    .story-description {
        background: var(--bg-card) !important;
        border-radius: 10px !important;
        margin: 0 12px 6px !important;
        overflow: hidden !important;
        padding: 14px 16px !important;
    }

    .story-description .desc-header {
        display: none !important;
    }

    .story-description .description-content {
        font-size: 13px !important;
        line-height: 1.7 !important;
        color: var(--text-secondary) !important;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: pre-wrap;
    }

    .story-description.open .description-content {
        display: block;
        -webkit-line-clamp: unset;
    }

    .desc-toggle-btn {
        display: inline-block !important;
        background: none;
        border: none;
        color: var(--primary);
        font-size: 13px;
        cursor: pointer;
        padding: 6px 0 0;
        font-weight: 500;
    }

    /* ===== TOC BUTTON - Tight ===== */
    .toc-button-section {
        margin: 0 12px 6px !important;
    }

    .toc-popup-btn {
        width: 100% !important;
        padding: 12px 16px !important;
        background: var(--bg-card) !important;
        border: none !important;
        border-radius: 10px !important;
        color: var(--text) !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        display: flex !important;
        align-items: center !important;
    }

    .toc-popup-btn .toc-icon {
        font-size: 16px !important;
    }

    .toc-popup-btn .toc-count {
        color: var(--text-secondary) !important;
        font-size: 13px !important;
    }

    /* ===== LATEST CHAPTERS - Tight ===== */
    .chapter-section {
        background: var(--bg-card) !important;
        border-radius: 10px !important;
        margin: 0 12px 8px !important;
        overflow: hidden !important;
    }

    .chapter-header {
        padding: 12px 16px !important;
    }

    .chapter-header .section-title {
        font-size: 14px !important;
    }

    .chapter-list {
        min-height: auto !important;
        max-height: none !important;
    }

    #latestChaptersList {
        padding: 4px 0 !important;
    }

    #latestChaptersList .chapter-item {
        display: flex !important;
        align-items: center !important;
        padding: 10px 16px !important;
        border-bottom: 1px solid rgba(255,255,255,0.03) !important;
    }

    #latestChaptersList .chapter-item:last-child {
        border-bottom: none !important;
    }

    #latestChaptersList .chapter-number {
        min-width: 24px !important;
        width: auto !important;
        height: 24px !important;
        font-size: 10px !important;
        border-radius: 5px !important;
        padding: 0 5px !important;
    }

    #latestChaptersList .chapter-title a {
        font-size: 13px !important;
    }

    #latestChaptersList .chapter-views {
        font-size: 11px !important;
    }

    .chapter-date {
        font-size: 11px !important;
        margin-left: 8px !important;
        width: auto !important;
        margin-top: 0 !important;
    }

    /* ===== RELATED STORIES ===== */
    .related-section {
        background: var(--bg-card) !important;
        border-radius: 10px !important;
        margin: 0 12px 8px !important;
    }

    .related-header {
        padding: 12px 16px 0 !important;
    }

    .related-header .section-title {
        font-size: 14px !important;
    }

    .related-list-item {
        padding: 10px 16px !important;
    }

    .related-list-title {
        font-size: 13px !important;
    }

    /* ===== COMMENTS - Full screen on mobile ===== */
    .comments-section-wrapper.modal-open {
        padding: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        align-items: flex-end !important;
    }

    .comments-section-wrapper.modal-open .comments-section {
        max-width: 100% !important;
        max-height: 95vh !important;
        border-radius: 16px 16px 0 0 !important;
        animation: mobileSlideUp 0.3s ease !important;
    }

    .comments-section-wrapper.modal-closing .comments-section {
        animation: mobileSlideDown 0.25s ease forwards !important;
    }

    @keyframes mobileSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    @keyframes mobileSlideDown {
        from { transform: translateY(0); }
        to { transform: translateY(100%); }
    }

    .comments-section-wrapper.modal-open .chapter-header {
        padding: 14px 16px !important;
        margin-bottom: 0 !important;
    }

    .comments-section {
        padding: 0 !important;
    }

    .comment-form {
        padding: 12px 16px !important;
    }

    .comment-item {
        padding: 8px 16px !important;
    }

    .comment-actions {
        padding-left: 42px !important;
    }

    .comments-filters {
        padding: 8px 16px !important;
    }

    .comments-section .login-prompt {
        padding: 20px 16px !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .comments-section .login-prompt-icon {
        font-size: 28px !important;
        margin-bottom: 8px !important;
    }

    .comments-section .login-prompt-text {
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }

    .comments-section .login-prompt-btn {
        padding: 8px 24px !important;
        font-size: 13px !important;
    }

    .comments-empty {
        padding: 24px 16px !important;
    }

    .comments-empty-icon {
        font-size: 32px !important;
        margin-bottom: 8px !important;
    }

    .comments-empty-text {
        font-size: 14px !important;
    }

    /* ===== BOTTOM BAR - Removed, using inline action bar ===== */

    /* ===== FAB MENU ===== */
    .fab-menu {
        bottom: 16px !important;
        right: 12px !important;
    }

    .fab-main {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
    }

    /* ===== MODAL FULLSCREEN ===== */
    .modal {
        padding: 0 !important;
    }
    
    .modal-content {
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    /* ===== BOTTOM PADDING ===== */
    .main-content {
        padding-bottom: 16px !important;
    }

    /* ===== DESKTOP TWO-COL: Stack on mobile ===== */
    .desktop-two-col {
        display: block !important;
    }
}
