@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic+Coding:wght@400;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #050505;
    color: #dfdfdf;
    font-family: 'Nanum Gothic Coding', monospace;
    height: 100vh;
    margin: 0;
    overflow: hidden; /* body 레벨에서 스크롤 완벽 차단 */
    display: flex;
    justify-content: center;
    align-items: center;
}

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #111; 
}
::-webkit-scrollbar-thumb {
    background: #444; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

/* 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #111;
    border: 1px solid #333;
    padding: 40px;
    width: 360px;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    text-align: center;
}

.game-title {
    font-size: 28px;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 15px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #aaa;
}

.input-group input {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: #666;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #ccc;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn:hover {
    background: #2a2a2a;
    border-color: #666;
    color: #fff;
}

.btn:disabled {
    background: #0a0a0a;
    border-color: #222;
    color: #444;
    cursor: not-allowed;
}

.auth-message {
    margin-top: 15px;
    font-size: 13px;
    color: #ff5555;
    min-height: 15px;
}

.auth-message.auth-kicked {
    font-weight: 600;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* 캐릭터 선택 */
.char-select-modal {
    width: min(720px, 92vw);
    max-width: 720px;
}

.char-slot-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 16px;
}

.char-slot {
    min-height: 140px;
    padding: 14px 10px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0a0a0a;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.char-slot:hover {
    border-color: #666;
    background: #141414;
    transform: translateY(-2px);
}

.char-slot.empty {
    border-style: dashed;
    color: #888;
}

.char-slot.empty:hover {
    border-color: #c5a86a;
    color: #e8d5a8;
}

.char-slot-index {
    font-size: 11px;
    color: #666;
}

.char-slot-name {
    font-size: 15px;
    color: #ffd54f;
    font-weight: 700;
}

.char-slot-meta {
    font-size: 12px;
    color: #9aa8b8;
}

.char-slot-create {
    font-size: 13px;
    color: #8aa0b8;
}

.char-select-logout {
    margin-top: 8px;
    max-width: 160px;
}

.btn-logout {
    border-color: #6a3a3a;
    color: #f0c0c0;
}

.btn-logout:hover {
    border-color: #a05050;
    background: #2a1515;
}

@media (max-width: 720px) {
    .char-slot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 캐릭터 생성 */
.char-create-modal {
    width: min(560px, 92vw);
    text-align: left;
}

.char-create-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.char-create-prologue {
    min-height: 120px;
    padding: 16px;
    background: #080808;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #cfcfcf;
    line-height: 1.7;
    white-space: pre-wrap;
}

.char-create-hint {
    color: #9aa8b8;
    font-size: 14px;
    line-height: 1.6;
}

.char-create-skip,
.char-create-back {
    align-self: flex-end;
}

.char-class-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.char-class-card {
    text-align: left;
    padding: 12px 14px;
    background: #101010;
    border: 1px solid #333;
    border-radius: 6px;
    color: #ddd;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.char-class-card strong {
    display: block;
    color: #ffd54f;
    margin-bottom: 4px;
}

.char-class-card span {
    font-size: 12px;
    color: #8aa0b8;
}

.char-class-card:hover {
    border-color: #c5a86a;
    background: #17130d;
}

.char-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.char-stat-grid div {
    padding: 12px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-stat-grid strong {
    color: #69f0ae;
    font-size: 20px;
}

.char-create-stat-total {
    text-align: center;
    color: #c5a86a;
    font-size: 13px;
}

/* 3분할 그리드 레이아웃 */
#gameContainer {
    width: 100%;
    height: 100vh; /* 화면 꽉 차게 고정 */
    max-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 15px;
    padding: 15px;
    max-width: 1600px;
    overflow: hidden; /* 컨테이너 자체가 늘어나지 않게 고정 */
}

.left-panel, .right-panel {
    background: #0d0d0d;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 20px;
    overflow-y: auto; /* 내용이 넘치면 스크롤 */
}

.minimap-section {
    min-height: 0;
}

.minimap-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.minimap-section-header h3 {
    margin: 0;
}

.online-players-badge {
    flex-shrink: 0;
    border: 1px solid #3a5a40;
    background: rgba(34, 80, 50, 0.35);
    color: #9ee0a8;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.online-players-badge:hover {
    background: rgba(50, 110, 70, 0.5);
    border-color: #5a9a60;
    color: #c8f0cc;
}

.online-players-modal {
    max-width: 420px;
    width: 92%;
}

.online-players-desc {
    color: #8899aa;
    font-size: 13px;
    margin: 0 0 10px;
}

.online-players-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #2a3544;
    border-radius: 6px;
    background: #0a0e14;
}

.online-players-list li {
    padding: 8px 12px;
    border-bottom: 1px solid #1a2430;
    color: #c8d4e0;
    font-size: 13px;
    font-family: 'Consolas', 'Courier New', monospace;
}

.online-players-list li:last-child {
    border-bottom: none;
}

.online-players-list li.empty-hint {
    color: #667788;
    font-style: italic;
    text-align: center;
}

.minimap-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #080a0e;
    border: 1px solid #2a3544;
    border-radius: 6px;
    padding: 8px;
}

#minimap {
    display: block;
    width: 100%;
    max-width: 250px;
    height: auto;
    image-rendering: pixelated;
}

.minimap-hint {
    font-size: 11px;
    color: #667788;
    text-align: center;
    margin-top: 4px;
}

.inventory-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.inventory-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.inventory-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 88vw);
    height: 100vh;
    background: #0d0d0d;
    border-left: 1px solid #333;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.6);
    z-index: 910;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.inventory-sidebar.open {
    transform: translateX(0);
}

.inventory-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.inventory-sidebar-header h3 {
    margin: 0;
    border: none;
    padding: 0;
}

.btn-close-inventory {
    flex: 0 0 auto;
    width: auto;
    min-width: 36px;
    padding: 6px 10px;
    font-size: 14px;
}

.inventory-sidebar .inventory-list {
    max-height: 50vh;
}

.center-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    height: 100%; /* 중앙 패널 높이 고정 */
    overflow: hidden; /* 영역 밖으로 삐져나가는 것 강제 차단 */
}

.center-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 0 2px;
    gap: 8px;
}

.center-panel-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-map,
.btn-map-editor {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    padding: 6px 14px;
    font-size: 13px;
    letter-spacing: 0;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flex-grow {
    flex-grow: 1;
}

h3 {
    font-size: 16px;
    color: #ccc;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

/* 캐릭터 상태창 스타일 */
.char-info p {
    margin-bottom: 5px;
    color: #aaa;
}

.bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 5px;
}

.bar-label {
    min-width: 38px;
    flex-shrink: 0;
    white-space: nowrap;
    color: #888;
}

.bar-label.has-tooltip {
    cursor: help;
    border-bottom: 1px dotted #555;
    color: #bbb;
}

.bar-bg {
    flex: 1 1 0;
    min-width: 0;
    height: 12px;
    background: #222;
    border: 1px solid #111;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease-out;
}

.hp-fill { background: #b33a3a; }
.mp-fill { background: #3a5cb3; }
.focus-fill { background: #c9a227; }

.bar-text {
    min-width: 76px;
    flex-shrink: 0;
    text-align: right;
    color: #aaa;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #111;
    padding: 10px;
    border: 1px solid #222;
    margin-top: 10px;
    color: #999;
}

.stat-val { color: #fff; }

.combat-stats-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    background: #141414;
    border: 1px solid #2a2a2a;
    color: #9ab;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}

.combat-stats-toggle:hover {
    border-color: #3a4a5a;
    color: #cde;
}

.combat-stats-toggle.is-open {
    border-color: #3a5060;
    color: #cde;
}

.combat-stats-toggle-icon {
    display: inline-block;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.combat-stats-toggle.is-open .combat-stats-toggle-icon {
    transform: rotate(-180deg);
}

.combat-stats-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
    border: 1px solid #222;
    border-top: none;
    background: #0d0d0d;
}

.combat-stats-panel.is-open {
    grid-template-rows: 1fr;
}

.combat-stats-panel[hidden] {
    display: none;
}

.combat-stats-panel.is-open[hidden] {
    display: grid;
}

.combat-stats-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 10px;
    transition: padding 0.25s ease;
}

.combat-stats-panel.is-open .combat-stats-inner {
    padding: 8px 10px 10px;
}

.combat-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    color: #999;
    font-size: 12px;
    border-bottom: 1px solid #1a1a1a;
}

.combat-stat-row:last-child {
    border-bottom: none;
}

.stat-bonus {
    color: #6dca7a;
    font-weight: normal;
    margin-left: 4px;
}

.text-success {
    color: #6dca7a;
}

/* 스탯 라벨 툴팁 */
.stat-label {
    color: #bbb;
    border-bottom: 1px dotted #555;
    cursor: help;
}

.has-tooltip {
    position: relative;
}

.stat-tooltip-float {
    position: fixed;
    max-width: 260px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #1e2433 0%, #141820 100%);
    color: #e8ecf4;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid #4a6080;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
    white-space: normal;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 10000;
}

.stat-tooltip-float.visible {
    opacity: 1;
    visibility: visible;
}

.stat-tooltip-float.item-tooltip {
    max-width: 280px;
    padding: 12px 14px;
}

.item-tip-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.item-tip-meta {
    color: #9aa8bc;
    font-size: 11px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.item-tip-stats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}

.item-tip-stat {
    font-size: 12px;
    color: #d8e0ec;
}

.item-tip-stat-bonus {
    color: #7dcea0;
}

.item-tip-bonus-tag {
    color: #5a9e72;
    font-size: 10px;
}

.item-tip-empty {
    color: #666;
    font-size: 11px;
}

.item-tip-desc {
    color: #8a96a8;
    font-size: 11px;
    margin-top: 4px;
    line-height: 1.4;
}

.item-tip-hint {
    color: #555;
    font-size: 10px;
    margin-top: 8px;
    border-top: 1px solid #333;
    padding-top: 6px;
}

.item-rarity-normal { color: #e8ecf4; }
.item-rarity-magic { color: #6fcf97; }
.item-rarity-rare { color: #5dade2; }
.item-rarity-epic { color: #bb8fce; }
.item-rarity-mythic { color: #f4d03f; }

.equip-slot.has-tooltip {
    border-bottom: 1px dotted #555;
}

.equip-rarity-normal { color: #e8ecf4 !important; }
.equip-rarity-magic { color: #6fcf97 !important; }
.equip-rarity-rare { color: #5dade2 !important; }
.equip-rarity-epic { color: #bb8fce !important; }
.equip-rarity-mythic { color: #f4d03f !important; }

.equipment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #888;
}

.empty-slot {
    color: #555;
}

/* 방 정보 (상단 고정 패널) */
.room-info {
    background: #0d0f14;
    border: 1px solid #2a3344;
    padding: 12px;
}

/* 전투 VS 체력 프레임 — 자리 고정, 내용만 교체 (출렁임 방지) */
.combat-vs-frame {
    margin: 6px 0 0;
    border: 1px solid #2a3038;
    background: linear-gradient(180deg, #14181e 0%, #10141a 100%);
}

.combat-vs-frame.is-active {
    border-color: #3a2a2a;
    background: linear-gradient(180deg, #1a1214 0%, #120e10 100%);
}

.combat-vs-frame.is-idle {
    border-color: #252a32;
    opacity: 0.85;
}

.combat-vs-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: 52px;
    box-sizing: border-box;
}

.combat-vs-side {
    flex: 1;
    min-width: 0;
}

.combat-vs-self .combat-vs-name {
    color: #9ec9ff;
}

.combat-vs-target .combat-vs-name {
    color: #ffb0a0;
    text-align: right;
}

.combat-vs-frame.is-idle .combat-vs-target .combat-vs-name {
    color: #667788;
}

.combat-vs-name {
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.combat-vs-bar-bg {
    height: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 2px;
    overflow: hidden;
}

.combat-vs-bar-fill {
    height: 100%;
    width: 0%;
    /* 피해로 깎일 때만 부드럽게 — 전투 시작 시 차오름은 JS에서 transition 끄고 즉시 세팅 */
    transition: width 0.15s ease;
}

.combat-vs-bar-fill.no-transition {
    transition: none !important;
}

.combat-vs-bar-self {
    background: linear-gradient(90deg, #8a3030, #c44);
}

.combat-vs-bar-target {
    background: linear-gradient(90deg, #a05020, #e08030);
}

.combat-vs-frame.is-idle .combat-vs-bar-target {
    background: #2a3038;
}

.combat-vs-hp {
    margin-top: 3px;
    font-size: 11px;
    color: #aaa;
    font-variant-numeric: tabular-nums;
}

.combat-vs-target .combat-vs-hp {
    text-align: right;
}

.combat-vs-frame.is-idle .combat-vs-target .combat-vs-hp {
    color: #556677;
}

.combat-vs-center {
    flex-shrink: 0;
    width: 36px;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #667788;
    letter-spacing: 0.04em;
}

.combat-vs-frame.is-active .combat-vs-center {
    color: #c9a227;
}

@media (max-width: 720px) {
    .combat-vs-inner {
        gap: 6px;
        padding-left: 8px;
        padding-right: 8px;
    }
    .combat-vs-center {
        width: 28px;
        font-size: 11px;
    }
}

.room-scene-view {
    width: 100%;
}

.room-scene-card {
    background: linear-gradient(165deg, #1a2233 0%, #12161f 55%, #0f1218 100%);
    border: 1px solid #3d4f66;
    border-radius: 8px;
    padding: 18px 20px 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 6px 18px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    position: relative;
}

.room-scene-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #5a7a9a, transparent);
    opacity: 0.7;
}

.room-scene-safe {
    border-color: #3d5c4a;
    box-shadow:
        inset 0 1px 0 rgba(180, 220, 180, 0.08),
        0 6px 18px rgba(0, 0, 0, 0.45),
        0 0 24px rgba(72, 140, 96, 0.12);
}

.room-scene-safe::before {
    background: linear-gradient(90deg, transparent, #6aaa7a, transparent);
}

.room-scene-forest .room-scene-art pre { color: #7cb87c; text-shadow: 0 0 8px rgba(100, 180, 100, 0.25); }
.room-scene-cave .room-scene-art pre { color: #9a8ac8; text-shadow: 0 0 8px rgba(140, 120, 200, 0.25); }
.room-scene-town .room-scene-art pre { color: #8ab4d4; text-shadow: 0 0 8px rgba(120, 170, 220, 0.2); }

.room-scene-art {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
    padding: 8px 0 4px;
}

.room-scene-art pre {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.15;
    text-align: left;
    background: transparent;
    border: none;
    color: #8ab4d4;
}

.room-scene-title {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.room-scene-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: #7a8a9a;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.room-scene-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #ffd54f;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.room-scene-safe .room-scene-name {
    color: #a8e6a0;
}

.room-scene-desc {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

.room-scene-desc-line {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.65;
    color: #b8c6d4;
    word-break: keep-all;
}

.room-scene-desc-line:last-child {
    margin-bottom: 0;
}

.room-scene-empty {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-scene-empty-text {
    margin: 0;
    color: #666;
    font-size: 13px;
}

.room-exit-compass-wrap {
    margin: 6px auto 10px;
    width: 100%;
    overflow-x: auto;
}

.exit-compass {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto auto;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px 20px;
    width: max-content;
    max-width: 100%;
    margin: 12px auto;
    padding: 0 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.2;
}

.exit-north {
    grid-column: 2;
    grid-row: 1;
    color: #b8e8a0;
    justify-self: center;
}

.exit-west {
    grid-column: 1;
    grid-row: 2;
    color: #b8e8a0;
    justify-self: end;
}

.exit-center {
    grid-column: 2;
    grid-row: 2;
    color: #ffd54f;
    font-weight: bold;
    font-size: 15px;
    justify-self: center;
}

.exit-east {
    grid-column: 3;
    grid-row: 2;
    color: #b8e8a0;
    justify-self: start;
}

.exit-south {
    grid-column: 2;
    grid-row: 3;
    color: #b8e8a0;
    justify-self: center;
}

.exit-north,
.exit-west,
.exit-east,
.exit-south,
.exit-center {
    white-space: nowrap;
    padding: 2px 4px;
}

.exit-compass-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.exit-vertical {
    color: #9ec8e8;
    white-space: nowrap;
}

.exit-compass-empty {
    text-align: center;
    color: #666;
    font-family: monospace;
    font-size: 12px;
    margin: 10px auto;
}

.room-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #888;
    background: #0a0a0a;
    padding: 10px;
    border: 1px solid #222;
    font-family: monospace;
    margin-top: 10px;
    text-align: left;
}

.room-detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.room-detail-label {
    font-size: 12px;
    color: #666;
}

.room-entities-list,
.room-items-list {
    min-height: 1.2em;
}

.room-entities-list.has-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.entity-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #333;
    background: #141414;
    font-family: inherit;
    line-height: 1.3;
}

.entity-chip-monster {
    cursor: pointer;
    border-color: #4a3828;
    background: #1a1510;
    transition: border-color 0.15s, background 0.15s;
}

.entity-chip-monster:hover {
    border-color: #8a6840;
    background: #241c14;
}

.entity-chip-monster.entity-chip-combat {
    border-color: #8a4040;
    background: #1f1212;
}

.entity-chip-player {
    border-color: #2a3a4a;
    background: #101820;
}

.entity-chip-npc {
    cursor: pointer;
    border-color: #5a4a28;
    background: #1a1810;
    transition: border-color 0.15s, background 0.15s;
}

.entity-chip-npc:hover {
    border-color: #c0a050;
    background: #242010;
}

.entity-chip-npc .entity-chip-name {
    color: #e0c878;
}

.entity-chip-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.entity-chip-name.entity-lv-white { color: #f0f0f0; }
.entity-chip-name.entity-lv-green { color: #5dff7a; }
.entity-chip-name.entity-lv-orange { color: #ffa040; }
.entity-chip-name.entity-lv-red { color: #c62828; font-weight: 600; }
.entity-chip-name.entity-lv-unknown { color: #e8c8a0; }

.entity-chip-player .entity-chip-name {
    color: #9ec8e8;
}

.entity-chip-level {
    flex-shrink: 0;
    min-width: 1.6em;
    padding: 1px 6px;
    border-radius: 3px;
    background: #2a2218;
    color: #d4b87a;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.entity-chip-combat-icon {
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1;
}

/* 터미널 탭 + 로그 영역 */
.terminal-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terminal-tabs {
    display: flex;
    gap: 4px;
    background: #111;
    border: 1px solid #333;
    border-bottom: none;
    padding: 6px 8px 0;
}

.terminal-tab {
    flex: 1;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    color: #888;
    background: #1a1a1a;
    border: 1px solid #333;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.terminal-tab:hover {
    color: #ccc;
    background: #222;
}

.terminal-tab.active {
    color: #fff;
    background: #0a0a0a;
    border-color: #444;
    border-bottom: 1px solid #0a0a0a;
    margin-bottom: -1px;
    font-weight: bold;
}

/* 터미널 스타일 */
.terminal {
    flex: 1; /* 남은 공간 모두 차지 */
    min-height: 0; /* flex-item이 부모 영역을 넘어가지 않도록 방어 */
    height: 100%; /* 명시적 높이 지정 */
    background: #0a0a0a;
    border: 1px solid #333;
    border-top: none;
    padding: 15px;
    overflow-y: auto; /* 터미널 내부에서만 스크롤 되도록 설정 */
    line-height: 1.8;
    font-size: 15px;
    word-break: break-all;
}

.terminal p.log-hidden {
    display: none;
}

.terminal p {
    margin: 4px 0;
}

.input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #111;
    border: 1px solid #333;
    padding: 10px 15px;
}

.btn-auto-hunt {
    flex-shrink: 0;
    margin-left: auto;
    padding: 4px 8px;
    font-size: 11px;
    background: #1a1a1a;
    color: #888;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-auto-hunt:hover {
    background: #252525;
    color: #ccc;
}

.btn-auto-hunt.active {
    background: #1a3a1a;
    color: #55ff55;
    border-color: #338833;
    box-shadow: 0 0 8px rgba(85, 255, 85, 0.25);
}

.btn-auto-hunt.active:hover {
    background: #224422;
}

.prompt-char {
    color: #888;
    margin-right: 10px;
    font-weight: bold;
}

#commandInput {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

/* 우측 패널 (인벤토리) */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.bag-count {
    font-size: 12px;
    color: #777;
}

.money-container {
    background: #151500;
    border: 1px solid #330;
    padding: 8px;
    text-align: right;
    color: #aaa;
}

.highlight-money {
    font-weight: bold;
}

.money-gold {
    color: #ffd54f;
    font-weight: bold;
}

.money-silver {
    color: #c0c8d0;
    font-weight: bold;
}

.money-copper {
    color: #cd7f32;
    font-weight: bold;
}

.inventory-list {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
    background: #0a0a0a;
    border: 1px solid #222;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.inventory-list li {
    padding: 5px;
    color: #ccc;
    border-bottom: 1px dashed #222;
}

.inventory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.inventory-item-name {
    flex: 1;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-item-name:hover {
    color: #fff;
}

.inventory-list li:hover {
    background: #1a1a1a;
}

.btn-inventory-drop {
    flex-shrink: 0;
    padding: 2px 8px;
    font-size: 11px;
    background: #2a1515;
    color: #ff8888;
    border: 1px solid #552222;
    border-radius: 3px;
    cursor: pointer;
}

.btn-inventory-drop:hover {
    background: #3a1a1a;
    color: #ffaaaa;
    border-color: #773333;
}

.inventory-guide {
    font-size: 11px;
    color: #555;
    margin-top: 10px;
}

/* 무공 / 버프 UI */
.skills-list {
    list-style: none;
    font-size: 12px;
    max-height: 220px;
    overflow-y: auto;
}

.skills-list li,
.skills-list .skill-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #1a1a1a;
    color: #bbb;
}

.skill-item-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    flex: 1;
    cursor: help;
}

.skill-item-name {
    color: #ddd;
}

.skill-item-level {
    color: #666;
    font-size: 11px;
}

.skill-item-cd {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 3px;
    background: #3a2020;
    border: 1px solid #6a3030;
    color: #f88;
    font-size: 11px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.skill-item.is-cooldown .skill-item-name {
    color: #888;
}

.skill-auto-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    font-size: 11px;
    color: #9ab;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.skill-auto-toggle input {
    cursor: pointer;
    accent-color: #6a9;
}

.skill-type-active { color: #ff8888; }
.skill-type-buff { color: #88aaff; }
.skill-type-passive { color: #aaff88; }

.skill-tip-title {
    font-weight: bold;
    color: #ffe08a;
    margin-bottom: 4px;
}

.skill-tip-type {
    font-size: 11px;
    color: #8ab;
    margin-bottom: 6px;
}

.skill-tip-desc {
    color: #ccc;
    margin-bottom: 8px;
    line-height: 1.35;
}

.skill-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.skill-tip-row b {
    color: #ddd;
    font-weight: normal;
}

.buff-section {
    flex-shrink: 0;
}

.buff-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 36px;
}

.buff-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1a1a2e;
    border: 1px solid #334;
    border-radius: 4px;
    padding: 4px 8px;
    min-width: 64px;
    color: inherit;
    font: inherit;
}

.buff-icon.is-clickable {
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.buff-icon.is-clickable:hover {
    border-color: #668;
    background: #222240;
}

.buff-icon.is-clickable:hover::after {
    content: '해제';
    display: block;
    font-size: 9px;
    color: #f88;
    margin-top: 1px;
}

.buff-icon-name {
    font-size: 11px;
    color: #aac;
    white-space: nowrap;
}

.buff-icon-time {
    font-size: 10px;
    color: #6af;
    font-weight: bold;
}

.empty-hint {
    color: #555;
    font-size: 12px;
}

/* 텍스트 색상 클래스 */
.msg-system { color: #55ff55; font-weight: bold; }
.msg-error { color: #ff5555; }
.msg-normal { color: #cccccc; }
.msg-italic { color: #888888; font-style: italic; }
.msg-bold { color: #ffffff; font-weight: bold; }
.msg-title { color: #ffff55; font-weight: bold; font-size: 1.1em; margin-top: 10px; }
.msg-stat { color: #55ffff; }

.highlight { color: #fff; }
.highlight-exit { color: #00bfff; }
.highlight-item { color: #32cd32; }

.ground-item-link {
    color: #32cd32;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ground-item-link:hover {
    color: #6fff6f;
}

/* 월드맵 모달 */
.map-modal-content {
    width: min(860px, 92vw);
    height: min(640px, 88vh);
    max-width: 860px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.map-modal-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-modal-title {
    color: #fff;
    font-size: 20px;
    margin: 0;
}

.map-zone-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.map-zone-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    padding: 5px 12px;
    font-size: 12px;
    white-space: nowrap;
    background: #151820;
    border: 1px solid #333;
    color: #9aa8bc;
}

.map-zone-btn:hover {
    background: #1e2430;
    border-color: #4a6080;
    color: #dce4f0;
}

.map-zone-btn.active {
    background: #243040;
    border-color: #5a80a8;
    color: #fff;
}

.map-canvas-wrap {
    flex: 1;
    min-height: 280px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
}

.map-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: #888;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.map-legend-dot.player { background: #ff4444; }
.map-legend-dot.safe { background: #3399ff; border-radius: 2px; }
.map-legend-dot.normal { background: #777; border-radius: 2px; width: 6px; height: 6px; }
.map-legend-dot.portal {
    background: #e8a838;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid #e8a838;
    border-radius: 0;
}

.btn-map-close {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 0;
}

/* 맵 에디터 */
.map-editor-modal {
    width: min(1400px, 98vw);
    height: min(900px, 94vh);
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 10px;
}

.map-editor-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.map-editor-header h2 {
    margin: 0;
    color: #ffd54f;
    font-size: 18px;
}

.map-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.map-editor-toolbar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
}

.map-editor-viewer-close {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 13px;
}

/* ── 월드맵 Canvas 2D ── */
.world-map-modal {
    width: min(1100px, 96vw);
    max-width: 1100px;
    height: min(780px, 92vh);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: #0e141c;
    border: 1px solid #2a3a4c;
}

.world-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #243040;
    background: #121a24;
}

.world-map-title-block h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #e8eef6;
    letter-spacing: 0.02em;
}

.world-map-status {
    margin: 4px 0 0;
    font-size: 12px;
    color: #7a90a8;
}

.world-map-toolbar {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.world-map-toolbar .btn {
    min-width: 36px;
}

.world-map-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.world-map-canvas-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
    background: #0b1018;
}

#worldMapCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

#worldMapCanvas.panning {
    cursor: grabbing;
}

.world-map-legend {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 8px 12px;
    background: rgba(10, 16, 24, 0.78);
    border: 1px solid #2a3a4c;
    border-radius: 6px;
    font-size: 11px;
    color: #a8b8c8;
    pointer-events: none;
}

.world-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.wm-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid #fff;
}

.wm-dot.me { background: #ff2020; }
.wm-dot.party { background: #46b4ff; }
.wm-dot.leader { background: #50c878; }

.wm-swatch {
    display: inline-block;
    width: 12px;
    height: 9px;
    border-radius: 2px;
    border: 1px solid #5a7a6a;
}

.wm-swatch.safe { background: #284637; border-color: #6a9a7a; }
.wm-swatch.hunt { background: #203046; border-color: #4a6a90; }

.world-map-detail {
    width: 240px;
    flex-shrink: 0;
    padding: 16px;
    border-left: 1px solid #243040;
    background: #101820;
    overflow-y: auto;
    color: #c8d4e0;
}

.world-map-detail h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #f0f4f8;
}

.wm-detail-empty {
    color: #667788;
    font-size: 13px;
    margin: 0;
}

.wm-detail-meta {
    margin: 0 0 6px;
    font-size: 12px;
    color: #8aa0b8;
}

.wm-detail-desc {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #b8c8d8;
}

.wm-detail-me {
    margin: 12px 0 0;
    color: #ff8080;
    font-size: 13px;
    font-weight: 600;
}

.wm-detail-party {
    margin: 8px 0 0;
    color: #7ec8ff;
    font-size: 13px;
}

.world-map-tooltip {
    position: fixed;
    z-index: 1200;
    min-width: 140px;
    max-width: 240px;
    padding: 8px 10px;
    background: rgba(12, 18, 28, 0.94);
    border: 1px solid #3a5068;
    border-radius: 6px;
    color: #d8e4f0;
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.world-map-tooltip.hidden {
    display: none;
}

.world-map-tooltip strong {
    color: #fff;
    font-size: 13px;
}

.wm-tip-me { color: #ff9090; }
.wm-tip-party { color: #7ec8ff; }

@media (max-width: 720px) {
    .world-map-modal {
        height: min(92vh, 900px);
    }
    .world-map-body {
        flex-direction: column;
    }
    .world-map-detail {
        width: 100%;
        max-height: 140px;
        border-left: none;
        border-top: 1px solid #243040;
    }
    .world-map-header {
        flex-wrap: wrap;
    }
}

.map-editor-modal.viewer-mode .map-editor-body {
    min-height: 0;
}

.map-editor-modal.viewer-mode .map-editor-workspace {
    min-height: 600px;
}

.map-editor-modal.viewer-mode .map-node {
    pointer-events: none;
    cursor: default;
}

.map-node-meta-viewer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
}

.map-node-meta-viewer .map-node-id {
    color: #8aa0b8;
}

.map-node-meta-viewer .map-node-entry,
.map-node-meta-entry {
    color: #a8b8c8;
}

.map-node-meta-viewer .map-node-spawn,
.map-node-meta-spawn {
    color: #e8a85a;
}

.map-node-meta {
    color: #7a8a9a;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.25;
}

.map-node-meta-id {
    color: #6a7a8a;
    font-size: 0.9em;
}

.map-node.here {
    border-color: #ff4040;
    box-shadow: 0 0 0 calc(2px * var(--nz, 1)) rgba(255, 64, 64, 0.55);
    outline: calc(1px * var(--nz, 1)) solid rgba(255, 120, 120, 0.35);
}

.map-here-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(16px * var(--nz, 1));
    height: calc(16px * var(--nz, 1));
    margin-left: calc(-8px * var(--nz, 1));
    margin-top: calc(-8px * var(--nz, 1));
    border-radius: 50%;
    background: #ff2020;
    border: calc(2.5px * var(--nz, 1)) solid #fff;
    box-shadow:
        0 0 0 calc(4px * var(--nz, 1)) rgba(255, 40, 40, 0.35),
        0 0 calc(14px * var(--nz, 1)) rgba(255, 40, 40, 0.95);
    animation: map-here-pulse 1.1s ease-in-out infinite;
    z-index: 8;
    pointer-events: none;
}

@keyframes map-here-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow:
            0 0 0 calc(3px * var(--nz, 1)) rgba(255, 40, 40, 0.4),
            0 0 calc(12px * var(--nz, 1)) rgba(255, 40, 40, 0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        box-shadow:
            0 0 0 calc(7px * var(--nz, 1)) rgba(255, 40, 40, 0.2),
            0 0 calc(18px * var(--nz, 1)) rgba(255, 40, 40, 0.75);
    }
}

.map-party-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(11px * var(--nz, 1));
    height: calc(11px * var(--nz, 1));
    margin-left: calc(-5.5px * var(--nz, 1));
    margin-top: calc(-5.5px * var(--nz, 1));
    border-radius: 50%;
    background: #46b4ff;
    border: calc(1.5px * var(--nz, 1)) solid #fff;
    box-shadow: 0 0 calc(6px * var(--nz, 1)) rgba(70, 180, 255, 0.8);
    transform: rotate(var(--party-angle, 0deg)) translateY(calc(-18px * var(--nz, 1)));
    z-index: 7;
    pointer-events: none;
}

.map-party-dot.leader {
    background: #50c878;
    box-shadow: 0 0 calc(6px * var(--nz, 1)) rgba(80, 200, 120, 0.85);
}

.map-party-name {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%) rotate(calc(var(--party-angle, 0deg) * -1));
    white-space: nowrap;
    font-size: calc(9px * var(--nz, 1));
    color: #d8ecff;
    text-shadow: 0 0 3px #000, 0 1px 2px #000;
    pointer-events: none;
}

.map-node.has-party:not(.here) {
    border-color: #3a7a9a;
}

.btn-primary {
    background: #2d6a4f;
    border-color: #40916c;
}

.btn-primary:hover {
    background: #40916c;
}

.btn-danger {
    background: #5c2a2a;
    border-color: #8b3a3a;
    color: #ffcdd2;
}

.btn-danger:hover {
    background: #8b3a3a;
}

.btn-warning {
    background: #5a4a20;
    border-color: #c9a227;
    color: #f0e6c0;
}

.btn-warning:hover {
    background: #7a6428;
}

.map-editor-status {
    margin: 0;
    font-size: 12px;
    color: #8aa0b8;
}

.map-editor-status.error {
    color: #ff8a80;
}

.map-editor-body {
    flex: 1;
    display: flex;
    gap: 12px;
    min-height: 0;
}

.map-editor-workspace {
    flex: 1;
    position: relative;
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #0a0c10;
    border: 1px solid #333;
    border-radius: 6px;
    min-height: 500px;
    touch-action: none;
    cursor: grab;
}

.map-editor-workspace::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.map-editor-workspace.panning {
    cursor: grabbing;
}

.map-editor-viewport-inner {
    position: relative;
    min-width: 2400px;
    min-height: 1800px;
    background-color: #0a0c12;
    background-image:
        linear-gradient(to right, rgba(55, 72, 98, 0.14) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(55, 72, 98, 0.14) 1px, transparent 1px),
        linear-gradient(to right, rgba(75, 105, 145, 0.32) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(75, 105, 145, 0.32) 1px, transparent 1px);
    background-size: 30px 30px, 30px 30px, 150px 150px, 150px 150px;
}

.map-editor-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: visible;
}

.map-editor-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none !important;
    overflow: visible;
}

.map-node {
    position: absolute;
    background: linear-gradient(180deg, #1e2838 0%, #141a24 100%);
    border: 2px solid #4a6080;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
    pointer-events: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.map-node .map-node-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.map-node .map-node-meta {
    overflow: hidden;
}

.map-node.selected {
    border-color: #ffd54f;
    box-shadow: 0 0 12px rgba(255, 213, 79, 0.35);
    cursor: grab;
}

.map-node.selected-group {
    border-color: #7ec8ff;
    box-shadow: 0 0 10px rgba(126, 200, 255, 0.4);
    cursor: grab;
}

.map-node.grouped:not(.selected):not(.selected-group) {
    border-color: #6a5a9a;
    box-shadow: inset 0 0 0 1px rgba(106, 90, 154, 0.35);
}

.map-editor-selection-box {
    position: absolute;
    border: 1px dashed #7ec8ff;
    background: rgba(126, 200, 255, 0.12);
    pointer-events: none;
    z-index: 20;
    box-sizing: border-box;
}

.map-node.dragging {
    cursor: grabbing;
    z-index: 10;
}

.map-node.safe {
    border-color: #4a8060;
}

.map-node-title {
    font-weight: bold;
    color: #e8ecf4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.map-port {
    position: absolute;
    border-radius: 50%;
    border: 2px solid #6a8ab0;
    background: #1a2230;
    padding: 0;
    cursor: crosshair;
    z-index: 3;
    box-sizing: border-box;
}

.map-port-북 { top: calc(-7px * var(--nz, 1)); left: 50%; transform: translateX(-50%); }
.map-port-남 { bottom: calc(-7px * var(--nz, 1)); left: 50%; transform: translateX(-50%); }
.map-port-동 { right: calc(-7px * var(--nz, 1)); top: 50%; transform: translateY(-50%); }
.map-port-서 { left: calc(-7px * var(--nz, 1)); top: 50%; transform: translateY(-50%); }

.map-port.linked {
    background: #5a9fd4;
    border-color: #8ec8ff;
}

.map-link-line {
    stroke: #5a9fd4;
    opacity: 0.85;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.map-link-hit {
    stroke: transparent;
    pointer-events: stroke;
    cursor: pointer;
}

.map-link-line.selected {
    stroke: #ffd54f;
    opacity: 1;
}

.map-link-line.temp {
    stroke: #ffd54f;
    stroke-dasharray: 6 4;
    opacity: 0.9;
}

.map-editor-props {
    width: 220px;
    flex-shrink: 0;
    background: #141820;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.map-editor-props h3 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #ccc;
}

.map-editor-props label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: #999;
}

.map-editor-props input,
.map-editor-props textarea {
    background: #0d0f14;
    border: 1px solid #333;
    color: #eee;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.spawn-count-row .spawn-count-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.spawn-count-row .spawn-count-inputs input[type="number"] {
    flex: 1;
    min-width: 0;
}

.spawn-random-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 12px;
    color: #bbb;
    cursor: pointer;
}

.ai-dungeon-modal .spawn-count-row .spawn-count-inputs {
    margin-top: 4px;
}

.btn-map-editor {
    margin-left: 8px;
}

.btn-ai-dungeon {
    background: linear-gradient(135deg, #3a2a5c 0%, #2a3a5c 100%);
    border-color: #7a6aaa;
    color: #e8e0ff;
}

.ai-dungeon-modal {
    width: min(440px, 92vw);
    max-width: 440px;
}

.ai-dungeon-modal h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #e8e0ff;
}

.ai-dungeon-desc {
    margin: 0 0 14px;
    font-size: 12px;
    color: #9aa8b8;
    line-height: 1.5;
}

.ai-dungeon-modal label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #aab4c4;
}

.ai-dungeon-modal input {
    background: #0d0f14;
    border: 1px solid #333;
    color: #eee;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.ai-dungeon-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.ai-dungeon-error {
    min-height: 18px;
    margin: 8px 0 0;
    font-size: 12px;
    color: #ff6b6b;
}

.ai-dungeon-loading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    font-size: 13px;
    color: #b8c8e8;
}

.ai-dungeon-loading.hidden {
    display: none;
}

.ai-dungeon-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ai-dungeon-progress-meta {
    font-size: 11px;
    color: #7a8aa0;
}

.ai-dungeon-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(126, 200, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
}

.ai-dungeon-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #5a9fd4, #7ec8ff);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.ai-dungeon-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(126, 200, 255, 0.25);
    border-top-color: #7ec8ff;
    border-radius: 50%;
    animation: ai-dungeon-spin 0.8s linear infinite;
}

@keyframes ai-dungeon-spin {
    to { transform: rotate(360deg); }
}

.game-settings-modal,
.party-invite-modal {
    max-width: 420px;
}

.game-settings-desc,
.party-invite-text {
    color: #bbb;
    font-size: 13px;
    margin: 0 0 14px;
    line-height: 1.5;
}

.game-settings-hint {
    color: #888;
    font-size: 12px;
    margin: 8px 0 16px;
}

.settings-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    color: #ddd;
    font-size: 13px;
    cursor: pointer;
}

.player-context-menu {
    position: fixed;
    z-index: 12000;
    min-width: 150px;
    background: #161b24;
    border: 1px solid #4a6080;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-context-menu.hidden {
    display: none;
}

.player-context-item {
    background: transparent;
    border: none;
    color: #e8eef8;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.player-context-item:hover:not(:disabled) {
    background: rgba(126, 200, 255, 0.15);
}

.player-context-item:disabled {
    color: #777;
    cursor: not-allowed;
}

.entity-chip-clickable {
    cursor: pointer;
}

.entity-chip-clickable:hover {
    border-color: #7ec8ff;
    box-shadow: 0 0 8px rgba(126, 200, 255, 0.25);
}

.party-section {
    flex-shrink: 0;
}

.party-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.party-section-header h3 {
    margin: 0;
}

.party-follow-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 11px;
    color: #9eb4c8;
    cursor: pointer;
    user-select: none;
}

.party-follow-label.hidden {
    display: none;
}

.party-follow-label input {
    margin: 0;
    cursor: pointer;
}

.party-count-label {
    font-weight: 400;
    color: #8aa0b8;
    font-size: 12px;
}

.party-member-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}

.party-member-list .empty-hint {
    color: #666;
    font-size: 12px;
    padding: 4px 0;
}

.party-member-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #2a3344;
    background: #101820;
    color: #d8e4f0;
    font-size: 12px;
    text-align: left;
    font-family: inherit;
}

.party-member-item.is-self {
    cursor: default;
}

.party-member-item.is-clickable {
    cursor: pointer;
}

.party-member-item.is-clickable:hover {
    border-color: #7ec8ff;
    background: #152030;
}

.party-member-item.is-offline {
    opacity: 0.55;
}

.party-member-leader {
    flex-shrink: 0;
    color: #ffd54f;
    font-size: 11px;
}

.party-member-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.party-member-self-tag {
    flex-shrink: 0;
    color: #7ec8ff;
    font-size: 11px;
}