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

:root {
    /* 기본 */
    --bg-dark: #0b2030;
    --bg-medium: #184660;
    --bg-deep: #07131e;
    --text-primary: #ffffff;
    --text-secondary: #d7d8d1;

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

    /* 게임별 색상 */
    --game1-color: #ff6b35;
    --game2-color: #00d9ff;
    --game3-color: #ffd700;
    --game4-color: #c58b4a;
    --game5-color: #111111;
    --game6-color: #ffbd5a;
    --app-height: 100dvh;
    --app-safe-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--browser-safe-bottom-offset, 0px));
    --hub-safe-inline: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    --hub-title-target-inline: calc(var(--hub-safe-inline) * 0.5);
    --hub-title-rest-tilt: -2deg;
    --hub-title-font-brand: 'Luckiest Guy', 'Jua', sans-serif;
    --player-name-font-brand: 'Lilita One', 'Jua', sans-serif;
    --hub-title-cream: #fff1c9;
    --hub-title-navy: #122746;
    --hub-title-amber: #ffbf53;
    --hub-title-coral: #ff7548;
    --hub-title-sky: #7fe7ff;
    --hub-title-shell-top: #2e6783;
    --hub-title-shell-bottom: #173951;
    --hub-title-shell-border: #ffe1a0;
    --hub-title-shell-shadow: #07131e;
    --hub-card-rim: #ffe1a0;
    --hub-card-paper: #fff1c9;
    --hub-card-ink: #122746;
    --hub-card-shadow: #07131e;
    --player1-accent: #58b8ff;
    --player2-accent: #ff676d;
    --hub-controller-height: clamp(92px, 15dvh, 116px);
    --hub-controller-card-height: 76px;
    --hub-core-base-width: 352px;
    --hub-core-base-height: 300px;
}

* {
    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: #12354d;
    background-image: linear-gradient(180deg, #1b4f6a 0%, #12354d 42%, #0b2030 100%);
}

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-color: #12354d;
    background-image: linear-gradient(180deg, #1b4f6a 0%, #12354d 42%, #0b2030 100%);
    color: var(--text-primary);
}

html[data-hub-layout-ready="0"] body {
    visibility: hidden;
}

/* ============================================
   메인 컨테이너
   ============================================ */
.hub-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: block;
    position: relative;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) var(--app-safe-bottom) env(safe-area-inset-left);
    overflow: hidden;
    overscroll-behavior: none;
    isolation: isolate;
}

.hub-container::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 18%);
    z-index: 0;
}

.hub-container::after {
    content: '';
    position: absolute;
    left: 50%;
    top: calc(env(safe-area-inset-top, 0px) + var(--hub-controller-height) + var(--hub-title-top, clamp(2px, 1.2vh, 12px)) + clamp(30px, 4.8vh, 42px));
    width: clamp(360px, 66vw, 560px);
    height: clamp(230px, 34vh, 360px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle at center,
            rgba(255, 191, 83, 0.38) 0%,
            rgba(255, 191, 83, 0.22) 42%,
            rgba(255, 191, 83, 0) 82%);
    filter: blur(18px);
    z-index: 1;
}

/* ============================================
   플레이어 섹션
   ============================================ */
.player-section {
    position: absolute;
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    height: var(--hub-controller-height);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

.player2-section {
    top: env(safe-area-inset-top, 0px);
    transform: rotate(180deg);
}

.player1-section {
    bottom: var(--app-safe-bottom);
}

.hub-container.p2-ai-opponent .player2-section .player-emoji-btn,
.hub-container.p2-ai-opponent .player2-section .player-info {
    transform: rotate(180deg);
}

.hub-container.p2-ai-opponent .player2-section .player-info {
    flex-direction: column;
    align-items: center;
}

.player-card {
    --player-control-button-size: 54px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(18, 39, 70, 0.94) 0%, rgba(11, 32, 48, 0.94) 100%);
    border: 1px solid rgba(255, 225, 160, 0.18);
    border-radius: 18px 14px 20px 14px;
    padding: 10px 15px 10px 17px;
    max-width: 312px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(4, 10, 16, 0.3);
}

.player-card::before {
    content: none;
}

.player-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 999px 999px 0;
    pointer-events: none;
}

.player1-section .player-card::after {
    background: rgba(88, 184, 255, 0.95);
}

.player2-section .player-card::after {
    background: rgba(255, 103, 109, 0.95);
}

.player-emoji-btn {
    position: relative;
    z-index: 1;
    flex: 0 0 var(--player-control-button-size);
    width: var(--player-control-button-size);
    height: var(--player-control-button-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 16px 13px 18px 13px;
    background: transparent;
    border: 0;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.18s ease;
}

.player-emoji-btn:focus-visible {
    outline: 2px solid rgba(255, 225, 160, 0.72);
    outline-offset: 2px;
}

.player-emoji-btn:active {
    transform: translateY(1px) scale(0.96);
}

.player-emoji {
    font-size: 2.1rem;
    line-height: 1;
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    position: relative;
    z-index: 1;
    text-align: center;
}

.player-name {
    font-family: var(--player-name-font-brand);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.player-stats {
    font-family: var(--player-name-font-brand);
    font-size: 0.84rem;
    font-weight: 400;
    color: var(--hub-title-cream);
    display: inline-flex;
    align-self: center;
    max-width: 100%;
    padding: 3px 9px 2px;
    border-radius: 999px;
    background: rgba(5, 12, 19, 0.28);
    border: 1px solid rgba(255, 225, 160, 0.16);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-btn {
    position: relative;
    z-index: 1;
    width: var(--player-control-button-size);
    height: var(--player-control-button-size);
    flex: 0 0 var(--player-control-button-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.48rem;
    line-height: 1;
    color: var(--hub-title-cream);
    background: transparent;
    border: 0;
    border-radius: 13px 10px 14px 10px;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.18s ease;
}

.settings-btn:focus-visible {
    outline: 2px solid rgba(255, 225, 160, 0.72);
    outline-offset: 2px;
}

.settings-btn:active {
    transform: translateY(1px) scale(0.96);
}

/* ============================================
   게임 허브 (중앙)
   ============================================ */
.game-hub {
    position: absolute;
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    top: calc(var(--hub-controller-height) + env(safe-area-inset-top, 0px));
    bottom: calc(var(--hub-controller-height) + var(--app-safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 15px;
    overflow: hidden;
    overscroll-behavior: none;
    min-height: 0;
    isolation: isolate;
    z-index: 10;
}

.hub-core {
    --hub-core-scale: 1;
    --hub-core-bottom-reserve: 0px;
    width: var(--hub-core-base-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    transform: scale(var(--hub-core-scale));
    transform-origin: top center;
    will-change: transform;
    margin: clamp(10px, 1.8vh, 18px) auto var(--hub-core-bottom-reserve);
    position: relative;
    isolation: isolate;
    z-index: 1;
}

.hub-core::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(280px, 52vw, 430px);
    height: clamp(220px, 36vh, 320px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle at center,
            rgba(127, 231, 255, 0.26) 0%,
            rgba(71, 162, 199, 0.18) 42%,
            rgba(71, 162, 199, 0) 80%);
    filter: blur(12px);
    z-index: -1;
}

.hub-title {
    --hub-title-visual-pad-top: 6px;
    --hub-title-visual-pad-bottom: 26px;
    position: absolute;
    top: var(--hub-title-top, clamp(2px, 1.2vh, 12px));
    left: 50%;
    transform: translateX(-50%) rotate(var(--hub-title-current-tilt, var(--hub-title-rest-tilt)));
    transform-origin: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: min(calc(100% - 20px), 360px);
    padding: clamp(14px, 1.8vh, 18px) clamp(22px, 4vw, 30px);
    text-align: center;
    pointer-events: auto;
    z-index: 2;
    margin: 0;
    border: 3px solid var(--hub-title-shell-border);
    border-radius: 28px;
    background: linear-gradient(180deg, var(--hub-title-shell-top) 0%, var(--hub-title-shell-bottom) 100%);
    box-shadow:
        0 8px 0 rgba(7, 19, 30, 0.95),
        0 16px 26px rgba(7, 19, 30, 0.38),
        inset 0 2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -4px 0 rgba(6, 20, 30, 0.44);
    isolation: isolate;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hub-title > * {
    position: relative;
    z-index: 1;
}

.hub-title:focus-visible {
    outline: 3px solid rgba(255, 241, 201, 0.92);
    outline-offset: 5px;
}

.hub-title-wordmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    padding-inline: clamp(6px, 1.5vw, 12px);
    font-family: var(--hub-title-font-brand);
    font-size: clamp(1.9rem, calc(var(--hub-title-target-inline) / 5.4), 3.3rem);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: clamp(0.65px, calc(var(--hub-safe-inline) * 0.0018), 1.3px);
    white-space: nowrap;
    color: var(--hub-title-cream);
    text-shadow:
        0 3px 0 var(--hub-title-navy),
        0 6px 0 rgba(18, 39, 70, 0.18);
}

@media (hover: none) and (pointer: coarse) {
    .hub-title-wordmark {
        transform: translateY(clamp(2px, 0.11em, 3px));
    }
}

@media (max-height: 620px) {
    .hub-title {
        --hub-title-visual-pad-top: 4px;
        --hub-title-visual-pad-bottom: 12px;
        max-width: min(calc(100% - 16px), 320px);
        padding: 11px 18px;
        border-radius: 24px;
        box-shadow:
            0 5px 0 rgba(7, 19, 30, 0.95),
            0 10px 16px rgba(7, 19, 30, 0.28),
            inset 0 2px 0 rgba(255, 255, 255, 0.26),
            inset 0 -3px 0 rgba(6, 20, 30, 0.4);
    }

    .hub-title-wordmark {
        font-size: clamp(1.66rem, calc(var(--hub-title-target-inline) / 6.2), 2.55rem);
        letter-spacing: clamp(0.45px, calc(var(--hub-safe-inline) * 0.0015), 0.95px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hub-title {
        transition: none;
    }
}

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

.resume-last-game-btn {
    position: absolute;
    left: 50%;
    top: 0;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(239, 213, 158, 0.58);
    background: rgba(37, 31, 18, 0.78);
    color: #f8e7bc;
    font-family: var(--player-name-font-brand);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    transform: translateX(-50%);
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
    box-shadow: 0 0 14px rgba(247, 197, 107, 0.2);
    width: max-content;
    max-width: min(calc(100% - 24px), 360px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}

.resume-last-game-btn:active {
    transform: translateX(-50%) scale(0.97);
}

.resume-last-game-btn:hover {
    background: rgba(51, 42, 22, 0.88);
    box-shadow: 0 0 18px rgba(250, 203, 118, 0.34);
}

.version-meta {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.version-tag {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
}

.version-updated-at {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

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

.game-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    --card-icon-box-size: 56px;
    --card-title-height: 22px;
    --card-desc-height: 22px;
    --card-tilt: 0deg;
    --card-fill: #2f6883;
    --card-title-color: var(--hub-card-paper);
    --card-desc-color: rgba(255, 241, 201, 0.88);
    --card-icon-shadow: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
    background: var(--card-fill);
    border: none;
    border-radius: 20px 18px 24px 18px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--card-title-height) var(--card-desc-height);
    justify-items: center;
    align-content: center;
    gap: 4px;
    padding: 12px 8px 10px;
    cursor: pointer;
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow:
        0 6px 0 var(--hub-card-shadow),
        0 12px 16px rgba(7, 19, 30, 0.34),
        inset 0 2px 0 rgba(255, 255, 255, 0.24),
        inset 0 -4px 0 rgba(6, 20, 30, 0.42);
    transform: rotate(var(--card-tilt)) translateZ(0);
    backface-visibility: hidden;
    will-change: transform, box-shadow;
    isolation: isolate;
}

.game-card::before {
    content: none;
}

.game-card::after {
    content: none;
}

.game-card > * {
    position: relative;
    z-index: 1;
}

.game-card[data-game]:hover {
    transform: translateY(-3px) rotate(var(--card-tilt));
    box-shadow:
        0 8px 0 var(--hub-card-shadow),
        0 18px 22px rgba(7, 19, 30, 0.34),
        inset 0 2px 0 rgba(255, 255, 255, 0.24),
        inset 0 -4px 0 rgba(6, 20, 30, 0.42);
}

.game-card:active,
.game-card.is-pressed {
    transform: translateY(2px) scale(0.96) rotate(var(--card-tilt));
    box-shadow:
        0 3px 0 var(--hub-card-shadow),
        0 8px 12px rgba(7, 19, 30, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.18),
        inset 0 -3px 0 rgba(6, 20, 30, 0.36);
}

.game-card[data-game="airhockey"] {
    --card-tilt: -2deg;
    --card-fill: #e6dc75;
    --card-title-color: #1b1504;
    --card-desc-color: rgba(27, 21, 4, 0.78);
    --card-icon-shadow: drop-shadow(0 8px 13px rgba(9, 26, 42, 0.32));
}

.game-card[data-game="airhockey"] .airhockey-icon {
    width: calc(var(--card-icon-box-size) * 1.2);
    height: calc(var(--card-icon-box-size) * 1.2);
    transform: translateY(2px);
}

.game-card[data-game="tankduel"] {
    --card-tilt: 2deg;
    --card-fill: #b69b81;
    --card-title-color: #1a120b;
    --card-desc-color: rgba(26, 18, 11, 0.76);
}

.game-card[data-game="highnoon"] {
    --card-tilt: -2deg;
    --card-fill: #df7f60;
    --card-title-color: #291506;
    --card-desc-color: rgba(41, 21, 6, 0.78);
    --card-icon-shadow: drop-shadow(0 8px 13px rgba(58, 24, 14, 0.32));
}

.game-card[data-game="chess"] {
    --card-tilt: 2deg;
    --card-fill: #e8ebef;
    --card-title-color: #101214;
    --card-desc-color: rgba(16, 18, 20, 0.72);
}

.game-card[data-game="chess"] .game-icon {
    color: #f1f3f6;
    text-shadow: 0 0 8px rgba(196, 203, 214, 0.45);
}

.game-card[data-game="chess"] .chess-icon {
    width: 50px;
    height: 50px;
    line-height: 0;
    transform: translateY(5px);
}

.chess-icon-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(11, 14, 18, 0.52));
}

.game-card[data-game="yachtdice"] {
    --card-tilt: -2deg;
    --card-fill: #7ba2bc;
    --card-title-color: #0e2a3d;
    --card-desc-color: rgba(14, 42, 61, 0.78);
    --card-icon-shadow: drop-shadow(0 8px 13px rgba(37, 13, 21, 0.32));
}

.game-card[data-game="othello"] {
    --card-tilt: 2deg;
    --card-fill: #69a77a;
    --card-title-color: #000000;
    --card-desc-color: rgba(0, 0, 0, 0.78);
}

.game-card[data-game="othello"] .game-icon {
    color: #e2ffef;
    text-shadow: 0 0 10px rgba(0, 133, 61, 0.62);
}

.game-card[data-game="othello"] .othello-icon {
    width: 42px;
    height: 42px;
    padding: 4px;
    display: grid;
    grid-template-columns: repeat(2, 15px);
    grid-template-rows: repeat(2, 15px);
    justify-content: center;
    align-content: center;
    gap: 2px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(180deg, #16bf66 0%, #0e8f4f 100%);
    box-shadow:
        0 0 0 1px #000,
        inset 0 1px 0 rgba(232, 255, 243, 0.24),
        0 3px 9px rgba(0, 56, 24, 0.42);
    font-size: 0;
    transform: translateY(6px);
}

.game-card[data-game="othello"] .othello-disc {
    border-radius: 50%;
    display: block;
    width: 100%;
    height: 100%;
}

.game-card[data-game="othello"] .othello-disc.white {
    background: #ffffff;
    border: none;
    box-shadow: none;
}

.game-card[data-game="othello"] .othello-disc.black {
    background: #000000;
    border: none;
    box-shadow: none;
}


/* 잠긴 게임 */
.game-card.locked {
    background: linear-gradient(180deg, rgba(92, 101, 112, 0.94) 0%, rgba(45, 52, 61, 0.98) 100%);
    cursor: not-allowed;
    opacity: 0.58;
    filter: saturate(0.45);
}

.game-card.locked::before {
    opacity: 0;
}

.game-card.locked:active {
    transform: rotate(var(--card-tilt));
}

.game-icon {
    width: var(--card-icon-box-size);
    height: var(--card-icon-box-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
    align-self: center;
}

.hub-icon-svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: var(--card-icon-shadow);
}

.game-card[data-game="highnoon"] .highnoon-icon {
    width: calc(var(--card-icon-box-size) * 1.5);
    height: calc(var(--card-icon-box-size) * 0.82);
    overflow: visible;
}

.game-card[data-game="yachtdice"] .yachtdice-icon {
    width: calc(var(--card-icon-box-size) * 1.25);
    height: calc(var(--card-icon-box-size) * 1.25);
}

.game-card[data-game="highnoon"] .hub-colt-svg {
    transform: scale(1);
}

.hub-colt-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    filter: var(--card-icon-shadow);
    transform: scale(0.9);
    transform-origin: center;
}

.hub-colt-svg .empty-shell {
    opacity: 0;
}

.hub-colt-svg .muzzle-flash {
    opacity: 0;
}

.hub-colt-svg .muzzle-core {
    fill: #fffde3;
}

.hub-colt-svg .muzzle-rays {
    fill: #ffc845;
}

.hub-colt-svg .muzzle-trail {
    fill: none;
    stroke: #ffe2a2;
    stroke-width: 3.2;
    stroke-linecap: round;
    opacity: 0;
}

.hub-colt-svg .muzzle-bullet {
    fill: #fffef6;
    opacity: 0;
}

.hub-colt-svg .muzzle-smoke {
    fill: rgba(226, 226, 226, 0.92);
    opacity: 0;
}

.tank-icon {
    position: relative;
    font-size: 0;
}

.game-card[data-game="tankduel"] .tank-icon {
    width: 70px;
    height: 70px;
    transform: translateY(4px);
}

.tank-icon-canvas {
    width: 100%;
    height: 100%;
    display: block;
    filter: none;
}

.game-title {
    font-family: var(--hub-title-font-brand);
    font-size: 0.76rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #000000;
    width: 100%;
    min-height: var(--card-title-height);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-top: 2px;
    text-align: center;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 2px rgba(7, 19, 30, 0.18);
    transform: translateY(14px);
}

.game-desc {
    font-family: 'Jua', sans-serif;
    font-size: 0.68rem;
    color: #000000;
    width: 100%;
    min-height: var(--card-desc-height);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    transform: translateY(8px);
}

/* ============================================
   설정 모달
   ============================================ */
.settings-modal {
    position: fixed;
    inset: 0;
    padding: 18px 14px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 50% 12%, rgba(255, 191, 83, 0.18) 0%, rgba(255, 191, 83, 0) 28%),
        linear-gradient(180deg, rgba(6, 12, 18, 0.84) 0%, rgba(3, 8, 12, 0.92) 100%);
    display: none;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    z-index: 2000;
}

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

.settings-modal-stack {
    width: min(80vw, 268px);
    max-height: calc(var(--app-height, 100dvh) - 36px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.settings-content {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%),
        linear-gradient(160deg, rgba(17, 40, 58, 0.98) 0%, rgba(10, 23, 35, 0.98) 100%);
    border: 1px solid rgba(255, 225, 160, 0.2);
    border-radius: 24px 18px 22px 16px;
    padding: 11px 9px 9px;
    text-align: left;
    width: 100%;
    max-width: none;
    box-shadow:
        0 24px 40px rgba(3, 8, 12, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}

.settings-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 11px;
    right: 11px;
    height: 6px;
    border-radius: 0 0 16px 16px;
    background: rgba(255, 191, 83, 0.9);
    pointer-events: none;
}

.settings-content[data-player="1"]::before {
    background: rgba(88, 184, 255, 0.95);
}

.settings-content[data-player="2"]::before {
    background: rgba(255, 103, 109, 0.95);
}

.settings-header {
    --settings-header-control-size: 54px;
    display: grid;
    grid-template-columns: var(--settings-header-control-size) 1fr;
    align-items: center;
    gap: 7px;
    margin: 4px 0 5px;
}

.settings-marquee {
    position: relative;
    width: var(--settings-header-control-size);
    height: var(--settings-header-control-size);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px 12px 18px 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 100%),
        linear-gradient(155deg, rgba(11, 32, 48, 0.95) 0%, rgba(18, 39, 70, 0.9) 100%);
    border: 1px solid rgba(255, 225, 160, 0.16);
    box-shadow:
        0 12px 18px rgba(3, 8, 12, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-content[data-player="1"] .settings-marquee {
    box-shadow:
        0 12px 18px rgba(3, 8, 12, 0.22),
        0 0 0 1px rgba(88, 184, 255, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-content[data-player="2"] .settings-marquee {
    box-shadow:
        0 12px 18px rgba(3, 8, 12, 0.22),
        0 0 0 1px rgba(255, 103, 109, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-content[data-ai-preview="1"] .settings-marquee {
    background:
        linear-gradient(180deg, rgba(127, 231, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 100%),
        linear-gradient(155deg, rgba(9, 24, 37, 0.95) 0%, rgba(18, 39, 70, 0.94) 100%);
    border-color: rgba(127, 231, 255, 0.26);
}

.settings-marquee-emoji {
    position: relative;
    z-index: 1;
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 6px 10px rgba(4, 10, 16, 0.18));
}

.settings-header-copy {
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.settings-content h3 {
    font-family: 'Jua', sans-serif;
    color: var(--hub-title-cream);
    margin: 0;
    font-size: clamp(1.24rem, 4vw, 1.42rem);
    line-height: 1.06;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

.settings-form-group + .settings-form-group {
    margin-top: 14px;
}

.settings-content label {
    display: inline-flex;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    margin: 0 0 7px 4px;
    color: var(--hub-title-cream);
    opacity: 0.92;
}

.settings-content input[type="text"],
.settings-content select {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: 'Jua', sans-serif;
    background:
        linear-gradient(180deg, rgba(7, 19, 30, 0.82) 0%, rgba(5, 13, 20, 0.96) 100%);
    border: 1px solid rgba(255, 225, 160, 0.16);
    border-radius: 14px 10px 14px 10px;
    color: var(--text-primary);
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.settings-content input[type="text"]::placeholder {
    color: rgba(255, 241, 201, 0.48);
}

.settings-content input[type="text"]:focus,
.settings-content select:focus {
    outline: none;
    border-color: rgba(255, 225, 160, 0.52);
    box-shadow:
        0 0 0 3px rgba(255, 191, 83, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.settings-content input[type="text"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

.settings-content input.settings-name-input {
    min-height: var(--settings-header-control-size);
    height: var(--settings-header-control-size);
    padding: 0 12px;
    font-size: clamp(1.18rem, 3.9vw, 1.32rem);
    line-height: 1;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%),
        linear-gradient(155deg, rgba(8, 20, 31, 0.94) 0%, rgba(12, 29, 43, 0.94) 100%);
    border-color: rgba(255, 225, 160, 0.18);
    border-radius: 16px 12px 16px 12px;
    color: var(--hub-title-cream);
    box-shadow:
        0 12px 18px rgba(3, 8, 12, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
    caret-color: rgba(255, 191, 83, 0.92);
}

.settings-content input.settings-name-input::placeholder {
    color: rgba(255, 241, 201, 0.42);
}

.settings-content input.settings-name-input:focus {
    border-color: rgba(255, 225, 160, 0.52);
    box-shadow:
        0 0 0 3px rgba(255, 191, 83, 0.12),
        0 10px 14px rgba(3, 8, 12, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-content input.settings-name-input:disabled {
    color: rgba(255, 241, 201, 0.72);
}

.settings-content.p2-ai-locked .settings-name-input {
    border-color: rgba(127, 231, 255, 0.28);
    box-shadow:
        0 10px 14px rgba(3, 8, 12, 0.18),
        0 0 0 1px rgba(127, 231, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-emoji-group {
    margin-top: 2px;
}

.settings-content.p2-ai-locked .emoji-picker {
    opacity: 0.5;
    filter: grayscale(0.95);
    pointer-events: none;
}

.settings-content.p2-ai-locked .emoji-picker .emoji-option {
    cursor: not-allowed;
}

.emoji-picker {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0 1px;
    margin-top: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
}

.emoji-option {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    font-size: 1.36rem;
    padding: 0;
    cursor: pointer;
    min-height: 28px;
    border-radius: 999px;
    background: transparent;
    border: none;
    box-shadow: none;
    transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.emoji-option:hover {
    transform: translateY(-1px) scale(1.06);
    filter: drop-shadow(0 4px 8px rgba(255, 191, 83, 0.18));
}

.emoji-option.selected {
    transform: scale(1.12);
    filter: drop-shadow(0 6px 10px rgba(255, 191, 83, 0.26));
}

.settings-ai-toggle-btn {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    text-align: left;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%),
        linear-gradient(155deg, rgba(12, 29, 43, 0.94) 0%, rgba(7, 18, 27, 0.94) 100%);
    color: var(--hub-title-cream);
    border: 1px solid rgba(255, 241, 201, 0.82);
    box-shadow: 0 0 0 1px rgba(255, 241, 201, 0.2);
}

.settings-ai-toggle-btn[hidden] {
    display: none;
}

.settings-ai-toggle-btn[aria-pressed="true"] {
    background:
        linear-gradient(180deg, rgba(127, 231, 255, 0.14) 0%, rgba(127, 231, 255, 0.04) 100%),
        linear-gradient(155deg, rgba(16, 43, 61, 0.94) 0%, rgba(8, 22, 33, 0.94) 100%);
    color: #e6f8ff;
    border-color: rgba(191, 242, 255, 0.82);
    box-shadow: 0 0 0 1px rgba(127, 231, 255, 0.2);
}

.settings-ai-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.settings-ai-toggle-label {
    font-family: 'Jua', sans-serif;
    line-height: 1.05;
}

.settings-ai-toggle-switch {
    margin-left: auto;
    width: 46px;
    height: 26px;
    padding: 3px;
    border-radius: 999px;
    box-sizing: border-box;
    background: rgba(5, 12, 19, 0.58);
    border: 1px solid rgba(255, 241, 201, 0.82);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.settings-ai-toggle-thumb {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 241, 201, 0.96);
    transition: transform 0.18s ease, background 0.18s ease;
}

.settings-ai-toggle-btn[aria-pressed="true"] .settings-ai-toggle-switch {
    background: rgba(127, 231, 255, 0.2);
    border-color: rgba(191, 242, 255, 0.82);
}

.settings-ai-toggle-btn[aria-pressed="true"] .settings-ai-toggle-thumb {
    transform: translateX(20px);
    background: #e6f8ff;
}

.settings-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
}

.settings-buttons button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.8rem;
    font-family: 'Jua', sans-serif;
    border: 1px solid transparent;
    border-radius: 14px 11px 14px 11px;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.settings-buttons button:focus-visible {
    outline: 2px solid rgba(255, 225, 160, 0.72);
    outline-offset: 2px;
}

#settings-save {
    background: linear-gradient(180deg, rgba(255, 191, 83, 0.98) 0%, rgba(255, 117, 72, 0.92) 100%);
    color: #122746;
    box-shadow:
        0 12px 18px rgba(255, 117, 72, 0.16),
        inset 0 1px 0 rgba(255, 241, 201, 0.44);
}

#settings-cancel {
    background: rgba(5, 12, 19, 0.5);
    color: var(--hub-title-cream);
    border-color: rgba(255, 225, 160, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#stats-reset {
    grid-column: 1 / -1;
    min-height: 36px;
    background: rgba(69, 25, 28, 0.18);
    color: #ffd1c7;
    border: 1px dashed rgba(255, 133, 111, 0.44);
    font-size: 0.76rem;
    padding: 7px 12px;
    margin-top: 0;
}

.settings-buttons button:active {
    transform: translateY(1px) scale(0.98);
}

@media (max-height: 760px) {
    :root {
        --hub-controller-card-height: 68px;
    }

    .player-card {
        --player-control-button-size: 50px;
    }

    .settings-modal {
        padding: 14px 12px;
    }

    .settings-modal-stack {
        max-height: calc(var(--app-height, 100dvh) - 28px);
    }

    .settings-content {
        padding: 10px 8px 8px;
    }

    .settings-header {
        --settings-header-control-size: 50px;
        grid-template-columns: var(--settings-header-control-size) 1fr;
        gap: 6px;
        margin: 3px 0 5px;
    }

    .settings-content input.settings-name-input {
        min-height: var(--settings-header-control-size);
        height: var(--settings-header-control-size);
        padding: 0 11px;
        font-size: 1.22rem;
    }

    .settings-marquee-emoji {
        font-size: 1.86rem;
    }

    .emoji-picker {
        gap: 0 1px;
        padding-top: 0;
    }

    .emoji-option {
        min-height: 25px;
        font-size: 1.22rem;
    }

    .settings-buttons button {
        min-height: 34px;
        padding: 6px 9px;
        font-size: 0.77rem;
    }

    #stats-reset {
        min-height: 34px;
        font-size: 0.73rem;
    }

    .player-section {
        padding: 12px;
    }

    .player-card {
        padding: 8px 12px 8px 14px;
    }

    .player-emoji {
        font-size: 1.95rem;
    }
}

@media (max-height: 700px) {
    :root {
        --hub-controller-card-height: 63px;
    }

    .player-card {
        --player-control-button-size: 46px;
    }

    .settings-content {
        padding: 10px 7px 8px;
    }

    .settings-header {
        --settings-header-control-size: 44px;
        grid-template-columns: var(--settings-header-control-size) 1fr;
        gap: 5px;
        margin: 3px 0 5px;
    }

    .settings-marquee-emoji {
        font-size: 1.66rem;
    }

    .settings-content h3 {
        font-size: 1.14rem;
    }

    .settings-content input.settings-name-input {
        min-height: var(--settings-header-control-size);
        height: var(--settings-header-control-size);
        padding: 0 10px;
        font-size: 1.1rem;
    }

    .settings-content label {
        font-size: 0.84rem;
        margin-bottom: 6px;
    }

    .settings-content input[type="text"],
    .settings-content select {
        padding: 10px 12px;
    }

    .emoji-picker {
        gap: 0 1px;
        padding-top: 0;
    }

    .emoji-option {
        min-height: 23px;
        font-size: 1.02rem;
    }

    .settings-buttons button {
        min-height: 32px;
        padding: 5px 8px;
        font-size: 0.74rem;
    }

    #stats-reset {
        min-height: 32px;
        font-size: 0.69rem;
    }

    .player-section {
        padding: 9px 10px;
    }

    .player-card {
        gap: 10px;
        padding: 7px 10px 7px 12px;
    }

    .player-emoji {
        font-size: 1.8rem;
    }

    .settings-btn {
        font-size: 1.28rem;
    }
}

/* ============================================
   터치 제스처 차단
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .game-card[data-game]:hover,
    .game-card[data-game]:active {
        transform: rotate(var(--card-tilt)) translateZ(0);
        box-shadow:
            0 6px 0 var(--hub-card-shadow),
            0 12px 16px rgba(7, 19, 30, 0.34),
            inset 0 2px 0 rgba(255, 255, 255, 0.24),
            inset 0 -4px 0 rgba(6, 20, 30, 0.42);
    }

    .game-card[data-game].is-pressed {
        transform: translateY(2px) scale(0.96) rotate(var(--card-tilt));
        box-shadow:
            0 3px 0 var(--hub-card-shadow),
            0 8px 12px rgba(7, 19, 30, 0.3),
            inset 0 2px 0 rgba(255, 255, 255, 0.18),
            inset 0 -3px 0 rgba(6, 20, 30, 0.36);
    }
}
