:root {
    --crystal-primary: rgba(137, 196, 244, 0.7);
    --crystal-secondary: rgba(170, 216, 255, 0.5);
    --crystal-accent: rgba(255, 255, 255, 0.8);
    --crystal-shadow: rgba(70, 130, 180, 0.4);
    --crystal-text: #334455;
    --crystal-dark: #142635;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    background: linear-gradient(135deg, #e0f7ff, #d5e9ff);
    color: var(--crystal-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.crystal-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    min-height: 80vh;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 0 80px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.crystal-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(45deg, rgba(255,255,255,0.4) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.4) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.4) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.4) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.05;
    z-index: -1;
}

.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.5), 
        rgba(255, 255, 255, 0.2));
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

h1 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2.5rem;
    color: var(--crystal-dark);
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1rem;
    color: var(--crystal-text);
    opacity: 0.8;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    max-height: 70vh;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.user {
    align-self: flex-end;
    align-items: flex-end;
    margin-left: auto;
}

.assistant {
    align-self: flex-start;
    align-items: flex-start;
    margin-right: auto;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.user .message-content {
    background: var(--crystal-primary);
    border-top-right-radius: 2px;
    color: white;
}

.assistant .message-content {
    background: var(--crystal-accent);
    border-top-left-radius: 2px;
    color: var(--crystal-dark);
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

textarea {
    flex: 1;
    height: 50px;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--crystal-dark);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
}

textarea:focus {
    border-color: var(--crystal-primary);
    box-shadow: 0 0 0 2px rgba(137, 196, 244, 0.2);
}

.crystal-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 50px;
    background: linear-gradient(135deg, var(--crystal-primary), var(--crystal-secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px var(--crystal-shadow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.crystal-button::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.8) 50%, 
        rgba(255, 255, 255, 0) 100%);
    transform: rotate(45deg) translate(-100px, 0);
    transition: all 0.5s ease;
}

.crystal-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px var(--crystal-shadow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.crystal-button:hover::before {
    transform: rotate(45deg) translate(300px, 0);
}

.crystal-button:active {
    transform: translateY(1px);
    box-shadow: 
        0 2px 10px var(--crystal-shadow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .crystal-container {
        min-height: 90vh;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .message {
        max-width: 90%;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--crystal-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--crystal-primary);
}

/* 加载中的动画效果 */
.loading {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.loading .dot {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    border-radius: 50%;
    background-color: var(--crystal-primary);
    opacity: 0.6;
    animation: loadingDot 1.4s infinite ease-in-out both;
}

.loading .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingDot {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1);
    }
}

.clear-button {
    background: linear-gradient(135deg, #b0c4de, #e0eafc);
    color: var(--crystal-dark);
    margin-left: 0;
    padding: 0 16px;
    border-left: 1px solid rgba(255,255,255,0.2);
    transition: background 0.3s;
}
.clear-button svg {
    vertical-align: middle;
    display: inline-block;
}
.clear-button:hover {
    background: linear-gradient(135deg, #a2b8d3, #c9d6ff);
}

.crystal-image {
    max-width: 100%;
    border-radius: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.crystal-image:hover {
    transform: scale(1.02);
} 