* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --bg-color: #F5F5F5;
    --card-color: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #000000;
    --divider-color: #E5E5E5;
    --active-color: #07C160;
    --expired-color: #FA5151;
    --paused-color: #FF9F0A;
    --draft-color: #8E8E93;
    
    font-size: clamp(0.875rem, 2vw, 1rem); /* 14-16px */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: clamp(0.75rem, 2vw, 0.9375rem);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    color: white;
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    background: none;
    border: 0.2rem solid #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: clamp(0.25rem, 0.75vw, 0.3125rem);
    padding: clamp( 0.3rem, 0.75vw, 0.3125rem);
    border-radius: 10%;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 500;
    text-align: center;
    flex: 1;
    padding-right: clamp(2.5rem, 6vw, 3rem);
}

.messages-container {
    padding: clamp(1rem, 3vw, 1.25rem);
    max-width: 37.5rem;
    margin: 0 auto;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-item {
    background: var(--card-color);
    border-radius: 0.5rem;
    padding: clamp(1rem, 3vw, 1.25rem);
    border: 0.0625rem solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.message-item:last-child {
    margin-bottom: 0;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.message-time {
    font-size: 0.8125rem;
    color: var(--text-light);
    white-space: nowrap;
}

.message-content {
    margin-bottom: 0.75rem;
}

.message-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.message-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.unread-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--unread-border);
    border-radius: 50%;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
    background: var(--card-color);
    border-radius: 0.75rem;
    border: 0.0625rem solid var(--border-color);
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-text {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 18.75rem;
    margin: 0 auto;
}

.load-more {
    text-align: center;
    margin-top: 2rem;
}

.load-more-btn {
    padding: 0.75rem 2rem;
    background: white;
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.message-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1.25rem;
}

.message-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.detail-content {
    background: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 37.5rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(1.25rem);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.message-detail-modal.active .detail-content {
    transform: translateY(0);
}

.detail-header {
    padding: 1.25rem;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-header-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.detail-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.125rem;
    transition: background-color 0.2s;
}

.detail-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.detail-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.detail-time {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 0.0625rem solid var(--border-color);
}

.detail-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-line;
}

@media (max-width: 30rem) {
    .messages-container {
        padding: 0.75rem;
    }
    
    .message-item {
        padding: 0.875rem;
        margin-bottom: 0.75rem;
    }
    
    .message-title {
        font-size: 1rem;
    }
    
    .message-text {
        font-size: 0.875rem;
    }
}