/* CSS 변수 정의 */
:root {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --secondary-color: #3b82f6;
    --secondary-hover: #2563eb;
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-hover: #475569;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
}

/* 네비게이션 바 */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* 메인 컨테이너 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem 2rem;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* 게임 영역 */
.game-area {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
    margin-bottom: 3rem;
}

/* 클릭 섹션 */
.click-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.click-container {
    text-align: center;
}

.click-button {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.click-button:hover {
    transform: scale(1.05);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.4);
}

.click-button:active {
    transform: scale(0.95);
}

.click-text {
    position: relative;
    z-index: 2;
}

.click-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    pointer-events: none;
}

.click-effect.active {
    width: 300px;
    height: 300px;
    opacity: 0;
}

.click-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-width: 120px;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* 사이드 패널 */
.side-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    min-width: 250px;
}

.score-section {
    margin-bottom: 2rem;
    text-align: center;
}

.score-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.high-score {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.game-info {
    margin-bottom: 2rem;
}

.game-info h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-item:last-child {
    border-bottom: none;
}

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

.info-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* 컨트롤 버튼 */
.controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

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

.control-btn:active {
    transform: translateY(0);
}

/* 업그레이드 섹션 */
.upgrades-section {
    margin-top: 3rem;
}

.upgrades-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.upgrade-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    cursor: pointer;
}

.upgrade-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.upgrade-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.upgrade-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.upgrade-level {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
}

.upgrade-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.upgrade-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.upgrade-cost {
    color: var(--accent-color);
    font-weight: 600;
}

.upgrade-effect {
    color: var(--text-secondary);
}

.upgrade-button {
    width: 100%;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-button:hover:not(:disabled) {
    background: var(--secondary-hover);
    transform: translateY(-1px);
}

.upgrade-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: var(--background);
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.modal-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.modal-btn.primary:hover {
    background: var(--primary-hover);
}

/* 모바일 알림 */
.mobile-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    text-align: center;
    z-index: 1500;
    max-width: 400px;
    width: 90%;
}

.notice-content h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.notice-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.notice-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notice-btn:hover {
    background: var(--primary-hover);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 5rem 1rem 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .game-area {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .side-panel {
        min-width: auto;
        padding: 1.5rem;
    }

    .click-button {
        width: 150px;
        height: 150px;
        font-size: 1.25rem;
    }

    .click-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .upgrades-grid {
        grid-template-columns: 1fr;
    }

    .nav-bar {
        padding: 1rem;
    }

    .nav-buttons {
        gap: 0.5rem;
    }

    .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }

    .score {
        font-size: 2rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }

    .click-button {
        width: 120px;
        height: 120px;
        font-size: 1rem;
    }
}

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

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

@keyframes clickPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.click-section {
    animation: fadeIn 0.6s ease-out;
}

.score {
    animation: pulse 2s infinite;
}

.click-button:active {
    animation: clickPulse 0.1s ease-out;
}

/* 접근성 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

/* 다크 모드 대응 */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
    }
}