:root {
    --primary-color: #c0392b; /* 中国红 */
    --paper-color: #f4f1ea;   /* 宣纸色 */
    --border-color: #8e44ad;
}

body {
    font-family: "KaiTi", "楷体", serif; /* 使用楷体更有书法感 */
    background-color: #e9e4d0;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 20px;
}

.container {
    background-color: var(--paper-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.input-section {
    margin-bottom: 20px;
}

input[type="text"] {
    font-size: 24px;
    padding: 10px;
    width: 200px;
    text-align: center;
    border: 2px solid #ccc;
    border-radius: 5px;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: 0.3s;
    margin: 5px;
}

.primary-btn { background-color: var(--primary-color); color: white; }
.secondary-btn { background-color: #7f8c8d; color: white; }
button:hover { opacity: 0.9; }

/* 核心网格区域 */
.workspace {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.grid-container {
    position: relative;
    width: 300px;
    height: 300px;
    border: 4px solid var(--primary-color);
    background-color: white;
}

/* 米字格背景线 */
.mizi-grid {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        linear-gradient(to right, transparent 49.5%, #ffcccc 49.5%, #ffcccc 50.5%, transparent 50.5%),
        linear-gradient(to bottom, transparent 49.5%, #ffcccc 49.5%, #ffcccc 50.5%, transparent 50.5%),
        linear-gradient(45deg, transparent 49.5%, #ffcccc 49.5%, #ffcccc 50.5%, transparent 50.5%),
        linear-gradient(-45deg, transparent 49.5%, #ffcccc 49.5%, #ffcccc 50.5%, transparent 50.5%);
    z-index: 0;
    pointer-events: none;
}

#writer-container {
    position: absolute;
    top: 0; left: 0;
    z-index: 1;
    opacity: 1; /* 演示模式全显，练习模式需变淡 */
    transition: opacity 0.5s;
}

#userCanvas {
    position: absolute;
    top: 0; left: 0;
    z-index: 10; /* 最顶层 */
    cursor: crosshair;
    touch-action: none; /* 防止触摸屏滚动 */
    display: none; /* 默认隐藏，练习模式显示 */
}

.hidden { display: none; }

/* 结果卡片 */
.result-box {
    margin-top: 20px;
    padding: 20px;
    border: 2px dashed var(--primary-color);
    background: #fff;
    border-radius: 8px;
}

.score-display {
    font-size: 48px;
    color: var(--primary-color);
    font-weight: bold;
}

.feedback-content {
    text-align: left;
    margin-top: 10px;
    line-height: 1.6;
    font-size: 16px;
    white-space: pre-wrap;
}
