* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    padding: 20px;
}

.app-container {
    max-width: 720px;
    margin: 0 auto;
}

/* 用户栏样式 */
.user-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 8px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
}

.login-link, .admin-link {
    color: #c18254;
    text-decoration: none;
    font-weight: 500;
}

.write-link {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 6px 16px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
}

.logout-btn-small {
    background: #f0e2cf;
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #5a3e2b;
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 28px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #d9b48b 0%, #c18254 100%);
    padding: 14px 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.count-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: normal;
    margin-left: auto;
    transition: all 0.3s ease;
}

.count-badge:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.refresh-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.refresh-btn:active::before {
    width: 100%;
    height: 100%;
}

.refresh-btn:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.35);
}

.refresh-btn.loading {
    animation: rotate360 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes rotate360 {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.card-body {
    padding: 28px 16px 16px 16px;
}

#publicLettersContainer {
    margin-top: 4px;
    transition: all 0.3s ease;
}

.letters-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.public-letter-item {
    background: linear-gradient(135deg, #fffef7 0%, #fffaf3 100%);
    border-radius: 24px;
    padding: 18px;
    border: 1px solid rgba(217, 180, 139, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.public-letter-item:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: #d9b48b;
    box-shadow: 0 12px 28px rgba(193, 130, 84, 0.2);
}

.public-letter-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(193, 130, 84, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    pointer-events: none;
}

.public-letter-item:active::after {
    width: 200%;
    height: 200%;
}

@keyframes cardFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.public-letter-item {
    animation: cardFadeInUp 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.letter-preview .preview-text {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #4a3520;
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: 'Georgia', serif;
}

.letter-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: #b28b65;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(217, 180, 139, 0.3);
    flex-wrap: wrap;
    gap: 8px;
}

.open-badge {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.68rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
    transition: all 0.2s;
}

.open-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.4);
}

.load-more-trigger {
    text-align: center;
    padding: 20px 0;
    color: #b28b65;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-trigger:hover {
    color: #c18254;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f0e2cf;
    border-top-color: #c18254;
    border-right-color: #c18254;
    border-radius: 50%;
    animation: spin 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-more {
    text-align: center;
    padding: 20px 0;
    color: #b28b65;
    font-size: 0.75rem;
    position: relative;
}

.no-more::before,
.no-more::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d9b48b, transparent);
}

.no-more::before { left: 0; }
.no-more::after { right: 0; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #b28b65;
}

.empty-state span {
    font-size: 4rem;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.empty-state p {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #8b694a;
}

.search-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    border: none;
    color: white;
    font-size: 24px;
}

.search-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.5);
}

.search-fab:active {
    transform: scale(0.92);
}

.fab {
    position: fixed;
    bottom: 30px;
    right: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    text-decoration: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(245, 87, 108, 0.5);
}

.fab:active {
    transform: scale(0.92);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    background: #fffef7;
    border-radius: 40px;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #d9b48b, #c18254);
    padding: 20px 24px;
    color: white;
}

.modal-header h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.full-content {
    font-family: 'Georgia', serif;
    line-height: 1.8;
    color: #4a3520;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 1rem;
    background: linear-gradient(135deg, #fffaf0 0%, #fff5e8 100%);
    padding: 28px;
    border-radius: 24px;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02), 0 2px 6px rgba(0,0,0,0.05);
}

.modal-meta {
    font-size: 0.75rem;
    color: #8b694a;
    text-align: right;
    border-top: 1px solid #f0e2cf;
    padding-top: 16px;
    margin-top: 8px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #c18254, #a56e42);
    color: white;
}

.modal-btn-primary:active {
    transform: scale(0.96);
}

.modal-btn-secondary {
    background: #f0e2cf;
    color: #5a3e2b;
}

.modal-btn-secondary:active {
    transform: scale(0.96);
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    color: white;
    padding: 10px 24px;
    border-radius: 60px;
    font-size: 0.85rem;
    z-index: 1100;
    max-width: 85%;
    text-align: center;
    animation: toastSlideUp 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 550px) {
    body { padding: 12px; }
    .card-body { padding: 24px 12px 12px 12px; }
    .card-header { padding: 12px 16px; }
    .card-header h2 { font-size: 1rem; }
    .refresh-btn { width: 32px; height: 32px; font-size: 1rem; }
    .count-badge { padding: 3px 10px; font-size: 0.65rem; }
    .public-letter-item { padding: 14px; border-radius: 20px; }
    .letter-preview .preview-text { font-size: 0.85rem; }
    .modal-header { padding: 16px 20px; }
    .modal-header h3 { font-size: 1rem; }
    .full-content { padding: 20px; font-size: 0.9rem; }
    .search-fab, .fab { width: 48px; height: 48px; font-size: 22px; }
    .search-fab { bottom: 90px; right: 16px; }
    .fab { bottom: 26px; right: 16px; }
}


/* 新的元信息行样式 */
.letter-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: #b28b65;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(217, 180, 139, 0.3);
    flex-wrap: wrap;
    gap: 8px;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.key-badge {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-family: monospace;
    font-weight: 500;
}

.user-badge {
    background: #764ba2;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
}

.open-badge {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
}

.date-text {
    font-size: 0.65rem;
    color: #b28b65;
}

/* 模态框元信息样式 */
.modal-meta {
    font-size: 0.75rem;
    color: #8b694a;
    text-align: left;
    border-top: 1px solid #f0e2cf;
    padding-top: 16px;
    margin-top: 8px;
}

.modal-meta div {
    margin-bottom: 6px;
}

.modal-meta div:last-child {
    margin-bottom: 0;
}

/* 响应式调整 */
@media (max-width: 550px) {
    .meta-left {
        gap: 6px;
    }
    
    .key-badge, .user-badge, .open-badge {
        padding: 2px 8px;
        font-size: 0.6rem;
    }
    
    .date-text {
        font-size: 0.6rem;
    }
}
/* 元信息行样式 - 只显示用户名和公开标签 */
.letter-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: #b28b65;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(217, 180, 139, 0.3);
    flex-wrap: wrap;
    gap: 8px;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-badge {
    background: #764ba2;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.open-badge {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.date-text {
    font-size: 0.7rem;
    color: #b28b65;
}

/* 模态框元信息样式 */
.modal-meta {
    font-size: 0.8rem;
    color: #8b694a;
    text-align: left;
    border-top: 1px solid #f0e2cf;
    padding-top: 16px;
    margin-top: 8px;
}

.modal-meta div {
    margin-bottom: 8px;
}

.modal-meta div:last-child {
    margin-bottom: 0;
}

/* 响应式调整 */
@media (max-width: 550px) {
    .meta-left {
        gap: 6px;
    }
    
    .user-badge, .open-badge {
        padding: 3px 10px;
        font-size: 0.65rem;
    }
    
    .date-text {
        font-size: 0.65rem;
    }
}

/* 用户名链接样式 - 可点击跳转设置 */
.username-link {
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.username-link:active {
    transform: scale(0.95);
    opacity: 0.7;
}

/* 移动端增加点击区域 */
.username-link::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
}

/* 添加小手图标提示 */
.user-info {
    position: relative;
}

/* 可选：添加设置图标提示 */
.username-link {
    text-decoration: none;
}