/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: KaiTi, SimKai, "楷体", serif;
    background: #1a1b2f;
    color: #333;
    transition: background-color 0.3s ease;
}

body.front {
    overflow: hidden;
}

/* 左侧控制面板 */
.control-panel {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    border-radius: 0 20px 20px 0;
    padding: 15px;
    width: 220px;
    z-index: 300;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    border-left: none;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}
.control-panel.collapsed {
    transform: translateY(-50%) translateX(-200px);
}
.toggle-arrow {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 40px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    border-radius: 0 20px 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 12px;
}
.control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: white;
    font-size: 14px;
    margin-bottom: 12px;
}
.mic-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mic-icon {
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
}
.mic-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
}
.mic-icon::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: #333;
    border-radius: 2px;
}
.mic-icon.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 16px;
    height: 2px;
    background: red;
    bottom: auto;
}
.volume-bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 24px;
}
.volume-bars span {
    width: 5px;
    height: 20px;
    background: #ccc;
    border-radius: 2px;
    transition: transform 0.05s linear;
    transform-origin: bottom;
    transform: scaleY(0.2);
}
input[type="range"] {
    width: 120px;
    -webkit-appearance: none;
    background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    margin-top: -4px;
    cursor: pointer;
}
.theme-options {
    display: flex;
    gap: 8px;
}
.theme-option {
    background: rgba(255,255,255,0.15);
    padding: 4px 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}
.theme-option.active {
    background: white;
    color: black;
}
.fullscreen-icon {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}
.fullscreen-icon::before,
.fullscreen-icon::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 2px solid white;
}
.fullscreen-icon::before {
    top: 4px;
    left: 4px;
    border-right: none;
    border-bottom: none;
}
.fullscreen-icon::after {
    bottom: 4px;
    right: 4px;
    border-left: none;
    border-top: none;
}

/* ===== 任务卡片样式（优化后） ===== */
.task-card {
    position: fixed;
    top: 20px;
    right: 20px;
    width: auto;
    max-width: 40vw;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 12px 16px;
    color: white;
    z-index: 200;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}
.task-header {
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    opacity: 0.9;
}
#taskTitle {
    font-size: 24px;
    margin: 6px 0;
    text-align: center;
    font-weight: bold;
}
#taskContent {
    font-size: 22px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
/* 颜色切换按钮容器 */
.color-picker {
    text-align: right;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.color-btn {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.8);
}
.color-btn:hover {
    transform: scale(1.1);
}
.color-white {
    background-color: #ffffff;
}
.color-red {
    background-color: #ff6666;
}
.task-text-white #taskContent * {
    color: #ffffff !important;
}
.task-text-red #taskContent * {
    color: #ff9999 !important;
}

/* ===== 倒计时卡片样式 ===== */
.countdown-card {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: rgba(245, 247, 250, 0.95);
    border-radius: 12px;
    padding: 1rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    z-index: 201;
    backdrop-filter: blur(8px);
    transition: left 0.3s ease, transform 0.3s ease;
}
.countdown-card-inner {
    width: 100%;
}
.countdown-label {
    font-size: 0.9rem;
    color: #8c8c8c;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}
.countdown-time {
    font-size: 2rem;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1;
    margin-bottom: 0.8rem;
    font-family: monospace;
}
.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #4ade80;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 响应式布局 */
@media (max-width: 800px) {
    .countdown-card {
        left: 20px;
        transform: none;
        width: 260px;
    }
    .task-card {
        min-width: 260px;
    }
}
@media (max-width: 640px) {
    .countdown-card {
        width: 220px;
        padding: 0.8rem;
        top: 10px;
        left: 10px;
    }
    .task-card {
        top: 10px;
        right: 10px;
        min-width: 220px;
        padding: 8px 12px;
    }
    .countdown-time {
        font-size: 1.6rem;
    }
    #taskContent {
        font-size: 18px;
    }
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: white;
    border-radius: 30px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.modal-content button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
}

/* Canvas 画布 */
canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* ===== 教师后台样式 ===== */
.teacher-container {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.sidebar .menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    margin: 5px 0;
}
.sidebar .menu-item.active {
    background: rgba(255,255,255,0.2);
    border-left: 4px solid #ffaa44;
}
.sidebar .menu-item:hover {
    background: rgba(255,255,255,0.1);
}
.content-area {
    flex: 1;
    padding: 20px;
    background: #fff;
    border-radius: 20px 0 0 0;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
}
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
}
button {
    background: #764ba2;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.1s;
}
button:active {
    transform: scale(0.96);
}
.task-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.task-card-item {
    flex: 1;
    min-width: 300px;
}
.rich-editor {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    min-height: 150px;
    background: #fff;
    white-space: pre-wrap;
}
.toolbar {
    margin-bottom: 8px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.tool-btn {
    background: #f0f0f0;
    color: #333;
    padding: 4px 8px;
    font-size: 12px;
}
.changelog-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

/* 管理员后台样式 */
.admin-container {
    display: flex;
    min-height: 100vh;
}