* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    background: #111;
    color: #f5f5f5;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

.container {
    max-width: 500px;
    width: 100%;
    padding: 24px;
    background: #1e1e1e;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

h1 {
    margin-top: 0;
    text-align: center;
    font-size: 24px;
}

.subtitle {
    text-align: center;
    font-size: 14px;
    color: #ccc;
    margin-bottom: 24px;
}

.primary-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 999px;
    border: none;
    background: #4f46e5;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.primary-btn:hover {
    background: #6366f1;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

#stage-info {
    font-size: 12px;
    color: #888;
    text-align: center;
    margin-bottom: 4px;
}

.nav-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nav-btn {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #444;
    background: transparent;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

#problem-title {
    font-size: 18px;
    margin-bottom: 8px;
    text-align: center;
}

#problem-image {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
    margin-bottom: 12px;
}

#problem-desc {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 16px;
    min-height: 32px;
    text-align: center;
}

.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #111;
    color: #f5f5f5;
    font-size: 14px;
}

button {
    padding: 0 16px;
    border-radius: 8px;
    border: none;
    background: #4f46e5;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

button:hover:not(:disabled) {
    background: #6366f1;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
    transform: none;
}

#result-message {
    min-height: 20px;
    font-size: 13px;
    color: #f97373;
    margin-bottom: 4px;
    text-align: center;
}

#finish-message {
    margin-top: 16px;
    text-align: center;
    font-size: 16px;
    color: #4ade80;
    font-weight: 600;
}

/* 숨김 처리 */
.hidden {
    display: none;
}

/* 모바일 최적화 */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding: 16px 8px;
    }

    .container {
        max-width: 100%;
        padding: 16px;
        border-radius: 12px;
        min-height: calc(100vh - 32px);
    }

    h1 {
        font-size: 20px;
    }

    #problem-image {
        max-height: 200px;
    }

    #problem-desc {
        font-size: 13px;
    }

    input[type="text"] {
        font-size: 13px;
    }

    button {
        font-size: 13px;
    }
}

.nickname-row {
    margin-bottom: 16px;
}

.nickname-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.secondary-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #111827;
    color: #e5e7eb;
    cursor: pointer;
    font-size: 14px;
}

.nickname-message {
    margin-top: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.hidden {
    display: none !important;
}

/* 선택형 문제 버튼들 */
.choice-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.choice-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #222;
    color: #fff;
    cursor: pointer;
}

.choice-btn:hover {
    background: #333;
}
