* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 允许文本选择的内容 */
.voice-operation, .light-operation, .setting-group label {
    -webkit-user-select: auto;
    user-select: auto;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    font-size: 14px;
    opacity: 0.8;
}

.control-panel {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

button {
    padding: 15px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    min-width: 44px;
    position: relative;
    overflow: hidden;
    -webkit-appearance: none;
    touch-action: manipulation;
}

/* 按钮触摸反馈 */
button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 按钮波纹效果 */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(56, 239, 125, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(245, 87, 108, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(79, 172, 254, 0.3);
}

.table-container {
    padding: 30px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

th {
    background: #4a90e2;
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}

td {
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

tr:nth-child(even) {
    background: #f8f9fa;
}

tr:hover {
    background: #e3f2fd;
    transition: background 0.3s ease;
}

.highlight {
    background: #fff3cd !important;
    border: 2px solid #ffc107;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

.scenario-number {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 8px;
}

.voice-operation {
    font-weight: 500;
    color: #495057;
}

.light-operation {
    font-weight: 600;
    color: #e74c3c;
    background: #ffeaa7;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
}

.note-section {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 25px;
    margin: 30px;
    border-radius: 10px;
    text-align: center;
    flex-shrink: 0;
}

.note-section h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.note-section p {
    line-height: 1.6;
    margin-bottom: 10px;
}

.status-bar {
    padding: 15px;
    background: #2c3e50;
    color: white;
    text-align: center;
    font-size: 14px;
}

.current-scenario {
    font-weight: bold;
    color: #ffc107;
}

.settings-panel {
    padding: 20px;
    background: #e9ecef;
    border-top: 1px solid #dee2e6;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.setting-group label {
    font-weight: 600;
    min-width: 120px;
}

.setting-group input[type="range"] {
    flex: 1;
}

.setting-group span {
    min-width: 50px;
    text-align: center;
    font-weight: bold;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
        align-items: center;
    }

    button {
        width: 100%;
        max-width: 300px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px;
    }
}
/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 0;
        padding-bottom: 60px;
    }

    .container {
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    .header {
        padding: 15px 20px;
        background: #1a2530;
    }

    .header h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .header p {
        font-size: 12px;
    }

    .control-panel {
        padding: 15px;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        flex-shrink: 0;
        order: 1;
    }

    .button-group {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        display: grid;
        margin-bottom: 15px;
    }

    button {
        width: 100%;
        max-width: none;
        font-size: 14px;
        padding: 12px 16px;
        min-height: 48px;
        border-radius: 8px;
    }

    .table-container {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        position: relative;
        overscroll-behavior: contain;
        order: 2;
    }

    table {
        font-size: 13px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    th {
        padding: 12px 8px;
        font-size: 14px;
        background: #3a7bd5;
    }

    td {
        padding: 12px 8px;
        font-size: 12px;
        line-height: 1.4;
    }

    .scenario-number {
        display: block;
        margin-bottom: 4px;
        font-size: 11px;
        color: #666;
    }

    .voice-operation {
        font-size: 13px;
        line-height: 1.5;
    }

    .light-operation {
        font-size: 11px;
        padding: 6px 10px;
        margin: 4px 0;
        display: inline-block;
        line-height: 1.3;
    }

    .note-section {
        margin: 15px 0 0 0;
        padding: 0;
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        flex-shrink: 0;
        order: 3;
        border-radius: 0;
        position: relative;
        overflow: hidden;
        max-height: 60px;
        transition: max-height 0.3s ease-out;
    }

    .note-section.expanded {
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .note-header {
        padding: 15px 20px;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        position: sticky;
        top: 0;
        z-index: 11;
        background: inherit;
    }

    .note-header h3 {
        font-size: 16px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .toggle-icon {
        font-size: 14px;
        transition: transform 0.3s ease;
        margin-left: 10px;
    }

    .note-section.expanded .toggle-icon {
        transform: rotate(180deg);
    }

    .note-content {
        padding: 15px 20px;
        max-height: calc(50vh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .note-section p {
        font-size: 12px;
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .settings-panel {
        padding: 15px;
        background: #f8f9fa;
        border-top: 2px solid #e9ecef;
        flex-shrink: 0;
        order: 4;
    }

    .setting-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
    }

    .setting-group label {
        min-width: auto;
        font-size: 13px;
        font-weight: 500;
    }

    .setting-group input[type="range"] {
        height: 6px;
        border-radius: 3px;
        background: #ddd;
        outline: none;
        -webkit-appearance: none;
    }

    .setting-group input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #4a90e2;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .setting-group span {
        min-width: auto;
        text-align: right;
        font-size: 12px;
        font-weight: 500;
    }

    .status-bar {
        padding: 10px 15px;
        font-size: 12px;
        background: #1a2530;
        flex-shrink: 0;
        order: 5;
    }

    .highlight {
        background: #fff3cd !important;
        border-left: 4px solid #ffc107;
        animation: mobilePulse 1.5s infinite;
    }

    @keyframes mobilePulse {
        0% {
            box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
            border-left-color: #ffc107;
        }
        70% {
            box-shadow: 0 0 0 8px rgba(255, 193, 7, 0);
            border-left-color: #ff8c00;
        }
        100% {
            box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
            border-left-color: #ffc107;
        }
    }
}

/* 超小屏幕优化 (iPhone SE等) */
@media (max-width: 375px) {
    .button-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    button {
        min-height: 52px;
        font-size: 15px;
        padding: 14px 20px;
    }

    .voice-operation {
        font-size: 12px;
    }

    .light-operation {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 10px 15px;
    }

    .header h1 {
        font-size: 18px;
    }

    .control-panel {
        padding: 8px 12px;
    }

    .button-group {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    button {
        min-height: 40px;
        font-size: 12px;
        padding: 8px 12px;
    }

    .note-section {
        display: none; /* 横屏时隐藏说明以节省空间 */
    }

    .settings-panel {
        padding: 8px 12px;
    }

    .setting-group {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .table-container {
        padding: 8px 12px;
    }

    th, td {
        padding: 8px 6px;
        font-size: 11px;
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        border-radius: 10px;
        margin: 10px;
    }

    .header {
        padding: 18px 25px;
    }

    .header h1 {
        font-size: 24px;
    }

    .button-group {
        gap: 12px;
    }

    button {
        padding: 14px 20px;
        font-size: 15px;
    }

    .table-container {
        padding: 20px;
    }

    th {
        padding: 16px 12px;
        font-size: 15px;
    }

    td {
        padding: 14px 12px;
        font-size: 13px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .table-container {
        padding: 40px;
    }

    th {
        padding: 24px;
        font-size: 18px;
    }

    td {
        padding: 18px 24px;
        font-size: 15px;
    }
}

/* 移动端手势支持 */
.table-container {
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.button-group {
    touch-action: manipulation;
}

/* 确保页面主体可以正常滚动 */
body {
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

/* 移动端滚动优化 */
@media (max-width: 768px) {
    html {
        width: 100%;
        height: 100%;
        overflow-x: hidden;
    }

    body {
        width: 100%;
        min-height: 100vh;
        overflow-x: hidden;
        overscroll-behavior-y: contain;
    }

    .container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .table-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: contain;
        padding-bottom: 30px;
    }
}

/* 移动端滚动优化 */
.table-container::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 移动端触摸反馈 (支持的设备) */
@media (hover: none) and (pointer: coarse) {
    button:active {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    button {
        border: 0.5px solid transparent;
    }

    .highlight {
        border-left-width: 2px;
    }
}

/* 纯语音模式遮罩层 */
.voice-only-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.voice-only-overlay.active {
    display: flex;
}

.voice-only-content {
    max-width: 80%;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.voice-only-status {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 600;
}

.voice-only-controls {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.voice-only-button {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 44px;
}

.voice-only-stop {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.voice-only-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(231, 76, 60, 0.3);
}

.voice-only-pause {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.voice-only-pause:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(243, 156, 18, 0.3);
}

.voice-only-indicator {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 30px;
    animation: voicePulse 2s infinite;
}

@keyframes voicePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 20px rgba(52, 152, 219, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

.voice-only-indicator.playing {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.voice-only-indicator.paused {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    animation: none;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .voice-only-content {
        max-width: 95%;
        padding: 20px;
    }

    .voice-only-status {
        font-size: 18px;
    }

    .voice-only-controls {
        gap: 10px;
    }

    .voice-only-button {
        padding: 12px 20px;
        font-size: 14px;
    }

    .voice-only-indicator {
        width: 60px;
        height: 60px;
    }
}

/* 顺序练习按钮 */
.btn-practice {
    background: linear-gradient(135deg, #5b86e5 0%, #36d1dc 100%);
    color: white;
}

.btn-practice:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(91, 134, 229, 0.3);
}

/* 考试模式：隐藏真实答案列，显示填写答案列 */
.answer-input-col {
    display: none;
}

body.exam-mode .correct-answer-cell {
    display: none;
}

body.exam-mode .answer-input-col {
    display: table-cell;
}

.answer-input {
    width: 100%;
    min-width: 96px;
    padding: 8px 10px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
    transition: border-color 0.2s, background 0.2s;
}

.answer-input:focus {
    border-color: #4a90e2;
}

.answer-input.right {
    border-color: #27ae60;
    background: #eafaf0;
}

.answer-input.wrong {
    border-color: #e74c3c;
    background: #fdeded;
}

.answer-feedback {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    min-height: 16px;
}

.answer-feedback.ok {
    color: #27ae60;
}

.answer-feedback.reveal {
    color: #27ae60;
}

.answer-feedback.reveal strong {
    font-size: 13px;
}

/* 纯语音模式答题区 */
.voice-answer-area {
    margin-top: 26px;
}

.voice-answer-label {
    font-size: 15px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.voice-answer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 22px;
    flex-wrap: wrap;
}

#voiceAnswerInput {
    font-size: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    outline: none;
    width: 210px;
    max-width: 70vw;
    text-align: center;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.92);
}

#voiceAnswerInput.right {
    background: #d5f5e3;
}

#voiceAnswerInput.wrong {
    background: #fadbd8;
}

#voiceAnswerFeedback {
    width: 100%;
    text-align: center;
    font-size: 15px;
    min-height: 20px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .answer-input {
        min-width: 72px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .answer-feedback {
        font-size: 11px;
    }
}
