/* 基础样式重置 */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; line-height: 1.6; color: #2d5a27; min-height: 100vh; overflow-x: hidden; } /* 容器布局 */ .container { max-width: 1200px; margin: 0 auto; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; } /* 头部样式 */ .header { text-align: center; margin-bottom: 40px; padding: 30px 0; } .header h1 { font-size: 2.5rem; color: #1a4d1a; margin-bottom: 10px; font-weight: 700; text-shadow: 0 2px 4px rgba(26, 77, 26, 0.1); } .subtitle { font-size: 1.1rem; color: #4a7c59; opacity: 0.8; } /* 主内容区域 */ .main-content { flex: 1; display: flex; justify-content: center; align-items: flex-start; } /* 加载动画 */ .loading { text-align: center; padding: 60px 20px; } .spinner { width: 50px; height: 50px; border: 4px solid #e8f5e8; border-top: 4px solid #4caf50; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .loading p { color: #4a7c59; font-size: 1.1rem; } /* 题目容器 */ .question-container { background: rgba(255, 255, 255, 0.95); border-radius: 20px; padding: 40px; box-shadow: 0 10px 30px rgba(26, 77, 26, 0.1); border: 2px solid rgba(76, 175, 80, 0.2); width: 100%; max-width: 800px; backdrop-filter: blur(10px); } /* 题目头部 */ .question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 2px solid #e8f5e8; } .question-id { font-size: 1.1rem; color: #4caf50; font-weight: 600; background: linear-gradient(135deg, #e8f5e8, #c8e6c9); padding: 8px 16px; border-radius: 20px; } .refresh-btn { background: linear-gradient(135deg, #4caf50, #45a049); border: none; border-radius: 50%; width: 45px; height: 45px; color: white; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; } .refresh-btn:hover { transform: rotate(180deg) scale(1.1); box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3); } /* 题目文本 */ .question-text h2 { font-size: 1.5rem; color: #1a4d1a; margin-bottom: 25px; text-align: center; } /* 代码块 */ .code-block { background: #f8f9fa; border: 2px solid #e8f5e8; border-radius: 12px; margin: 25px 0; overflow-x: auto; position: relative; } .code-block pre { margin: 0; padding: 25px; font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-size: 0.95rem; line-height: 1.5; color: #2d5a27; white-space: pre-wrap; word-wrap: break-word; background: transparent !important; } .code-block code { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; background: transparent !important; } /* 代码高亮自定义样式 - 丰富的语法高亮 */ .code-block .hljs { background: transparent !important; color: #333333 !important; } /* JavaScript 关键字 - 蓝色 */ .code-block .hljs-keyword { color: #0066cc !important; font-weight: 600; } /* 字符串 - 绿色 */ .code-block .hljs-string { color: #22aa22 !important; } /* 数字 - 橙色 */ .code-block .hljs-number { color: #ff6600 !important; } /* 函数名 - 紫色 */ .code-block .hljs-function, .code-block .hljs-title.function_ { color: #9933cc !important; font-weight: 600; } /* 变量名 - 深蓝色 */ .code-block .hljs-variable, .code-block .hljs-name { color: #0066aa !important; } /* 注释 - 灰色 */ .code-block .hljs-comment { color: #888888 !important; font-style: italic; } /* 内置对象和方法 - 深紫色 */ .code-block .hljs-built_in { color: #663399 !important; font-weight: 500; } /* 字面量 (true, false, null) - 红色 */ .code-block .hljs-literal { color: #cc0000 !important; font-weight: 600; } /* 操作符 - 深灰色 */ .code-block .hljs-operator { color: #666666 !important; } /* 标点符号 - 深灰色 */ .code-block .hljs-punctuation { color: #666666 !important; } /* 属性名 - 深蓝色 */ .code-block .hljs-property, .code-block .hljs-attr { color: #0066aa !important; } /* 类名和构造函数 - 深绿色 */ .code-block .hljs-title.class_, .code-block .hljs-title { color: #228833 !important; font-weight: 600; } /* 参数 - 深蓝色 */ .code-block .hljs-params { color: #0066aa !important; } /* 正则表达式 - 深红色 */ .code-block .hljs-regexp { color: #aa0066 !important; } /* 模板字符串 - 深绿色 */ .code-block .hljs-template-variable, .code-block .hljs-template-tag { color: #228833 !important; } /* 选项容器 */ .options-container { margin: 30px 0; } .option { background: rgba(255, 255, 255, 0.8); border: 2px solid #e8f5e8; border-radius: 12px; padding: 15px 20px; margin: 12px 0; cursor: pointer; transition: all 0.3s ease; font-size: 1rem; position: relative; overflow: hidden; } .option:hover { border-color: #4caf50; background: rgba(76, 175, 80, 0.05); transform: translateX(5px); } .option.selected { border-color: #4caf50; background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05)); color: #1a4d1a; font-weight: 600; } .option.correct { border-color: #4caf50; background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1)); color: #1a4d1a; } .option.incorrect { border-color: #f44336; background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05)); color: #c62828; } /* 按钮样式 */ .action-buttons { display: flex; gap: 15px; margin: 30px 0; justify-content: center; flex-wrap: wrap; } .submit-btn, .show-answer-btn, .retry-btn, .export-btn { padding: 12px 30px; border: none; border-radius: 25px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; min-width: 120px; display: flex; align-items: center; justify-content: center; gap: 8px; } .submit-btn { background: linear-gradient(135deg, #4caf50, #45a049); color: white; } .submit-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3); } .submit-btn:disabled { background: #cccccc; cursor: not-allowed; transform: none; box-shadow: none; } .show-answer-btn { background: linear-gradient(135deg, #2196f3, #1976d2); color: white; } .show-answer-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3); } .retry-btn { background: linear-gradient(135deg, #ff9800, #f57c00); color: white; } .retry-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3); } .export-btn { background: linear-gradient(135deg, #9c27b0, #7b1fa2); color: white; } .export-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(156, 39, 176, 0.3); } .export-btn svg { width: 16px; height: 16px; } /* 结果容器 */ .result-container { margin-top: 30px; padding: 25px; background: rgba(255, 255, 255, 0.9); border-radius: 15px; border: 2px solid #e8f5e8; } .result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e8f5e8; } .result-status { font-size: 1.2rem; font-weight: 600; } .result-status.correct { color: #4caf50; } .result-status.incorrect { color: #f44336; } .correct-answer { font-weight: 600; color: #4caf50; background: rgba(76, 175, 80, 0.1); padding: 5px 12px; border-radius: 15px; } .explanation { color: #2d5a27; line-height: 1.7; font-size: 1rem; } .explanation pre { background: #f8f9fa; border: 1px solid #e8f5e8; border-radius: 8px; padding: 15px; margin: 15px 0; overflow-x: auto; font-family: 'Consolas', 'Monaco', 'Courier New', monospace; } /* 错误容器 */ .error-container { text-align: center; padding: 60px 20px; background: rgba(255, 255, 255, 0.9); border-radius: 20px; border: 2px solid rgba(244, 67, 54, 0.2); max-width: 500px; margin: 0 auto; } .error-icon { font-size: 3rem; margin-bottom: 20px; } .error-container h3 { color: #f44336; margin-bottom: 15px; font-size: 1.5rem; } .error-container p { color: #666; margin-bottom: 25px; font-size: 1.1rem; } /* 底部 */ .footer { text-align: center; padding: 30px 0; margin-top: 40px; color: #4a7c59; opacity: 0.7; border-top: 1px solid rgba(76, 175, 80, 0.2); } /* 平板端适配 (768px - 1024px) */ @media (max-width: 1024px) and (min-width: 768px) { .container { padding: 15px; } .header h1 { font-size: 2.2rem; } .question-container { padding: 30px; } .action-buttons { flex-wrap: wrap; } } /* 手机端适配 (最大768px) */ @media (max-width: 768px) { .container { padding: 10px; } .header { margin-bottom: 25px; padding: 20px 0; } .header h1 { font-size: 1.8rem; } .subtitle { font-size: 1rem; } .question-container { padding: 20px; border-radius: 15px; } .question-header { flex-direction: column; gap: 15px; text-align: center; } .question-text h2 { font-size: 1.3rem; } .code-block pre { padding: 15px; font-size: 0.85rem; } .option { padding: 12px 15px; font-size: 0.95rem; } .action-buttons { flex-direction: column; align-items: center; } .submit-btn, .show-answer-btn, .retry-btn { width: 100%; max-width: 200px; } .result-header { flex-direction: column; gap: 10px; text-align: center; } .explanation { font-size: 0.95rem; } .explanation pre { padding: 10px; font-size: 0.8rem; } } /* 小屏手机适配 (最大480px) */ @media (max-width: 480px) { .container { padding: 8px; } .header h1 { font-size: 1.6rem; } .question-container { padding: 15px; } .question-id { font-size: 1rem; padding: 6px 12px; } .refresh-btn { width: 40px; height: 40px; } .code-block pre { font-size: 0.8rem; padding: 12px; } .option { padding: 10px 12px; font-size: 0.9rem; } .submit-btn, .show-answer-btn, .retry-btn { padding: 10px 20px; font-size: 0.95rem; } }