Kexin-251202's picture
update app.css home.jsx adjust layout
e72f32a verified
/* =========================================
1. REACT layout setting
========================================= */
html, body, #root {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.app-container {
width: 100%;
min-height: 100vh; /* screen height */
display: flex;
flex-direction: column;
background-color: #f9f9f9;
}
/* =========================================
2. original layout
========================================= */
/* GLOBAL STYLES */
body {
font-family: 'Nunito', sans-serif;
background-color: #f9f9f9;
overflow-x: hidden;
overflow-y: auto;
}
/* dynamic class name */
.hidden {
display: none !important;
}
/* TOP MENU */
#top-menu {
height: 60px;
background-color: white;
display: flex;
align-items: center;
justify-content: center; /* Center buttons horizontally */
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
.menu-btn {
background: none;
border: none;
font-family: 'Nunito', sans-serif;
font-size: 16px;
color: #333;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.2s;
}
.menu-btn:hover {
background-color: #f0f0f0;
border-radius: 4px;
}
/* active for React */
.menu-btn.active {
font-weight: bold;
color: #007BFF;
background-color: #eef7ff;
border-radius: 4px;
}
.separator {
width: 1px;
height: 20px;
background-color: #555; /* Dark gray separator */
margin: 0 5px;
}
/* PAGE CONTAINER */
.page {
/* content under menu */
min-height: calc(100vh - 60px);
width: 100%;
padding-top: 60px; /* Space for fixed menu */
padding-bottom: 40px; /* Space at bottom for scrolling */
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
}
/* Ensure page titles are black */
.page h1 {
color: #000 !important;
background: transparent !important;
}
.page-title {
color: #000 !important;
background: transparent !important;
}
/* PAGE A SPECIFIC */
#page-a {
justify-content: center; /* Center vertically */
/* 注意:因为 React 结构变化,如果感觉偏下,可以微调这个 margin-top */
margin-top: -40px;
flex: 1; /* 确保它占满剩余空间以便垂直居中 */
}
#page-a h1 {
font-size: 80px;
margin: 0 0 10px 0;
color: #000;
text-align: center; /* 确保文字居中 */
}
#page-a p {
color: #666;
font-size: 20px;
margin-bottom: 40px;
text-align: center;
}
.btn-main {
background-color: #007BFF; /* Blue */
color: white;
border: none;
padding: 15px 50px;
font-size: 20px;
font-family: 'Nunito', sans-serif;
border-radius: 30px; /* Fully rounded corners */
cursor: pointer;
transition: transform 0.2s ease;
}
.btn-main:hover {
transform: scale(1.1); /* Zoom effect */
}
/* PAGE B SPECIFIC */
#page-b {
justify-content: space-evenly; /* Distribute vertical space */
padding-bottom: 20px;
min-height: calc(100vh - 60px); /* 再次确保高度足够 */
}
/* 1. Display Area */
#display-area {
width: 60%;
height: 50vh; /* 改用 vh 单位,确保在不同屏幕下的高度比例 */
min-height: 300px;
border: 2px solid #ddd;
border-radius: 12px;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
color: #555;
font-size: 24px;
position: relative;
/* 确保视频元素也能居中且不溢出 */
overflow: hidden;
}
#display-area video {
width: 100%;
height: 100%;
object-fit: cover; /* 类似于 background-size: cover */
}
/* 2. Timeline Area */
#timeline-area {
width: 60%;
height: 80px;
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.timeline-label {
position: absolute;
top: 0;
left: 0;
color: #888;
font-size: 14px;
}
#timeline-line {
width: 100%;
height: 2px;
background-color: #87CEEB; /* Light blue */
}
/* 3. Control Panel */
#control-panel {
display: flex;
gap: 20px;
width: 60%;
justify-content: space-between;
}
.action-btn {
flex: 1; /* Evenly distributed width */
padding: 12px 0;
border: none;
border-radius: 12px;
font-size: 16px;
font-family: 'Nunito', sans-serif;
font-weight: 700;
cursor: pointer;
color: white;
transition: opacity 0.2s;
}
.action-btn:hover {
opacity: 0.9;
}
.action-btn.green { background-color: #28a745; }
.action-btn.yellow { background-color: #ffce0b; }
.action-btn.blue { background-color: #326ed6; }
.action-btn.red { background-color: #dc3545; }
/* 4. Frame Control */
#frame-control {
display: flex;
align-items: center;
gap: 15px;
color: #333;
font-weight: bold;
}
#frame-slider {
width: 200px;
cursor: pointer;
}
#frame-input {
width: 50px;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
text-align: center;
font-family: 'Nunito', sans-serif;
}
/* ================ ACHIEVEMENT PAGE ================ */
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
width: 80%;
margin: 40px auto;
}
.stat-card {
background: white;
padding: 30px;
border-radius: 12px;
text-align: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.stat-number {
font-size: 48px;
font-weight: bold;
color: #007BFF;
margin-bottom: 10px;
}
.stat-label {
font-size: 16px;
color: #666;
}
.achievements-section {
width: 80%;
margin: 0 auto;
}
.achievements-section h2 {
color: #333;
margin-bottom: 20px;
}
.badges-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
.badge {
background: white;
padding: 30px 20px;
border-radius: 12px;
text-align: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
transition: transform 0.2s;
}
.badge:hover {
transform: translateY(-5px);
}
.badge.locked {
opacity: 0.4;
filter: grayscale(100%);
}
.badge-icon {
font-size: 64px;
margin-bottom: 15px;
}
.badge-name {
font-size: 16px;
font-weight: bold;
color: #333;
}
/* ================ RECORDS PAGE ================ */
.records-controls {
display: flex;
gap: 10px;
margin: 20px auto;
width: 80%;
justify-content: center;
}
.filter-btn {
padding: 10px 20px;
border: 2px solid #007BFF;
background: white;
color: #007BFF;
border-radius: 8px;
cursor: pointer;
font-family: 'Nunito', sans-serif;
font-weight: 600;
transition: all 0.2s;
}
.filter-btn:hover {
background: #e7f3ff;
}
.filter-btn.active {
background: #007BFF;
color: white;
}
.chart-container {
width: 80%;
background: white;
padding: 30px;
border-radius: 12px;
margin: 20px auto;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
#focus-chart {
display: block;
margin: 0 auto;
/* 确保图表在容器内自适应 */
max-width: 100%;
}
.sessions-list {
width: 80%;
margin: 20px auto;
}
.sessions-list h2 {
color: #333;
margin-bottom: 15px;
}
#sessions-table {
width: 100%;
background: white;
border-collapse: collapse;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
#sessions-table th {
background: #007BFF;
color: white;
padding: 15px;
text-align: left;
font-weight: 600;
}
#sessions-table td {
padding: 12px 15px;
border-bottom: 1px solid #eee;
}
#sessions-table tr:last-child td {
border-bottom: none;
}
#sessions-table tbody tr:hover {
background: #f8f9fa;
}
.btn-view {
padding: 6px 12px;
background: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-family: 'Nunito', sans-serif;
transition: background 0.2s;
}
.btn-view:hover {
background: #0056b3;
}
/* ================ SETTINGS PAGE ================ */
.settings-container {
width: 60%;
max-width: 800px;
margin: 20px auto;
}
.setting-group {
background: white;
padding: 30px;
border-radius: 12px;
margin-bottom: 20px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.setting-group h2 {
margin-top: 0;
color: #333;
font-size: 20px;
margin-bottom: 20px;
border-bottom: 2px solid #007BFF;
padding-bottom: 10px;
}
.setting-item {
margin-bottom: 25px;
}
.setting-item:last-child {
margin-bottom: 0;
}
.setting-item label {
display: block;
margin-bottom: 8px;
color: #333;
font-weight: 600;
}
.slider-group {
display: flex;
align-items: center;
gap: 15px;
}
.slider-group input[type="range"] {
flex: 1;
}
.slider-group span {
min-width: 40px;
text-align: center;
font-weight: bold;
color: #007BFF;
font-size: 18px;
}
.setting-description {
font-size: 14px;
color: #666;
margin-top: 5px;
font-style: italic;
}
input[type="checkbox"] {
margin-right: 10px;
cursor: pointer;
}
input[type="number"] {
width: 100px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
font-family: 'Nunito', sans-serif;
}
/* --- 新的代码:让按钮居中且变宽 --- */
.setting-group .action-btn {
display: inline-block; /* 允许并排显示 */
width: 48%; /* 两个按钮各占约一半宽度 (留2%缝隙) */
margin: 15px 1%; /* 上下 15px,左右 1% 间距来实现居中和分隔 */
text-align: center; /* 文字居中 */
box-sizing: border-box; /* 确保边框不会撑大按钮导致换行 */
}
#save-settings {
display: block;
margin: 20px auto;
}
/* ================ HELP PAGE ================ */
.help-container {
width: 70%;
max-width: 900px;
margin: 20px auto;
}
/* Fake ad block (Help page) */
.fake-ad {
position: relative;
display: block;
width: min(600px, 90%);
margin: 10px auto 30px auto;
border: 1px solid #e5e5e5;
border-radius: 12px;
overflow: hidden;
background: #fff;
text-decoration: none;
box-shadow: 0 8px 24px rgba(0,0,0,0.12);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fake-ad:hover {
transform: translateY(-2px);
box-shadow: 0 12px 30px rgba(0,0,0,0.16);
}
.fake-ad img {
display: block;
width: 100%;
height: auto;
}
.fake-ad-badge {
position: absolute;
top: 12px;
left: 12px;
background: rgba(0,0,0,0.75);
color: #fff;
font-size: 12px;
padding: 4px 8px;
border-radius: 6px;
letter-spacing: 0.5px;
}
.fake-ad-cta {
position: absolute;
right: 12px;
bottom: 12px;
background: #111;
color: #fff;
font-size: 14px;
padding: 8px 12px;
border-radius: 8px;
}
.help-section {
background: white;
padding: 30px;
border-radius: 12px;
margin-bottom: 20px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.help-section h2 {
color: #007BFF;
margin-top: 0;
margin-bottom: 15px;
}
.help-section ol,
.help-section ul {
line-height: 1.8;
color: #333;
}
.help-section p {
line-height: 1.6;
color: #333;
}
details {
margin: 15px 0;
cursor: pointer;
padding: 10px;
background: #f8f9fa;
border-radius: 5px;
}
summary {
font-weight: bold;
padding: 5px;
color: #007BFF;
}
details[open] summary {
margin-bottom: 10px;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
}
details p {
margin: 10px 0 0 0;
}
/* ================ SESSION SUMMARY MODAL ================ */
/* 如果将来要做弹窗,这些样式可以直接复用 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 2000;
}
.modal-content {
background: white;
padding: 40px;
border-radius: 16px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
max-width: 500px;
width: 90%;
}
.modal-content h2 {
margin-top: 0;
color: #333;
text-align: center;
margin-bottom: 30px;
}
.summary-stats {
margin-bottom: 30px;
}
.summary-item {
display: flex;
justify-content: space-between;
padding: 15px 0;
border-bottom: 1px solid #eee;
}
.summary-item:last-child {
border-bottom: none;
}
.summary-label {
font-weight: 600;
color: #666;
}
.summary-value {
font-weight: bold;
color: #007BFF;
font-size: 18px;
}
.modal-content .btn-main {
display: block;
margin: 0 auto;
padding: 12px 40px;
}
/* ================ TIMELINE BLOCKS ================ */
.timeline-block {
transition: opacity 0.2s;
border-radius: 2px;
}
.timeline-block:hover {
opacity: 0.7;
}
/* ================ RESPONSIVE DESIGN ================ */
@media (max-width: 1200px) {
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
.badges-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.stats-grid,
.badges-grid {
grid-template-columns: 1fr;
width: 90%;
}
.settings-container,
.help-container,
.chart-container,
.sessions-list,
.records-controls {
width: 90%;
}
#control-panel {
width: 90%;
flex-wrap: wrap;
}
#display-area {
width: 90%;
}
#timeline-area {
width: 90%;
}
#frame-control {
width: 90%;
flex-direction: column;
}
}
/* =========================================
SESSION RESULT OVERLAY (新增)
========================================= */
.session-result-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.85); /* 深色半透明背景 */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
z-index: 10;
animation: fadeIn 0.5s ease;
backdrop-filter: blur(5px); /* 背景模糊效果 (可选) */
}
.session-result-overlay h3 {
font-size: 32px;
margin-bottom: 30px;
color: #4cd137; /* 绿色标题 */
text-transform: uppercase;
letter-spacing: 2px;
}
.session-result-overlay .result-item {
display: flex;
justify-content: space-between;
width: 200px; /* 控制宽度 */
margin-bottom: 15px;
font-size: 20px;
border-bottom: 1px solid rgba(255,255,255,0.2);
padding-bottom: 5px;
}
.session-result-overlay .label {
color: #ccc;
font-weight: normal;
}
.session-result-overlay .value {
color: #fff;
font-weight: bold;
font-family: 'Courier New', monospace; /* 看起来像数据 */
}
@keyframes fadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
/* ================= 迎宾弹窗样式 ================= */
.welcome-modal-overlay {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.welcome-modal {
background-color: #1e1e24;
padding: 40px;
border-radius: 15px;
text-align: center;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
border: 1px solid #333;
}
.welcome-modal h2 { margin-top: 0; color: #fff; }
.welcome-modal p { margin-bottom: 30px; color: #ccc; }
.welcome-buttons { display: flex; gap: 20px; justify-content: center; }
/* ================= 左上角头像样式 (修改版) ================= */
#top-menu {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.avatar-container {
position: absolute;
left: 20px;
cursor: pointer;
}
.avatar-circle {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
font-size: 1.2rem;
color: white;
transition: all 0.3s ease;
border: 2px solid transparent;
}
.avatar-circle.user { background-color: #555; }
.avatar-circle.admin { background-color: #ffaa00; border-color: #fff; box-shadow: 0 0 10px rgba(255, 170, 0, 0.5); }
/* ================= 首页按钮 2x2 响应式网格 (终极修正版) ================= */
.home-button-grid {
display: grid;
grid-template-columns: 1fr 1fr; /* 强行平分两列,绝不妥协 */
gap: 20px; /* 按钮之间的间距 */
width: 100%;
max-width: 500px; /* 限制最大宽度,宽屏下也不会显得傻大黑粗 */
margin: 40px auto 0 auto; /* 上边距40px,左右auto保证绝对居中! */
}
.home-button-grid .btn-main {
width: 100%;
height: 60px; /* 统一高度,像一块块整齐的砖头 */
margin: 0; /* 清除默认外边距 */
padding: 10px;
font-size: 1rem;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
box-sizing: border-box; /* 保证边框和内边距不会撑破格子 */
}
/* 📱 手机端专属适配 (屏幕宽度小于 600px 时自动缩放) */
@media (max-width: 600px) {
.home-button-grid {
gap: 15px;
max-width: 90%;
}
.home-button-grid .btn-main {
height: 50px;
font-size: 0.85rem;
}
}