/* --- Minigame Styles --- */
.minigame-section {
    background-color: var(--color-bg);
    text-align: center;
}

.game-description {
    margin-bottom: 2rem;
    color: var(--color-text-light);
}

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.game-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}


#game-canvas {
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    border: 4px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

.game-stats {
    position: absolute !important;
    top: 15px !important;
    left: 0 !important;
    width: 600px !important; /* 캔버스 원본 너비와 일치시킴 */
    max-width: 100% !important;
    padding: 0 45px !important; /* 좌우 끝에서 안쪽으로 밀어 넣음 */
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: space-between !important;
    font-size: 1.2rem !important;
    font-family: 'Montserrat', sans-serif !important;
    color: #444 !important;
    font-weight: 700 !important;
    z-index: 50 !important;
    pointer-events: none !important;
}

.game-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 85%;
    max-width: 320px;
    text-align: center;
    z-index: 20;
    box-sizing: border-box;
}

.game-modal.hidden {
    display: none;
}

.game-modal h3 {
    margin-top: 0;
    color: var(--color-accent);
    font-size: 1.5rem;
}

.leaderboard-form {
    margin: 1rem 0;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.leaderboard-form input {
    width: 100px;
    padding: 0.5rem;
    font-size: 1.1rem;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.leaderboard-wrapper {
    width: 100%;
    max-width: 100%;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.leaderboard-wrapper h3 {
    color: var(--color-accent);
    margin-top: 0;
    margin-bottom: 1rem;
}

/* ── 경품 안내 ── */
.prize-notice {
    position: relative;
    margin-bottom: 1.2rem;
    padding: 16px 18px 14px;
    background: linear-gradient(135deg, #fffdf9 0%, #fdf6ec 100%);
    border: 1px solid #e8d9c4;
    border-radius: 10px;
    text-align: center;
    overflow: hidden;
}

.prize-notice::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 18px,
        rgba(212, 181, 142, 0.07) 18px,
        rgba(212, 181, 142, 0.07) 19px
    );
    pointer-events: none;
}

.prize-notice-title {
    font-family: 'Gowun Dodum', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: var(--color-accent);
    margin: 0 0 12px;
    text-transform: uppercase;
}

.prize-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prize-list li {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 1px solid #ecdec8;
    border-radius: 6px;
    overflow: hidden;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.82rem;
}

.prize-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 36px;
    font-size: 1rem;
    font-weight: 700;
}

.prize-rank.gold   { background: #fef9ec; }
.prize-rank.silver { background: #f5f6f7; }
.prize-rank.bronze { background: #fdf2ed; }

.prize-label {
    padding: 0 10px;
    color: #888;
    font-size: 0.75rem;
    border-right: 1px solid #ecdec8;
    height: 36px;
    display: flex;
    align-items: center;
}

.prize-label.gold   { color: #b8872a; }
.prize-label.silver { color: #7a8490; }
.prize-label.bronze { color: #9a5e42; }

.prize-item {
    flex: 1;
    padding: 0 12px;
    color: #444;
    text-align: left;
    font-size: 0.82rem;
    height: 36px;
    display: flex;
    align-items: center;
}

.prize-notice-sub {
    font-family: 'Gowun Dodum', sans-serif;
    font-size: 0.72rem;
    color: #bbb;
    margin: 0;
    letter-spacing: 0.5px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.leaderboard-table th {
    background-color: var(--color-surface);
    font-weight: 600;
    color: var(--color-text);
}

.leaderboard-table tr:nth-child(1) td {
    font-weight: bold;
    color: #e6b800;
    /* Gold */
}

.leaderboard-table tr:nth-child(2) td {
    font-weight: bold;
    color: #c0c0c0;
    /* Silver */
}

.leaderboard-table tr:nth-child(3) td {
    font-weight: bold;
    color: #cd7f32;
    /* Bronze */
}

/* --- Section preview centering (iOS Safari 대응) --- */
#runner-game-section .runner-section-preview {
    width: 100%;
}

#runner-game-section .runner-start-overlay {
    margin-left: auto;
    margin-right: auto;
}

/* --- Game Toggle --- */
.game-toggle-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-btn {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text-light);
    border-radius: 25px;
    font-family: 'Gowun Dodum', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.toggle-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 10px rgba(142, 125, 111, 0.3);
}

.toggle-btn:hover {
    background: #f8f8f8;
}

.toggle-btn.active:hover {
    background: #7a6b5e;
}

.hidden {
    display: none !important;
}