:root { --cube-color: #00ff41; --bg-color: #050a15; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body, html { width:100%; height:100%; overflow-y:scroll; overflow-x:hidden; background:var(--bg-color); font-family:'Noto Sans SC',sans-serif; color:#e0e6ed; }
.hidden { display:none !important; }

/* Auth */
.cyber-auth { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); z-index:100; width:350px; padding:30px; text-align:center; border-radius:12px; border:1px solid rgba(0,255,65,0.3); background:rgba(10,15,25,0.92); backdrop-filter:blur(15px); box-shadow:0 0 40px rgba(0,255,65,0.15); }
.cyber-auth h2 { font-family:'Orbitron',sans-serif; margin-bottom:20px; color:var(--cube-color); }
.auth-tabs { display:flex; gap:10px; margin-bottom:20px; }
.auth-tabs button { flex:1; padding:8px; background:transparent; border:1px solid rgba(0,255,65,0.3); color:#aaa; border-radius:5px; cursor:pointer; transition:all .3s; }
.auth-tabs button.active { background:rgba(0,255,65,0.15); color:var(--cube-color); border-color:var(--cube-color); }
.input-group { margin-bottom:12px; }
.input-group input { width:100%; padding:10px 15px; background:rgba(0,0,0,0.5); border:1px solid rgba(0,255,65,0.3); color:#fff; border-radius:5px; font-size:.95rem; }
.input-group input:focus { outline:none; box-shadow:0 0 12px rgba(0,255,65,0.3); }
.error-msg { color:#ff003c; font-size:.85rem; }
.success-msg { color:#00ff66; font-size:.85rem; }

.highlight { color:var(--cube-color); font-weight:bold; }

/* Glass Panel */
.glass-panel { background:rgba(10,20,40,0.6); border:1px solid rgba(0,255,65,0.15); border-radius:10px; padding:10px 14px; backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }

/* App Layout */
#app { position:relative; z-index:10; display:flex; flex-direction:column; height:calc(100vh - 4px); padding:8px; gap:6px; }

/* Header */
.cube-header { background:rgba(5,5,10,0.85); border-bottom:1px solid var(--cube-color); margin-bottom:20px; }
.cube-header h1 { font-family:'Orbitron',sans-serif; font-size:1.2rem; white-space:nowrap; }
.cube-header h1 .badge { font-size:.65rem; padding:2px 8px; border-radius:4px; background:rgba(0,255,65,0.15); color:var(--cube-color); }
.cube-header #user-info { border-color: var(--cube-color); }
.stats-inline { display:flex; align-items:center; gap:6px; font-family:'Orbitron',sans-serif; font-size:0.85rem; color:var(--cube-color); }
.stats-inline .stat-label { font-size:0.8rem; opacity:0.7; }
.stats-inline .stat-value { font-weight:bold; min-width:48px; text-align:center; }
.stats-inline .stat-sep { color:#333; margin:0 2px; }
.nav-btn { text-decoration:none; display:inline-flex; align-items:center; }

/* 3D Canvas */
#cube-canvas-container { flex:1; position:relative; border-radius:10px; overflow:hidden; min-height:200px; }
#cube-canvas-container canvas { width:100% !important; height:100% !important; display:block; }

/* Controls */
.controls-panel { display:flex; flex-direction:column; gap:8px; align-items:center; padding:10px 12px; }
.action-btns { display:flex; gap:10px; margin-bottom:4px; }
.action-btn { font-size:.9rem; }
.move-grid { display:grid; grid-template-columns:repeat(6,1fr); gap:6px; width:100%; max-width:500px; }
.move-btn { padding:10px 0; border:1px solid rgba(0,255,65,0.3); background:rgba(0,255,65,0.06); color:#ccc; border-radius:6px; font-size:.95rem; font-weight:bold; font-family:'Orbitron',sans-serif; cursor:pointer; transition:all .2s; text-align:center; }
.move-btn:hover { background:rgba(0,255,65,0.2); color:#fff; box-shadow:0 0 10px rgba(0,255,65,0.2); }
.move-btn:active { transform:scale(0.93); background:rgba(0,255,65,0.35); }
.move-btn.inv { border-color:rgba(0,200,255,0.3); background:rgba(0,200,255,0.06); }
.move-btn.inv:hover { background:rgba(0,200,255,0.2); box-shadow:0 0 10px rgba(0,200,255,0.2); }
.move-labels { font-size:.7rem; color:#666; text-align:center; }

/* Modals */
.modal-overlay { position:fixed; top:0;left:0;width:100%;height:100%;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.75);backdrop-filter:blur(8px); }
.modal-card { max-width:420px; width:90%; padding:24px; border-radius:14px; border:1px solid rgba(0,255,65,0.3); background:rgba(10,15,25,0.95); box-shadow:0 0 40px rgba(0,255,65,0.15); animation:modalIn .25s ease; }
@keyframes modalIn { from{opacity:0;transform:scale(.9)} to{opacity:1;transform:scale(1)} }

/* Leaderboard Table */
.lb-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.lb-table th { color:var(--cube-color); text-align:left; padding:6px 8px; border-bottom:1px solid rgba(0,255,65,0.2); font-family:'Orbitron',sans-serif; font-size:.7rem; }
.lb-table td { padding:6px 8px; border-bottom:1px solid rgba(255,255,255,0.05); }
.lb-table tr:hover td { background:rgba(0,255,65,0.05); }

/* Responsive */
@media (max-width:768px) {
    .cube-header { gap:4px; }
    .header-top { flex-wrap:wrap; gap:8px; }
    #user-info { flex-wrap:wrap; gap:4px; }
    .move-grid { grid-template-columns:repeat(4,1fr); max-width:320px; }
    .move-btn { padding:12px 0; }
    .stat-value { font-size:1.1rem; }
}
@media (max-width:480px) {
    .move-grid { grid-template-columns:repeat(3,1fr); }
}

/* Camera Overlay Controls */
.camera-controls-overlay {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    flex-wrap: wrap; /* 允许在窄屏手机上折行，防止被裁剪 */
    justify-content: center;
    z-index: 20;
    background: rgba(10, 20, 40, 0.7);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 65, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.15);
    max-width: 95%; /* 限制最大宽度，防止溢出屏幕 */
}
.cam-control-btn {
    background: transparent;
    border: 1px solid rgba(0, 255, 65, 0.4);
    color: var(--cube-color);
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: 'Noto Sans SC', sans-serif;
}
.cam-control-btn:hover {
    background: var(--cube-color);
    color: #0a0f19;
    box-shadow: 0 0 10px var(--cube-color);
    transform: translateY(-2px);
}
.cam-control-btn:active {
    transform: scale(0.95);
}
.cam-control-btn.reset {
    border-color: rgba(0, 200, 255, 0.5);
    color: #00c8ff;
}
.cam-control-btn.reset:hover {
    background: #00c8ff;
    color: #0a0f19;
    box-shadow: 0 0 10px #00c8ff;
}
.cam-control-btn.flip {
    border-color: rgba(255, 149, 0, 0.5);
    color: #ff9500;
}
.cam-control-btn.flip:hover {
    background: #ff9500;
    color: #0a0f19;
    box-shadow: 0 0 10px #ff9500;
}

/* Kid-friendly controls container */
.kid-controls-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 600px;
    margin-top: 8px;
}
.control-row-group {
    background: rgba(10, 15, 30, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.control-row-group.horiz { border-color: rgba(255, 255, 255, 0.15); }
.control-row-group.vert { border-color: rgba(255, 149, 0, 0.15); }
.control-row-group.face { border-color: rgba(0, 170, 68, 0.15); }

.group-title {
    font-size: 0.8rem;
    font-weight: bold;
    width: 80px;
    text-align: left;
    white-space: nowrap;
}
.group-buttons {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

/* Kid-friendly buttons color-coded */
.kids-btn {
    padding: 8px 0 !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
    font-family: 'Noto Sans SC', sans-serif !important;
    font-weight: bold !important;
    text-shadow: none !important;
}
.kids-btn.white {
    border-color: rgba(255, 255, 255, 0.4) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}
.kids-btn.white:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2) !important;
}
.kids-btn.yellow {
    border-color: rgba(255, 213, 0, 0.4) !important;
    background: rgba(255, 213, 0, 0.05) !important;
    color: #ffd500 !important;
}
.kids-btn.yellow:hover {
    background: rgba(255, 213, 0, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 213, 0, 0.2) !important;
}
.kids-btn.orange {
    border-color: rgba(255, 149, 0, 0.4) !important;
    background: rgba(255, 149, 0, 0.05) !important;
    color: #ff9500 !important;
}
.kids-btn.orange:hover {
    background: rgba(255, 149, 0, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.2) !important;
}
.kids-btn.red {
    border-color: rgba(255, 0, 60, 0.4) !important;
    background: rgba(255, 0, 60, 0.05) !important;
    color: #ff003c !important;
}
.kids-btn.red:hover {
    background: rgba(255, 0, 60, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.2) !important;
}
.kids-btn.green {
    border-color: rgba(0, 170, 70, 0.4) !important;
    background: rgba(0, 170, 70, 0.05) !important;
    color: #00ff66 !important;
}
.kids-btn.green:hover {
    background: rgba(0, 170, 70, 0.25) !important;
    box-shadow: 0 0 10px rgba(0, 170, 70, 0.2) !important;
}
.kids-btn.blue {
    border-color: rgba(0, 102, 255, 0.4) !important;
    background: rgba(0, 102, 255, 0.05) !important;
    color: #0066ff !important;
}
.kids-btn.blue:hover {
    background: rgba(0, 102, 255, 0.25) !important;
    box-shadow: 0 0 10px rgba(0, 102, 255, 0.2) !important;
}

@media (max-width: 600px) {
    .control-row-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .group-buttons {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width:480px) {
    .move-grid { grid-template-columns:repeat(3,1fr); }
}
