:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --accent-1: #ff6b6b;
    --accent-2: #4ecdc4;
    --accent-3: #ffe66d;
    --accent-4: #a855f7;
    --accent-5: #3b82f6;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: #2a2a3a;
    --glow-color: rgba(78, 205, 196, 0.3);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Background Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(78, 205, 196, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 107, 107, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px 15px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 8px 0;
    flex-shrink: 0;
}

.header h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-4));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(78, 205, 196, 0.5);
    letter-spacing: 2px;
}

.header p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr 240px;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

/* Panel Styles */
.panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-2);
}

.panel-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--accent-2), var(--accent-4));
    border-radius: 2px;
}

/* Input Styles */
.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-group textarea {
    resize: vertical;
    min-height: 50px;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Buttons */
.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-2), #38b2ac);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(78, 205, 196, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-4), #9333ea);
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(168, 85, 247, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-1), #e53e3e);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-full {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 80px;
}

/* Preset Buttons */
.preset-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.preset-btn {
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.preset-btn:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
}

.preset-btn.active {
    border-color: var(--accent-2);
    background: rgba(78, 205, 196, 0.1);
    color: var(--accent-2);
}

.preset-btn.has-data::after {
    content: '●';
    display: block;
    font-size: 6px;
    margin-top: 4px;
    color: var(--accent-3);
}

.preset-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.preset-actions .btn {
    flex: 1;
    padding: 6px;
    font-size: 0.75rem;
}

/* Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 0;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.game-canvas-container {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#ladderCanvas {
    width: 100%;
    flex: 1;
    display: block;
}

/* Participants Row */
.participants-row {
    position: relative;
    display: flex;
    padding: 45px 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    min-height: 70px;
    align-items: flex-end;
    flex-shrink: 0;
}

.participant {
    position: absolute;
    bottom: 50%;
    transform: translateX(-50%) translateY(50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 8px;
}

.participant:hover:not(.completed):not(.disabled) {
    background: rgba(78, 205, 196, 0.1);
}

.participant.completed {
    opacity: 0.6;
    cursor: default;
}

.participant.disabled {
    cursor: not-allowed;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.participant:hover:not(.completed):not(.disabled) .participant-avatar {
    transform: scale(1.1);
    box-shadow: 0 0 20px currentColor;
}

.participant-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    word-break: keep-all;
    white-space: nowrap;
}

.participant-result {
    font-size: 0.65rem;
    color: var(--accent-3);
    margin-top: 2px;
    padding: 2px 6px;
    background: rgba(255, 230, 109, 0.15);
    border-radius: 4px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.participant-result.show {
    opacity: 1;
    transform: translateY(0);
}

/* Prizes Row */
.prizes-row {
    position: relative;
    display: flex;
    padding: 25px 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    min-height: 50px;
    align-items: flex-start;
    flex-shrink: 0;
}

.prize {
    position: absolute;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
}

.prize-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.prize-name {
    font-size: 0.7rem;
    color: var(--accent-3);
    text-align: center;
    word-break: keep-all;
    white-space: nowrap;
}

.prize.claimed .prize-name {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Results Panel */
.results-panel {
    overflow-y: auto;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-item .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.result-item .info {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex; align-items: center;
}

.result-item .name {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-item .prize {
    position: relative;
    transform: none;
    margin-left: 0.4rem;
    font-size: 0.7rem;
    color: var(--accent-3);
    padding: 0;
    min-width: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-results {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 2rem;
    margin-bottom: 6px;
    opacity: 0.5;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    padding: 20px;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 0.9rem;
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 20px currentColor, 0 0 30px currentColor; }
}

.participant.active .participant-avatar {
    animation: pulse 0.5s ease infinite;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 240px 1fr;
    }
    .results-panel {
        position: fixed;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 220px;
        max-height: 60vh;
        z-index: 100;
        display: none;
    }
    .results-panel.show {
        display: block;
    }
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .header h1 {
        font-size: 1.8rem;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--accent-2);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

