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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.desk-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    color: #4a90e2;
}

.layout-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.layout-selector label {
    font-weight: bold;
    color: #4a90e2;
    font-size: 0.9em;
}

.layout-buttons {
    display: flex;
    gap: 8px;
}

.layout-btn {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.9em;
}

.layout-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
}

.layout-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.add-desk-btn {
    padding: 10px 12px;
    border: 2px solid #4caf50;
    background: #4caf50;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.add-desk-btn:hover {
    background: #388e3c;
    border-color: #388e3c;
}

.desk-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.attendance-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 250px;
}

.input-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.input-mode-selector label {
    font-weight: bold;
    color: #4a90e2;
    font-size: 0.9em;
}

.mode-buttons {
    display: flex;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.mode-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
}

.mode-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-weight: bold;
    color: #4a90e2;
    font-size: 0.9em;
}

.number-input, .exclude-input, .name-input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.name-textarea {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.number-input:focus, .exclude-input:focus, .name-textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.input-group small {
    color: #666;
    font-size: 0.8em;
    font-style: italic;
}

.name-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.save-btn, .load-btn, .clear-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: #4caf50;
    color: white;
}

.save-btn:hover {
    background: #45a049;
}

.load-btn {
    background: #2196f3;
    color: white;
}

.load-btn:hover {
    background: #1976d2;
}

.clear-btn {
    background: #f44336;
    color: white;
}

.clear-btn:hover {
    background: #d32f2f;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #ff6b6b;
    color: white;
    font-size: 20px;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

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

#deskCount {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a90e2;
    min-width: 30px;
    text-align: center;
}

.randomize-btn, .reset-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.randomize-btn {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
}

.randomize-btn:hover {
    background: linear-gradient(45deg, #45a049, #4caf50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.reset-btn {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    color: white;
}

.reset-btn:hover {
    background: linear-gradient(45deg, #f57c00, #ff9800);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.classroom {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    min-height: 700px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.desk {
    position: absolute;
    width: 80px;
    height: 60px;
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    user-select: none;
}

.desk:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.desk.dragging {
    cursor: grabbing;
    transform: scale(1.05);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transition: none !important;
    will-change: transform, left, top;
}

.desk.empty {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    border-color: #9e9e9e;
    color: #757575;
}

.desk.desk-male {
    background: linear-gradient(135deg, #2196f3 60%, #90caf9 100%);
    border: 3px solid #1976d2;
}

.desk.desk-female {
    background: linear-gradient(135deg, #f06292 60%, #f8bbd0 100%);
    border: 3px solid #d81b60;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: white;
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

footer p {
    margin: 5px 0;
    color: white;
}

.copyright {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.copyright p {
    margin: 0;
    color: #999;
    font-size: 0.85em;
    font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .version-info {
        text-align: center;
        font-size: 0.8em;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .layout-buttons {
        flex-direction: column;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
    
    .attendance-input {
        min-width: 200px;
        width: 100%;
    }
    
    .name-controls {
        flex-direction: column;
    }
    
    .desk {
        width: 60px;
        height: 45px;
        font-size: 1em;
    }
    
    .teacher-desk {
        width: 90px;
        height: 60px;
        font-size: 0.9em;
    }
    
    .classroom {
        padding: 20px;
        min-height: 600px;
    }
}

/* 애니메이션 효과 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.desk.assigned {
    animation: bounce 0.6s ease-in-out;
}

.teacher-desk-controls {
    display: flex;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.teacher-desk-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #9c27b0, #673ab7);
    color: white;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

.teacher-desk-btn:hover {
    background: linear-gradient(45deg, #673ab7, #9c27b0);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.teacher-desk {
    position: absolute;
    width: 120px;
    height: 80px;
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    border: 4px solid #4a148c;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-weight: bold;
    font-size: 1.1em;
    color: white;
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
    transition: all 0.3s ease;
    user-select: none;
    z-index: 100;
}

.teacher-desk:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.5);
}

.teacher-desk.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    z-index: 1001;
    box-shadow: 0 10px 30px rgba(156, 39, 176, 0.6);
    transition: none !important;
    will-change: transform, left, top;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

.version-info {
    text-align: right;
    color: white;
    font-size: 0.9em;
    line-height: 1.4;
}

.status-info {
    position: fixed !important;
    right: 30px !important;
    bottom: 30px !important;
    z-index: 9999 !important;
    text-align: right !important;
    color: white !important;
    font-size: 1em !important;
    line-height: 1.4 !important;
    background: rgba(50, 50, 50, 0.8) !important;
    padding: 14px 20px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.status-info .desk-count,
.status-info .student-count {
    margin: 3px 0 !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
    display: block !important;
}

.version-info .version {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.version-info .developer {
    margin-bottom: 3px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.version-info .email {
    font-size: 0.85em;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .status-info {
        right: 10px !important;
        bottom: 10px !important;
        font-size: 0.95em !important;
        padding: 10px 12px !important;
    }
}

.force-white-bg {
    background: #fff !important;
}

.force-capture-bg {
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
    padding: 0 !important;
}

.force-capture-desk {
    background: #ffecd2 !important;
    box-shadow: none !important;
}

.force-capture-desk.desk-male {
    background: linear-gradient(135deg, #2196f3 60%, #90caf9 100%) !important;
    border: 3px solid #1976d2 !important;
}

.force-capture-desk.desk-female {
    background: linear-gradient(135deg, #f06292 60%, #f8bbd0 100%) !important;
    border: 3px solid #d81b60 !important;
}

html.force-capture-bg,
body.force-capture-bg {
    background: #fff !important;
}

.pdf-btn {
    background: linear-gradient(45deg, #ff5252, #ff1744);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.18);
}

.pdf-btn:hover {
    background: linear-gradient(45deg, #ff1744, #ff5252);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 23, 68, 0.28);
}

.mode-toggle-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(45deg, #2196f3, #4a90e2);
    color: white;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(33,150,243,0.15);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}
.mode-toggle-btn:hover {
    background: linear-gradient(45deg, #1976d2, #4a90e2);
    transform: scale(1.05);
}

.mode-toggle-btn.red {
    background: linear-gradient(45deg, #ff5252, #ff1744);
    color: white;
    box-shadow: 0 2px 8px rgba(255,23,68,0.15);
}
.mode-toggle-btn.red:hover {
    background: linear-gradient(45deg, #ff1744, #ff5252);
    transform: scale(1.05);
}

/* 마법 효과 애니메이션 */
@keyframes magic-sparkle {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }
    25% {
        box-shadow: 0 0 20px 10px rgba(255, 215, 0, 0.9),
                    0 0 40px 20px rgba(138, 43, 226, 0.7),
                    0 0 60px 30px rgba(255, 20, 147, 0.5);
        transform: scale(1.02);
    }
    50% {
        box-shadow: 0 0 30px 15px rgba(255, 215, 0, 0.8),
                    0 0 60px 30px rgba(138, 43, 226, 0.6),
                    0 0 90px 45px rgba(255, 20, 147, 0.4);
        transform: scale(1.05);
    }
    75% {
        box-shadow: 0 0 20px 10px rgba(255, 215, 0, 0.9),
                    0 0 40px 20px rgba(138, 43, 226, 0.7),
                    0 0 60px 30px rgba(255, 20, 147, 0.5);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }
}

@keyframes desk-magic-rotate {
    0% {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: rotateY(90deg) scale(0.8);
        opacity: 0.7;
    }
    50% {
        transform: rotateY(180deg) scale(0.6);
        opacity: 0.5;
    }
    75% {
        transform: rotateY(270deg) scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: rotateY(360deg) scale(1);
        opacity: 1;
    }
}

@keyframes teacher-desk-magic {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
        filter: brightness(1.2) hue-rotate(30deg);
    }
    50% {
        transform: scale(1.2) rotate(-5deg);
        filter: brightness(1.4) hue-rotate(60deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
        filter: brightness(1.2) hue-rotate(30deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
}

.classroom.magic-effect {
    animation: magic-sparkle 2s ease-in-out;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(138, 43, 226, 0.1), rgba(255, 20, 147, 0.1));
}

.desk.magic-rotating {
    animation: desk-magic-rotate 1.5s ease-in-out;
    transform-style: preserve-3d;
}

.teacher-desk.magic-effect {
    animation: teacher-desk-magic 2s ease-in-out;
}

/* 마법 효과 중 버튼 비활성화 */
.randomize-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(45deg, #ccc, #999);
} 