/* jinji.css — 외로운 진지 게임 페이지 (황량한 초원 다크 톤 #2a2a20 계열) */

/* ── 게임 프레임 (HUD + 스테이지 공통 패널) ─────────────── */
#jinji-game-frame {
    max-width: 960px;
    margin: 0 auto;
    background: #1f1f17;
    border: 1px solid #3a3a2c;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* ── HUD 바 ──────────────────────────────────────────── */
#jinji-hud {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: #d8d4c0;
    font-size: 13px;
    user-select: none;
}

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

.hud-row-main {
    flex-wrap: wrap;
    justify-content: space-between;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hud-label {
    color: #8f8b75;
    font-size: 12px;
    white-space: nowrap;
}

.hud-value {
    color: #f0ecd8;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hud-stat {
    white-space: nowrap;
}

.hud-silver .fa-coins {
    color: #c9c9c9;
}

.hud-weapon .fa-gun {
    color: #b8a86a;
}

#hud-weapon-name {
    color: #f0ecd8;
    font-weight: 700;
}

/* 생명/경험치 바 */
.hud-bars {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    flex: 1 1 220px;
    max-width: 380px;
}

.hud-bar-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-bar-label {
    width: 42px;
    text-align: right;
    flex: none;
}

.hud-bar {
    position: relative;
    flex: 1;
    height: 14px;
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 7px;
    overflow: hidden;
}

.hud-bar > div {
    height: 100%;
    border-radius: 6px;
    transition: width 0.2s linear;
}

/* 생명 = 빨강 */
.hud-bar-life > #hud-life-fill {
    background: linear-gradient(180deg, #e5484d, #a72f33);
}

/* 경험치 = 파랑 */
.hud-bar-exp > #hud-exp-fill {
    background: linear-gradient(180deg, #4d8fe5, #2f5aa7);
}

.hud-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* 종류별 킬 카운트 줄 */
.hud-row-kills {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #3a3a2c;
    min-height: 24px;
}

.hud-row-kills .fa-skull {
    color: #8f8b75;
}

#hud-kills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: #cfc9ae;
    min-width: 0;
}

/* ── 게임 스테이지 (960×540 논리 해상도, 16:9 스케일) ──── */
#jinji-stage {
    position: relative;
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    overflow: hidden;
    touch-action: none; /* 드래그 시야 이동용 — 브라우저 제스처 차단 */
}

/* 캔버스 3장 겹침 (배경/게임/이펙트) */
#jinji-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#bg-canvas   { z-index: 1; }
#game-canvas { z-index: 2; }
#fx-canvas   { z-index: 3; }

/* ── 기절 표시 (기본 hidden) ─────────────────────────── */
#hud-knockout {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    background: rgba(20, 18, 12, 0.85);
    border: 1px solid #e5484d;
    border-radius: 10px;
    padding: 10px 18px;
    color: #ffd7d8;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    animation: jinji-knockout-pulse 1.2s ease-in-out infinite;
}

#hud-knockout[hidden] {
    display: none;
}

#hud-knockout .fa-dizzy {
    color: #e5484d;
}

@keyframes jinji-knockout-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* ── 시작 오버레이 ───────────────────────────────────── */
#jinji-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 18, 12, 0.72);
    backdrop-filter: blur(2px);
}

#jinji-overlay[hidden],
#jinji-overlay.hidden {
    display: none;
}

.overlay-inner {
    text-align: center;
    padding: 24px 28px;
    max-width: 420px;
}

.overlay-title {
    color: #f0ecd8;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    margin-bottom: 18px;
}

#btn-start {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 32px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#btn-start:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.55);
}

#btn-start:active {
    transform: translateY(0);
}

#overlay-msg {
    margin-top: 14px;
    color: #b5b09a;
    font-size: 12.5px;
    line-height: 1.6;
}

/* ── 조작 안내 ───────────────────────────────────────── */
#jinji-controls-hint {
    margin-top: 8px;
    text-align: center;
    color: #8f8b75;
    font-size: 12px;
    user-select: none;
}

/* ── HUD 상점 버튼 ───────────────────────────────────── */
#btn-shop {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}

#btn-shop:hover {
    background: #4a4936;
    border-color: #6c6a4e;
}

#btn-shop .fa-store {
    color: #b8a86a;
}

/* ── HUD 소모품 퀵슬롯 (붕대/의료상자 — shop.js가 채움) ── */
#hud-consumables {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex: none;
}

.hud-consumable {
    position: relative;
    width: 34px;
    height: 28px;
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 6px;
    color: #d8d4c0;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease;
}

.hud-consumable:hover:not(:disabled) {
    border-color: #b8a86a;
    color: #f0ecd8;
}

.hud-consumable:disabled {
    opacity: 0.4;
    cursor: default;
}

.hud-consumable .qty-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #6366f1;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    font-weight: 700;
    pointer-events: none;
}

/* ── 공용 모달 (상점/결산 — 다크 HUD 톤) ─────────────── */
.jinji-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.jinji-modal[hidden] {
    display: none;
}

.jinji-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 14, 9, 0.7);
    backdrop-filter: blur(2px);
}

.jinji-modal-panel {
    position: relative;
    z-index: 1;
    width: min(640px, 94vw);
    max-height: min(80vh, 680px);
    display: flex;
    flex-direction: column;
    background: #23231a;
    border: 1px solid #3a3a2c;
    border-radius: 12px;
    color: #d8d4c0;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.jinji-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3a2c;
    flex: none;
}

.jinji-modal-title {
    color: #f0ecd8;
    font-weight: 800;
    font-size: 16px;
    margin-right: auto;
}

.jinji-modal-title .fa-store,
.jinji-modal-title .fa-moon {
    color: #b8a86a;
}

.jinji-modal-close {
    background: none;
    border: none;
    color: #8f8b75;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
}

.jinji-modal-close:hover {
    color: #f0ecd8;
}

/* ── 상점 모달 내부 ──────────────────────────────────── */
.shop-silver-wrap {
    color: #f0ecd8;
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.shop-silver-wrap .fa-coins {
    color: #c9c9c9;
}

#shop-msg {
    padding: 8px 16px 0;
    font-size: 12px;
    color: #e5905a;
    flex: none;
}

#shop-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 16px 0;
    flex-wrap: wrap;
    flex: none;
}

.shop-tab {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    color: #b5b09a;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.shop-tab:hover:not(:disabled):not(.active) {
    background: #333326;
    color: #f0ecd8;
}

.shop-tab.active {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    border-color: transparent;
    color: #fff;
}

.shop-tab:disabled {
    opacity: 0.45;
    cursor: default;
}

#shop-list {
    overflow-y: auto;
    padding: 12px 16px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    align-content: start;
}

.shop-item {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shop-item-name {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    color: #f0ecd8;
    font-weight: 700;
    font-size: 14px;
}

/* 상점 아이콘(M4) — icon_{item_code} 스프라이트 헤더(없으면 .shop-item-name 단독, 기존 레이아웃) */
.shop-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-item-head .shop-item-name {
    flex: 1;
    min-width: 0;
}

.shop-item-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    object-fit: contain;
    background: #1f1f17;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
}

.shop-item-price {
    color: #d9b64f;
    font-weight: 700;
    font-size: 12.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.shop-item-lock {
    color: #e5a04d;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.shop-item-desc {
    font-size: 11.5px;
    color: #8f8b75;
    line-height: 1.45;
    margin: 0;
}

.shop-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11.5px;
    color: #b5b09a;
}

.shop-badge-equipped {
    color: #7ddb8a;
    font-weight: 700;
}

.shop-badge-broken {
    color: #e5484d;
    font-weight: 700;
}

.shop-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: auto;
}

.shop-btn {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease;
}

.shop-btn:hover:not(:disabled) {
    background: #4a4936;
}

.shop-btn.primary {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    border-color: transparent;
    color: #fff;
}

.shop-btn.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #7577f3, #5a5ce2);
}

.shop-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.shop-busy .shop-btn,
.shop-busy .shop-tab {
    pointer-events: none;
    opacity: 0.6;
}

.shop-item-reason {
    font-size: 11px;
    color: #e5484d;
}

.shop-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #8f8b75;
    font-size: 13px;
    padding: 28px 0;
}

/* ── 결산 모달 내부 ──────────────────────────────────── */
#settlement-body {
    padding: 14px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.settle-header {
    color: #f0ecd8;
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 4px;
}

.settle-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    padding: 3px 0;
    border-bottom: 1px dashed #33321f;
}

.settle-row .label {
    color: #8f8b75;
    white-space: nowrap;
}

.settle-row .value {
    color: #f0ecd8;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.settle-row .value.gold {
    color: #d9b64f;
}

.settle-row .value.up {
    color: #7ddb8a;
}

.settle-row .value.warn {
    color: #e5a04d;
}

.settle-row .value.muted {
    color: #8f8b75;
    font-weight: 400;
    font-size: 11.5px;
}

.settle-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 6px;
}

.settle-chip {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11.5px;
    color: #cfc9ae;
    white-space: nowrap;
}

.settle-warn {
    background: rgba(229, 72, 77, 0.12);
    border: 1px solid rgba(229, 72, 77, 0.45);
    color: #ffd7d8;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
}

.settle-footer {
    padding: 12px 18px 16px;
    text-align: center;
    border-top: 1px solid #3a3a2c;
    flex: none;
}

#settlement-close {
    padding: 8px 36px;
    font-size: 14px;
}

/* ── M5: 계절·날씨 HUD 배지 (#hud-season — 통합 코드가 내용·계절 클래스 부여) ── */
.hud-season {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 12px;
    padding: 2px 10px;
    color: #d8d4c0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.hud-season[hidden] {
    display: none;
}

/* 계절별 강조색 — 통합 코드가 #hud-season에 season-* 클래스 토글 */
.hud-season.season-spring { border-color: #5f8f52; color: #b9e0a8; }
.hud-season.season-summer { border-color: #3f6fae; color: #a8cbe0; }
.hud-season.season-autumn { border-color: #a8763a; color: #e0c9a8; }
.hud-season.season-winter { border-color: #6f8fa8; color: #cfe4f0; }

/* ── M5: 배치 모드 (#jinji-place-hint 오버레이 + 스테이지 하이라이트) ── */
#jinji-place-hint {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6; /* 기절(5) 위, 시작 오버레이(10) 아래 */
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92%, 640px);
    background: rgba(20, 18, 12, 0.88);
    border: 1px solid #b8a86a;
    border-radius: 10px;
    padding: 8px 14px;
    color: #f0ecd8;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    pointer-events: none; /* 스테이지 클릭 배치 방해 금지 — 버튼만 예외 */
}

#jinji-place-hint[hidden] {
    display: none;
}

#jinji-place-hint .fa-arrow-pointer {
    color: #b8a86a;
    flex: none;
}

#jinji-place-cancel {
    pointer-events: auto;
    flex: none;
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease;
}

#jinji-place-cancel:hover {
    background: #4a4936;
}

/* 배치 모드 중 스테이지 — 통합 코드가 #jinji-stage에 .placing 토글 */
#jinji-stage.placing {
    border-color: #b8a86a;
    box-shadow: 0 0 0 2px rgba(184, 168, 106, 0.35);
}

#jinji-stage.placing canvas {
    cursor: crosshair;
}

/* ── M5: 구매공간(화면 하단 확장 영역) 보기 상태 — 통합 코드가 .space-home 토글 ── */
#jinji-stage.space-home {
    border-color: #5f8f52;
}

/* 전투/구매공간 전환 버튼 공용 스타일(클래스 훅 — 생성·배선은 통합 코드) */
.jinji-space-toggle {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.jinji-space-toggle:hover {
    background: #4a4936;
    border-color: #6c6a4e;
}

/* ── M5: 상점 배치 배지 ─────────────────────────────── */
.shop-badge-placed {
    color: #7ddb8a;
    font-weight: 700;
}

/* ── 모바일 보정 ─────────────────────────────────────── */
@media (max-width: 640px) {
    #jinji-game-frame {
        padding: 6px;
        border-radius: 8px;
    }

    #jinji-hud {
        font-size: 12px;
        padding: 6px 8px;
    }

    .hud-bars {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .overlay-title {
        font-size: 20px;
    }

    .jinji-modal {
        padding: 8px;
    }

    .jinji-modal-panel {
        max-height: 88vh;
    }

    #shop-list {
        grid-template-columns: 1fr;
    }

    #btn-shop span {
        display: none; /* 모바일은 아이콘만 */
    }

    /* M5 — 모바일 계절 배지·배치 안내 축소 */
    .hud-season {
        font-size: 11px;
        padding: 1px 8px;
    }

    #jinji-place-hint {
        font-size: 11.5px;
        gap: 8px;
        padding: 6px 10px;
    }
}

/* ── M6: HUD 설정 버튼 (#btn-shop 톤 공유 — 아이콘 전용) ── */
#btn-settings {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}

#btn-settings:hover {
    background: #4a4936;
    border-color: #6c6a4e;
}

#btn-settings .fa-gear {
    color: #b8a86a;
}

/* ── M6: 설정 모달 (공용 .jinji-modal 골격 + 좁은 패널) ── */
.jinji-settings-panel {
    width: min(440px, 94vw);
}

.jinji-settings-panel .fa-gear {
    color: #b8a86a;
}

#settings-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.settings-label {
    color: #b5b09a;
    font-weight: 700;
    white-space: nowrap;
    flex: none;
}

.settings-volume-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 240px;
    min-width: 0;
}

#settings-volume {
    flex: 1;
    min-width: 0;
    accent-color: #6366f1;
    cursor: pointer;
}

#settings-volume-val {
    width: 40px;
    text-align: right;
    color: #f0ecd8;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex: none;
}

#settings-mute {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    cursor: pointer;
}

.settings-seg {
    display: flex;
    gap: 6px;
}

.settings-seg button {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    color: #b5b09a;
    border-radius: 8px;
    padding: 4px 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.settings-seg button:hover:not(.active) {
    background: #333326;
    color: #f0ecd8;
}

.settings-seg button.active {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    border-color: transparent;
    color: #fff;
}

#settings-language {
    background: #17170f;
    color: #f0ecd8;
    border: 1px solid #3a3a2c;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12.5px;
    cursor: pointer;
}

.settings-row-logout {
    justify-content: flex-end;
    border-top: 1px solid #3a3a2c;
    padding-top: 14px;
}

/* ── M6: 오버레이 로그인 폼 ─────────────────────────────── */
.overlay-login {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto 4px;
    max-width: 280px;
    text-align: left;
}

.overlay-login input {
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    color: #f0ecd8;
    padding: 9px 12px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.12s ease;
}

.overlay-login input:focus {
    border-color: #6366f1;
}

.overlay-login input::placeholder {
    color: #8f8b75;
}

#login-error {
    margin: 0;
    color: #ffb3b6;
    font-size: 12px;
    line-height: 1.5;
}

#login-error[hidden] {
    display: none;
}

#btn-login {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

#btn-login:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

/* "또는" 구분선 */
.overlay-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 280px;
    margin: 10px auto;
    color: #8f8b75;
    font-size: 11.5px;
    white-space: nowrap;
}

.overlay-divider::before,
.overlay-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #3a3a2c;
}

/* 게스트 버튼 — 로그인 폼이 주가 되며 보조 톤으로 (기존 #btn-start 규칙을 덮어씀) */
#jinji-overlay #btn-start {
    background: #3a3a2c;
    border: 1px solid #55543e;
    box-shadow: none;
    font-size: 14px;
    padding: 9px 28px;
}

#jinji-overlay #btn-start:hover {
    background: #4a4936;
    border-color: #6c6a4e;
    transform: none;
    box-shadow: none;
}

/* ── M6: 모바일 보정 ────────────────────────────────────── */
@media (max-width: 640px) {
    #settings-body {
        padding: 12px 14px 14px;
        gap: 13px;
    }

    .settings-volume-wrap {
        max-width: 180px;
    }

    .overlay-login,
    .overlay-divider {
        max-width: 240px;
    }
}

/* ── M7: 멀티 진입 (오버레이 — 게스트 버튼 보조 톤 공유) ── */
#btn-multi {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 28px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

#btn-multi:hover {
    background: #4a4936;
    border-color: #6c6a4e;
}

#btn-multi .fa-users {
    color: #b8a86a;
}

#jinji-multi-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 280px;
    margin: 10px auto 0;
}

#jinji-multi-form[hidden] {
    display: none;
}

#btn-room-create {
    background: linear-gradient(180deg, #6366f1, #4b4ddb);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    padding: 8px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#btn-room-create:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

#btn-room-create:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

#jinji-room-join-form {
    display: flex;
    gap: 8px;
}

#room-code-input {
    flex: 1;
    min-width: 0;
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    color: #f0ecd8;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    outline: none;
    transition: border-color 0.12s ease;
}

#room-code-input:focus {
    border-color: #6366f1;
}

#room-code-input::placeholder {
    color: #8f8b75;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

#btn-room-join {
    flex: none;
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease;
}

#btn-room-join:hover:not(:disabled) {
    background: #4a4936;
}

#btn-room-join:disabled,
#room-code-input:disabled {
    opacity: 0.55;
    cursor: default;
}

#room-error {
    margin: 0;
    color: #ffb3b6;
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
}

#room-error[hidden] {
    display: none;
}

/* ── M7: 방 패널 (#jinji-hud 옆 — HUD 톤 공유, 기본 hidden) ── */
#jinji-room-panel {
    background: #2a2a20;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: #d8d4c0;
    font-size: 13px;
    user-select: none;
}

#jinji-room-panel[hidden] {
    display: none;
}

.room-panel-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.room-panel-title {
    color: #f0ecd8;
    font-weight: 800;
    white-space: nowrap;
}

.room-panel-title .fa-users {
    color: #b8a86a;
}

.room-code-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.room-code-label {
    color: #8f8b75;
    font-size: 12px;
    white-space: nowrap;
}

#room-code-text {
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 6px;
    padding: 2px 10px;
    color: #d9b64f;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.22em;
    user-select: all;
}

#room-code-copy {
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

#room-code-copy:hover {
    background: #4a4936;
    border-color: #6c6a4e;
}

#btn-room-leave {
    margin-left: auto;
    background: #3a3a2c;
    color: #f0ecd8;
    border: 1px solid #55543e;
    border-radius: 6px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

#btn-room-leave:hover:not(:disabled) {
    background: #4a3030;
    border-color: #e5484d;
    color: #ffd7d8;
}

#btn-room-leave:disabled,
#room-code-copy:disabled {
    opacity: 0.55;
    cursor: default;
}

/* 멤버 리스트 — 슬롯 칩(이름·실버·레벨·킬, seat 배지) */
#room-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.room-member {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #17170f;
    border: 1px solid #3a3a2c;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.room-member.self {
    border-color: #6366f1;
}

.room-member-seat {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3a3a2c;
    color: #f0ecd8;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.room-member.self .room-member-seat {
    background: #6366f1;
}

.room-member-name {
    color: #f0ecd8;
    font-weight: 700;
    max-width: 9em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-member-you {
    color: #8f8b75;
    font-weight: 400;
    font-size: 11px;
}

.room-member-stat {
    color: #cfc9ae;
    font-variant-numeric: tabular-nums;
}

.room-member-stat .fa-coins {
    color: #c9c9c9;
}

.room-member-stat .fa-skull {
    color: #8f8b75;
}

.room-members-empty {
    color: #8f8b75;
    font-size: 12px;
    padding: 2px 0;
}

/* ── M7: 이벤트 토스트 (#jinji-toast — 스테이지 우상단 오버레이, 상한 3개) ── */
#jinji-toast {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 7; /* 배치 안내(6) 위, 시작 오버레이(10) 아래 */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    max-width: 70%;
    pointer-events: none;
}

.jinji-toast-item {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(20, 18, 12, 0.88);
    border: 1px solid #55543e;
    border-left: 3px solid #b8a86a;
    border-radius: 8px;
    padding: 6px 12px;
    color: #f0ecd8;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    animation: jinji-toast-in 0.18s ease-out;
}

.jinji-toast-item.out {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes jinji-toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* ── M7: 모바일 보정 ────────────────────────────────────── */
@media (max-width: 640px) {
    #jinji-multi-form {
        max-width: 240px;
    }

    #jinji-room-panel {
        font-size: 12px;
        padding: 6px 8px;
    }

    #room-code-text {
        font-size: 12.5px;
        letter-spacing: 0.16em;
    }

    #btn-room-leave span {
        display: none; /* 모바일은 아이콘만 */
    }

    .jinji-toast-item {
        font-size: 11px;
        padding: 5px 10px;
    }
}
