/* Heading Resets for Tailwind Preflight */

h1 {
    font-size: 2em;
    font-weight: bold;
}

h2 {
    font-size: 1.5em;
    font-weight: bold;
}

h3 {
    font-size: 1.17em;
    font-weight: bold;
}

h4 {
    font-size: 1em;
    font-weight: bold;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka One', 'Varela Round', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #FFF9E6;
    background-image:
        radial-gradient(#F5E6CA 15%, transparent 16%),
        radial-gradient(#F5E6CA 15%, transparent 16%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    min-height: 100vh;
    color: #2D3436;
    overflow-x: hidden;
    overflow-y: auto;
}



/* Unified View Switcher Style */

.view-btn {
    background: none;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: #636D6A;
    transition: all 0.2s;
    font-size: 14px;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.view-btn.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Study/Read specific colors when active */
.view-btn[data-value="study"].active,
.view-btn[data-value="students"].active {
    color: #1DD1A1 !important;
}

.view-btn[data-value="read"].active,
.view-btn[data-value="class"].active {
    color: #FF9F43 !important;
}

.icon-btn {
    background: white;
    padding: 8px 16px;
    border: 2px solid #F1F2F6;
    color: #2D3436;
}

.icon-btn:hover {
    border-color: #1DD1A1;
    color: #1DD1A1;
}





/* Lock Button */
.lock-btn {
    font-size: 18px;
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s;
    display: inline-block;
    vertical-align: middle;
}

.status-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 1px solid white;
}

.lock-btn:hover {
    transform: scale(1.1);
}

.lock-btn.locked {
    filter: grayscale(100%) brightness(80%);
    /* Optionally change appearance */
}

/* Locked state for interactive elements */
body.is-locked .students-grid,
body.is-locked #feedAll,
body.is-locked #deductAll,
body.is-locked #addRewardRuleBtn,
body.is-locked #addPunishRuleBtn,
body.is-locked .rule-item .delete-btn,
body.is-locked .header .view-switcher button,
/* Disable header buttons */
body.is-locked .header #openSettingsBtn,
body.is-locked .header #startDetection,
body.is-locked .header #stopDetection {
    pointer-events: none;
    opacity: 0.7;
    filter: grayscale(0.5);
}

/* Ensure Lock Button is ALWAYS clickable */
body.is-locked #lockStatusBtn {
    pointer-events: auto !important;
    opacity: 1 !important;
    filter: none !important;
    cursor: pointer;
}

/* Fullscreen Rainbow Border Effect */
@keyframes rainbowBorder {
    0% {
        border-color: #ff0000;
        box-shadow: inset 0 0 20px #ff0000;
    }

    15% {
        border-color: #ff00ff;
        box-shadow: inset 0 0 20px #ff00ff;
    }

    30% {
        border-color: #0000ff;
        box-shadow: inset 0 0 20px #0000ff;
    }

    45% {
        border-color: #00ffff;
        box-shadow: inset 0 0 20px #00ffff;
    }

    60% {
        border-color: #00ff00;
        box-shadow: inset 0 0 20px #00ff00;
    }

    75% {
        border-color: #ffff00;
        box-shadow: inset 0 0 20px #ffff00;
    }

    90% {
        border-color: #ff0000;
        box-shadow: inset 0 0 20px #ff0000;
    }

    100% {
        border-color: #ff0000;
        box-shadow: inset 0 0 20px #ff0000;
    }
}

body.focus-mode {
    overflow: hidden;
    /* Prevent body scroll */
    border: 10px solid transparent;
    animation: rainbowBorder 5s linear infinite;
    height: calc(100vh - 40px);
    box-sizing: border-box;
}

body.focus-mode .header,
body.focus-mode .left-panel,
body.focus-mode .view-switcher,
body.focus-mode .settings-modal {
    display: none !important;
}

/* Hide students view by default in focus mode, unless specified */
body.focus-mode #studentsView {
    display: flex;
    /* Default behavior */
}

/* If in Class View Focus Mode */
body.focus-mode.focus-view-class #studentsView {
    display: none !important;
}

body.focus-mode.focus-view-class #classTreeView {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 50;
    background: #FFF9E6;
    /* Match bg */
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Adjust internal layout for fullscreen class tree */
body.focus-mode.focus-view-class .class-info-panel {
    position: absolute;
    top: 40px;
    left: 40px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 60;
}

body.focus-mode.focus-view-class .tree-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.focus-mode.focus-view-class .big-tree-img {
    max-height: 80vh;
    max-width: 80vw;
    object-fit: contain;
}

/* Regular Focus Mode (Students) */
body.focus-mode .container {
    padding: 0;
    margin: 0;
    max-width: 100vw;
    height: calc(100vh - 40px);
}

body.focus-mode .main-content {
    flex-direction: row;
    height: 100vh;
    padding: 0;
    margin: 0;
    gap: 0;
}

body.focus-mode .right-panel {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    padding: 20px;
    background: #F0F2F5;
    margin: 0;
    box-shadow: none;
}

body.focus-mode .students-grid {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    /* Space for exit button */
}

/* Floating Exit Button for Focus Mode */
.focus-exit-btn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 30px;
    background: #FF6B6B;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    z-index: 9999;
    cursor: pointer;
    transition: all 0.2s;
}

.focus-exit-btn:hover {
    transform: scale(1.05);
    background: #FF5252;
}

body.focus-mode .focus-exit-btn {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 班级树视图 */
/* Class Tree View - Game Style */
.class-tree-view {
    display: none;
    height: 100%;
    min-height: 500px;
    background: #C4E0E5;
    /* Light Sky Blue */
    background-image: linear-gradient(0deg, #7FBC5D 0%, #7FBC5D 20%, transparent 20%);
    /* Ground */
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    border: 4px solid #fff;
    margin-bottom: 20px;
}

.class-tree-view.active {
    display: block;
}

.tree-container {
    position: absolute;
    bottom: 12%;
    /* Adjusted for ground */
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.big-tree-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.2));
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

.class-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 16px;
    box-shadow: 0 4px 0 #E0E0E0, 0 8px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #F0F0F0;
    text-align: center;
    min-width: 220px;
    z-index: 10;
    font-size: 1.2em;
    /* Increased font size */
}

.left-panel .class-info-panel {
    position: static;
    min-width: 0;
    width: 100%;
    margin-bottom: 20px;
}

.class-info-panel #classNameDisplay {
    font-size: 20px !important;
}

.class-level-badge {
    background: #FF9F43;
    color: white;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 30px;
    display: inline-block;
    margin-bottom: 8px;
    box-shadow: 0 6px 0 #E67E22;
    font-size: 2rem;
}

.class-exp-bar {
    width: 100%;
    height: 16px;
    background: #F1F2F6;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid #E1E2E6;
}

.class-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #1DD1A1, #10AC84);
    width: 0%;
    transition: width 0.5s ease;
}

/* 能量球动画 */
.energy-bubble {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF6421;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(255, 100, 33, 0.3);
    pointer-events: none;
    animation: floatUp 2s ease-out forwards;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translateY(-20px) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translateY(-150px) scale(1);
        opacity: 0;
    }
}

/* Main Layout - Flexible logic */
.main-content {
    display: flex;
    align-items: flex-start;
    /* Ensure left panel doesn't stretch */
    gap: 20px;
    margin-bottom: 20px;
    min-height: calc(100vh - 140px);
}

.left-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    top: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 240px;
    gap: 15px;
    max-height: 100%;
    position: static;
    /* Remove sticky, let flex handle height */
}

.right-panel {
    flex-grow: 1;
    /* Important: Allow it to grow naturally */
    height: auto;
    min-height: 500px;
    overflow: visible;
    padding: 5px 0 5px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    min-height: 0;
}

.mode-switch {
    display: flex;
    background: #F1F2F6;
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 5px;
    position: relative;
    border: 1px solid #E1E2E6;
}

.mode-option {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    z-index: 1;
    font-weight: 700;
    color: #A4B0BE;
    transition: color 0.3s;
    border-radius: 8px;
}

.mode-option.active {
    color: #fff;
}

.mode-indicator {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc(50% - 5px);
    background: #1DD1A1;
    /* Soft Green */
    border-radius: 8px;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.3s;
    /* Bouncy transition */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 朗读模式下的指示器颜色 */
.mode-switch[data-mode="read"] .mode-indicator {
    transform: translateX(100%);
    background: #FECA57;
    /* Warm Yellow */
}

.control-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 0 #F0F0F0;
    border: 2px solid #F5F6FA;
}

.control-section h3 {
    font-size: 16px;
    color: #004737;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.detection-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    top: 0;
}

/* Compact Sections (Monitoring & Progress) */
.compact-section {
    padding: 12px;
}

.compact-section h3,
.compact-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.status-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.status-item-compact {
    background: #F8F9FA;
    padding: 8px 4px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #E1E2E6;
}

.status-item-compact .status-label {
    font-size: 10px;
    margin-bottom: 2px;
}

.status-item-compact .status-value {
    font-size: 14px;
    font-weight: 800;
}

.progress-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.progress-item-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #F8F9FA;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #E1E2E6;
}

.progress-item-compact .progress-label {
    font-size: 10px;
    margin-bottom: 2px;
}

.progress-item-compact .progress-value {
    font-size: 16px;
}

/* Compact Student Card - Partial styles used by JS structure, but main layout overrides some */
.exp-bar-compact {
    width: 90%;
    height: 14px;
    background: #F1F2F6;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    border: 1px solid #E1E2E6;
}

.exp-text-overlay {
    position: absolute;
    right: 0;
    width: 100%;
    text-align: center;
    font-size: 9px;
    line-height: 14px;
    color: #636D6A;
    z-index: 2;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
    font-weight: 700;
}

/* Global Layout Optimizations */
.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    margin-bottom: 20px;
    padding: 10px 20px;
}

.main-content {
    flex: 1;
    min-height: 0;
    /* Critical for flex scrolling */
    margin-bottom: 0;
    overflow: hidden;
    /* Prevent outer scroll */
}

/* Updated Header Controls */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Glassmorphism for Header Buttons */
.view-switcher,
.header-right .cloud-controls .btn-cloud,
.header-right .btn-save-nav,
.header-right .close-btn {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.view-switcher {
    padding: 4px;
    border-radius: 12px;
}

.cloud-controls {
    display: flex;
    gap: 8px;
}

.btn-cloud {
    background: #F1F2F6;
    color: #636D6A;
    border: 1px solid #E1E2E6;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-cloud:hover {
    background: #E8F8F5;
    color: #1DD1A1;
    border-color: #1DD1A1;
}

.divider-v {
    width: 1px;
    height: 24px;
    background: #E1E2E6;
}

/* Settings Row Layout */
.settings-row-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-bottom: 10px;
}

.settings-row-layout .panel-section {
    height: 100%;
    min-width: 0;
    /* Allow grid item to shrink */
}

.control-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.control-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Control Card overrides for compactness */
.control-grid-3 .control-card,
.control-grid-2 .control-card {
    padding: 10px;
}

.control-card h4 {
    font-size: 13px;
    margin-bottom: 8px;
    text-align: center;
}

.control-card .icon {
    font-size: 24px;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .settings-row-layout {
        flex-direction: column;
    }

    .settings-row-layout .panel-section {
        width: 100%;
    }
}

.management-grid-3 {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    /* Fixed sidebars, fluid middle */
    gap: 20px;
    height: 100%;
    overflow-y: auto;
}

/* Specific Section Styles */
.section-class,
.section-rules {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.class-list-container,
.rules-list-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
}

.section-students {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .management-grid-3 {
        grid-template-columns: 1fr;
        /* Stack on smaller screens */
    }

    .panel-grid-2 {
        grid-template-columns: 1fr;
    }
}

.class-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #F8F9FA;
    border-radius: 10px;
    border: 1px solid #EEE;
    transition: all 0.2s;
}

.class-row.active {
    background: #E8F8F5;
    border-color: #1DD1A1;
}

.class-name-text {
    font-weight: 700;
    color: #2D3436;
}

.class-row.active .class-name-text {
    color: #004737;
}

.current-badge {
    color: #1DD1A1;
    font-size: 12px;
    font-weight: 800;
    background: rgba(29, 209, 161, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.class-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.class-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.import-area-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.list-actions {
    background: #F8F9FA;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #EEE;
}

.file-upload-box {
    margin-bottom: 10px;
}

.file-label {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px dashed #CBD5E0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    color: #718096;
    font-weight: 600;
    transition: all 0.2s;
    background: white;
}

.file-label:hover {
    border-color: #1DD1A1;
    color: #1DD1A1;
    background: #F0FFF4;
}

.file-input-hidden {
    display: none;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .modal-header {
        flex-direction: column;
        height: auto;
        gap: 10px;
        padding: 10px;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 10px;
    }

    .settings-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 14px;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .management-grid {
        grid-template-columns: 1fr;
    }
}


.settings-main {
    flex: 1;
    padding: 20px;
    /* Reduced padding */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

.tab-panel {
    display: none;
    max-width: 1000px;
    /* Limit width for readability */
    margin: 0 auto;
    padding-bottom: 40px;
    /* Space for bottom scroll */
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Functional Block Cards */
.panel-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #E1E2E6;
}

.cloud-info-box {
    background: #F8F9FA;
    border: 1px dashed #CED4DA;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cloud-info-box:hover {
    border-color: var(--primary);
    background: #EBFFFA;
}

.panel-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 17px;
    color: #2D3436;
    border-left: 4px solid #00B894;
    padding-left: 10px;
    font-weight: 700;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.control-card {
    background: #FAFAFA;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #EEE;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.control-card:hover {
    border-color: #00B894;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.15);
}

.control-card h4 {
    margin: 5px 0;
    color: #2D3436;
    font-size: 15px;
}

.control-card p {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
    line-height: 1.4;
}

.control-card .icon {
    font-size: 28px;
    margin-bottom: 5px;
}

.full-width {
    width: 100%;
}

/* Mobile & Touch Optimization */
@media (max-width: 768px) {
    .full-screen-modal .full-screen-content {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        top: 0;
        left: 0;
        transform: none;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 15px;
        flex-shrink: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        height: auto;
        border-bottom: 1px solid #E1E2E6;
    }

    .header-left {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .settings-tabs {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        display: flex;
        gap: 10px;
        border-bottom: none;
        /* Override default */
    }

    .settings-tabs::-webkit-scrollbar {
        height: 4px;
        /* Thin scrollbar for tabs */
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 14px;
        background: #F5F6FA;
        border-radius: 20px;
        border: 1px solid transparent;
        color: #636D6A;
        font-weight: 600;
    }

    .tab-btn.active {
        background: #E8F8F5;
        color: #1DD1A1;
        border-color: #1DD1A1;
        border-bottom-color: #1DD1A1;
        /* Match active style */
    }

    .modal-title {
        font-size: 18px;
    }

    .settings-main {
        padding: 15px;
        overflow-y: auto;
        flex: 1;
        display: block;
        /* Ensure block layout */
    }

    .control-grid {
        grid-template-columns: 1fr;
    }

    .management-grid-3 {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .panel-section {
        padding: 15px;
        height: auto;
        /* Allow auto height */
    }

    /* Input & Button size for touch */
    input,
    select,
    button {
        min-height: 44px;
        /* Apple recommendation for touch targets */
    }

    .range-slider {
        height: 20px;
    }

    /* Hide non-essential elements if needed */
    .sensitivity-guide {
        font-size: 11px;
    }
}


.btn:active {
    top: 3px;
}

.btn-primary {
    background: #1DD1A1;
    color: white;
    box-shadow: 0 4px 0 #10AC84;
}

.btn-primary:active {
    box-shadow: 0 1px 0 #10AC84;
}

.btn-danger {
    background: #FF6B6B;
    color: white;
    box-shadow: 0 4px 0 #EE5253;
}

.btn-danger:active {
    box-shadow: 0 1px 0 #EE5253;
}

.btn-warning {
    background: #FECA57;
    color: #576574;
    box-shadow: 0 4px 0 #FF9F43;
}

.btn-warning:active {
    box-shadow: 0 1px 0 #FF9F43;
}

.btn-info {
    background: #54A0FF;
    color: white;
    box-shadow: 0 4px 0 #2E86DE;
}

.btn-info:active {
    box-shadow: 0 1px 0 #2E86DE;
}

.volume-meter {
    text-align: center;
}

.volume-display {
    font-size: 24px;
    font-weight: bold;
    color: #004737;
    margin-bottom: 10px;
}

.volume-bar {
    width: 100%;
    height: 18px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.volume-fill {
    height: 100%;
    background: linear-gradient(90deg, #A7DB9A 0%, #FFDE5E 50%, #FF6421 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.status-item {
    background: #F8F9FA;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #E1E2E6;
    box-shadow: 0 4px 0 #E1E2E6;
}

.status-value {
    font-size: 18px;
    font-weight: 800;
    color: #2D3436;
    margin-bottom: 4px;
}

.status-label {
    font-size: 12px;
    color: #636D6A;
    font-weight: 600;
}

.progress-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 0 #F0F0F0;
    border: 2px solid #F5F6FA;
}

.progress-section h4 {
    font-size: 16px;
    color: #2D3436;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #F1F2F6;
    border-radius: 10px;
    border: 1px solid #E1E2E6;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-label {
    font-weight: 700;
    color: #2D3436;
    font-size: 14px;
}

.progress-value {
    font-size: 18px;
    font-weight: 800;
    color: #FF9F43;
}

.system-selector {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 0 #F0F0F0;
    border: 2px solid #F5F6FA;
}

.system-selector h4 {
    font-size: 16px;
    color: #2D3436;
    margin-bottom: 12px;
    font-weight: 700;
}

.system-selector select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #DCF5D9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #102620;
    cursor: pointer;
}

.system-selector select:focus {
    outline: none;
    border-color: #A7DB9A;
    box-shadow: 0 0 0 3px rgba(167, 219, 154, 0.1);
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.seat-layout-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-container label {
    font-size: 14px;
    cursor: pointer;
    color: #102620;
}

.students-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 15px;
    height: auto;
    overflow-y: visible;
}

.student-card {
    background: white;
    border-radius: 20px;
    padding: 8px 10px 8px 5px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 3px solid #F0F0F0;
    position: relative;
    display: flex;
    flex-direction: row;
    /* Changed to row for left-right layout */
    justify-content: flex-start;
    align-items: center;
    overflow: visible;
    box-shadow: 0 6px 0 #E0E0E0, 0 10px 20px rgba(0, 0, 0, 0.05);
    gap: 4px;
    min-width: 125px;
}

.card-left {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    /* Fixed width for image container */
}

.card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    /* Enable text truncation */
}

.student-card:hover {
    transform: translateY(-5px);
    border-color: #54A0FF;
    box-shadow: 0 8px 0 #2E86DE, 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

/* 左右侧加减分按钮 - New Style */
.side-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.student-card:hover .side-btn {
    opacity: 1;
}

/* Adjust positions to pop out */
.btn-left-sub {
    left: -10px;
    background: #FF6B6B;
    border: 2px solid white;
}

.btn-right-add {
    right: -10px;
    background: #1DD1A1;
    border: 2px solid white;
    color: white;
}

.side-btn:hover {
    transform: translateY(-50%) scale(1.2);
}

.tree-image {
    width: 55px;
    height: 55px;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.1));
}

.tree-image.level-1,
.tree-image.level-2 {
    width: 24px;
    height: 24px;
}

.tree-image.level-3,
.tree-image.level-4 {
    width: 28px;
    height: 28px;
}

.tree-image.level-5,
.tree-image.level-6 {
    width: 32px;
    height: 32px;
}

.tree-image.level-7,
.tree-image.level-8 {
    width: 38px;
    height: 38px;
}

.tree-image.level-9,
.tree-image.level-10 {
    width: 45px;
    height: 45px;
}

.student-card:hover .tree-image {
    transform: scale(1.2) rotate(5deg);
}

.level-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #FECA57;
    color: #2D3436;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 1px 0 #FF9F43;
    border: 2px solid white;
    z-index: 6;
}

.exp-bar-container {
    width: 80%;
    height: 8px;
    background: #F1F2F6;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid #E1E2E6;
}

.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1DD1A1, #10AC84);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.student-card.selected {
    border-color: #FFDE5E;
    background: #FFFBF0;
    box-shadow: 0 2px 8px rgba(255, 222, 94, 0.3);
}

.student-card.highlighted {
    border-color: #FF6421;
    background: #FFF5F0;
    animation: pulse 1s infinite;
    box-shadow: 0 4px 12px rgba(255, 100, 33, 0.4);
}

.student-card.dragging {
    opacity: 0.6;
    transform: rotate(3deg) scale(0.95);
    z-index: 1000;
}

.student-card.edit-active {
    border-style: dashed;
    border-color: #FF9F43;
    cursor: move;
}

.student-card.edit-active:hover {
    background: #FFF9F0;
}

.student-card.drag-over {
    border-color: #1DD1A1;
    background: #E8F9F5;
    transform: scale(1.02);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.student-name {
    font-weight: 800;
    margin-bottom: 0;
    /* Remove bottom margin as gap is handled by flex container */
    font-size: 16px;
    color: #2D3436;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
    /* Reset padding */
}

.exp-bar-compact {
    width: 100%;
    height: 14px;
    /* Slightly taller for readability */
    background: #F1F2F6;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    border: 1px solid #E1E2E6;
}

.exp-text-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    color: #636D6A;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.student-resources {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.resource-item {
    display: flex;
    align-items: center;
    font-size: 10px;
    gap: 2px;
    color: #636D6A;
    font-weight: 500;
}

.resource-icon {
    font-size: 12px;
}

.student-controls {
    display: none;
    /* 隐藏旧的控制按钮 */
}

.control-btn {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    transform: scale(1.1);
}

.btn-add {
    background: #A7DB9A;
    color: #004737;
}

.btn-subtract {
    background: #FF6421;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 0 #E0E0E0, 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 4px solid #fff;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #F1F2F6;
}

.modal-title {
    font-size: 22px;
    font-weight: 800;
    color: #2D3436;
}

.numpad-modal {
    max-width: 400px;
}

.close-btn {
    background: #F1F2F6;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #A4B0BE;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #FF6B6B;
    color: white;
}

.rules-list {
    list-style: none;
    padding: 0;
}

.rules-list li {
    padding: 12px 0;
    border-bottom: 1px solid #DCF5D9;
    font-size: 14px;
    line-height: 1.5;
    color: #102620;
}

.rules-list li:last-child {
    border-bottom: none;
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #004737;
    font-size: 14px;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #DCF5D9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.setting-item input:focus,
.setting-item select:focus {
    outline: none;
    border-color: #A7DB9A;
    box-shadow: 0 0 0 3px rgba(167, 219, 154, 0.1);
}

.sensitivity-guide {
    background: #DCF5D9;
    padding: 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #004737;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    font-size: 14px;
    max-width: 350px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: transparent;
}

.notification.show {
    transform: translateX(0);
}

.notification.info {
    background: #A7DB9A;
    color: #004737;
}

.notification.success {
    background: #A7DB9A;
    color: #004737;
}

.notification.warning {
    background: #FF6421;
}

.notification.error {
    background: #dc3545;
}

/* 排行榜样式 */
/* 排行榜样式 - Game Style */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 2px solid #F1F2F6;
    gap: 12px;
    background: white;
    transition: transform 0.2s;
    border-radius: 8px;
    margin-bottom: 4px;
}

.leaderboard-item:hover {
    transform: scale(1.02);
    background: #FAFAFA;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F1F2F6;
    color: #A4B0BE;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    border: 2px solid #E1E2E6;
}

.rank-1 {
    background: #FECA57;
    color: white;
    border-color: #FF9F43;
    box-shadow: 0 2px 0 #FF9F43;
}

.rank-2 {
    background: #B2BEC3;
    color: white;
    border-color: #636D6A;
    box-shadow: 0 2px 0 #636D6A;
}

.rank-3 {
    background: #E17055;
    color: white;
    border-color: #D35400;
    box-shadow: 0 2px 0 #D35400;
}

.rank-info {
    flex: 1;
    overflow: hidden;
}

.rank-name {
    font-size: 14px;
    font-weight: 700;
    color: #2D3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-level {
    font-size: 12px;
    color: #A4B0BE;
    font-weight: 600;
}

.rank-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.fullscreen-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
    padding: 20px;
}

.fullscreen-alert.red {
    background: rgba(255, 68, 68, 0.9);
    opacity: 1;
}

.fullscreen-alert.green {
    background: rgba(76, 175, 80, 0.9);
    opacity: .6;
}

/* Security Grid */
.security-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.security-grid .control-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.desc-text {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.security-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8F9FA;
    padding: 8px;
    border-radius: 6px;
    margin-top: auto;
}

.code-display {
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    color: #2D3436;
    letter-spacing: 1px;
}

/* Settings Modal Tabs */
.settings-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #636D6A;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #1DD1A1;
    border-bottom-color: #1DD1A1;
}

.tab-content,
.tab-panel {
    display: none;
    padding: 10px 0;
}

.tab-content.active,
.tab-panel.active {
    display: block;
}

/* Config Lists */
.cfg-row,
.class-row {
    transition: background 0.2s;
}

.cfg-row:hover,
.class-row:hover {
    background: #F1F2F6;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 0 4px;
}

.edit-btn:hover {
    opacity: 1;
}

.btn-save {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
}

/* Nav Save Button Override */
.btn-save-nav {
    padding: 8px 16px;
    background: #1DD1A1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

.btn-save:active {
    transform: translateY(0);
}

.btn-export {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* --- Restored Desktop Styles --- */

/* Range Sliders */
.setting-row {
    margin-bottom: 25px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.range-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #E1E2E6;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #1DD1A1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.value-badge {
    font-weight: 800;
    color: #1DD1A1;
    background: #E8F8F5;
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 60px;
    text-align: center;
}

.desc {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}

.input-box {
    width: 100%;
    padding: 10px;
    border: 2px solid #E1E2E6;
    border-radius: 8px;
    font-size: 16px;
    margin-top: 5px;
}

.input-box:focus {
    border-color: #1DD1A1;
    outline: none;
}

/* Import Area */
.import-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.large-textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px solid #E1E2E6;
    border-radius: 10px;
    font-size: 14px;
    resize: none;
    font-family: monospace;
}

.file-input {
    width: 100%;
    padding: 30px;
    border: 2px dashed #E1E2E6;
    background: #F9F9F9;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
}

.action-buttons-stack {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.warning-text {
    font-size: 12px;
    color: #FF9F43;
    text-align: center;
}

/* Cloud Section */
.center-content {
    text-align: center;
    padding: 60px 40px;
}

.cloud-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.cloud-actions {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 12px;
}

/* --- Left Panel Toggle Implementation --- */

.main-content {
    position: relative;
    /* Ensure toggle button positioning context */
    transition: gap 0.3s ease;
}

/* Toggle Button */
.panel-toggle-btn {
    position: absolute;
    left: 0;
    /* Aligned with left-panel width */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background: #fff;
    border: 1px solid #E1E2E6;
    border-left: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: left 0.3s ease, background-color 0.2s, color 0.2s;
    color: #636D6A;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.05);
    font-size: 12px;
    user-select: none;
}

.panel-toggle-btn:hover {
    background: #F1F2F6;
    color: #1DD1A1;
}

/* Transition for Left Panel */
.left-panel {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, transform 0.3s ease;
    will-change: margin-left, opacity;
}

/* Collapsed State */
.main-content.panel-collapsed .left-panel {
    margin-left: -260px;
    /* 240px width + 20px gap */
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    /* Ensure it doesn't take focus */
}

/* Move button when collapsed */
.main-content.panel-collapsed .panel-toggle-btn {
    left: 0;
    border-left: 1px solid #E1E2E6;
    /* Add border back */
    border-radius: 0 10px 10px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Student Modal (Action) */
.student-modal {
    width: 320px;
    padding: 20px;
    border-radius: 20px;
}

.modal-header-simple {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.close-btn-simple {
    border: none;
    background: #f0f0f0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.s-info {
    text-align: center;
    margin-bottom: 20px;
}

.s-info img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.s-level {
    font-weight: 800;
    color: #FF9F43;
    font-size: 18px;
}

/* Call Name Highlight */
.card-highlight-active {
    background-color: #ff9f43 !important;
    /* Orange-Redish */
    color: #fff !important;
    position: relative;
    z-index: 10;
    box-shadow: 0 0 15px rgba(255, 159, 67, 0.6) !important;
    border-color: #e67e22 !important;
    transform: scale(1.05);
    transition: all 0.1s ease;
}

/* Ensure text color is readable */
.card-highlight-active .s-name,
.card-highlight-active .s-level {
    color: #fff !important;
}

/* Group Card specific highlight: Shrink instead of expand */
.group-card.card-highlight-active {
    transform: scale(0.96) !important;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.manual-action {
    display: flex;
    gap: 5px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.small-input {
    width: 60px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
}

.btn-xs {
    font-size: 12px;
    padding: 6px 10px;
}

/* Fix Scrollbars inside modal */
.settings-main::-webkit-scrollbar {
    width: 8px;
}



/* 减分动画 */
@keyframes shakeRed {

    0%,
    100% {
        transform: translateX(0);
        border-color: #eee;
    }

    20%,
    60% {
        transform: translateX(-5px);
        border-color: #ff4444;
        background-color: #fff0f0;
    }

    40%,
    80% {
        transform: translateX(5px);
        border-color: #ff4444;
        background-color: #fff0f0;
    }
}

.shake-red {
    animation: shakeRed 0.5s ease-in-out;
}

.exp-float-minus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff4444;
    font-weight: bold;
    font-size: 24px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    animation: floatUpFade 1s ease-out forwards;
    z-index: 10;
}

/* Volume Meter Enhancements */
.volume-meter-large {
    text-align: center;
    padding: 10px 0;
}

.volume-display-large {
    font-size: 32px;
    font-weight: 800;
    color: #2D3436;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
    transition: transform 0.1s ease, color 0.2s ease;
}

.volume-bar-box {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.volume-fill {
    height: 100%;
    width: 0%;
    transition: width 0.1s linear, background-color 0.2s ease;
    border-radius: 12px;
    /* Gradient handled by JS or simple color */
}

.threshold-line {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 20px;
    /* Wider hit area */
    background-color: transparent;
    left: 50%;
    /* Default, will be set by JS */
    transition: left 0.3s ease;
    z-index: 20;
    cursor: ew-resize;
    display: flex;
    justify-content: center;
}

/* The visual line */
.threshold-line::after {
    content: '';
    width: 2px;
    height: 100%;
    background-color: #E67E22;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    transition: width 0.2s, background-color 0.2s;
}

/* Handle at the top */
.threshold-line::before {
    content: '';
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #E67E22;
    transition: border-top-color 0.2s;
}

.threshold-line:hover::after,
.threshold-line.dragging::after {
    background-color: #2D3436;
    width: 4px;
}

.threshold-line:hover::before,
.threshold-line.dragging::before {
    border-top-color: #2D3436;
}

.threshold-line.dragging {
    transition: none !important;
}

/* 滚动条样式 */
/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F1F2F6;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #BDC3C7;
    border-radius: 5px;
    border: 2px solid #F1F2F6;
}

::-webkit-scrollbar-thumb:hover {
    background: #A4B0BE;
}

/* 数字键盘样式 */
/* 数字键盘样式 */
.numpad-container {
    padding: 10px;
}

.numpad-display {
    margin-bottom: 20px;
}

.numpad-display input {
    width: 100%;
    height: 60px;
    font-size: 32px;
    text-align: center;
    border: 3px solid #1DD1A1;
    border-radius: 16px;
    background: #fff;
    color: #2D3436;
    font-weight: 800;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.num-btn {
    height: 60px;
    font-size: 24px;
    font-weight: 800;
    border: none;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 0 #E0E0E0;
    border: 2px solid #F0F0F0;
    cursor: pointer;
    transition: all 0.1s ease;
    color: #2D3436;
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:active {
    background: #F1F2F6;
    transform: translateY(4px);
    box-shadow: 0 0 0 #E0E0E0;
}

.num-btn.clear {
    color: #FF6421;
    font-size: 16px;
}

.num-btn.delete {
    font-size: 20px;
    color: #FF9F43;
}

.btn-secondary {
    background: #607D8B;
    color: white;
}

.btn-secondary:hover {
    background: #546E7A;
}

.danger-zone .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Rules Grid Layout */
.rules-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: 100%;
}

.rules-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (max-width: 768px) {
    .rules-layout-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column !important;
        height: auto !important;
        padding: 15px !important;
        gap: 15px;
    }

    .header-title {
        text-align: center;
        width: 100%;
    }

    .header>div:last-child {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100%;
        gap: 10px !important;
    }

    .view-switcher {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        max-width: 80px;
    }

    .view-switcher .view-btn {
        width: 100%;
        justify-content: center;
    }

    .tree-image {
        display: none;
        width: 0;
        height: 0;
    }

    .card-left {
        width: 0;
    }

    .student-card {
        min-width: 108px;
    }

    .student-name {
        text-align: right;
    }
}

/* Context Menu & Selection Styles */
.student-card.selected {
    border: 3px solid #1DD1A1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(29, 209, 161, 0.4);
}

.student-card.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #1DD1A1;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.student-card.highlight-active {
    border: 3px solid #FF9F43;
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 0 15px rgba(255, 159, 67, 0.6);
}

.student-card.highlight-winner {
    border: 3px solid #ff7675;
    background-color: #ffeaa7;
    transform: scale(1.1);
    z-index: 20;
    box-shadow: 0 0 20px rgba(255, 118, 117, 0.8);
    animation: winnerPulse 1s infinite;
}

@keyframes winnerPulse {
    0% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 118, 117, 0.8);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(255, 118, 117, 1);
    }

    100% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 118, 117, 0.8);
    }
}

.context-menu {
    border: 1px solid #eee;
    overflow: hidden;
}

.context-menu .menu-item {
    transition: background-color 0.1s;
}

.context-menu {
    display: none;
    position: absolute;
    z-index: 10000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 5px 0;
    min-width: 160px;
    font-size: 14px;
}

.menu-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.menu-item:hover {
    background-color: #f5f5f5;
}

.menu-divider {
    height: 1px;
    background: #eee;
    margin: 5px 0;
}

.text-green {
    color: #1DD1A1;
}

.text-orange {
    color: #FF9F43;
}

/* Submenu Styles */
.has-submenu .arrow {
    font-size: 10px;
    color: #999;
}

.submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -5px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 5px 0;
    min-width: 100px;
}

.has-submenu:hover .submenu {
    display: block;
}

.sub-item {
    justify-content: center;
    font-weight: bold;
}