:root {
    --primary-bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent-primary: #38bdf8;
    --accent-secondary: #c084fc;
    --accent-accent: #2dd4bf;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

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

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

/* Background Circles */
.bg-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    top: -100px;
    left: -100px;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--accent-accent), var(--accent-primary));
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

@keyframes move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 100px); }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-primary);
}

.logo-sub {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.contact-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-accent);
    background: rgba(45, 212, 191, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(45, 212, 191, 0.2);
}

.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--accent-primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 450px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card.full-width {
    max-width: 800px;
}

/* Setup Section */
.setup-section {
    display: flex;
    justify-content: center;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.input-group label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
}

.count-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.btn-count {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-count:hover {
    background: var(--accent-primary);
    transform: translateY(-2px);
}

#participant-count {
    width: 80px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
}

/* Progress-style Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 189, 248, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-accent {
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: none;
    background: var(--accent-accent);
    color: var(--primary-bg);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accent:hover {
    transform: scale(1.05);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

/* Entry Section */
.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.entry-header h2 {
    font-size: 1.5rem;
}

.entry-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 2rem;
}

/* Custom Scrollbar */
.entry-container::-webkit-scrollbar {
    width: 6px;
}
.entry-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.entry-row {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.entry-row label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    font-weight: 700;
}

.entry-row input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.entry-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ladder Section */
.ladder-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.ladder-canvas-container {
    position: relative;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

#ladder-canvas {
    display: block;
}

.ladder-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ladder-name-tag {
    position: absolute;
    width: 100px;
    text-align: center;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.name-tag-top {
    top: 15px;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s;
}

.name-tag-top:hover {
    background: var(--accent-primary);
    color: var(--primary-bg);
    transform: translateX(-50%) translateY(-3px);
}

.name-tag-bottom {
    bottom: 15px;
}

.ladder-controls {
    display: flex;
    gap: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    text-align: center;
    transform: scale(0.9);
    animation: modalIn 0.3s forwards;
}

@keyframes modalIn {
    to { transform: scale(1); opacity: 1; }
}

.result-divider {
    height: 2px;
    width: 50px;
    margin: 1.5rem auto;
    background: var(--accent-primary);
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--accent-accent);
}

/* Footer */
.footer {
    margin-top: 3rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Utility */
.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .main-title {
        font-size: 1.8rem;
    }
    .glass-card {
        padding: 1.5rem;
    }
    .entry-container {
        grid-template-columns: 1fr;
    }
}
