:root {
    --primary-color: #706fd3;
    --primary-hover: #5857b0;
    --secondary-color: #ff5252;
    --text-black: #2d3436;
    --text-gray: #636e72;
    --bg-main: #f5f6fa;
    --card-bg: #ffffff;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    --border-color: #eeeeee;
}

[data-theme="dark"] {
    --text-black: #f5f6fa;
    --text-gray: #a4b0be;
    --bg-main: #1e272e;
    --card-bg: #2f3542;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    --border-color: #3f4a56;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-black);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 500px) {
    .app-container {
        min-height: 800px;
        height: 800px;
        border-radius: 20px;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: var(--bg-main);
    color: var(--text-black);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Screen Management */
.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    transition: opacity 0.3s ease;
    flex: 1;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

.screen.active {
    opacity: 1;
}

/* Start Screen */
#start-screen {
    justify-content: center;
    text-align: center;
}

.start-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.text-link-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.text-link-btn:hover {
    color: var(--primary-color);
}

.main-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 15px;
    line-height: 1.3;
}

.subtitle {
    color: var(--text-gray);
    margin-bottom: 40px;
    font-size: 1rem;
}

.mascot {
    font-size: 5rem;
    margin-bottom: 50px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Game Screen */
#game-screen {
    padding: 0;
    height: 100%;
}

.game-header {
    width: 100%;
    padding: 20px;
    background: var(--card-bg);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: background-color 0.3s ease;
}

.round-badge {
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.match-count {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.battle-arena {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.candidate-card {
    flex: 1;
    width: 100%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background-color: var(--bg-main);
}

.candidate-card .img-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.candidate-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.candidate-card:hover img {
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
}

.name-tag {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 5;
}

/* VS Badge */
.vs-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 20;
    border: 3px solid var(--secondary-color);
    transition: background-color 0.3s ease;
}

/* Winner Screen */
#winner-screen {
    justify-content: center;
    text-align: center;
}

.winner-title {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.winner-card {
    position: relative;
    margin-bottom: 40px;
}

.crown {
    font-size: 3rem;
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%) rotate(-15deg);
    z-index: 10;
}

.winner-img-wrapper {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--primary-color);
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px rgba(112, 111, 211, 0.3);
}

.winner-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.winner-name {
    font-size: 2rem;
    color: var(--primary-color);
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 5px 15px rgba(112, 111, 211, 0.3);
}

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

.secondary-btn {
    background: var(--card-bg);
    color: var(--text-gray);
    border: 1px solid var(--border-color);
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Animation classes */
.fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
}

.fade-in {
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    margin-bottom: 5px;
}

.form-checkbox input {
    margin-top: 4px;
    cursor: pointer;
}

.form-checkbox label {
    font-size: 0.85rem;
    color: var(--text-gray);
    cursor: pointer;
    line-height: 1.4;
}

.form-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.form-status.hidden {
    display: none;
}

.form-status.success {
    background-color: #d1f7d1;
    color: #1b5e20;
    display: block;
}

.form-status.error {
    background-color: #ffebee;
    color: #c62828;
    display: block;
}

[data-theme="dark"] .form-status.success {
    background-color: #1b5e20;
    color: #d1f7d1;
}

[data-theme="dark"] .form-status.error {
    background-color: #c62828;
    color: #ffebee;
}

.full-width {
    width: 100%;
}
