/* ============================================
   The2nd Games - 메인 허브 스타일
   테마: 아케이드 라운지 (네온 + 다크)
   ============================================ */

:root {
    /* 기본 */
    --bg-dark: #0a0e27;
    --bg-medium: #1a1f3a;
    --text-primary: #ffffff;
    --text-secondary: #b8b8b8;

    /* 네온 액센트 */
    --neon-cyan: #00ffff;
    --neon-pink: #ff006e;
    --neon-purple: #8338ec;

    /* 게임별 색상 */
    --game1-color: #ff6b35;
    --game2-color: #00d9ff;
    --game3-color: #00ff88;
    --game4-color: #ffd700;
    --game5-color: #00ff88;
    --app-height: 100dvh;
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root.display-standalone {
    --app-safe-bottom: 0px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    background-color: var(--bg-dark);
}

body {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
    font-family: 'Jua', 'Inter', sans-serif;
    background: linear-gradient(180deg,
            var(--bg-dark) 0%,
            var(--bg-medium) 50%,
            var(--bg-dark) 100%);
    color: var(--text-primary);
}

/* ============================================
   메인 컨테이너
   ============================================ */
.hub-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) var(--app-safe-bottom) env(safe-area-inset-left);
}

/* ============================================
   플레이어 섹션
   ============================================ */
.player-section {
    flex: 0 0 auto;
    padding: 15px;
    display: flex;
    justify-content: center;
}

.player2-section {
    transform: rotate(180deg);
}

.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px 15px;
    max-width: 300px;
    width: 100%;
}

.player-emoji {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.player-stats {
    font-family: 'Jua', sans-serif;
    font-size: 0.95rem;
    color: var(--neon-cyan);
}

.settings-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

/* ============================================
   게임 허브 (중앙)
   ============================================ */
.game-hub {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 15px;
    overflow-y: auto;
    position: relative;
}

.hub-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 6vw, 2.2rem);
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    letter-spacing: 2px;
}

.hub-subtitle {
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.version-tag {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

/* ============================================
   게임 그리드
   ============================================ */
.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 350px;
    width: 100%;
}

.game-card {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid var(--game1-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
}

.game-card:active {
    transform: scale(0.95);
}

.game-card[data-game="the2nd"] {
    border-color: var(--game1-color);
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
}

.game-card[data-game="the2nd"]:hover,
.game-card[data-game="the2nd"]:active {
    box-shadow: 0 0 25px rgba(255, 107, 53, 0.6);
}

.game-card[data-game="yachtdice"] {
    border-color: var(--game2-color);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.3);
}

.game-card[data-game="yachtdice"]:hover,
.game-card[data-game="yachtdice"]:active {
    box-shadow: 0 0 25px rgba(0, 217, 255, 0.6);
}

.game-card[data-game="airhockey"] {
    border-color: var(--game3-color);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.game-card[data-game="airhockey"]:hover,
.game-card[data-game="airhockey"]:active {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
}

.game-card[data-game="tankduel"] {
    border-color: var(--game4-color);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.14) 0%, rgba(255, 215, 0, 0.04) 100%);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.game-card[data-game="tankduel"]:hover,
.game-card[data-game="tankduel"]:active {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.game-card[data-game="tankduel"] .tank-icon {
    font-size: 2.15rem;
    filter: drop-shadow(0 0 9px rgba(255, 215, 0, 0.5));
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.35);
}

/* 잠긴 게임 */
.game-card.locked {
    border-color: #444;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.game-card.locked:active {
    transform: none;
}

.game-icon {
    font-size: 2rem;
}

.game-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.game-desc {
    font-family: 'Jua', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   설정 모달
   ============================================ */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

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

.settings-content {
    background: var(--bg-medium);
    border: 2px solid var(--neon-cyan);
    border-radius: 15px;
    padding: 20px 18px;
    text-align: center;
    width: 90%;
    max-width: 304px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.settings-content h3 {
    font-family: 'Jua', sans-serif;
    color: var(--neon-cyan);
    margin-bottom: 14px;
    font-size: 1.3rem;
}

.settings-content label {
    display: block;
    font-family: 'Jua', sans-serif;
    font-size: 0.95rem;
    margin-top: 12px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.settings-content input[type="text"],
.settings-content select {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    font-family: 'Jua', sans-serif;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    text-align: center;
}

.settings-content input[type="text"]:focus,
.settings-content select:focus {
    outline: none;
    border-color: var(--neon-cyan);
}

.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.emoji-option {
    font-size: 1.6rem;
    padding: 5px;
    cursor: pointer;
    border-radius: 7px;
    transition: all 0.2s;
}

.emoji-option:hover,
.emoji-option.selected {
    background: rgba(0, 255, 255, 0.2);
}

.settings-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}

.settings-buttons button {
    padding: 10px 16px;
    font-size: 0.95rem;
    font-family: 'Jua', sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-buttons .ai-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 12px;
    height: 40px;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    cursor: pointer;
}

.settings-buttons .ai-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--neon-cyan);
}

.settings-buttons .ai-toggle span {
    color: var(--text-primary);
}

#settings-save {
    background: var(--neon-cyan);
    color: var(--bg-dark);
}

#settings-cancel {
    background: #555;
    color: #fff;
}

#stats-reset {
    background: transparent;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    font-size: 0.8rem;
    padding: 8px 14px;
    width: 100%;
    margin-top: 3px;
}

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

/* ============================================
   터치 제스처 차단
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .game-card:hover {
        transform: none;
        box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
    }
}
