/* ========================================
   Global Styles & Variables
   ======================================== */
:root {
    --color-primary: #0D47A1;
    --color-secondary: #FFC107;
    --color-background: #F9F9F9;
    --color-text-normal: #212121;
    --color-text-light: #BDBDBD;
    --color-white: #FFFFFF;
    --color-success: #4CAF50;
    --color-danger: #F44336;

    --font-body: 'Noto Sans KR', sans-serif;
    --font-number: 'Roboto', sans-serif;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.2);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text-normal);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.font-number {
    font-family: var(--font-number);
}

/* ========================================
   App Container
   ======================================== */
.app-container {
    max-width: 480px;
    min-height: 100vh;
    margin: 0 auto;
    background-color: var(--color-white);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* ========================================
   Page Management
   ======================================== */
.page {
    display: none;
    min-height: 100vh;
    padding-bottom: 80px;
}

.page.active {
    display: block;
}

.content {
    padding: 1rem;
}

.game-content {
    padding: 2rem 1rem;
}

/* ========================================
   Header
   ======================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.logo {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--color-primary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
    color: #666;
}

.icon-btn:hover {
    background-color: #f0f0f0;
}

.icon-btn:active {
    transform: scale(0.95);
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.game-header {
    position: relative;
}

/* ========================================
   Bottom Navigation
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    background-color: var(--color-white);
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    transition: color var(--transition-fast);
    padding: 0.5rem;
}

.nav-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-btn.active {
    color: var(--color-primary);
}

.nav-btn:hover {
    color: var(--color-primary);
}

/* ========================================
   Main Page Components
   ======================================== */
.banner {
    margin-bottom: 1rem;
}

.ad-banner, .ad-banner-small {
    width: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-weight: 500;
    border: 2px dashed #ccc;
}

.ad-banner {
    height: 128px;
}

.ad-banner-small {
    height: 96px;
}

.mission-card {
    background-color: var(--color-white);
    padding: 2rem 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-bottom: 1rem;
}

.user-greeting {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.user-greeting span {
    color: var(--color-primary);
}

.mission-description {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.btn-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    background-color: #0a3a85;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.mission-complete-msg {
    margin-top: 1rem;
    color: var(--color-primary);
    font-weight: 600;
}

.section {
    background-color: var(--color-white);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.live-wins-container {
    height: 150px;
    overflow: hidden;
    position: relative;
}

.live-wins {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.win-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f5f5f5;
    border-radius: 8px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.win-user {
    font-weight: 600;
}

.win-amount {
    color: var(--color-secondary);
    font-weight: 700;
    font-family: var(--font-number);
}

.rankings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
}

.rank-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #666;
    min-width: 30px;
}

.rank-number.gold {
    color: #FFD700;
}

.rank-user {
    flex: 1;
    font-weight: 600;
}

.rank-score {
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-number);
}

/* ========================================
   Game Page - Cards
   ======================================== */
.game-instruction {
    text-align: center;
    margin-bottom: 2rem;
}

.game-instruction h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.game-instruction p {
    color: var(--color-text-light);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.card-container {
    perspective: 1000px;
    height: 200px;
    cursor: pointer;
}

.card-container.wide {
    grid-column: span 2;
}

.card-container.flipped {
    pointer-events: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-container.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.card-front {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1565C0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-star {
    width: 60px;
    height: 60px;
    fill: rgba(255, 255, 255, 0.3);
}

.card-back {
    background-color: var(--color-white);
    border: 3px solid var(--color-secondary);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.card-back p:first-child {
    font-size: 0.875rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.card-back .odds {
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-primary);
    font-family: var(--font-number);
    margin-bottom: 0.5rem;
}

.card-back p:last-child {
    font-size: 0.75rem;
    color: #bbb;
}

/* ========================================
   MyPage
   ======================================== */
.profile-section {
    background-color: var(--color-white);
    padding: 2rem 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 1rem;
}

.profile-avatar {
    margin: 0 auto 1rem;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.logout-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.logout-btn:hover {
    color: #666;
}

.point-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.point-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.point-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-primary);
    font-family: var(--font-number);
}

.point-unit {
    font-size: 1.5rem;
}

.action-buttons {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    transition: transform var(--transition-fast);
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon.gift {
    background-color: #E3F2FD;
    color: var(--color-primary);
}

.action-icon.ad {
    background-color: #E8F5E9;
    color: var(--color-success);
}

.action-btn span {
    font-size: 0.875rem;
    font-weight: 600;
}

.mission-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.mission-info h4 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mission-info p {
    font-size: 0.875rem;
    color: #666;
}

.mission-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.mission-status.active {
    background-color: #E3F2FD;
    color: #1976D2;
}

.mission-status.won {
    background-color: #E8F5E9;
    color: #388E3C;
}

.mission-status.lost {
    background-color: #FFEBEE;
    color: #D32F2F;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* ========================================
   Modal
   ======================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--color-white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #666;
}

.modal-body {
    padding: 1.5rem;
}

.modal-odds {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-odds p:first-child {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.modal-odds-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-primary);
    font-family: var(--font-number);
    margin: 0.5rem 0;
}

.modal-odds-value span {
    font-size: 2rem;
}

.modal-games {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.modal-game {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    gap: 0.5rem;
}

.modal-game:last-child {
    border-bottom: none;
}

.modal-game-match {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-normal);
}

.modal-game-pick {
    padding: 0.375rem 0.75rem;
    background-color: var(--color-secondary);
    color: #fff;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.875rem;
    white-space: nowrap;
}

.modal-game-odds {
    padding: 0.375rem 0.75rem;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.875rem;
    font-family: var(--font-number);
    white-space: nowrap;
}

.modal-note {
    font-size: 0.875rem;
    color: #999;
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-confirm-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.modal-confirm-btn:hover {
    background-color: #0a3a85;
    transform: translateY(-2px);
}

.modal-confirm-btn:active {
    transform: translateY(0);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 480px) {
    .app-container {
        box-shadow: none;
    }

    .cards-grid {
        gap: 0.75rem;
    }

    .card-container {
        height: 180px;
    }
}


/* ==========================================
   Auth Page Styles
   ========================================== */
.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.auth-header h1 {
    font-size: 48px;
    margin-bottom: 10px;
}

.auth-header p {
    font-size: 18px;
    opacity: 0.9;
}

.auth-form-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.auth-form-container h2 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #667eea;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-note {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #999;
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

.header-spacer {
    width: 28px;
}

/* ========================================
   Banner Sections (Top & Middle)
   ======================================== */
.banner-section {
    width: 100%;
    background-color: #f8f9fa;
    min-height: 0;
    overflow: hidden;
}

.banner-section:empty {
    display: none;
}

#top-banner-area {
    /* 관리자용 상단 배너 - 헤더 바로 아래 */
}

#top-banner-area img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

#middle-banner-area {
    /* 회원용 중간 배너 - 콘텐츠 사이 */
    margin: 1rem 0;
    border-radius: 12px;
    background-color: transparent;
}

#middle-banner-area img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 12px;
}

/* 배너 클릭 가능한 링크 스타일 */
.banner-section a {
    display: block;
    width: 100%;
}

/* 배너 로딩/빈 상태 */
.banner-section .banner-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    color: #999;
    font-size: 0.875rem;
}

/* 반응형 배너 처리 */
@media (max-width: 480px) {
    #top-banner-area img,
    #middle-banner-area img {
        border-radius: 0;
    }

    #middle-banner-area {
        margin: 0.75rem 0;
        border-radius: 0;
    }
}
