/* =========================================================
   ARCADE PHYSICAL HUB - Gaming & Party Mini-Game Theme CSS
   ========================================================= */

:root {
    --bg-primary: #0a0d14;
    --bg-secondary: #121723;
    --bg-card: rgba(23, 29, 45, 0.7);
    --border-color: #26334d;
    --border-glow: rgba(0, 240, 255, 0.3);

    --neon-blue: #00f0ff;
    --neon-green: #00ff88;
    --neon-yellow: #ffd700;
    --neon-red: #ff2a5f;
    --neon-purple: #a855f7;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(0, 240, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(255, 42, 95, 0.08) 0%, transparent 40%),
        linear-gradient(to bottom, #07090e, #0a0d14);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* App Header */
.app-header {
    background: rgba(13, 17, 27, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
}

.brand h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(120deg, #fff 30%, var(--neon-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(0, 240, 255, 0.15);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 240, 255, 0.3);
    margin-left: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-sound {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sound:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--neon-blue);
}

.btn-sound.muted {
    opacity: 0.6;
    color: var(--text-muted);
}

/* Nav Tabs */
.nav-tabs-wrapper {
    background: rgba(18, 23, 35, 0.7);
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 6px;
    padding: 6px 20px 0 20px;
    overflow-x: auto;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.nav-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
    color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.07);
    border-bottom: 2px solid var(--neon-blue);
    box-shadow: inset 0 2px 0 var(--neon-blue);
}

/* Main Container */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 60px 20px;
}

/* Game Section Containers */
.game-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.game-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Common Card Box */
.card-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   1. QWER 피지컬 에임 게임 UI
   ========================================================= */
.qwer-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qwer-hud {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.hud-card {
    background: rgba(18, 23, 35, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    text-align: center;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.hud-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.hud-val {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    font-family: 'Pretendard', monospace;
}

.hud-val.score { color: var(--neon-yellow); }
.hud-val.combo { color: var(--neon-blue); }
.hud-val.time { color: var(--neon-green); }
.hud-val.acc { color: #f43f5e; }
.hud-val.avg { color: #a855f7; }

/* Canvas Arena */
.qwer-arena-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: #0a0d14;
    cursor: crosshair;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.qwer-arena-wrapper canvas {
    display: block;
    width: 100%;
    height: 520px;
}

/* QWER Controls */
.qwer-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(18, 23, 35, 0.8);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: var(--radius-md);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

select.cyber-select, input.cyber-input {
    background: #0d121c;
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

select.cyber-select:focus, input.cyber-input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.btn-cyber-primary {
    background: linear-gradient(135deg, #00f0ff, #0077ff);
    color: #050b14;
    border: none;
    font-weight: 800;
    font-size: 15px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    transition: all 0.2s ease;
}

.btn-cyber-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
}

.btn-cyber-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 14px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cyber-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--neon-blue);
}

/* Guide Notice & Key Badges */
.guide-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.key-badges {
    display: flex;
    gap: 8px;
}

.key-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.key-badge.q { background: rgba(0, 240, 255, 0.2); color: #00f0ff; border: 1px solid #00f0ff; }
.key-badge.w { background: rgba(0, 255, 136, 0.2); color: #00ff88; border: 1px solid #00ff88; }
.key-badge.e { background: rgba(255, 215, 0, 0.2); color: #ffd700; border: 1px solid #ffd700; }
.key-badge.r { background: rgba(255, 42, 95, 0.2); color: #ff2a5f; border: 1px solid #ff2a5f; }

/* =========================================================
   2. 사다리 타기 UI
   ========================================================= */
.ladder-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ladder-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.ladder-slots-row {
    display: flex;
    justify-content: space-around;
    padding: 0 40px;
    gap: 12px;
}

.ladder-slot {
    flex: 1;
    max-width: 120px;
    text-align: center;
}

.btn-player-start {
    width: 100%;
    background: #141c2b;
    border: 2px solid #273147;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-player-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.input-ladder-player, .input-ladder-result {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.bottom-slot {
    background: #141c2b;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    transition: all 0.3s;
}

.bottom-slot.ladder-winner-highlight {
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid var(--neon-green);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    transform: scale(1.08);
}

.ladder-canvas-box {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.ladder-canvas-box canvas {
    display: block;
    width: 100%;
    height: 420px;
}

/* =========================================================
   3. 돌림판 (룰렛) UI
   ========================================================= */
.roulette-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

@media (max-width: 860px) {
    .roulette-grid { grid-template-columns: 1fr; }
}

.roulette-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.roulette-canvas-wrapper {
    position: relative;
    max-width: 420px;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.roulette-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.btn-spin-wheel {
    background: linear-gradient(135deg, #ff2a5f, #ff7a00);
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 14px 48px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(255, 42, 95, 0.6);
    transition: all 0.2s ease;
}

.btn-spin-wheel:hover {
    transform: scale(1.06);
    box-shadow: 0 0 35px rgba(255, 42, 95, 0.9);
}

.roulette-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.roulette-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.input-roulette-item {
    flex: 1;
    background: #0d121c;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.btn-del-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
}

.btn-del-item:hover { color: var(--neon-red); }

.roulette-history-list {
    list-style: none;
    max-height: 150px;
    overflow-y: auto;
    font-size: 13px;
}

.roulette-history-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.roulette-history-list .badge {
    background: rgba(255, 42, 95, 0.2);
    color: var(--neon-red);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.roulette-history-list .time {
    color: var(--text-muted);
    font-size: 11px;
}

/* =========================================================
   4. 제비뽑기 UI (3D 플립 카드)
   ========================================================= */
.draw-lots-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.draw-lots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
    perspective: 1000px;
}

.draw-card {
    height: 190px;
    cursor: pointer;
    user-select: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.draw-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.card-front {
    background: linear-gradient(145deg, #182236, #0e1420);
    border: 2px solid #2e3c5a;
    transition: all 0.2s;
}

.draw-card:hover .card-front {
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    transform: translateY(-4px);
}

.card-num {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
}

.card-icon {
    font-size: 38px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

.card-tap-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.card-back {
    background: #141c2b;
    border: 2px solid var(--border-color);
    transform: rotateY(180deg);
}

.card-back.win {
    background: linear-gradient(145deg, #163628, #0e2018);
    border-color: var(--neon-green);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
}

.card-back.lose {
    background: linear-gradient(145deg, #361622, #200e16);
    border-color: var(--neon-red);
}

.result-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.card-back.win .result-badge {
    background: rgba(0, 255, 136, 0.2);
    color: var(--neon-green);
}

.card-back.lose .result-badge {
    background: rgba(255, 42, 95, 0.2);
    color: var(--neon-red);
}

.result-text {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    word-break: keep-all;
}

/* =========================================================
   5. 신호 반응속도 테스트 UI
   ========================================================= */
.reflex-screen {
    width: 100%;
    min-height: 440px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    padding: 30px;
}

.bg-waiting {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid #334155;
}

.bg-ready {
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    border: 2px solid #ef4444;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.4);
}

.bg-click {
    background: linear-gradient(135deg, #15803d, #166534);
    border: 2px solid #22c55e;
    box-shadow: 0 0 50px rgba(34, 197, 94, 0.6);
}

.bg-early {
    background: linear-gradient(135deg, #854d0e, #713f12);
    border: 2px solid #eab308;
}

.bg-result, .bg-finished {
    background: linear-gradient(135deg, #1e1b4b, #2e1065);
    border: 2px solid #818cf8;
}

.reflex-icon {
    font-size: 54px;
    margin-bottom: 14px;
}

.reflex-title {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 8px;
    color: #fff;
}

.reflex-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    max-width: 500px;
    margin: 0 auto 20px auto;
    line-height: 1.5;
}

.reflex-rounds {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.round-dot {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.round-dot.filled {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* =========================================================
   Modal Dialogs
   ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.modal-card {
    background: #111726;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 240, 255, 0.2);
}

.tier-badge-large {
    font-size: 64px;
    margin-bottom: 8px;
}

.tier-title {
    font-size: 26px;
    font-weight: 900;
    margin-bottom: 6px;
}

.tier-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.result-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.stat-item {
    background: #161e31;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin-top: 2px;
}

.high-record-badge {
    background: rgba(255, 215, 0, 0.1);
    color: var(--neon-yellow);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(10, 13, 20, 0.9);
}
