:root {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --primary-color: #4facfe;
    --accent-color: #ff9a9e;
    --text-main: #2c3e50;
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --font-main: "PingFang SC", "Microsoft YaHei", sans-serif;
    --success-color: #52c41a;
    --error-color: #ff4d4f;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    background: var(--bg-gradient);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 顶部状态栏 */
.top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 10;
}

.school-info {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-main);
}

.school-icon {
    font-size: 24px;
    margin-right: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #fff1f0; /* Default Disconnected */
    border: 1px solid #ffa39e;
    border-radius: 20px;
    color: var(--error-color);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.status-indicator.connected {
    background: #e6fffa;
    border-color: #b7eb8f;
    color: #389e0d;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--error-color);
    border-radius: 50%;
    margin-right: 6px;
    position: relative;
}

.status-indicator.connected .status-dot {
    background: #52c41a;
    box-shadow: 0 0 0 2px rgba(82, 196, 26, 0.2);
}

.status-indicator.waiting {
    background: #fffbe6;
    border-color: #ffe58f;
    color: #faad14;
}

.status-indicator.waiting .status-dot {
    background: #faad14;
    box-shadow: 0 0 0 2px rgba(250, 173, 20, 0.2);
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% { opacity: 0.6; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0.6; transform: scale(0.9); }
}

/* 核心内容区 */
.main-container {
    width: 90%;
    height: 80%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr); /* 限制高度，防止撑开 */
    gap: 30px;
    max-width: 1200px;
    animation: fadeIn 0.5s ease;
}

/* 左侧：时钟卡片 */
.clock-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    overflow: hidden;
}

.clock-time {
    font-size: 100px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 20px;
    font-variant-numeric: tabular-nums;
    text-shadow: 2px 4px 0px rgba(0,0,0,0.05);
}

.clock-date {
    font-size: 24px;
    color: #666;
    margin-bottom: 40px;
}

.class-badge {
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);
}

/* 右侧：通知与控制 */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%; /* 充满父容器 */
    min-height: 0; /* 允许收缩 */
}

.info-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    min-height: 0; /* 关键：允许内部滚动 */
}

.card-title {
    font-size: 16px;
    color: #888;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-list {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
}

.log-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    animation: slideLeft 0.3s ease;
}

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

.log-time {
    color: #999;
    margin-right: 12px;
    font-size: 12px;
    margin-top: 2px;
    min-width: 45px;
}

.log-content-wrapper {
    flex: 1;
}

.log-text {
    color: #333;
    margin-bottom: 6px;
}

.log-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.log-btn {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    color: white;
}
.log-btn.confirm { background: var(--success-color); }
.log-btn.busy { background: #faad14; }
.log-btn.reject { background: var(--error-color); }
.log-btn.replay { background: var(--primary-color); }
.log-btn:disabled { background: #ccc; cursor: not-allowed; opacity: 0.7; }
.log-btn:hover:not(:disabled) { filter: brightness(1.1); }

.control-card {
    background: white;
    border-radius: 20px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

.dnd-label {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(26px); }

/* Setup Panel (New Style) */
#setupPanel {
    background: rgba(255, 255, 255, 0.95);
    padding: 28px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 480px;
    text-align: center;
    position: relative;
    z-index: 100;
    backdrop-filter: blur(20px);
}

#setupPanel.is-compact {
    max-width: 420px;
    padding: 18px;
    border-radius: 20px;
}

#setupPanel.is-compact .setup-brand {
    display: none;
}

#setupPanel.is-compact .setup-subtitle {
    display: none;
}

#setupPanel.is-compact .setup-header {
    margin-bottom: 10px;
    gap: 8px;
}

#setupPanel.is-compact .setup-title {
    font-size: 18px;
    letter-spacing: 0;
}

#setupPanel.is-compact .setup-body {
    gap: 8px;
}

#setupPanel.is-compact .setup-section {
    padding: 0;
    border: none;
    background: transparent;
}

#setupPanel.is-compact select,
#setupPanel.is-compact input {
    border-radius: 12px;
}

#setupPanel.is-compact select,
#setupPanel.is-compact input {
    padding: 11px 12px;
    margin-bottom: 12px;
}

#setupPanel.is-compact label {
    font-size: 12px;
    margin-bottom: 6px;
}

#setupPanel.is-compact .setup-row {
    gap: 10px;
    margin-bottom: 12px;
}

#setupPanel.is-compact .selection-summary {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 12px;
}

#setupPanel.is-compact .binding-info {
    padding: 10px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}

#setupPanel.is-compact #bindingCompactHint {
    margin-top: -6px;
    margin-bottom: 0;
}

#setupPanel.is-compact .setup-more {
    border-radius: 14px;
}

#setupPanel.is-compact .setup-more > summary {
    padding: 10px 0;
    justify-content: center;
    color: rgba(0,0,0,0.55);
    font-weight: 700;
}

#setupPanel.is-compact .setup-more > summary:after {
    margin-left: 8px;
}

#setupPanel.is-compact .setup-more {
    border: none;
    background: transparent;
}

#setupPanel.is-compact .setup-more-body {
    padding: 10px 0 0;
}

#setupPanel.is-compact .setup-divider {
    margin: 10px 0;
}

#setupPanel.is-compact .btn-primary {
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    margin-top: 6px;
}

#setupPanel.is-compact .setup-status {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
}

.setup-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.setup-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #566;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.setup-brand-icon {
    font-size: 22px;
    line-height: 1;
}

.setup-brand-text {
    font-size: 16px;
}

.setup-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setup-title {
    margin: 0;
    color: var(--text-main);
    font-size: 22px;
    font-weight: 800;
}

.setup-subtitle {
    color: #667;
    font-size: 13px;
    line-height: 1.5;
}

.setup-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setup-section {
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    background: rgba(255,255,255,0.7);
}

.setup-section-title {
    text-align: left;
    font-size: 13px;
    font-weight: 800;
    color: #556;
    margin-bottom: 10px;
}

.setup-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.setup-custom {
    margin-top: -6px;
}

.selection-summary {
    margin-top: 10px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.85);
    text-align: left;
    color: #445;
    font-size: 13px;
    line-height: 1.55;
}

.selection-summary.is-compact {
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
}

.setup-more {
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    background: rgba(255,255,255,0.65);
    overflow: hidden;
}

.setup-more > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 12px;
    font-size: 13px;
    font-weight: 800;
    color: #556;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setup-more > summary::-webkit-details-marker {
    display: none;
}

.setup-more > summary:after {
    content: '▾';
    font-size: 12px;
    color: #778;
    transition: transform 0.2s;
}

.setup-more[open] > summary:after {
    transform: rotate(-180deg);
}

.setup-more-body {
    padding: 0 12px 12px;
}

.setup-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 12px 0;
}

.selection-summary.is-warning {
    background: #fffbe6;
    border-color: #ffe58f;
    color: #ad6800;
}

.selection-summary.is-ok {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}

.field-hint {
    font-size: 12px;
    color: #889;
    margin-top: 8px;
    text-align: left;
}

.setup-advanced {
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    background: rgba(255,255,255,0.65);
    overflow: hidden;
}

.setup-advanced > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 800;
    color: #556;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setup-advanced > summary::-webkit-details-marker {
    display: none;
}

.setup-advanced > summary:after {
    content: '▾';
    font-size: 12px;
    color: #778;
    transition: transform 0.2s;
}

.setup-advanced[open] > summary:after {
    transform: rotate(-180deg);
}

.setup-advanced-body {
    padding: 0 16px 14px;
}

.binding-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 12px;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #389e0d;
    font-size: 13px;
    margin-bottom: 12px;
}

.btn-secondary {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    color: #445;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    border-color: rgba(79, 172, 254, 0.55);
    box-shadow: 0 8px 18px rgba(79, 172, 254, 0.18);
}

.btn-primary.is-busy {
    opacity: 0.9;
    cursor: wait;
}

.setup-status {
    min-height: 44px;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.6);
    color: #566;
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
}

.setup-status:empty {
    padding: 0;
    border-color: transparent;
    background: transparent;
    min-height: 0;
}

.setup-status.is-info {
    background: #e6f7ff;
    border-color: #91d5ff;
    color: #0958d9;
}

.setup-status.is-warning {
    background: #fffbe6;
    border-color: #ffe58f;
    color: #ad6800;
}

.setup-status.is-success {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}

.setup-status.is-error {
    background: #fff1f0;
    border-color: #ffa39e;
    color: #cf1322;
}

@media (max-width: 520px) {
    #setupPanel { padding: 18px; }
    .setup-row { flex-direction: column; }
    .setup-section { padding: 14px; }
}

@media (max-height: 720px) {
    #setupPanel.is-compact {
        padding: 16px;
    }
    #setupPanel.is-compact .setup-title {
        font-size: 17px;
    }
}

#setupPanel select, #setupPanel input {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    background: #f9f9f9;
    transition: all 0.3s;
    box-sizing: border-box;
}

#setupPanel select:focus, #setupPanel input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.1);
}

#setupPanel label {
    display: block;
    text-align: left;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);
}

.btn-sm {
    padding: 6px 15px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-sm:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 172, 254, 0.3);
}

/* 全屏呼叫弹窗 */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none; 
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.call-card {
    background: white;
    width: 80%;
    max-width: 800px;
    border-radius: 30px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 5px solid var(--primary-color);
}

.call-icon {
    font-size: 80px;
    margin-bottom: 20px;
    display: inline-block;
    animation: shake 1s infinite;
}

.call-title {
    font-size: 28px;
    color: #666;
    margin-bottom: 20px;
}

/* 优化后的名字显示样式 */
#overlayName {
    font-size: 100px;
    font-weight: 900;
    /* 渐变色文字 */
    background: linear-gradient(135deg, #2af598 0%, #009efd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    margin: 20px 0 40px;
    /* 文字阴影/发光效果 */
    filter: drop-shadow(0 10px 20px rgba(0, 158, 253, 0.3));
    
    /* 动画 */
    animation: namePulse 2s infinite ease-in-out;
    letter-spacing: 4px;
}

@keyframes namePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); filter: drop-shadow(0 15px 30px rgba(0, 158, 253, 0.5)); }
    100% { transform: scale(1); }
}

/* 保留原类名用于其他地方，但这里我们用 ID 覆盖 */
.student-name-legacy {}

.action-text {
    font-size: 40px;
    color: #333;
    margin-bottom: 50px;
    font-weight: 500;
}

.btn-large {
    padding: 20px 60px;
    font-size: 24px;
    background: #52c41a;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 8px 0 #389e0d;
    transition: all 0.1s;
}

.btn-large:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #389e0d;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideLeft { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
    100% { transform: rotate(0deg); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 6px; }
::-webkit-scrollbar-thumb { 
    background: #bbb; 
    border-radius: 6px; 
    border: 3px solid transparent; 
    background-clip: content-box; 
}
::-webkit-scrollbar-thumb:hover { background-color: #999; }

/* Custom Confirm Modal */
.custom-confirm-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.custom-confirm-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
    width: 300px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.confirm-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.confirm-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-cancel {
    background: #f0f0f0;
    color: #666;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
}

.btn-confirm:hover {
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

/* --- 学生卡片视图样式 (移植自教师端) --- */
:root {
    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --glass-blur: blur(12px);
}

#studentViewPanel {
    width: 90%;
    height: 80%;
    max-width: 1200px;
    animation: fadeIn 0.5s ease;
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden; /* Changed from overflow-y: auto to fix header */
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 20px;
    align-content: start;
    padding: 10px;
    /* Allow scrolling only within the grid */
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    width: 100%;
}

.student-card {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 20px 10px;
    text-align: center;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid rgba(255,255,255,0.6);
    position: relative;
}

.student-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    background: white;
    z-index: 10;
}

.student-avatar {
    width: 60px;
    height: 60px;
    border-radius: 22px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.student-card:hover .student-avatar {
    transform: scale(1.1) rotate(3deg);
}

.student-name {
    font-size: 16px; /* Adjusted for card */
    font-weight: bold;
    color: #333;
    margin-bottom: 0; /* Reset */
}

/* 呼叫中动画 */
.student-card.calling { 
    animation: breathe 2s infinite ease-in-out;
    background: white;
    box-shadow: 0 0 0 2px var(--primary-color);
}
@keyframes breathe {
    0% { box-shadow: 0 4px 15px rgba(24, 144, 255, 0.2); border-color: transparent; }
    50% { box-shadow: 0 4px 25px rgba(24, 144, 255, 0.6); transform: scale(1.02); }
    100% { box-shadow: 0 4px 15px rgba(24, 144, 255, 0.2); border-color: transparent; }
}

/* 状态标记 */
.status-dot {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 8px;
    height: 8px;
    background-color: #d9d9d9;
    border-radius: 50%;
    display: none;
}
.student-card.has-called .status-dot {
    display: block;
    background-color: #1890ff;
    box-shadow: 0 0 0 2px white;
}

/* 随机点名相关样式 */
.random-btn-container {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
    gap: 15px; /* Add gap between buttons */
}

.btn-icon-round {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    color: #666;
}

.btn-icon-round:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #1890ff;
}

.btn-icon-round.muted {
    color: #ccc;
    background: #f5f5f5;
    box-shadow: none;
}

.btn-random {
    background: linear-gradient(135deg, #b06ab3, #4568dc);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(176, 106, 179, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(176, 106, 179, 0.6);
}

/* 随机点名高亮样式 - 增强版 (Slot Machine Effect) */
.student-card.highlight {
    transform: scale(1.18) !important; /* 明显放大 */
    background: linear-gradient(135deg, #fff 0%, #e6f7ff 100%) !important;
    box-shadow: 0 0 30px rgba(24, 144, 255, 0.6), 0 0 10px rgba(24, 144, 255, 0.4) inset !important;
    z-index: 100 !important;
    border: 2px solid #1890ff !important;
    transition: transform 0.05s ease-out; /* 极速响应 */
}

.student-card.highlight .student-name {
    color: #1890ff !important;
    font-weight: 900 !important;
    font-size: 1.2em;
}

.student-card.highlight .student-avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 15px rgba(24, 144, 255, 0.3);
}

/* 结果展示弹窗 */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.result-card {
    background: white;
    padding: 40px 60px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 4px solid #b06ab3;
}

.result-avatar {
    width: 100px;
    height: 100px;
    border-radius: 30px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 4px solid white;
}

.result-name {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.result-title {
    color: #b06ab3;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd300;
    top: 0;
    opacity: 0;
}

.sr-only-input {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.ui-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    z-index: 2000;
}

.ui-modal-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.28);
    padding: 18px;
    animation: popIn 0.32s ease;
}

.ui-modal-card--pairing {
    max-width: 480px;
}

.ui-modal-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ui-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, rgba(79,172,254,0.18), rgba(0,242,254,0.18));
    border: 1px solid rgba(79,172,254,0.22);
}

.ui-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: 0.2px;
}

.ui-modal-subtitle {
    font-size: 13px;
    color: rgba(0,0,0,0.6);
    text-align: center;
    line-height: 1.5;
}

.ui-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.ui-modal-label {
    display: block;
    text-align: left;
    font-weight: 800;
    color: #445;
    font-size: 13px;
}

.ui-modal-hint {
    min-height: 18px;
    font-size: 12px;
    color: rgba(0,0,0,0.65);
    text-align: center;
    margin-top: 8px;
}

.ui-modal-hint.is-error {
    color: #cf1322;
}

.ui-modal-hint.is-success {
    color: #389e0d;
}

.ui-modal-hint.is-info {
    color: #0958d9;
}

.ui-code-input {
    display: grid;
    width: 100%;
    max-width: 360px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 12px auto 0;
}

.ui-code-cell {
    width: 100%;
    min-width: 0;
    padding: 0;
    box-sizing: border-box;
    height: 54px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.10);
    background: rgba(255,255,255,0.9);
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    outline: none;
    box-shadow: 0 8px 18px rgba(0,0,0,0.06);
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

@media (max-width: 420px) {
    .ui-code-input {
        max-width: 320px;
        gap: 8px;
    }

    .ui-code-cell {
        height: 48px;
        font-size: 20px;
        border-radius: 12px;
    }
}

.ui-code-cell:focus {
    border-color: rgba(79, 172, 254, 0.85);
    box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.16);
    transform: translateY(-1px);
}

.ui-code-cell[disabled] {
    opacity: 0.7;
}

.ui-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.ui-modal-actions .btn-secondary {
    flex: 1;
}

.ui-modal-actions .btn-primary {
    flex: 2;
    margin-top: 0;
}

.setup-link {
    color: rgba(9, 88, 217, 0.95);
    text-decoration: none;
    font-weight: 800;
}

.setup-link:hover {
    text-decoration: underline;
}
