/* CSS 변수 정의 */
:root {
    --primary-color: #1e293b;
    --primary-hover: #334155;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 기본 스타일 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 헤더 스타일 */
.header {
    text-align: center;
    padding: 4rem 0 2rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
}

.title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    opacity: 0.9;
}

/* 메인 콘텐츠 */
.main {
    margin-bottom: 4rem;
}

/* 룰렛 섹션 */
.roulette-section {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 4rem;
}

/* 중앙 결과 모달 */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

.result-modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #84cc16, #65a30d);
    color: white;
    padding: 3rem;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(132, 204, 22, 0.3);
    border: 5px solid #10b981;
    max-width: 500px;
    width: 90%;
    animation: modalPopIn 0.5s ease-out;
}

.modal-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.food-result {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #fbbf24;
}

.celebration-text {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.modal-close-btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #10b981;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* 모달 애니메이션 */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* 세레머니 효과 (빵빠레) */
.celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    display: none;
}

.celebration-container.show {
    display: block;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #10b981;
    animation: confettiFall 3s linear infinite;
}

.confetti:nth-child(2n) {
    background: #059669;
    animation-delay: 0.1s;
}

.confetti:nth-child(3n) {
    background: #34d399;
    animation-delay: 0.2s;
}

.confetti:nth-child(4n) {
    background: #6ee7b7;
    animation-delay: 0.3s;
}

.confetti:nth-child(5n) {
    background: #a7f3d0;
    animation-delay: 0.4s;
}

/* 빵빠레 애니메이션 */
@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* 룰렛 회전 애니메이션 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 룰렛 휠 스타일 */
.roulette-wheel {
    width: 450px;
    height: 450px;
    border-radius: 50%;
    position: relative;
    border: 8px solid #1e293b;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(30, 41, 59, 0.2);
    transition: transform 4s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
    background: #1e293b;
    outline: none;
}

.roulette-wheel.spinning {
    animation: spin 4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* 룰렛 섹션 아이템 스타일 - 널널하게 */
.roulette-section-item {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

/* 룰렛 텍스트 스타일 - 널널하게 배치 */
.roulette-text {
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* 룰렛 포인터 스타일 */
.roulette-pointer {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid #f59e0b;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 룰렛 컨테이너 */
.roulette-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

/* 룰렛 컨트롤 */
.roulette-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.roulette-controls .btn {
    min-width: 140px;
}

/* 룰렛 컨트롤 스타일 */
.roulette-controls {
    text-align: center;
    margin: 2rem 0;
}

.spin-limit-info {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
}

.time-remaining {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.time-remaining span:first-child {
    color: var(--text-secondary);
}

.time-remaining span:last-child {
    color: var(--accent-color);
    font-weight: 700;
}

.progress-bar-container {
    background: var(--border);
    border-radius: 10px;
    height: 12px;
    margin: 1rem 0;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #f59e0b);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.spin-count-info {
    font-size: 1rem;
    color: var(--text-primary);
}

.spin-count-info span:first-child {
    color: var(--text-secondary);
}

.spin-count-info span:last-child {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-buttons .btn {
    min-width: 120px;
}

/* 버튼 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border: 2px solid #f59e0b;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
}

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

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* 카테고리 선택기 스타일 */
.category-selector {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    text-align: center;
}

.category-selector h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.category-selector select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    font-size: 1rem;
    margin-right: 1rem;
    min-width: 200px;
    cursor: pointer;
}

.category-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.category-selector .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .roulette-wheel {
        width: 350px;
        height: 350px;
    }
    
    .roulette-text {
        font-size: 0.75rem;
        top: 20%;
        left: 20%;
        width: 60%;
        height: 60%;
    }
    
    .category-selector {
        padding: 1rem;
    }
    
    .category-selector select {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .control-buttons .btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .roulette-wheel {
        width: 300px;
        height: 300px;
    }
    
    .roulette-text {
        font-size: 0.7rem;
        width: 70px;
        height: 25px;
    }
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.food-item {
    animation: fadeInUp 0.6s ease-out;
}

.food-item:nth-child(2) {
    animation-delay: 0.1s;
}

.food-item:nth-child(3) {
    animation-delay: 0.2s;
}

/* 포커스 스타일 */
.btn:focus,
.remove-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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