* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #4A90E2;
    --light-blue: #E8F4FF;
    --bg-white: #FFFFFF;
    --text-dark: #2C3E50;
    --text-gray: #7F8C8D;
    --border-color: #E1E8ED;
    --shadow: 0 2px 12px rgba(74, 144, 226, 0.1);
    --shadow-hover: 0 4px 16px rgba(74, 144, 226, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                'Microsoft YaHei', sans-serif;
    background: var(--light-blue);
    min-height: 100vh;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

.container {
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
}

/* 消息容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    background: var(--light-blue);
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 加载状态 */
.loading {
    text-align: center;
    color: var(--text-gray);
    padding: 20px;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    color: var(--text-gray);
    padding: 40px 20px;
    font-size: 14px;
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* 消息卡片 */
.message-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    position: relative;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-actions {
    display: flex;
    gap: 6px;
}

.message-time {
    font-size: 12px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-time svg {
    width: 14px;
    height: 14px;
}

.copy-button {
    background: var(--light-blue);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--primary-blue);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.copy-button:active {
    transform: scale(0.95);
    background: var(--primary-blue);
    color: white;
}

.copy-button svg {
    width: 14px;
    height: 14px;
}

.delete-button {
    background: #FFE8E8;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: #E74C3C;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0;
    font-weight: 500;
}

.delete-button:active {
    transform: scale(0.95);
    background: #E74C3C;
    color: white;
}

.delete-button svg {
    width: 14px;
    height: 14px;
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* 输入区域 */
.input-container {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px 12px;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    resize: none;
    max-height: 100px;
    overflow-y: hidden;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--bg-white);
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-blue);
}

#messageInput::placeholder {
    color: var(--text-gray);
}

.send-button {
    background: var(--primary-blue);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    flex-shrink: 0;
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 6px;
    padding-right: 4px;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    15%, 85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* 滚动条样式 */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.3);
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.5);
}

#messageInput::-webkit-scrollbar {
    width: 4px;
}

#messageInput::-webkit-scrollbar-track {
    background: transparent;
}

#messageInput::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* 防止iOS双击缩放 */
button {
    touch-action: manipulation;
}
