/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #9b59b6;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --stroke-count-color: #2380dd;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --background-gradient: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    --card-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    --text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    background: var(--background-gradient);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--card-gradient);
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    z-index: -1;
}

h1 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 2.0rem;
    text-shadow: var(--text-shadow);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

h1::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.subtitle {
    color: var(--dark-color);
    font-size: 1.3em;
    opacity: 0.8;
    font-weight: 300;
}

/* 主内容区域 */
.experiment-area {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 20px;
}

/* 控制面板样式 */
.control-panel {
    flex: 1;
    min-width: 300px;
    background: var(--card-gradient);
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-panel > div {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.control-panel > div:last-child {
    border-bottom: none;
}

.character-selector, .difficulty {
    display: flex;
    align-items: center;
    gap: 15px;
}

.character-selector label, .difficulty label {
    font-weight: bold;
    min-width: 100px;
    color: var(--dark-color);
}

#character-input {
    padding: 12px 15px;
    border: 2px solid rgba(52, 152, 219, 0.3);
    border-radius: 10px;
    font-size: 18px;
    width: 140px;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#character-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
    transform: scale(1.05);
}

button, select {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(1px);
}

button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

select {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(52, 152, 219, 0.3);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    padding-right: 45px;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 书写区域样式 */
.writing-area {
    flex: 2;
    min-width: 400px;
    background: var(--card-gradient);
    padding: 15px;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.writing-area::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C92AC' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.2;
    z-index: -1;
}

#character-target {
    width: 300px;
    height: 300px;
    margin-bottom: 25px;
    border: 2px dashed rgba(52, 152, 219, 0.3);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

#character-target:hover {
    border-color: var(--primary-color);
    box-shadow: inset 0 0 30px rgba(52, 152, 219, 0.2);
}

.feedback {
    text-align: center;
    width: 100%;
}

.feedback p {
    margin: 10px 0;
    font-size: 18px;
}

#score {
    font-weight: bold;
    color: var(--success-color);
}

#stroke-count {
    font-weight: bold;
    color: var(--stroke-count-color);
}

#message {
    min-height: 30px;
    color: var(--accent-color);
    font-weight: 600;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

/* 进度部分样式 */
.progress-section {
    background: var(--card-gradient);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-section h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    text-align: center;
    font-size: 1.8rem;
    text-shadow: var(--text-shadow);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#progress-chart {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--secondary-color);
    height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 15px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    flex: 1;
    background: linear-gradient(to top, var(--primary-color), var(--secondary-color));
    border-radius: 10px 10px 0 0;
    transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
}

.progress-bar::after {
    content: attr(data-character);
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--dark-color);
}

.progress-bar:hover {
    transform: scaleY(1.01);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .experiment-area {
        flex-direction: column;
    }

    .control-panel, .writing-area {
        min-width: 100%;
    }

    #character-target {
        width: 280px;
        height: 280px;
    }

    h1 {
        font-size: 1.6rem;
    }
}

/* 添加一些动画元素 */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.floating-element {
    position: absolute;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.7;
    }
    33% {
        transform: translateY(-30px) translateX(100px) rotate(120deg);
        opacity: 0.4;
    }
    66% {
        transform: translateY(20px) translateX(-100px) rotate(240deg);
        opacity: 0.6;
    }
    100% {
        transform: translateY(0) translateX(0) rotate(360deg);
        opacity: 0.7;
    }
}