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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.description {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    opacity: 0.9;
}

.voting-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.section-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* 투표용지 스타일 */
.ballot-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ballot-paper {
    background: white;
    color: #333;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
}

.ballot-paper:active {
    cursor: grabbing;
}

.ballot-paper:hover:not(.voted) {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.ballot-paper.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

.ballot-paper.voted {
    background: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.6;
}

.ballot-paper.voted::after {
    content: '✓ 투표완료';
    position: absolute;
    top: 10px;
    right: 15px;
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.ballot-header {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2563eb;
}

.ballot-paper.voted .ballot-header {
    color: #64748b;
}

/* 투표함 스타일 */
.boxes-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ballot-box {
    background: rgba(255, 255, 255, 0.1);
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.ballot-box.drag-over {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
    transform: scale(1.02);
}

.ballot-box[data-box-type="blue"].drag-over {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
}

.ballot-box[data-box-type="red"].drag-over {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.ballot-box[data-box-type="green"].drag-over {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
}

.box-header {
    font-weight: bold;
    font-size: 1.1rem;
}

.vote-count {
    font-weight: bold;
    color: #fbbf24;
    font-size: 1.1rem;
}

/* 투표 결과 */
.voting-results {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.result-label {
    min-width: 100px;
    font-weight: bold;
}

.result-bar {
    flex: 1;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.result-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    width: 0%;
}

.blue-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.red-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.green-fill {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.result-percentage {
    min-width: 50px;
    font-weight: bold;
    text-align: right;
}

.reset-btn {
    display: block;
    margin: 0 auto;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.reset-btn:hover {
    background: white;
    color: #764ba2;
    transform: translateY(-2px);
}

/* 드롭 애니메이션 */
@keyframes dropAnimation {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.ballot-paper.dropping {
    animation: dropAnimation 0.6s ease forwards;
    pointer-events: none;
}

/* 알림 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification.error {
    background: #ef4444;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 연결 상태 표시 */
.connection-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-status.online {
    background: #10b981;
    color: white;
}

.connection-status.offline {
    background: #ef4444;
    color: white;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 반응형 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .voting-area {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .boxes-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ballot-box {
        min-width: 140px;
        flex: 1;
        max-width: 200px;
    }

    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .result-bar {
        width: 100%;
        max-width: 250px;
    }

    .result-label {
        min-width: auto;
    }

    .connection-status {
        bottom: 10px;
        left: 10px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
