/* 首页布局与组件样式（原 index.html 内联样式） */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.body-scroll-lock {
    overflow: hidden;
    overscroll-behavior: none;
}

.bg-content {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.glass-container {
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-title {
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.subheader-text {
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.bg-white {
    background: rgba(255, 255, 255, 0.85) !important;
}

.bg-fb-bg {
    background: rgba(240, 242, 245, 0.82) !important;
}

.bg-fb-bg.focus\:bg-white {
    background: rgba(240, 242, 245, 0.8) !important;
}

.shadow-md {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
}

.hover\:bg-gray-100:hover {
    background: rgba(243, 244, 246, 0.9) !important;
}

.text-gray-900, .text-gray-700, .text-gray-800 {
    color: rgba(17, 24, 39, 0.9) !important;
}

.bg-fb-blue {
    background-color: #618ea5 !important;
    opacity: 0.95;
}

.hover\:bg-fb-blue-dark:hover {
    background-color: #70887d !important;
    opacity: 0.95;
}

.bg-green-50, .bg-red-50, .bg-yellow-50 {
    opacity: 0.95;
}

@media (max-width: 768px) {
    .glass-container {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 16px !important;
        border-radius: 16px;
    }
    .bg-content {
        padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
        padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
    }
    .app-header {
        position: sticky;
        top: 0;
        z-index: 90;
        padding: 4px 6px 6px;
        margin-bottom: 4px !important;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), transparent);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
    .app-header .header-text {
        font-size: 1.125rem !important;
        margin-bottom: 2px !important;
        line-height: 1.25;
    }
    .app-header .subheader-text {
        font-size: 0.75rem !important;
        line-height: 1.3;
    }
    input, textarea, select {
        font-size: 16px !important;
        max-width: 100% !important;
    }
    .compose-submit-btn,
    .load-more-btn,
    .reply-form-actions .reply-submit-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    .compose-submit-btn,
    .load-more-btn {
        width: 100% !important;
        border-radius: 12px !important;
        font-size: 16px !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    .reply-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .reply-form-actions .reply-submit-btn {
        width: 100% !important;
        min-height: 48px;
        border-radius: 12px;
        font-size: 16px !important;
    }
    .reply-shortcut-hint {
        display: none !important;
    }
    .bg-fb-bg {
        padding: 14px !important;
        border-radius: 14px;
    }
    .flex.items-start.gap-3 {
        gap: 12px !important;
    }
    .message-meta {
        row-gap: 4px;
        column-gap: 6px;
    }
    .message-meta .meta-dot,
    .message-meta .meta-date {
        display: none;
    }
    .msg-action-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 26px;
        min-width: auto;
        padding: 2px 8px;
        border-radius: 999px;
        background: rgba(240, 242, 245, 0.95);
        border: 1px solid rgba(0, 0, 0, 0.06);
        text-decoration: none !important;
        font-size: 12px !important;
        font-weight: 500;
        line-height: 1.2;
        touch-action: manipulation;
    }
    .msg-action-btn-primary {
        background: rgba(97, 142, 165, 0.14);
        color: #4a7288 !important;
        border-color: rgba(97, 142, 165, 0.25);
    }
    .msg-action-btn-danger {
        background: rgba(254, 242, 242, 0.95);
        border-color: rgba(248, 113, 113, 0.25);
    }
    .edit-remaining {
        width: auto;
        flex-basis: auto;
        margin-right: 2px;
        font-size: 10px !important;
    }
    #appToastHost {
        bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 12px));
        width: min(calc(100vw - 24px), 420px);
    }
    .app-toast {
        border-radius: 14px;
        font-size: 15px;
        padding: 14px 12px 14px 16px;
    }
    .app-toast-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    /* 手机端：确认弹窗改为底部抽屉 */
    .confirm-modal-root {
        align-items: flex-end;
        padding: 0;
        background: rgba(0, 0, 0, 0.45);
    }
    .confirm-modal-panel {
        max-width: none;
        width: 100%;
        border-radius: 20px 20px 0 0;
        border: none;
        padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
        transform: translateY(100%);
        animation: sheet-slide-up 0.28s ease forwards;
    }
    .confirm-modal-panel::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        margin: 0 auto 16px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.12);
    }
    .confirm-modal-actions {
        flex-direction: column-reverse;
        gap: 10px;
        margin-top: 20px;
    }
    .confirm-modal-actions .confirm-btn-cancel,
    .confirm-modal-actions .confirm-btn-ok {
        width: 100%;
        min-height: 48px;
        font-size: 16px !important;
        border-radius: 12px;
        padding: 12px 16px;
    }
    /* 手机端：回复底部抽屉 */
    .reply-sheet-host {
        position: fixed;
        inset: 0;
        z-index: 1050;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        pointer-events: none;
    }
    .reply-sheet-host.hidden {
        display: none;
    }
    .reply-sheet-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.28s ease;
        pointer-events: auto;
    }
    .reply-sheet-panel {
        position: relative;
        width: 100%;
        max-height: min(85vh, 640px);
        background: #fff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
        transform: translateY(100%);
        transition: transform 0.28s ease;
        pointer-events: auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .reply-sheet-host-open .reply-sheet-backdrop {
        opacity: 1;
    }
    .reply-sheet-host-open .reply-sheet-panel {
        transform: translateY(0);
    }
    .reply-sheet-handle {
        flex-shrink: 0;
        width: 36px;
        height: 4px;
        margin: 10px auto 0;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.12);
    }
    .reply-sheet-body {
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }
    .reply-sheet-body .reply-form-container {
        border: none;
        background: transparent;
        padding: 0;
        opacity: 1;
        transform: none;
        margin-top: 0;
    }
    .reply-sheet-body .reply-target-label {
        font-size: 15px;
    }
    .reply-sheet-body .reply-cancel-btn {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 14px;
    }
    .reply-sheet-body .reply-content-input {
        min-height: 100px;
        border-radius: 12px;
    }
    .reply-sheet-body .reply-meta-row {
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }
    .reply-sheet-body .reply-email-summary {
        flex-wrap: nowrap;
        min-width: 0;
        overflow: hidden;
    }
    .reply-sheet-body .reply-email-mask {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .reply-sheet-body .char-counter {
        width: auto;
        text-align: right;
        margin-top: 0;
        flex-shrink: 0;
    }
}

@keyframes sheet-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 480px) {
    .bg-content {
        padding: 8px !important;
    }
    .glass-container {
        padding: 12px !important;
    }
    .header-text {
        font-size: 1.5rem !important;
    }
    .subheader-text {
        font-size: 0.875rem !important;
    }
    .reply-form-container input,
    .reply-form-container textarea {
        padding: 10px !important;
    }
}

@supports not (backdrop-filter: blur(8px)) {
    .glass-container {
        background: rgba(255, 255, 255, 0.95) !important;
    }
    .bg-white {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

.text-base {
    word-break: break-word;
    overflow-wrap: break-word;
}

input[type="email"] {
    min-width: 0;
}

img[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.reply-form-container {
    border: 1px solid rgba(97, 142, 165, 0.35);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 10px;
    padding: 12px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.reply-form-container.reply-form-enter-active {
    opacity: 1;
    transform: translateY(0);
}

.reply-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.reply-target-label {
    color: #618ea5;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.reply-cancel-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #65676B;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.reply-cancel-btn:hover {
    color: #111827;
    text-decoration: underline;
}

.reply-content-input {
    min-height: 72px;
}

.edit-remaining {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
}

.edit-remaining-urgent {
    color: #ea580c;
    font-weight: 500;
}

.edit-remaining-expired {
    color: #9ca3af;
}

.reply-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 18px;
}

.reply-email-block {
    flex: 1;
    min-width: 0;
}

.char-counter {
    font-size: 12px;
    color: #65676B;
    text-align: right;
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.reply-email-summary {
    font-size: 12px;
    color: #65676B;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.reply-email-mask {
    color: #374151;
    font-weight: 500;
}

.reply-email-change {
    border: none;
    background: transparent;
    color: #1877F2;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.reply-email-change:hover {
    text-decoration: underline;
}

.reply-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reply-shortcut-hint {
    font-size: 11px;
    color: #9ca3af;
}

#appToastHost {
    position: fixed;
    left: 50%;
    bottom: max(18vh, calc(env(safe-area-inset-bottom, 0px) + 56px));
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 8px;
    width: min(92vw, 420px);
    pointer-events: none;
}

.app-toast {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 10px 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: auto;
    word-break: break-word;
}

.app-toast-text {
    flex: 1;
    min-width: 0;
}

.app-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin: -2px 0 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.app-toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.app-toast-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
    opacity: 1;
}

.app-toast.app-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast-ok {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.app-toast-err {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

@media (prefers-reduced-motion: reduce) {
    img[data-src] {
        animation: none !important;
    }
    .reply-form-container {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .confirm-modal-panel {
        animation: none;
        transform: none;
    }
    .reply-sheet-panel,
    .reply-sheet-backdrop {
        transition: none;
    }
    .reply-sheet-host-open .reply-sheet-panel {
        transform: none;
    }
}
