/* Dark Fantasy 잊혀진 신들의 탑 CSS Theme */
:root {
    --bg-dark: #0e0d13;
    --panel-bg: rgba(22, 20, 31, 0.85);
    --border-gold: #c8aa6e;
    --gold-bright: #f0e6d2;
    --text-primary: #e6e4eb;
    --text-muted: #9a98a6;
    --hp-red: #e74c3c;
    --mp-blue: #3498db;
    --exp-purple: #9b59b6;
    --accent-red: #c0392b;
}

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

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 50%, #1a1726 0%, #08070c 100%);
    color: var(--text-primary);
    font-family: 'Noto Sans KR', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, .game-title {
    font-family: 'Cinzel', serif;
    color: var(--border-gold);
    text-shadow: 0 0 10px rgba(200, 170, 110, 0.3);
}

/* Equipment rarity: colour, border-like glow, and progressively richer motion. */
.item-rarity {
    display: inline-block;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 0 3px;
    border-radius: 3px;
}

.rarity-common {
    color: #edf2f7;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.65);
}

.rarity-uncommon {
    color: #74f57a;
    text-shadow: 0 0 6px #1d9c3d, 0 0 12px rgba(70, 255, 110, 0.45);
}

.rarity-rare {
    color: #69b7ff;
    text-shadow: 0 0 5px #2375d9, 0 0 14px #2d9cff;
    animation: rarity-pulse 1.8s ease-in-out infinite;
}

.rarity-unique {
    color: #d28aff;
    text-shadow: 0 0 6px #7e2ac8, 0 0 16px #db74ff;
    animation: rarity-pulse 1.35s ease-in-out infinite;
}

.rarity-legendary {
    color: #ffe08a;
    background: linear-gradient(100deg, #ff7a18, #ffe486, #fff5c2, #ffc041, #ff7a18);
    background-size: 250% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 5px #ff8d1f) drop-shadow(0 0 12px rgba(255, 199, 70, 0.8));
    animation: legendary-shine 2.2s linear infinite;
}

.rarity-epic {
    color: #ff86fb;
    background: linear-gradient(100deg, #b014d6, #ff3df5, #ff9bfb, #ff3df5, #b014d6);
    background-size: 250% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 5px #ff3df5) drop-shadow(0 0 14px rgba(255, 61, 245, 0.85));
    animation: legendary-shine 1.8s linear infinite;
    font-weight: 900;
}

.levelup-banner {
    display: block;
    text-align: center;
    margin: 8px 0;
    padding: 10px 14px;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #fff3b0;
    background: linear-gradient(100deg, rgba(255, 122, 24, 0.12), rgba(255, 228, 134, 0.30), rgba(255, 122, 24, 0.12));
    border: 1px solid rgba(255, 196, 65, 0.6);
    border-radius: 10px;
    text-shadow: 0 0 10px #ffb300, 0 0 22px rgba(255, 196, 65, 0.9);
    box-shadow: 0 0 18px rgba(255, 180, 40, 0.4), inset 0 0 14px rgba(255, 196, 65, 0.18);
    animation: levelup-pop 0.5s ease-out, levelup-glow 1.4s ease-in-out infinite 0.5s;
}

/* Lv.1000 달성 / 환생(리모탈) — 최상급 화려한 배너 */
.maxlevel-banner {
    display: block;
    text-align: center;
    margin: 12px 0;
    padding: 16px 18px;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(110deg,
        rgba(255,0,128,0.22), rgba(255,170,0,0.28), rgba(80,255,120,0.24),
        rgba(0,200,255,0.26), rgba(180,80,255,0.26), rgba(255,0,128,0.22));
    background-size: 300% auto;
    border: 2px solid rgba(255,230,150,0.85);
    border-radius: 14px;
    text-shadow: 0 0 10px rgba(255,220,120,0.95), 0 0 22px rgba(255,120,220,0.7), 0 2px 3px rgba(0,0,0,0.6);
    box-shadow: 0 0 26px rgba(255,200,80,0.55), 0 0 46px rgba(200,80,255,0.35), inset 0 0 22px rgba(255,255,255,0.14);
    animation: maxlevel-pop 0.6s cubic-bezier(.2,1.5,.3,1),
               maxlevel-flow 4s linear infinite,
               maxlevel-glow 1.6s ease-in-out infinite;
}
@keyframes maxlevel-flow { to { background-position: 300% center; } }
@keyframes maxlevel-glow {
    50% { box-shadow: 0 0 40px rgba(255,210,90,0.85), 0 0 70px rgba(210,90,255,0.6), inset 0 0 28px rgba(255,255,255,0.22); }
}
@keyframes maxlevel-pop {
    0% { transform: scale(0.6) rotate(-2deg); opacity: 0; }
    60% { transform: scale(1.08) rotate(1deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}

@keyframes levelup-pop {
    0% { transform: scale(0.6); opacity: 0; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes levelup-glow {
    50% { filter: brightness(1.3); box-shadow: 0 0 28px rgba(255, 180, 40, 0.75), inset 0 0 18px rgba(255, 196, 65, 0.32); }
}

/* 플레이어 사망 전체 공지 — 붉은 띠 */
.death-notice {
    display: block;
    margin: 6px 0;
    padding: 7px 12px;
    font-weight: 700;
    color: #ffd9d4;
    background: linear-gradient(100deg, rgba(120, 20, 20, 0.35), rgba(200, 40, 40, 0.22), rgba(120, 20, 20, 0.35));
    border: 1px solid rgba(230, 80, 70, 0.55);
    border-left: 4px solid #e0564a;
    border-radius: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.fullmoon-banner {
    display: block;
    text-align: center;
    margin: 8px 0;
    padding: 10px 14px;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.5;
    color: #e8ecff;
    background: linear-gradient(100deg, rgba(40, 30, 90, 0.35), rgba(120, 90, 200, 0.30), rgba(40, 30, 90, 0.35));
    border: 1px solid rgba(180, 160, 255, 0.6);
    border-radius: 10px;
    text-shadow: 0 0 10px #b9a6ff, 0 0 22px rgba(150, 120, 255, 0.8);
    box-shadow: 0 0 18px rgba(140, 110, 240, 0.4), inset 0 0 14px rgba(180, 160, 255, 0.18);
    animation: levelup-pop 0.5s ease-out, fullmoon-glow 2s ease-in-out infinite 0.5s;
}

/* ── 핏빛달 ── 배너: 검붉은 바탕에 피가 번지듯 맥박치는 빛 */
.bloodmoon-banner {
    display: block;
    text-align: center;
    margin: 10px 0;
    padding: 14px 16px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.7;
    color: #ffd9d2;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 60, 40, 0.38), rgba(0, 0, 0, 0) 62%),
        linear-gradient(180deg, rgba(74, 6, 10, 0.92), rgba(24, 2, 6, 0.95));
    border: 1px solid rgba(255, 70, 50, 0.75);
    border-radius: 10px;
    text-shadow: 0 0 8px rgba(255, 40, 30, 0.75);
    box-shadow: 0 0 22px rgba(220, 20, 20, 0.55), inset 0 0 26px rgba(120, 0, 0, 0.6);
    animation: levelup-pop 0.5s ease-out, bloodmoon-pulse 2.4s ease-in-out infinite 0.5s;
}
.bloodmoon-banner::first-line {
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #ff5a48;
}
@keyframes bloodmoon-pulse {
    50% { box-shadow: 0 0 40px rgba(255, 30, 20, 0.9), inset 0 0 34px rgba(170, 0, 0, 0.75); filter: brightness(1.18); }
}
/* 핏빛달이 떠 있는 동안: 출력창과 패널 테두리가 붉게 물들고, 화면 가장자리에 붉은 기운이 드리운다 */
body.blood-moon { background-image: radial-gradient(circle at 50% 0%, #4a0a12 0%, #1a0508 55%, #070203 100%); }
body.blood-moon .panel-frame {
    border-color: #b8323a;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 22px rgba(90, 0, 0, 0.5),
                0 10px 30px rgba(0, 0, 0, 0.55), 0 0 22px rgba(220, 30, 30, 0.35);
}
body.blood-moon .chat-col .terminal-log {
    border-color: #7a1a22;
    box-shadow: inset 0 0 46px rgba(150, 0, 0, 0.38);
    animation: bloodmoon-vignette 5s ease-in-out infinite;
}
@keyframes bloodmoon-vignette {
    50% { box-shadow: inset 0 0 70px rgba(190, 0, 0, 0.5); }
}
@media (prefers-reduced-motion: reduce) {
    .bloodmoon-banner, body.blood-moon .chat-col .terminal-log { animation: none; }
}

@keyframes fullmoon-glow {
    50% { filter: brightness(1.25); box-shadow: 0 0 30px rgba(150, 120, 255, 0.8), inset 0 0 18px rgba(180, 160, 255, 0.34); }
}

@keyframes rarity-pulse {
    50% { filter: brightness(1.35) drop-shadow(0 0 5px currentColor); }
}

@keyframes legendary-shine {
    to { background-position: 250% center; }
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 8, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.auth-card {
    background: var(--panel-bg);
    border: 2px solid var(--border-gold);
    border-radius: 12px;
    padding: 35px;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.game-title {
    font-size: 2rem;
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-buttons button {
    flex: 1;
    padding: 10px;
    background: #191724;
    border: 1px solid #332f48;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.tab-buttons button.active {
    background: var(--border-gold);
    color: #111;
    border-color: var(--gold-bright);
}

.input-group {
    text-align: left;
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--border-gold);
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: #14121e;
    border: 1px solid #38344e;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 42px;
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.65;
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
    line-height: 1;
}

.toggle-password-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Remember ID & PW Checkboxes */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -4px 0 18px 0;
    padding: 0 4px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-muted);
    user-select: none;
    transition: color 0.2s;
}

.custom-checkbox:hover {
    color: var(--gold-bright);
}

.custom-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #4a4563;
    border-radius: 4px;
    background: #14121e;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    transition: all 0.2s;
}

.custom-checkbox input[type="checkbox"]:checked {
    background: var(--border-gold);
    border-color: var(--gold-bright);
}

.custom-checkbox input[type="checkbox"]:checked::after {
    content: "✓";
    font-size: 11px;
    font-weight: 900;
    color: #111;
}


.class-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.class-card {
    display: block;
    cursor: pointer;
}

.class-card input {
    display: none;
}

.card-content {
    display: block;
    padding: 10px;
    background: #14121e;
    border: 1px solid #38344e;
    border-radius: 6px;
    font-size: 0.8rem;
}

.class-card input:checked + .card-content {
    border-color: var(--border-gold);
    background: #272238;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #c8aa6e, #967332);
    border: none;
    border-radius: 6px;
    color: #0d0c10;
    font-weight: bold;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover {
    box-shadow: 0 0 15px rgba(200, 170, 110, 0.5);
    transform: translateY(-1px);
}

.error-msg {
    color: var(--hp-red);
    margin-top: 15px;
    font-size: 0.9rem;
}

/* Workspace Layout */
.workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;   /* 실제 보이는 높이 (태블릿·터치 브라우저의 주소창/툴바 제외) — 미지원 브라우저는 100vh */
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
    gap: 15px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    padding: 12px 20px;
}

.badge {
    padding: 4px 10px;
    background: #2a253a;
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--border-gold);
    margin-left: 8px;
}

.level-badge {
    background: var(--border-gold);
    color: #111;
    font-weight: bold;
}

.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    gap: 15px;
    flex: 1;
    min-height: 0;
}

/* Panels */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.panel-box {
    background: var(--panel-bg);
    border: 1px solid #332f48;
    border-radius: 8px;
    padding: 15px;
}

.panel-box h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    border-bottom: 1px dashed #38344e;
    padding-bottom: 6px;
}

/* Progress Bars */
.bar-container {
    margin-bottom: 10px;
}

.bar-label {
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.progress-bar {
    height: 14px;
    background: #14121e;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid #38344e;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.hp-fill { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.mp-fill { background: linear-gradient(90deg, #2980b9, #3498db); }
.exp-fill { background: linear-gradient(90deg, #8e44ad, #9b59b6); }

/* Stat Allocation */
.stat-row {
    margin-bottom: 12px;
    background: #14121e;
    padding: 10px;
    border-radius: 6px;
}

.stat-info strong {
    font-size: 0.9rem;
}

.stat-info small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.stat-buttons {
    display: flex;
    gap: 5px;
    margin-top: 6px;
}

.stat-buttons button {
    flex: 1;
    padding: 4px;
    background: #2a253b;
    border: 1px solid var(--border-gold);
    color: var(--border-gold);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
}

.stat-buttons button:hover {
    background: var(--border-gold);
    color: #111;
}

/* Console Panel */
.console-panel {
    display: flex;
    flex-direction: column;
    background: #09080e;
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    padding: 15px;
    min-height: 0;
}

.terminal-log {
    flex: 1;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    padding-right: 10px;
    white-space: pre-wrap;
}

/* Tight within a turn... */
.log-line {
    margin-bottom: 3px;
}
/* ...and a clear gap between turns (server-emitted turn separator). */
.log-turn-gap {
    height: 14px;
}

.log-empty-line {
    height: 0.85em;
    min-height: 0.85em;
    margin: 0;
    padding: 0;
    display: block;
}

.cmd-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.cmd-form input {
    flex: 1;
    padding: 12px;
    background: #14121e;
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    color: #00ffcc;
    font-family: monospace;
    font-size: 1rem;
}

.btn-send {
    padding: 12px 20px;
    background: var(--border-gold);
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

/* Navigation & Skill Buttons */
.compass-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.compass-grid button, .quick-actions-grid button {
    padding: 10px 5px;
    background: #191724;
    border: 1px solid #38344e;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.compass-grid button:hover, .quick-actions-grid button:hover {
    border-color: var(--border-gold);
    color: var(--border-gold);
}

.btn-map-action {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.2), rgba(0, 255, 204, 0.15));
    border: 1px solid var(--border-gold);
    color: var(--gold-bright);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.btn-map-action:hover {
    background: var(--border-gold);
    color: #111;
    box-shadow: 0 0 15px rgba(200, 170, 110, 0.5);
    transform: translateY(-1px);
}

.skill-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-btn {
    padding: 10px;
    background: linear-gradient(135deg, #1f1b2e, #14121e);
    border: 1px solid var(--border-gold);
    color: var(--gold-bright);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

/* Skill keybinding UI */
.skill-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 2px 0 8px;
}
.keybind-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 5px 12px;
    color: var(--gold-bright);
    background: linear-gradient(135deg, rgba(60, 52, 90, 0.55), rgba(32, 28, 48, 0.55));
    border: 1px solid var(--border-gold);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.keybind-btn:hover {
    background: linear-gradient(135deg, rgba(90, 78, 130, 0.7), rgba(48, 42, 70, 0.7));
    box-shadow: 0 0 10px rgba(255, 210, 120, 0.25);
}
.keybind-btn:active { transform: translateY(1px); }
.keybind-btn-ico { font-size: 0.9rem; line-height: 1; }
/* Keybinding modal */
.keybind-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.keybind-modal {
    background: linear-gradient(135deg, #221d33, #15121f);
    border: 1px solid var(--border-gold);
    border-radius: 10px;
    padding: 18px 20px;
    width: min(92vw, 420px);
    max-height: 86vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    color: var(--gold-bright);
}
.keybind-modal h3 { margin: 0 0 6px; }
.keybind-hint { font-size: 0.78rem; color: #c9bfe0; margin: 0 0 12px; line-height: 1.4; }
.keybind-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.keybind-skill-name { font-size: 0.9rem; }
.keybind-input {
    width: 48px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 6px;
    background: #0f0d18;
    color: #fff;
    border: 1px solid var(--border-gold);
    border-radius: 6px;
}
.keybind-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
/* 소지품 정보 창은 단추가 많을 수 있다 (요리 · 판매 · 제물) — 두 줄로 넘긴다 */
#item-info-modal .keybind-actions { flex-wrap: wrap; gap: 8px; }
#item-info-modal .keybind-actions > button { flex: 1 1 40%; min-width: 0; }
.keybind-save, .keybind-cancel {
    flex: 1;
    padding: 9px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    border: 1px solid var(--border-gold);
}
.keybind-save { background: var(--gold-bright); color: #1a1526; }
.keybind-cancel { background: #2a2440; color: var(--gold-bright); }

/* Clockwise cooldown sweep overlay (RPG-style) over a skill button. */
@property --cd-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 360deg;
}

.skill-cd-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(from -90deg,
        rgba(4, 6, 14, 0.74) var(--cd-angle), transparent var(--cd-angle));
    animation-name: skill-cd-sweep;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes skill-cd-sweep {
    from { --cd-angle: 360deg; }
    to   { --cd-angle: 0deg; }
}

.skill-cd-num {
    font-weight: 800;
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.9);
    font-variant-numeric: tabular-nums;
}

.skill-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;   /* keep the key badge top-aligned even when a long name wraps */
    gap: 8px;
    width: 100%;
}
.skill-header strong {
    min-width: 0;              /* allow long names to wrap instead of pushing the badge */
    overflow-wrap: anywhere;
}

.skill-hotkey-badge {
    background: rgba(0, 255, 204, 0.15);
    color: #00ffcc;
    border: 1px solid #00ffcc;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(0, 255, 204, 0.3);
    flex-shrink: 0;            /* never shrink/wrap — stays a tidy right-aligned pill */
    white-space: nowrap;
}

/* ===== 하단 배너 광고 (Google AdSense) ===== */
.ad-banner {
    width: 100%;
    max-width: 970px;
    margin: 14px auto 6px;
    padding: 0 14px;
}

.ad-slot {
    width: 100%;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    width: 100%;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    background: repeating-linear-gradient(
        45deg,
        rgba(200, 170, 110, 0.04),
        rgba(200, 170, 110, 0.04) 10px,
        rgba(200, 170, 110, 0.08) 10px,
        rgba(200, 170, 110, 0.08) 20px
    );
    border: 1px dashed rgba(200, 170, 110, 0.4);
    border-radius: 8px;
}

/* ===== 사각형 광고 (로그인 화면 · 게임 메뉴 창) ===== */
.ad-rect {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
}
.ad-rect .ad-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.ad-rect .ad-slot,
.ad-rect .ad-placeholder { min-height: 250px; }

/* 로그인 화면: 카드 아래에 광고 — 세로로 쌓고, 화면이 낮으면 스크롤 */
#auth-overlay {
    flex-direction: column;
    justify-content: flex-start;
    gap: 18px;
    overflow-y: auto;
    padding: 20px 0;
}
#auth-overlay > .auth-card { margin-top: auto; flex-shrink: 0; }
#auth-overlay > .ad-login  { margin-bottom: auto; flex-shrink: 0; }

/* 게임 메뉴 창: 닫기 버튼과 충분히 띄워 오클릭 방지 */
.ad-menu {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-mp-text {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.skill-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.skill-prof-badge {
    font-size: 0.76rem;
    color: #a0aec0;
}

.skill-prof-badge .prof-val {
    color: #00ffcc;
    font-weight: 700;
}

.skill-prof-bar-bg {
    width: 100%;
    height: 5px;
    background: #0f0e17;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 3px;
    border: 1px solid #2d2a3e;
}

.skill-prof-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00b4db, #00ffcc);
    box-shadow: 0 0 6px rgba(0, 255, 204, 0.6);
    transition: width 0.3s ease;
}

.skill-btn:hover {
    box-shadow: 0 0 10px rgba(200, 170, 110, 0.4);
    border-color: #00ffcc;
}

.skill-locked {
    opacity: 0.45;
    filter: grayscale(0.8);
    border-color: #38344e;
}

.skill-lock-badge {
    background: rgba(192, 57, 43, 0.2);
    color: #e2857b;
    border-color: #c0392b;
    box-shadow: none;
}

.highlight {
    color: #00ffcc;
    font-weight: bold;
}

/* Damage Numbers Formatting */
.dmg-dealt {
    color: #ffea00;
    font-weight: 800;
    font-size: 1.1em;
    text-shadow: 0 0 8px rgba(255, 234, 0, 0.7);
}

.dmg-taken {
    color: #ff3333;
    font-weight: 800;
    font-size: 1.1em;
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.7);
}

.heal-val {
    color: #2ecc71;
    font-weight: 800;
    font-size: 1.1em;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.7);
}

.heal-mp {
    color: #4da3ff;
    font-weight: 800;
    font-size: 1.1em;
    text-shadow: 0 0 8px rgba(77, 163, 255, 0.7);
}

/* 연타 횟수 뱃지 (문장 앞쪽) */
.hit-combo {
    display: inline-block;
    font-weight: 900;
    font-size: 0.82em;
    color: #ffdf6b;
    background: rgba(255, 180, 40, 0.16);
    border: 1px solid rgba(255, 196, 65, 0.6);
    border-radius: 6px;
    padding: 0 6px;
    margin-right: 2px;
    letter-spacing: 0.01em;
    text-shadow: 0 0 6px rgba(255, 180, 40, 0.6);
    vertical-align: middle;
}

/* 치명타 데미지 — '치명타!' 문구 대신 숫자에 입히는 강조 효과 */
.dmg-crit {
    color: #ffd23f;
    font-weight: 900;
    font-size: 1.4em;
    letter-spacing: 0.01em;
    text-shadow: 0 0 10px rgba(255, 180, 40, 0.95), 0 0 20px rgba(255, 120, 20, 0.75);
    animation: crit-pop 0.45s cubic-bezier(.2,1.4,.3,1);
    display: inline-block;
}
.dmg-crit::after {
    content: " ✦";
    font-size: 0.8em;
    color: #ff8d1f;
}
@keyframes crit-pop {
    0% { transform: scale(0.5) rotate(-6deg); opacity: 0; }
    55% { transform: scale(1.35) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}

/* Coloured equipment stats (item inspect) */
.stat-atk {
    color: #ff8a3d;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 138, 61, 0.55);
}

.stat-spd {
    color: #37e6c8;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(55, 230, 200, 0.5);
}

.stat-def {
    color: #ffd93d;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 217, 61, 0.55);
}

.stat-hp {
    color: #ff6b81;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 107, 129, 0.5);
}

.stat-mp {
    color: #4da3ff;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(77, 163, 255, 0.5);
}

.stat-str {
    color: #ff5c5c;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 92, 92, 0.5);
}

.stat-agi {
    color: #7ee26b;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(126, 226, 107, 0.5);
}

.stat-int {
    color: #c48bff;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(196, 139, 255, 0.5);
}

/* 새 기술 습득 배너 */
.newskill-banner {
    display: inline-block;
    padding: 7px 14px;
    margin: 3px 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 214, 102, 0.85);
    background: linear-gradient(90deg, rgba(120, 80, 10, 0.6), rgba(40, 90, 140, 0.55));
    color: #fff3c4;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(255, 214, 102, 0.9);
    box-shadow: 0 0 14px rgba(255, 200, 80, 0.45);
    animation: newskill-glow 1.6s ease-in-out 3;
}
@keyframes newskill-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 200, 80, 0.35); }
    50%      { box-shadow: 0 0 22px rgba(255, 220, 120, 0.85); }
}

/* 신들의 시련 공지 (열림 · 클리어 · 에픽 획득) */
.dungeon-banner {
    display: inline-block;
    padding: 6px 12px;
    margin: 2px 0;
    border-radius: 8px;
    border: 1px solid rgba(160, 140, 255, 0.7);
    background: linear-gradient(90deg, rgba(60, 30, 120, 0.55), rgba(20, 60, 120, 0.55));
    color: #e6dcff;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(170, 140, 255, 0.8);
    box-shadow: 0 0 12px rgba(140, 110, 255, 0.35);
}

/* NPC 대사 강조 */
.npc-em { font-weight: 700; }
.npc-cmd {
    color: #7fe3ff;
    background: rgba(127, 227, 255, 0.12);
    border-radius: 4px;
    padding: 0 3px;
}
.npc-gold { color: #ffc23a; text-shadow: 0 0 6px rgba(255, 194, 58, 0.5); }
.npc-lv   { color: #ff9f5a; text-shadow: 0 0 6px rgba(255, 159, 90, 0.45); }
.npc-warn { color: #ff6b6b; text-shadow: 0 0 6px rgba(255, 107, 107, 0.5); }

/* 획득 경험치 · 골드 */
.stat-exp {
    color: #5ff0a8;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(95, 240, 168, 0.55);
}

.stat-gold {
    color: #ffc23a;
    font-weight: 700;
    text-shadow: 0 0 7px rgba(255, 194, 58, 0.65);
}

.stat-crit {
    color: #ff9de2;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 157, 226, 0.5);
}

/* =========================================================
   Laptop screen optimization (14" / 16" notebooks)
   The 3-column layout stays, but columns, spacing and type
   tighten as the viewport narrows or shortens so nothing is
   cut off and the console keeps the most room.
   ========================================================= */

/* 16" notebooks & smaller desktops (~1512–1536px) */
@media (max-width: 1600px) {
    body { font-size: 15px; }
    .workspace { padding: 12px; gap: 12px; }
    .main-layout { grid-template-columns: 290px 1fr 270px; gap: 12px; }
    .side-panel { gap: 12px; }
    .panel-box { padding: 13px; }
}

/* 14" notebooks (~1280–1440px) */
@media (max-width: 1440px) {
    body { font-size: 14px; }
    .workspace { padding: 10px; gap: 10px; }
    .main-layout { grid-template-columns: 258px 1fr 244px; gap: 10px; }
    .side-panel { gap: 10px; }
    .panel-box { padding: 11px; }
    .panel-box h3 { font-size: 0.92rem; }
    .top-bar { padding: 8px 14px; }
    .terminal-log { font-size: 0.9rem; }
    .compass-grid button, .quick-actions-grid button { padding: 8px 4px; font-size: 0.76rem; }
    .btn-map-action { padding: 8px; font-size: 0.8rem; }
    #cmd-input, .btn-send { padding: 10px 14px; }
}

/* Narrow 13–14" notebooks (~1280px) */
@media (max-width: 1320px) {
    .main-layout { grid-template-columns: 238px 1fr 226px; gap: 9px; }
    .badge { font-size: 0.78rem; padding: 3px 8px; margin-left: 6px; }
}

/* Short notebook panels (≈768–900px tall): recover vertical space */
@media (max-height: 880px) {
    .workspace { padding: 9px; gap: 9px; }
    .side-panel { gap: 9px; }
    .panel-box { padding: 10px; }
    .panel-box h3 { margin-bottom: 7px; }
    .top-bar { padding: 7px 14px; }
    .ad-banner { min-height: 0; }
}

@media (max-height: 760px) {
    .workspace { padding: 7px; gap: 7px; }
    .panel-box { padding: 9px; }
    .compass-grid button, .quick-actions-grid button { padding: 7px 4px; }
    .terminal-log { font-size: 0.88rem; }
}

/* Room Title Easy-To-Read Badge */
.room-title {
    display: inline-block;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.22), rgba(200, 170, 110, 0.30));
    color: #00ffcc;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 6px 14px;
    border: 1px solid rgba(0, 255, 204, 0.55);
    border-left: 5px solid #00ffcc;
    border-radius: 8px;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.8);
    margin: 4px 0 10px;
    box-shadow: 0 0 18px rgba(0, 255, 204, 0.22), inset 0 0 12px rgba(0, 255, 204, 0.08);
}

/* =========================================================================
   MOCKUP UI REDESIGN — 2열(채팅 + 캐릭터) + 하단 핫바
   (기존 .top-bar / .main-layout / .side-panel / .console-panel 레이아웃을
    대체. 전투·희귀도·쿨다운·로그 클래스는 위쪽 정의를 그대로 재사용한다.)
   ========================================================================= */

.workspace { max-width: 1480px; }

.game-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 342px;
    gap: 14px;
    flex: 1;
    min-height: 0;
}

/* Ornate gold frame shared by chat / character / hotbar panels */
.panel-frame {
    background:
        linear-gradient(180deg, rgba(28, 23, 42, 0.94), rgba(15, 12, 23, 0.96));
    border: 2px solid var(--border-gold);
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.55),
        inset 0 0 22px rgba(0, 0, 0, 0.55),
        0 10px 30px rgba(0, 0, 0, 0.55),
        0 0 20px rgba(200, 170, 110, 0.08);
    position: relative;
}

/* ---- Chat / console column ---- */
.chat-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px;
    gap: 10px;
}
.chat-tabs {
    display: flex; gap: 6px;
    overflow-x: auto; scrollbar-width: none;   /* 귓속말 탭이 많아지면 가로 스크롤 */
}
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tabs > * { flex-shrink: 0; white-space: nowrap; }

/* 귓속말(1:1) 대화 탭 */
.chat-tab.chat-tab-dm { color: #e8a6ff; border-color: #6a3f7a; position: relative; }
.chat-tab.chat-tab-dm.active {
    color: #1a1526;
    background: linear-gradient(180deg, #f3d2ff, #c98ae0);
    border-color: #f3d2ff;
    box-shadow: 0 0 12px rgba(201, 138, 224, 0.45);
}
.chat-tab.chat-tab-dm.dm-unread::after {       /* 안 읽은 귓속말 표시 */
    content: ""; position: absolute; top: 4px; right: 4px;
    width: 7px; height: 7px; border-radius: 50%;
    background: #ff5c8a; box-shadow: 0 0 6px #ff5c8a;
}
.terminal-log .log-line[data-cat="whisper"] { color: #e8a6ff; }
.terminal-log .log-line.whisper-out { color: #c9a6e0; }
.chat-tab {
    padding: 8px 18px;
    background: linear-gradient(180deg, #241f33, #17131f);
    border: 1px solid #3a3450;
    border-bottom: none;
    border-radius: 9px 9px 0 0;
    color: var(--text-muted);
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.chat-tab:hover { color: var(--gold-bright); }
.chat-tab.active {
    color: #1a1526;
    background: linear-gradient(180deg, #ecdaab, #c8aa6e);
    border-color: var(--gold-bright);
    box-shadow: 0 0 12px rgba(200, 170, 110, 0.4);
}

.chat-col .terminal-log {
    background: rgba(6, 5, 10, 0.72);
    border: 1px solid #2a2640;
    border-radius: 8px;
    padding: 14px;
}

/* 시스템 로그는 목업처럼 은은한 초록으로 (전투/희귀도 전용 span 색은 유지) */
.terminal-log .log-line[data-cat="system"] { color: #7ee0a0; }

/* Chat tab filtering (direct children carry data-cat) */
/* data-cat 은 공백 구분 목록 — "general system" 은 일반·시스템 탭 양쪽에 보인다 (시간·날씨·경험치·획득) */
.terminal-log.chat-filter-general > [data-cat="system"] { display: none; }   /* 순수 시스템만 숨김 */
.terminal-log.chat-filter-system  > :not([data-cat~="system"]) { display: none; }
.terminal-log.chat-filter-party   > :not([data-cat~="party"]) { display: none; }
.terminal-log.chat-filter-kingdom > :not([data-cat~="kingdom"]) { display: none; }
.terminal-log.chat-filter-shout   > :not([data-cat~="shout"]) { display: none; }      /* 잡담 탭: 메가폰 잡담만 */

.chat-col .cmd-form { margin-top: 0; }
.chat-col .cmd-form input { color: #cfe9ff; }
.chat-col .btn-send {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #1a1526;
    background: radial-gradient(circle at 32% 28%, #f6e9c2, #c8aa6e 72%, #9a7636);
    border: 2px solid #ecdaab;
    box-shadow: 0 0 12px rgba(200, 170, 110, 0.4);
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.chat-col .btn-send:hover { filter: brightness(1.08); box-shadow: 0 0 16px rgba(200, 170, 110, 0.6); }
.chat-col .btn-send:active { transform: translateY(1px); }

/* ---- Character column ---- */
.char-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    overflow-y: auto;
    min-height: 0;
}
.char-head { display: flex; align-items: center; gap: 12px; }
.char-portrait {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    background: radial-gradient(circle at 50% 32%, #3a3350, #15121f 75%);
    border: 3px solid var(--border-gold);
    box-shadow: 0 0 16px rgba(200, 170, 110, 0.35), inset 0 0 14px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}
.char-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.char-level {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1.05;
    text-shadow: 0 0 10px rgba(200, 170, 110, 0.5);
}
.char-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.char-class { font-size: 0.85rem; color: var(--border-gold); }

/* Resource bars */
.cp-bars { display: flex; flex-direction: column; gap: 8px; }
.cp-bar { display: flex; align-items: center; gap: 8px; }
.cp-bar-ico { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.cp-bar-track {
    position: relative;
    flex: 1;
    height: 26px;
    border-radius: 13px;
    overflow: hidden;
    background: #14121e;
    border: 1px solid #38344e;
}
.cp-bar-track .progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    height: 100%;
    border-radius: 13px;
}
.cp-bar-name {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-weight: 800;
    font-size: 0.78rem;
    color: #fff;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}
.cp-bar-val {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-weight: 800;
    font-size: 0.82rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
    font-variant-numeric: tabular-nums;
}

/* Stat allocation */
.cp-stats {
    background: rgba(10, 8, 16, 0.5);
    border: 1px solid #2a2640;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cp-stats-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    color: var(--border-gold);
    font-weight: 700;
    font-size: 0.92rem;
}
.cp-unspent { font-size: 0.8rem; color: var(--text-muted); }
.cp-step { display: flex; align-items: center; gap: 5px; }
.cp-step-label { font-size: 0.75rem; color: var(--text-muted); margin-right: 2px; }
.cp-step-btn {
    padding: 3px 11px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    background: #1d1a2b;
    border: 1px solid #3a3450;
    color: var(--text-muted);
    transition: all 0.12s;
}
.cp-step-btn.active { background: var(--border-gold); color: #1a1526; border-color: var(--gold-bright); }
.cp-stat {
    display: grid;
    grid-template-columns: 26px 1fr auto 32px;
    align-items: center;
    gap: 8px;
    background: #14121e;
    border: 1px solid #2d2a3e;
    border-radius: 8px;
    padding: 8px 10px;
}
.cp-stat-ico { font-size: 1.05rem; text-align: center; }
.cp-stat-name { font-weight: 700; color: var(--text-primary); letter-spacing: 0.05em; }
.cp-stat-val { font-weight: 800; font-size: 1.1rem; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.cp-plus {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1;
    color: #1a1526;
    background: radial-gradient(circle at 30% 28%, #f6e9c2, #d7b876 70%, #a9823f);
    border: 2px solid #ecdaab;
    box-shadow: 0 0 8px rgba(200, 170, 110, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, filter 0.15s;
}
.cp-plus:hover { filter: brightness(1.1); transform: translateY(-1px); }
.cp-plus:active { transform: translateY(0); }
.cp-stat-sub {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: none;
}
.cp-stat:hover .cp-stat-sub { display: block; }

/* Gold / inventory */
.cp-meta { display: flex; flex-direction: column; gap: 6px; }
.cp-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #14121e;
    border: 1px solid #2d2a3e;
    border-radius: 8px;
    padding: 8px 12px;
}
.cp-meta-ico { font-size: 1.05rem; width: 22px; text-align: center; }
.cp-meta-name { color: var(--text-muted); font-size: 0.85rem; }
.cp-meta-val { margin-left: auto; font-weight: 800; color: var(--gold-bright); font-variant-numeric: tabular-nums; }

/* Action buttons */
.cp-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: auto;
}
.cp-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    background: linear-gradient(180deg, #241f33, #15121f);
    border: 1px solid var(--border-gold);
    border-radius: 10px;
    color: var(--gold-bright);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.15s;
}
.cp-action:hover {
    background: linear-gradient(180deg, #322b49, #1d182a);
    box-shadow: 0 0 12px rgba(200, 170, 110, 0.3);
    transform: translateY(-1px);
}
.cp-action-ico { font-size: 1.4rem; line-height: 1; }

/* ---- Bottom hotbar ---- */
.hotbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;            /* 화면이 낮아도 핫바(물약·스킬)는 줄어들지 않고, 출력창이 대신 줄어든다 */
    scrollbar-width: thin;     /* 슬롯이 넘칠 때 가로 스크롤바가 슬롯을 가리지 않게 얇게 */
}
.hotbar::-webkit-scrollbar { height: 4px; }
.hotbar::-webkit-scrollbar-thumb { background: rgba(200, 170, 110, 0.4); border-radius: 2px; }
.potion-slots, .hotbar-skills { flex-shrink: 0; }
.potion-slots { display: flex; gap: 10px; }
.hotbar-divider {
    width: 2px;
    align-self: stretch;
    background: linear-gradient(180deg, transparent, rgba(200, 170, 110, 0.5), transparent);
    margin: 0 4px;
    flex-shrink: 0;
}
.hotbar-skills { display: flex; gap: 10px; flex: 1; }

.potion-slot,
.hotbar-skills .skill-btn {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 32%, #2a2540, #120f1c 78%);
    border: 2px solid var(--border-gold);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.potion-slot:hover,
.hotbar-skills .skill-btn:hover {
    box-shadow: 0 0 14px rgba(200, 170, 110, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
    border-color: #00ffcc;
    transform: translateY(-2px);
}

.potion-ico { font-size: 2rem; line-height: 1; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.6)); }
.potion-hp { border-color: #e0564a; }
.potion-mp { border-color: #4aa3e0; }
.potion-count {
    position: absolute;
    bottom: 3px; right: 5px;
    font-size: 0.85rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px #000, 0 0 4px #000;
    z-index: 3;
    font-variant-numeric: tabular-nums;
}
.potion-slot.potion-empty { opacity: 0.4; filter: grayscale(0.7); }

/* Compact skill tile internals */
.hb-ico { font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.6)); }
.hb-mp {
    position: absolute; top: 3px; left: 5px;
    font-size: 0.62rem; font-weight: 700; color: #8ecbff;
    text-shadow: 0 1px 2px #000; z-index: 3;
}
.hb-num {
    position: absolute; bottom: 4px; right: 5px;
    font-size: 0.82rem; font-weight: 900; color: var(--gold-bright);
    text-shadow: 0 1px 2px #000, 0 0 4px #000; z-index: 3;
    font-variant-numeric: tabular-nums;
}
.hb-num.hb-passive { color: #ffd6ff; }
.hb-num.hb-lock { color: #e2857b; }
.hb-lockv {
    position: absolute; top: 3px; right: 5px;
    font-size: 0.56rem; font-weight: 700; color: #e2857b;
    text-shadow: 0 1px 2px #000; z-index: 3;
}
.hb-prof {
    position: absolute; left: 4px; right: 4px; bottom: 0;
    width: auto; height: 4px; margin: 0; z-index: 2;
}
.hotbar-skills .skill-cd-num { font-size: 1.1rem; }

/* 타일 좌상단 스킬 숙련 레벨 (성장이 보이도록) */
.hb-lv {
    position: absolute; top: 3px; left: 5px;
    font-size: 0.6rem; font-weight: 800; color: #9be8ff;
    text-shadow: 0 1px 2px #000; z-index: 3;
    letter-spacing: -0.02em;
}
/* hb-mp(소모)와 겹치지 않게 MP는 좌하단으로 */
.hotbar-skills .hb-mp {
    top: auto; bottom: 4px; left: 5px;
    color: #8ecbff;
}

/* 숙련도 상승 시 타일 성장 펄스 (한 번 반짝) */
.skill-btn.hb-grow { animation: hb-grow-pulse 0.7s ease-out; }
@keyframes hb-grow-pulse {
    0% { box-shadow: 0 0 0 rgba(0,255,204,0); }
    30% { box-shadow: 0 0 16px rgba(0,255,204,0.9), inset 0 0 12px rgba(0,255,204,0.5); border-color: #00ffcc; }
    100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.6); }
}
.skill-btn.hb-grow .hb-prof .skill-prof-bar-fill { filter: brightness(1.6); }

/* 숙련도 증가량 강조 (+N) — 증가할 때마다 톡 튀어오르는 효과 */
.prof-gain-amt {
    display: inline-block;
    font-weight: 900;
    color: #b6ff5a;
    text-shadow: 0 0 8px rgba(130, 255, 60, 0.85), 0 0 2px rgba(0,0,0,0.6);
    font-variant-numeric: tabular-nums;
    animation: prof-gain-pop 0.5s cubic-bezier(.2,1.5,.3,1);
}
@keyframes prof-gain-pop {
    0% { transform: translateY(4px) scale(0.6); opacity: 0; }
    60% { transform: translateY(-2px) scale(1.25); opacity: 1; }
    100% { transform: translateY(0) scale(1); }
}

/* 스킬 숙련도 진행 인라인 칩 (사용 때마다) */
.prof-gain {
    display: inline-block;
    font-weight: 800;
    color: #00e6c3;
    background: rgba(0, 230, 195, 0.12);
    border: 1px solid rgba(0, 230, 195, 0.5);
    border-radius: 6px;
    padding: 0 7px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 6px rgba(0, 230, 195, 0.5);
}

/* 스킬 숙련도 레벨업 배너 (성장의 순간) */
.skillup-banner {
    display: block;
    text-align: center;
    margin: 8px 0;
    padding: 9px 14px;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #d8fff6;
    background: linear-gradient(100deg, rgba(0, 120, 110, 0.18), rgba(0, 230, 195, 0.30), rgba(0, 120, 110, 0.18));
    border: 1px solid rgba(0, 230, 195, 0.6);
    border-radius: 10px;
    text-shadow: 0 0 10px rgba(0, 230, 195, 0.9), 0 0 20px rgba(0, 200, 170, 0.6);
    box-shadow: 0 0 18px rgba(0, 220, 190, 0.35), inset 0 0 14px rgba(0, 230, 195, 0.14);
    animation: levelup-pop 0.5s ease-out, skillup-glow 1.6s ease-in-out infinite 0.5s;
}
@keyframes skillup-glow {
    50% { filter: brightness(1.25); box-shadow: 0 0 26px rgba(0, 220, 190, 0.7), inset 0 0 18px rgba(0, 230, 195, 0.3); }
}

/* ── 스킬 레어리티 (하급→중급→고급→유니크→전설, 높을수록 화려) ── */
.hotbar-skills .skill-btn.rarity-low { border-color: #6b6780; }
.hotbar-skills .skill-btn.rarity-mid {
    border-color: #4fd17a;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6), 0 0 8px rgba(79, 209, 122, 0.4);
}
.hotbar-skills .skill-btn.rarity-high {
    border-color: #4aa3ff;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6), 0 0 12px rgba(74, 163, 255, 0.55);
}
.hotbar-skills .skill-btn.rarity-unique {
    border-color: #c77dff;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.55), 0 0 14px rgba(199, 125, 255, 0.65);
    animation: rarity-unique-glow 1.8s ease-in-out infinite;
}
@keyframes rarity-unique-glow {
    50% { box-shadow: inset 0 0 12px rgba(0,0,0,0.5), 0 0 24px rgba(199,125,255,0.95); border-color: #e0a8ff; }
}
.hotbar-skills .skill-btn.rarity-legend {
    border-color: #ffd23f;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.5), 0 0 18px rgba(255, 196, 65, 0.75);
    animation: rarity-legend-glow 1.5s ease-in-out infinite;
}
.hotbar-skills .skill-btn.rarity-legend::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(130deg, transparent 38%, rgba(255,240,180,0.40) 50%, transparent 62%);
    background-size: 250% 250%;
    animation: rarity-legend-shine 2.4s linear infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes rarity-legend-glow {
    50% { box-shadow: inset 0 0 14px rgba(0,0,0,0.45), 0 0 30px rgba(255,196,65,1); border-color: #fff0b0; }
}
@keyframes rarity-legend-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -100% 0; }
}

/* ---- Game menu overlay ---- */
.gm-modal { width: min(94vw, 440px); }
.gm-section-title {
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    color: var(--border-gold);
    font-weight: 700;
    font-size: 0.9rem;
    margin: 14px 0 8px;
}
.gm-section-title small { color: var(--text-muted); font-weight: 400; font-size: 0.7rem; }
.gm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-btn {
    padding: 10px 6px;
    background: #1d1a2b;
    border: 1px solid #3a3450;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.12s;
}
.gm-btn:hover { border-color: var(--border-gold); color: var(--border-gold); }
.gm-empty { visibility: hidden; }

/* ── 이동 창: 사냥터 / 마을 시설을 골라 날탈것으로 이동 ── */
.tv-modal { width: min(94vw, 440px); display: flex; flex-direction: column; overflow: hidden; }
.tv-tabs { display: flex; gap: 6px; margin: 8px 0; }
.tv-tab {
    flex: 1; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 0.86rem;
    background: #1d1a2b; border: 1px solid #3a3450; color: var(--text-muted);
}
.tv-tab.active { background: var(--gold-bright); border-color: var(--border-gold); color: #1a1526; }
.tv-note { font-size: 0.74rem; color: #c9bfe0; margin-bottom: 6px; min-height: 1.1em; }
.tv-list { flex: 1 1 auto; min-height: 120px; max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.tv-empty { padding: 18px 0; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.tv-item {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; flex: none;
    padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 0.86rem;
    background: #1d1a2b; border: 1px solid #3a3450; color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}
.tv-item .tv-lv { flex: none; width: 86px; color: var(--text-muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.tv-item .tv-name { flex: 1; min-width: 0; word-break: keep-all; }
.tv-item .tv-tag { flex: none; font-size: 0.72rem; color: var(--text-muted); }
.tv-item.tv-fit { border-color: #2f8f6f; }
.tv-item.tv-fit .tv-tag { color: #5fe0b0; }
.tv-item.tv-here { opacity: 0.55; cursor: default; }
.tv-item.tv-ed { border-color: #c8553d; }                 /* 정예 던전 입구 */
.tv-item.tv-ed .tv-name small { color: #ff9a85; font-size: 0.7rem; }
.tv-item.picked { border-color: var(--border-gold); background: #2a2440; color: var(--gold-bright); }
.tv-fac-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tv-fac { justify-content: center; }
.tv-fac .tv-name { flex: none; }
.tv-fac-ico { font-size: 1.15rem; }
.tv-confirm {
    margin-top: 8px; padding: 9px 10px; border-radius: 8px; flex: none;
    background: rgba(10, 8, 16, 0.6); border: 1px solid var(--border-gold);
    display: flex; align-items: center; gap: 10px;
}
.tv-confirm[hidden] { display: none; }
.tv-quote { flex: 1; min-width: 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-primary); word-break: keep-all; }
.tv-quote small { color: var(--text-muted); font-size: 0.7rem; }
.tv-fee { color: var(--gold-bright); }
.tv-bad { color: #ff8a7a; }
.tv-go { flex: none; padding: 10px 14px; }
.tv-go:disabled { opacity: 0.45; cursor: not-allowed; }

/* 광장 분수 — 누르면 '분수 마셔' */
#terminal-log .fountain-link {
    cursor: pointer; color: #8fd8ff; font-weight: 700;
    text-decoration: underline dotted rgba(143, 216, 255, 0.6); text-underline-offset: 3px;
    -webkit-tap-highlight-color: rgba(143, 216, 255, 0.25);
}

/* 은행 · 우체국 창 (상점 창의 sh-* 모양을 함께 쓴다) */
.fw-item:disabled { opacity: 0.5; cursor: not-allowed; }
.sh-step.fw-all { width: auto; padding: 0 10px; font-size: 0.8rem; }
.fw-gold { flex: none; margin-bottom: 10px; }
.fw-gold-head { font-size: 0.84rem; font-weight: 700; margin-bottom: 2px; }
.fw-gold-head small, .fw-label small { color: var(--text-muted); font-weight: 400; }
.fw-amt { flex: 1; min-width: 0; }
.fw-amt, .fw-text {
    height: 40px; padding: 0 10px; font-size: 16px;      /* 16px 미만이면 iOS 가 입력할 때 화면을 확대한다 */
    border-radius: 8px; background: #1d1a2b; border: 1px solid #3a3450; color: var(--text-primary);
}
.fw-quick { display: flex; gap: 6px; margin-top: 6px; }
.fw-chip {
    flex: 1; padding: 8px 0; border-radius: 8px; cursor: pointer; font-size: 0.78rem;
    background: #2a2440; border: 1px solid #3a3450; color: var(--gold-bright); touch-action: manipulation;
}
.fw-label { display: flex; flex-direction: column; gap: 4px; flex: none; font-size: 0.82rem; margin-bottom: 8px; }
.fw-text { width: 100%; box-sizing: border-box; }
.fw-msg { height: auto; padding: 8px 10px; resize: vertical; font-family: inherit; line-height: 1.45; }
.fw-wide { flex: none; width: 100%; padding: 11px; margin: 4px 0 10px; }
.fw-wide:disabled { opacity: 0.45; cursor: not-allowed; }
.fw-mail-head { flex: none; font-size: 0.84rem; font-weight: 700; margin: 6px 0 2px; }
.fw-mail {
    flex: none; padding: 7px 10px; border-radius: 8px; font-size: 0.8rem; line-height: 1.45; word-break: keep-all;
    background: #1d1a2b; border: 1px solid #3a3450;
}
.fw-mail small { color: var(--text-muted); }

/* 퀘스트 목록의 끝낸 의뢰 — 누르면 의뢰처로 날아가 완료 */
#terminal-log .quest-done-link {
    cursor: pointer; text-decoration: underline dotted currentColor; text-underline-offset: 3px;
    -webkit-tap-highlight-color: rgba(255, 215, 120, 0.25);
}
/* 진행 중인 퀘스트 — 누르면 사냥터 입구까지 걸어간다 */
#terminal-log .quest-go-link { cursor: pointer; -webkit-tap-highlight-color: rgba(255, 215, 120, 0.25); }
#terminal-log .quest-go-link:active { color: var(--gold-bright); }
.tv-reward { color: #5fe0b0; }

/* '사냥존' 목록의 사냥터 이름 — 누르면 이동 창 */
#terminal-log .zone-link {
    cursor: pointer; text-decoration: underline dotted currentColor; text-underline-offset: 3px;
    -webkit-tap-highlight-color: rgba(255, 215, 120, 0.25);
}
#terminal-log .zone-link:active { color: var(--gold-bright); }
#terminal-log .zone-go::after { content: " 🪽"; font-size: 0.85em; }

/* '장비' 목록의 장비 이름 — 누르면 정보 창 */
#terminal-log .eq-link {
    cursor: pointer; text-decoration: underline dotted currentColor; text-underline-offset: 3px;
    -webkit-tap-highlight-color: rgba(255, 215, 120, 0.25);
}
.ii-scroll { overflow-y: auto; max-height: 60vh; margin: 6px 0; padding-right: 4px; }
.ii-body { white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; font-size: 0.86rem; line-height: 1.55; text-align: left; }

/* 상점 창 — 이동 창(tv-*) 모양을 그대로 쓰고, 품목 아래에 수량칸을 펼친다 */
#terminal-log .speaker-npc { cursor: pointer; text-decoration: underline dotted rgba(143, 224, 162, 0.5); text-underline-offset: 3px; }
.sh-row { display: flex; flex-direction: column; flex: none; }
.sh-row .tv-name { display: flex; flex-direction: column; gap: 2px; }
.sh-eff { color: var(--text-muted); font-size: 0.7rem; }
.sh-price { flex: none; color: var(--gold-bright); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.sh-qty {
    display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 8px;
    border-radius: 8px; background: rgba(10, 8, 16, 0.6); border: 1px solid var(--border-gold);
}
.sh-step {
    flex: none; width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
    font-size: 1.3rem; font-weight: 700; line-height: 1;
    background: #2a2440; border: 1px solid #3a3450; color: var(--gold-bright);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.sh-step:active { background: #3a3260; }
#sh-qty-in {
    width: 56px; height: 40px; flex: none; text-align: center; font-size: 1rem;
    border-radius: 8px; background: #1d1a2b; border: 1px solid #3a3450; color: var(--text-primary);
    -moz-appearance: textfield;
}
#sh-qty-in::-webkit-outer-spin-button, #sh-qty-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sh-total { flex: 1; min-width: 0; text-align: right; font-size: 0.82rem; }
.sh-buy { flex: none; padding: 10px 14px; }
.sh-buy:disabled { opacity: 0.45; cursor: not-allowed; }
.sh-loot-all { flex: none; width: 100%; margin-bottom: 6px; padding: 10px 12px; font-size: 0.85rem; }
#shop-modal .tv-tab { flex: 1; }

/* ---- Responsive ---- */
@media (max-width: 1080px) {
    .game-stage { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 860px) {
    .game-stage { grid-template-columns: 1fr; grid-auto-rows: minmax(0, auto); }
    .chat-col { min-height: 46vh; }
    .char-col { max-height: none; }
    .cp-actions { margin-top: 10px; }
}
@media (max-width: 560px) {
    .workspace { padding: 8px; gap: 8px; }
    .chat-tab { padding: 7px 12px; font-size: 0.82rem; }
    .char-portrait { width: 60px; height: 60px; font-size: 1.7rem; }
    .char-level { font-size: 1.3rem; }
    .potion-slot, .hotbar-skills .skill-btn { width: 56px; height: 56px; }
    .hb-ico { font-size: 1.6rem; }
    .potion-ico { font-size: 1.7rem; }
}

/* ===================== 모바일 전용 UI (≤ 760px) ===================== */
.mobile-controls { display: none; }
.mc-top { display: none; }    /* 데스크톱에선 숨김 (모바일 상단 우측 전용) */
.chat-pad-toggle { display: none; }   /* 모바일 전용 패드 접기 버튼 */

@media (max-width: 760px) {
    html, body { overflow-x: hidden; }
    body { font-size: 14px; }
    .workspace { padding: 6px; gap: 6px; height: 100vh; height: 100dvh; max-width: 100%; }
    .game-stage { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; min-width: 0; }

    /* ── 상단: 왼쪽 레벨·직업·HP/MP/EXP · 오른쪽 가방·정보·메뉴·골드 ── */
    .char-col {
        order: 0; min-width: 0; max-width: 100%; overflow: hidden; padding: 8px;
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px; align-items: stretch;
    }
    .char-col > * { min-width: 0; }        /* 열이 내용 너비로 넘치지 않게 */
    .char-head { grid-column: 1; grid-row: 1; gap: 8px; align-items: center; }
    .char-portrait { display: none; }                 /* 공간 절약: 초상화 숨김 */
    .char-id { flex-direction: row; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
    .char-level { font-size: 1.2rem; }
    .char-name { font-size: 0.82rem; }
    .char-class { font-size: 0.8rem; }
    .cp-bars { grid-column: 1; grid-row: 2; gap: 6px; align-self: start; }   /* 상단 왼쪽 */
    .cp-bar-ico { width: 18px; font-size: 1rem; }
    .cp-bar-track { height: 24px; min-width: 0; }
    .cp-bar-name { left: 9px; font-size: 0.72rem; }
    .cp-bar-val { right: 9px; font-size: 0.78rem; }

    /* 오른쪽 열: 가방 · 정보 · 메뉴 + 소지 골드 */
    .mc-top { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; gap: 6px; }
    .mc-top-btn {
        flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
        background: linear-gradient(180deg, #241f33, #15121f);
        border: 1px solid var(--border-gold); border-radius: 10px;
        color: var(--gold-bright); font-weight: 700; font-size: 0.92rem; cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .mc-top-btn span { font-size: 1.2rem; }
    .mc-top-btn:active { background: var(--border-gold); color: #1a1526; }
    /* 능력치 칸 (힘 · 민첩 · 지능) — 누르면 상태창 */
    .mc-top-stat {
        flex: 1; min-height: 0; display: flex; align-items: center; gap: 5px; padding: 0 8px;
        background: rgba(10, 8, 16, 0.5); border: 1px solid #2a2640; border-radius: 8px;
        color: var(--gold-bright); font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .mc-top-stat span { font-size: 0.9rem; line-height: 1; }
    .mc-top-stat i { font-style: normal; font-size: 0.72rem; color: #c9bfe0; white-space: nowrap; }
    .mc-top-stat b {
        margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-size: 0.88rem; font-weight: 800; font-variant-numeric: tabular-nums;
    }
    .mc-stat-str b { color: #ff9a8a; }
    .mc-stat-agi b { color: #8fe3a0; }
    .mc-stat-int b { color: #a9b8ff; }
    .mc-top-stat:active { border-color: var(--border-gold); }
    .mc-top-gold {
        display: flex; align-items: center; justify-content: center; gap: 6px;
        padding: 8px; border-radius: 10px;
        background: rgba(10, 8, 16, 0.5); border: 1px solid #2a2640;
        color: var(--gold-bright); font-weight: 800; font-size: 1rem;
        font-variant-numeric: tabular-nums;
    }
    .mc-top-gold span { font-size: 1.05rem; }
    /* 골드 칸: 다른 UI 를 밀어내지 않도록 폭 상한 (값은 JS 에서 만/억/조 단위로 축약) */
    .mc-top-gold {
        position: relative; cursor: pointer; font-family: inherit;
        max-width: 78px; min-width: 0; flex: none;
        -webkit-tap-highlight-color: transparent;
    }
    .mc-top-gold b {
        min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }
    .mc-top-gold:active { border-color: var(--border-gold); }
    /* 터치 시 정확한 금액 말풍선 — 상단 패널이 overflow:hidden 이라 화면 기준(fixed)으로
       띄우고, 위치는 JS(showGoldDetail)가 골드 칸 바로 아래·오른쪽 정렬로 잡는다. */
    .mc-top-gold .mc-gold-pop {
        position: fixed; top: 0; right: 0; z-index: 1500;
        padding: 6px 10px; border-radius: 8px; white-space: nowrap;
        font-size: 0.85rem; font-weight: 800; color: var(--gold-bright);
        background: #15121f; border: 1px solid var(--border-gold);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
        opacity: 0; transform: translateY(-4px); pointer-events: none;
        transition: opacity 0.15s, transform 0.15s;
    }
    .mc-top-gold .mc-gold-pop.show { opacity: 1; transform: translateY(0); }

    /* 모바일에서 숨기는 데스크톱 전용 요소 */
    .cp-stats, .cp-meta, .cp-actions { display: none; }

    /* ── 중단: 출력 화면 ── */
    .chat-col { order: 1; flex: 1; min-height: 0; padding: 8px; }
    .chat-tabs { gap: 4px; }
    .chat-tab { padding: 5px 10px; font-size: 0.78rem; }
    .chat-col .terminal-log { padding: 10px; font-size: 0.86rem; }
    .chat-col .cmd-form input { padding: 10px; }
    .chat-col .btn-send { width: 46px; height: 46px; font-size: 1.3rem; }

    /* ── 조작 패널: 방향 이동 + 봐 + 공격 (핫바 바로 위) ── */
    .mobile-controls { display: flex; gap: 8px; padding: 8px; align-items: stretch; }
    .mc-pad {
        flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 1fr; gap: 5px;
    }
    .mc-gap { visibility: hidden; }
    .mc-btn {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 0; min-height: 46px;
        background: linear-gradient(180deg, #241f33, #15121f);
        border: 1px solid var(--border-gold); border-radius: 11px;
        color: var(--gold-bright); font-size: 1.2rem; cursor: pointer;
        -webkit-tap-highlight-color: transparent; user-select: none;
    }
    .mc-btn small { font-size: 0.58rem; color: var(--text-muted); font-weight: 700; line-height: 1; }
    .mc-btn:active { background: var(--border-gold); color: #1a1526; transform: translateY(1px); }
    /* 봐: 패드 오른쪽 큰 버튼 */
    .mc-look { border-color: #00ffcc; color: #00ffcc; }
    .mc-big { width: 86px; min-height: auto; font-size: 1.7rem; font-weight: 900; }
    .mc-big small { font-size: 0.78rem; }
    .mc-big.mc-look {
        background: radial-gradient(circle at 50% 32%, #1f6b5e, #0c2b27);
        color: #e6fff9; box-shadow: 0 0 12px rgba(0, 255, 204, 0.35);
    }
    .mc-big.mc-look small { color: #b8fff0; }
    .mc-map { border-color: #6ca8ff; color: #6ca8ff; }
    .mc-equip { border-color: #c77dff; color: #c77dff; }
    .mc-equip small { letter-spacing: -0.03em; white-space: nowrap; }
    .mc-ud { opacity: 0.92; }
    /* 공격: 방향 패드 가운데 칸 (빨간 강조) */
    .mc-attack {
        background: radial-gradient(circle at 50% 32%, #d04434, #7a1f16);
        border-color: #e0564a; color: #fff; font-weight: 900;
        box-shadow: 0 0 10px rgba(224,86,74,0.4);
    }
    .mc-attack small { color: #ffe3de; }
    .mc-attack:active { filter: brightness(1.2); transform: translateY(1px); }

    /* ── 하단 핫바 ── */
    .hotbar { padding: 7px 8px; gap: 7px; }
    .potion-slot, .hotbar-skills .skill-btn { width: 50px; height: 50px; }
    .hb-ico { font-size: 1.5rem; }
    .potion-ico { font-size: 1.5rem; }
    .hb-num { font-size: 0.72rem; }
    .hb-mp, .hb-lv { font-size: 0.54rem; }

    .ad-banner { display: none; }    /* 모바일은 플레이 영역 최대화 */

    /* ===== 출력 화면 최대화: 주변 UI 압축 ===== */
    .workspace { padding: 4px; gap: 4px; }
    .game-stage { gap: 4px; }

    /* 상단 패널 → 2줄: [Lv·이름·직업 | 아이콘 버튼·골드] / [HP | MP | EXP 가로 배치] */
    .char-col { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; padding: 6px 8px; }
    .char-id { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
    .char-level { font-size: 1.05rem; }
    .mc-top { grid-column: 2; grid-row: 1; flex-direction: row; gap: 4px; }
    .mc-top-btn { flex: none; width: 34px; height: 30px; gap: 0; font-size: 0; border-radius: 8px; }
    .mc-top-btn span { font-size: 1.05rem; }
    .mc-top-gold { padding: 0 6px; height: 30px; font-size: 0.85rem; gap: 3px; }
    .mc-top-stat { flex: none; height: 30px; padding: 0 5px; gap: 2px; }
    .mc-top-stat i { display: none; }                 /* 좁은 화면: 아이콘 + 수치만 */
    .mc-top-stat span { font-size: 0.8rem; }
    .mc-top-stat b { font-size: 0.8rem; max-width: 52px; }
    .cp-bars { grid-column: 1 / -1; grid-row: 2; flex-direction: row; gap: 5px; }
    .cp-bar { flex: 1; min-width: 0; }
    .cp-bar-ico, .cp-bar-name { display: none; }      /* 색으로 구분 (빨강 HP · 파랑 MP · 금색 EXP) */
    .cp-bar-track { height: 16px; }
    .cp-bar-val { left: 0; right: 0; text-align: center; font-size: 0.68rem; }

    /* 출력창 주변 여백·탭·입력줄 축소 */
    .chat-col { padding: 5px; gap: 5px; }
    .chat-tabs { align-items: center; }
    .chat-tab { padding: 4px 9px; font-size: 0.74rem; }
    .chat-col .terminal-log { padding: 6px 8px; line-height: 1.4; }
    .chat-col .cmd-form { gap: 6px; }
    .chat-col .cmd-form input { padding: 8px 10px; }
    .chat-col .btn-send { width: 40px; height: 40px; font-size: 1.15rem; }

    /* 조작 패드·핫바 축소 */
    .mobile-controls { padding: 4px 6px; gap: 6px; }
    .mc-pad { gap: 4px; }
    .mc-btn { min-height: 38px; font-size: 1.05rem; }
    .mc-big { width: 78px; }
    .hotbar { padding: 5px 6px; gap: 6px; }
    .potion-slot, .hotbar-skills .skill-btn { width: 46px; height: 46px; }

    /* 🎮 패드 접기 토글 (탭 줄 오른쪽) */
    .chat-pad-toggle {
        display: flex; align-items: center; gap: 3px; margin-left: auto;
        padding: 4px 8px; font-size: 0.74rem; font-weight: 700; white-space: nowrap;
        background: linear-gradient(180deg, #241f33, #15121f);
        border: 1px solid var(--border-gold); border-radius: 8px;
        color: var(--gold-bright); cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    body.pad-hidden .chat-pad-toggle { background: var(--border-gold); color: #1a1526; }
    body.pad-hidden .mobile-controls { display: none; }

    /* 입력 중(키보드 표시)에는 패드·핫바를 숨겨 출력창 확보 */
    body.typing .mobile-controls, body.typing .hotbar { display: none; }

    /* ===== 출력 가독성 ===== */
    /* 한글은 단어(어절) 단위로 줄을 바꾼다 — '허수아/비' 처럼 낱말 가운데서 끊기지 않게.
       한 줄보다 긴 낱말(지도 줄 · 긴 영문)만 어쩔 수 없이 중간에서 끊는다. */
    .chat-col .terminal-log { word-break: keep-all; overflow-wrap: anywhere; }
    /* 글(방 묘사 · 전투 · 대사)은 가변폭 글꼴로 — 고정폭보다 한 줄에 훨씬 많이 들어간다.
       열을 공백으로 맞춘 표와 지도([[PRE]])만 고정폭으로 남긴다. */
    .chat-col .terminal-log { font-family: 'Noto Sans KR', system-ui, sans-serif; }
    .chat-col .terminal-log .log-pre {
        font-family: 'Consolas', 'Courier New', monospace;
        word-break: normal; overflow-wrap: normal;
    }
    /* 선 글자만으로 된 줄을 대신하는 가로줄 */
    .log-rule { display: block; height: 0; margin: 5px 0; border-top: 1px solid rgba(255, 255, 255, 0.28); }
    /* 명령 사이 빈 줄 · 턴 사이 여백은 반으로 */
    .chat-col .log-empty-line { height: 0.4em; min-height: 0.4em; line-height: 0.4; overflow: hidden; }
    .chat-col .log-turn-gap { height: 7px; }
    /* 같은 줄이 연달아 오면 한 줄로 합치고 횟수를 붙인다 */
    .log-repeat {
        display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px;
        font-size: 0.85em; font-weight: 800; color: #1a1526; background: var(--border-gold);
        font-variant-numeric: tabular-nums;
    }
    /* 긴 출력을 처음부터 읽는 동안 아래에 새 줄이 쌓이면 띄우는 단추 */
    .chat-col { position: relative; }
    .log-new-chip {
        position: absolute; left: 50%; transform: translateX(-50%); z-index: 20;
        padding: 5px 14px; border-radius: 14px; white-space: nowrap;
        font-size: 0.76rem; font-weight: 800; font-family: inherit;
        color: #1a1526; background: var(--gold-bright); border: 1px solid var(--border-gold);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55); cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .log-new-chip[hidden] { display: none; }

    /* 🎮 패드 단추: 탭이 많아 가로로 넘쳐도 오른쪽 끝에 붙어 항상 보인다. 좁은 화면에서는 그림만. */
    .chat-pad-toggle { position: sticky; right: 0; z-index: 2; box-shadow: -6px 0 8px rgba(10, 8, 16, 0.85); }
    .chat-pad-toggle .pad-label { display: none; }

    /* 상단 이름: 자리가 모자라면 직업 표시가 먼저 줄어들고, 그다음에 이름이 줄어든다 */
    .char-id { gap: 4px 7px; }
    .char-level { flex: none; }
    .char-name { flex: 0 1 auto; min-width: 0; }
    .char-class { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (min-width: 400px) and (max-width: 760px) {
    .chat-pad-toggle .pad-label { display: inline; }
}
/* ===================== 모바일 색감 =====================
   기본 색은 PC 와 같지만, 모바일은 화면의 1/3 이 단추(패드 · 핫바 · 상단)라 어두운 단추 면이 화면을 칙칙하게 만든다.
   → 단추 면을 한 단계 밝히고 기능별 색을 입힌다. 막대는 더 선명하게, 패널 · 출력창은 조금 밝게.
   (색만 바꾼다 — 크기 · 배치는 그대로) */
@media (max-width: 760px) {
    body { background-image: radial-gradient(circle at 50% 30%, #2a2350 0%, #141026 55%, #0a0814 100%); }

    /* 패널: 검정에 가까운 남색 → 보랏빛 남색. 안쪽 그림자는 줄여 면이 탁해 보이지 않게 */
    .panel-frame {
        background: linear-gradient(180deg, rgba(48, 39, 82, 0.96), rgba(27, 22, 50, 0.97));
        border-color: #e2c47f;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 0 14px rgba(0, 0, 0, 0.3),
                    0 6px 18px rgba(0, 0, 0, 0.45), 0 0 16px rgba(226, 196, 127, 0.16);
    }

    /* 출력창: 글이 또렷하도록 바탕은 어둡게 두되 푸른 기를 주고, 글은 더 희게 */
    .chat-col .terminal-log { background: rgba(13, 11, 30, 0.82); border-color: #4a4378; color: #f4f2fb; }
    .chat-col .cmd-form input { background: #1b1736; border-color: #e2c47f; color: #e6f3ff; }
    .chat-col .cmd-form input::placeholder { color: #9d98bd; }

    /* 탭 */
    .chat-tab { background: linear-gradient(180deg, #3d3468, #272046); border-color: #5a5088; color: #cfc9ea; }
    .chat-tab.active {
        color: #1a1526; background: linear-gradient(180deg, #ffe9a8, #e2bd62); border-color: #fff3cf;
        box-shadow: 0 0 12px rgba(255, 215, 120, 0.55);
    }
    .chat-pad-toggle {
        background: linear-gradient(180deg, #3d3468, #272046); border-color: #e2c47f; color: #ffe9b0;
        box-shadow: -6px 0 8px rgba(44, 36, 76, 0.9);         /* 밑으로 지나가는 탭을 가리는 그림자 — 패널 색에 맞춘다 */
    }

    /* 체력 · 마력 · 경험치 막대: 화사한 톤 — 장미빛 체력 · 하늘빛 마력 · 라일락에서 분홍으로 번지는 경험치.
       왼쪽에서 오른쪽으로 밝아지고, 위쪽 절반에 흰 윤기를 얹는다. 숫자는 흰 글씨 + 짙은 테두리 그림자로 또렷하게. */
    .cp-bar-track { background: #1c1838; border-color: #7a6fb0; }
    .cp-bar-track .hp-fill {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 52%),
                    linear-gradient(90deg, #ff4f7b 0%, #ff7a9a 60%, #ffa3b8 100%);
        box-shadow: 0 0 9px rgba(255, 110, 150, 0.7);
    }
    .cp-bar-track .mp-fill {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 52%),
                    linear-gradient(90deg, #2fa8ff 0%, #56c8ff 60%, #8fe6ff 100%);
        box-shadow: 0 0 9px rgba(90, 200, 255, 0.7);
    }
    .cp-bar-track .exp-fill {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 52%),
                    linear-gradient(90deg, #b07cff 0%, #d98cff 55%, #ff9ad5 100%);
        box-shadow: 0 0 9px rgba(215, 140, 255, 0.7);
    }
    .cp-bar-val, .cp-bar-name {
        text-shadow: 0 0 2px rgba(20, 10, 40, 0.95), 0 1px 2px rgba(20, 10, 40, 0.95), 0 0 5px rgba(20, 10, 40, 0.7);
    }

    /* 상단 단추 · 골드 */
    .mc-top-btn { background: linear-gradient(180deg, #4a3f7e, #2c2552); border-color: #e2c47f; }
    .mc-top-gold { background: linear-gradient(180deg, #4a3a1c, #2a2010); border-color: #e2c47f; color: #ffe08a; }
    .mc-top-stat { background: linear-gradient(180deg, #2c2546, #1b1730); border-color: #5c4f8a; }

    /* 조작 패드: 방향은 푸른 보라, 나머지는 기능별 색 */
    .mc-btn {
        background: linear-gradient(180deg, #4a3f7e, #2c2552);
        border-color: #a99be0; color: #fff4d6;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 5px rgba(0, 0, 0, 0.35);
    }
    .mc-btn small { color: #dcd6f5; }
    .mc-btn:active { background: #e2c47f; color: #1a1526; }
    .mc-ud { background: linear-gradient(180deg, #2f5a8e, #1c3660); border-color: #7fb8ff; opacity: 1; }
    .mc-look {
        background: linear-gradient(180deg, #1f8f7c, #0f5046); border-color: #3dffd6; color: #eafffa;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 10px rgba(0, 255, 204, 0.3);
    }
    .mc-look small { color: #c9fff3; }
    .mc-map { background: linear-gradient(180deg, #2f66b8, #1b3d78); border-color: #8fc0ff; color: #eef6ff; }
    .mc-map small { color: #d6e8ff; }
    .mc-equip { background: linear-gradient(180deg, #7a3fc0, #4a2380); border-color: #dba6ff; color: #fbf1ff; }
    .mc-equip small { color: #f0dcff; }
    .mc-attack {
        background: radial-gradient(circle at 50% 30%, #ff6a52, #c22a1c 70%, #8e1a10 100%);
        border-color: #ffa291; color: #fff;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 14px rgba(255, 90, 70, 0.55);
    }
    .mc-attack small { color: #fff0ec; }

    /* 핫바 */
    .potion-slot, .hotbar-skills .skill-btn {
        background: radial-gradient(circle at 50% 30%, #4f4488, #241d48 80%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 8px rgba(0, 0, 0, 0.35);
    }
    .hotbar-skills .skill-btn { border-color: #e2c47f; }
}
@media (max-width: 399px) {
    .char-class { display: none; }      /* 아주 좁은 화면: 이름에 자리를 내준다 */
}
.log-new-chip { display: none; }
@media (max-width: 760px) { .log-new-chip:not([hidden]) { display: block; } }

/* ===================== 노트북(14·15·16인치) 컴팩트 UI =====================
   대상: 폭 761~1600px 이거나 높이 960px 이하인 데스크톱 화면
   (1366×768, 1536×864, 1920×1080@125~150% 배율 등)
   목표: 우측 캐릭터 메뉴를 간소화하고, 그만큼 출력창(terminal-log)을 넓힌다.
   모바일(≤760px) 규칙과는 겹치지 않는다. */
@media (min-width: 761px) and (max-width: 1600px),
       (min-width: 761px) and (max-height: 960px) {
    .workspace { padding: 8px; gap: 8px; max-width: 1600px; }
    .game-stage { grid-template-columns: minmax(0, 1fr) 250px; gap: 8px; }

    /* 노트북에서는 하단 배너를 숨겨 출력창 세로 공간 확보
       (광고는 로그인 화면 · ☰ 게임 메뉴 창의 사각형 슬롯으로 노출) */
    .ad-banner { display: none; }

    /* ---- 출력/채팅 영역 ---- */
    .chat-col { padding: 8px; gap: 6px; }
    .chat-tab { padding: 5px 12px; font-size: 0.8rem; }
    .chat-col .terminal-log { padding: 10px 12px; }
    #cmd-input { padding: 8px 12px; }
    .chat-col .btn-send { width: 40px; height: 40px; font-size: 1.1rem; }

    /* ---- 캐릭터 메뉴 간소화 ---- */
    .char-col { padding: 10px; gap: 8px; }
    .char-head { gap: 10px; }
    .char-portrait { width: 44px; height: 44px; font-size: 1.4rem; border-width: 2px; }
    .char-level { font-size: 1.15rem; }
    .char-name { font-size: 0.9rem; }
    .char-class { font-size: 0.76rem; }

    .cp-bars { gap: 5px; }
    .cp-bar { gap: 6px; }
    .cp-bar-ico { font-size: 0.95rem; width: 18px; }
    .cp-bar-track { height: 20px; }
    .cp-bar-name { left: 9px; font-size: 0.7rem; }
    .cp-bar-val { right: 9px; font-size: 0.74rem; }

    .cp-stats { padding: 7px 8px; gap: 5px; }
    .cp-stats-head { font-size: 0.82rem; }
    .cp-step-label { display: none; }
    .cp-step-btn { padding: 2px 9px; font-size: 0.7rem; }
    .cp-stat { grid-template-columns: 20px 1fr auto 24px; gap: 6px; padding: 4px 8px; }
    .cp-stat-ico { font-size: 0.92rem; }
    .cp-stat-name { font-size: 0.85rem; }
    .cp-stat-val { font-size: 0.95rem; }
    .cp-plus { width: 24px; height: 24px; font-size: 1rem; border-width: 1px; }

    /* 골드·소지품을 한 줄로 (이름 라벨 생략, 아이콘으로 구분) */
    .cp-meta { flex-direction: row; gap: 6px; }
    .cp-meta-row { flex: 1; min-width: 0; padding: 5px 8px; gap: 6px; }
    .cp-meta-ico { font-size: 0.92rem; width: auto; }
    .cp-meta-name { display: none; }
    .cp-meta-val { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .cp-actions { gap: 5px; }
    .cp-action { padding: 6px 2px; gap: 2px; font-size: 0.7rem; border-radius: 8px; }
    .cp-action-ico { font-size: 1.1rem; }

    /* ---- 하단 핫바 ---- */
    .hotbar { padding: 6px 10px; gap: 8px; }
    .potion-slots, .hotbar-skills { gap: 7px; }
    .potion-slot, .hotbar-skills .skill-btn { width: 50px; height: 50px; border-radius: 8px; }
    .hb-ico { font-size: 1.5rem; }
    .potion-ico { font-size: 1.55rem; }
}

/* 아주 낮은 화면(≈1280×720, 150% 배율 등): 한 단계 더 압축 */
@media (min-width: 761px) and (max-height: 720px) {
    .char-portrait { display: none; }
    .char-id { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
    .cp-bar-track { height: 18px; }
    .cp-stat { padding: 3px 8px; }
    .potion-slot, .hotbar-skills .skill-btn { width: 44px; height: 44px; }
    .hb-ico { font-size: 1.3rem; }
    .potion-ico { font-size: 1.35rem; }
}

/* ===================== 데스크톱: 캐릭터 정보·메뉴를 왼쪽에 배치 =====================
   (모바일 ≤760px · 1단 레이아웃 ≤860px 에는 적용하지 않음) */
@media (min-width: 861px) {
    .game-stage { grid-template-columns: 342px minmax(0, 1fr); }
    .char-col { order: -1; }
}
@media (min-width: 861px) and (max-width: 1080px) {
    .game-stage { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (min-width: 861px) and (max-width: 1600px),
       (min-width: 861px) and (max-height: 960px) {
    .game-stage { grid-template-columns: 250px minmax(0, 1fr); }
}

/* ══ 스킬 등급 효과 (하급 0 → 중급 1 → 고급 2 → 레전더리 3 → 에픽 4, 높을수록 화려) ══ */
/* 글 속의 등급 표시: 승급한 스킬 이름 · 기술 목록의 등급 꼬리표 */
.skill-tier { font-weight: 700; }
.skill-tier-0 { color: #b9b6c9; }
.skill-tier-1 { color: #5fe08a; text-shadow: 0 0 6px rgba(79, 209, 122, 0.45); }
.skill-tier-2 { color: #6bb6ff; text-shadow: 0 0 8px rgba(74, 163, 255, 0.6); }
.skill-tier-3 {
    color: #dba6ff;
    text-shadow: 0 0 8px rgba(199, 125, 255, 0.8), 0 0 16px rgba(160, 80, 255, 0.45);
    animation: skill-tier-legend-pulse 1.8s ease-in-out infinite;
}
.skill-tier-4 {
    background: linear-gradient(100deg, #ffb300, #fff3b0 40%, #ffd23f 60%, #ff8f00);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 6px rgba(255, 200, 60, 0.75));
    animation: skill-tier-epic-shine 2.2s linear infinite;
}
@keyframes skill-tier-legend-pulse {
    50% { text-shadow: 0 0 12px rgba(220, 160, 255, 1), 0 0 26px rgba(170, 90, 255, 0.75); }
}
@keyframes skill-tier-epic-shine {
    from { background-position: 220% 0; }
    to   { background-position: 0 0; }
}

/* 승급 배너: 기본 틀은 .skillup-banner, 색과 움직임만 등급마다 바꾼다 */
.skillup-banner.tierup { position: relative; overflow: hidden; }
.skillup-banner.tierup-1 {
    color: #e3ffe9;
    background: linear-gradient(100deg, rgba(20, 110, 55, 0.2), rgba(79, 209, 122, 0.34), rgba(20, 110, 55, 0.2));
    border-color: rgba(79, 209, 122, 0.7);
    text-shadow: 0 0 10px rgba(79, 209, 122, 0.9);
    box-shadow: 0 0 18px rgba(79, 209, 122, 0.4), inset 0 0 14px rgba(79, 209, 122, 0.15);
    animation: levelup-pop 0.5s ease-out, tierup-glow-1 1.6s ease-in-out infinite 0.5s;
}
.skillup-banner.tierup-2 {
    color: #e6f3ff;
    background: linear-gradient(100deg, rgba(20, 70, 140, 0.24), rgba(74, 163, 255, 0.38), rgba(20, 70, 140, 0.24));
    border-color: rgba(74, 163, 255, 0.8);
    text-shadow: 0 0 10px rgba(74, 163, 255, 0.95), 0 0 20px rgba(40, 120, 255, 0.6);
    box-shadow: 0 0 22px rgba(74, 163, 255, 0.5), inset 0 0 16px rgba(74, 163, 255, 0.18);
    animation: levelup-pop 0.5s ease-out, tierup-glow-2 1.4s ease-in-out infinite 0.5s;
}
.skillup-banner.tierup-3 {
    color: #f6e8ff;
    font-size: 1.2rem;
    background: linear-gradient(100deg, rgba(70, 20, 120, 0.3), rgba(199, 125, 255, 0.42), rgba(70, 20, 120, 0.3));
    border: 2px solid rgba(215, 150, 255, 0.9);
    text-shadow: 0 0 12px rgba(215, 150, 255, 1), 0 0 26px rgba(160, 80, 255, 0.75);
    box-shadow: 0 0 30px rgba(199, 125, 255, 0.65), inset 0 0 20px rgba(199, 125, 255, 0.22);
    animation: levelup-pop 0.6s ease-out, tierup-glow-3 1.2s ease-in-out infinite 0.6s;
}
.skillup-banner.tierup-4 {
    color: #fff8dc;
    font-size: 1.28rem;
    background: linear-gradient(100deg, rgba(130, 80, 0, 0.34), rgba(255, 210, 63, 0.5), rgba(130, 80, 0, 0.34));
    border: 2px solid rgba(255, 220, 110, 0.95);
    text-shadow: 0 0 14px rgba(255, 220, 110, 1), 0 0 30px rgba(255, 170, 0, 0.8);
    box-shadow: 0 0 38px rgba(255, 200, 60, 0.75), inset 0 0 24px rgba(255, 210, 63, 0.28);
    animation: levelup-pop 0.7s ease-out, tierup-glow-4 1s ease-in-out infinite 0.7s;
}
/* 레전더리·에픽 배너 위를 빛줄기가 훑고 지나간다 */
.skillup-banner.tierup-3::after,
.skillup-banner.tierup-4::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -60%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-20deg);
    animation: tierup-sweep 2.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes tierup-glow-1 { 50% { filter: brightness(1.2); box-shadow: 0 0 26px rgba(79, 209, 122, 0.7), inset 0 0 18px rgba(79, 209, 122, 0.28); } }
@keyframes tierup-glow-2 { 50% { filter: brightness(1.25); box-shadow: 0 0 32px rgba(74, 163, 255, 0.85), inset 0 0 20px rgba(74, 163, 255, 0.32); } }
@keyframes tierup-glow-3 { 50% { filter: brightness(1.3); box-shadow: 0 0 44px rgba(215, 150, 255, 1), inset 0 0 26px rgba(199, 125, 255, 0.4); } }
@keyframes tierup-glow-4 { 50% { filter: brightness(1.35); box-shadow: 0 0 56px rgba(255, 215, 90, 1), inset 0 0 30px rgba(255, 210, 63, 0.5); } }
@keyframes tierup-sweep {
    0%   { left: -60%; }
    60%, 100% { left: 130%; }
}

/* 스킬바: 방금 등급이 오른 스킬 타일이 한 번 터지듯 빛난다 (등급 색은 .rarity-* 가 맡는다) */
.hotbar-skills .skill-btn.hb-tierup { animation: hb-tierup-burst 1.6s ease-out; z-index: 2; }
@keyframes hb-tierup-burst {
    0%   { transform: scale(1);    filter: brightness(1); }
    20%  { transform: scale(1.28); filter: brightness(2.2) saturate(1.6); }
    45%  { transform: scale(0.96); filter: brightness(1.5); }
    100% { transform: scale(1);    filter: brightness(1); }
}
/* 움직임을 줄이도록 설정한 사용자에게는 색만 보여 준다 */
@media (prefers-reduced-motion: reduce) {
    .skill-tier-3, .skill-tier-4, .skillup-banner.tierup, .hotbar-skills .skill-btn.hb-tierup { animation: none; }
    .skillup-banner.tierup-3::after, .skillup-banner.tierup-4::after { display: none; }
}

/* ══ 스킬 속성 색 — 스킬 이름 · 시전 묘사 · 스킬바 아이콘 (속성은 content/skill_flavor.py 에서 정한다) ══ */
.skill-el { font-weight: 700; }
/* 시전 묘사 한 줄: 기울임체는 한글이 뭉개져 읽기 어려워 쓰지 않는다.
   곧은 글씨에 속성 색 세로줄과 옅은 바탕을 깔아 '묘사'임을 구분한다. */
.skill-flavor {
    display: inline-block;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.5;
    padding: 2px 10px 2px 9px;
    margin: 1px 0;
    border-left: 3px solid currentColor;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015) 70%, transparent);
}
/* 묘사 줄은 글자 번짐(글로우)을 없애 또렷하게 */
.skill-el.skill-flavor { text-shadow: none; }
.skill-el-fire { color: #ff8a4c; text-shadow: 0 0 7px #ff8a4c66; }
.hotbar-skills .skill-btn.hb-el-fire .hb-ico { filter: drop-shadow(0 0 5px #ff8a4c); }
.skill-el-frost { color: #8fdcff; text-shadow: 0 0 7px #8fdcff66; }
.hotbar-skills .skill-btn.hb-el-frost .hb-ico { filter: drop-shadow(0 0 5px #8fdcff); }
.skill-el-lightning { color: #ffe866; text-shadow: 0 0 7px #ffe86666; }
.hotbar-skills .skill-btn.hb-el-lightning .hb-ico { filter: drop-shadow(0 0 5px #ffe866); }
.skill-el-holy { color: #ffe9a8; text-shadow: 0 0 7px #ffe9a866; }
.hotbar-skills .skill-btn.hb-el-holy .hb-ico { filter: drop-shadow(0 0 5px #ffe9a8); }
.skill-el-arcane { color: #cfa4ff; text-shadow: 0 0 7px #cfa4ff66; }
.hotbar-skills .skill-btn.hb-el-arcane .hb-ico { filter: drop-shadow(0 0 5px #cfa4ff); }
.skill-el-poison { color: #9be35a; text-shadow: 0 0 7px #9be35a66; }
.hotbar-skills .skill-btn.hb-el-poison .hb-ico { filter: drop-shadow(0 0 5px #9be35a); }
.skill-el-shadow { color: #a78bdc; text-shadow: 0 0 7px #a78bdc66; }
.hotbar-skills .skill-btn.hb-el-shadow .hb-ico { filter: drop-shadow(0 0 5px #a78bdc); }
.skill-el-steel { color: #d5dbe8; text-shadow: 0 0 7px #d5dbe866; }
.hotbar-skills .skill-btn.hb-el-steel .hb-ico { filter: drop-shadow(0 0 5px #d5dbe8); }
.skill-el-earth { color: #d9ab72; text-shadow: 0 0 7px #d9ab7266; }
.hotbar-skills .skill-btn.hb-el-earth .hb-ico { filter: drop-shadow(0 0 5px #d9ab72); }
.skill-el-wind { color: #86f0d2; text-shadow: 0 0 7px #86f0d266; }
.hotbar-skills .skill-btn.hb-el-wind .hb-ico { filter: drop-shadow(0 0 5px #86f0d2); }
.skill-el-nature { color: #79d98a; text-shadow: 0 0 7px #79d98a66; }
.hotbar-skills .skill-btn.hb-el-nature .hb-ico { filter: drop-shadow(0 0 5px #79d98a); }
.skill-el-blood { color: #ff6b78; text-shadow: 0 0 7px #ff6b7866; }
.hotbar-skills .skill-btn.hb-el-blood .hb-ico { filter: drop-shadow(0 0 5px #ff6b78); }
/* 승급한 스킬 이름: 글자색은 속성 색, 빛(글로우·맥동)은 등급의 것을 물려받는다 */
.skill-tier .skill-el { text-shadow: inherit; }

/* ══ 물약 슬롯: 사용 이펙트 · 재사용 대기 (직접 사용 · 자동 물약 공통) ══ */
.potion-slot.potion-used { animation: potion-used-burst 0.7s ease-out; z-index: 2; }
.potion-slot.potion-used .potion-ico { animation: potion-ico-pop 0.7s ease-out; }
.potion-slot.potion-hp.potion-used { --potion-glow: 255, 96, 84; }
.potion-slot.potion-mp.potion-used { --potion-glow: 84, 170, 255; }
/* 슬롯 위로 떠오르며 사라지는 빛 */
.potion-slot.potion-used::after {
    content: "✚";
    position: absolute;
    left: 50%; top: 50%;
    font-size: 1.5rem;
    font-weight: 900;
    color: rgb(var(--potion-glow, 255, 255, 255));
    text-shadow: 0 0 8px rgba(var(--potion-glow, 255, 255, 255), 0.9);
    transform: translate(-50%, -50%);
    animation: potion-plus-rise 0.7s ease-out forwards;
    pointer-events: none;
    z-index: 5;
}
@keyframes potion-used-burst {
    0%   { box-shadow: 0 0 0 0 rgba(var(--potion-glow, 255, 255, 255), 0.9), inset 0 0 10px rgba(0, 0, 0, 0.6); filter: brightness(1.9); }
    40%  { box-shadow: 0 0 22px 8px rgba(var(--potion-glow, 255, 255, 255), 0.55), inset 0 0 18px rgba(var(--potion-glow, 255, 255, 255), 0.5); filter: brightness(1.35); }
    100% { box-shadow: 0 0 0 0 rgba(var(--potion-glow, 255, 255, 255), 0), inset 0 0 10px rgba(0, 0, 0, 0.6); filter: brightness(1); }
}
@keyframes potion-ico-pop {
    0%   { transform: scale(1) rotate(0deg); }
    25%  { transform: scale(1.35) rotate(-18deg); }
    55%  { transform: scale(0.92) rotate(6deg); }
    100% { transform: scale(1) rotate(0deg); }
}
@keyframes potion-plus-rise {
    0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
    25%  { opacity: 1; transform: translate(-50%, -70%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -150%) scale(0.9); }
}
/* 재사용 대기: 스킬 슬롯과 같은 시계 방향 가림막 */
.potion-slot .potion-cd-overlay { z-index: 3; }
@media (prefers-reduced-motion: reduce) {
    .potion-slot.potion-used, .potion-slot.potion-used .potion-ico { animation: none; }
    .potion-slot.potion-used::after { display: none; }
}

/* ══ 제물로 능력치가 올랐을 때 ══ 그 부분만 능력치 색(힘 진홍 · 민첩 비취 · 지능 보라)으로 살짝 빛나게 */
.sacup-chip {
    --sac: 255, 90, 60; --sac-hi: 255, 214, 190;
    display: inline-block;
    padding: 0 7px;
    border-radius: 9px;
    font-weight: 800;
    color: rgb(var(--sac-hi));
    background: rgba(var(--sac), 0.2);
    border: 1px solid rgba(var(--sac), 0.7);
    text-shadow: 0 0 8px rgba(var(--sac), 0.9);
    animation: levelup-pop 0.5s ease-out;
}
.sacup-str { --sac: 255, 80, 60; --sac-hi: 255, 214, 190; }
.sacup-agi { --sac: 40, 210, 130; --sac-hi: 210, 255, 225; }
.sacup-int { --sac: 170, 100, 255; --sac-hi: 236, 215, 255; }
@media (prefers-reduced-motion: reduce) {
    .sacup-chip { animation: none; }
}

/* ══ 로그 성능 ══
   · content-visibility 는 쓰지 않는다: 화면 밖 줄의 높이를 어림값으로 잡아, 지도·장비처럼 여러 줄짜리
     출력 뒤에 맨 아래로 스크롤이 내려가지 않았다. (줄 수 제한만으로도 충분히 가볍다)
   · 끝없이 도는 애니메이션(승급 배너의 빛 · 레전더리 이름의 맥동 · 희귀 아이템 반짝임)은 최근 줄에서만 돌린다.
     지나간 줄 수백 개가 계속 움직이면 오래 사냥할수록 화면이 느려진다. */
.terminal-log > :not(:nth-last-child(-n+30)),
.terminal-log > :not(:nth-last-child(-n+30)) *,
.terminal-log > :not(:nth-last-child(-n+30)) *::before,
.terminal-log > :not(:nth-last-child(-n+30)) *::after {
    animation: none !important;
}

/* ══ 대화 채널 — 중요도에 따라 점점 눈에 띄게: 말하기 < 파티 < 왕국 < 잡담(메가폰) ══
   (display 는 건드리지 않는다 — 채팅 탭 필터의 display:none 을 덮어쓰지 않도록) */
.terminal-log .log-line.chat-line {
    margin: 2px 0;
    padding: 2px 10px 2px 9px;
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
}
/* 말하기: 같은 방 사람끼리 — 차분한 흰색, 가는 줄만 */
.terminal-log .log-line.chat-say {
    color: #e6e2f0;
    border-left-color: #6f6a85;
}
/* 파티 대화: 하늘색 줄 + 옅은 바탕 */
.terminal-log .log-line.chat-party {
    color: #9fd8ff;
    font-weight: 500;
    border-left-color: #4fb3ff;
    background: linear-gradient(90deg, rgba(79, 179, 255, 0.13), rgba(79, 179, 255, 0.03) 70%, transparent);
}
/* 왕국 대화: 금색 줄 + 금빛 바탕, 조금 굵게 */
.terminal-log .log-line.chat-kingdom {
    color: #ffdf8a;
    font-weight: 600;
    border-left-width: 4px;
    border-left-color: #e8b93a;
    background: linear-gradient(90deg, rgba(232, 185, 58, 0.18), rgba(232, 185, 58, 0.05) 75%, transparent);
    text-shadow: 0 0 6px rgba(232, 185, 58, 0.35);
}
/* 잡담: 메가폰을 써서 모두에게 외치는 말 — 테두리 상자 · 큰 글씨 · 등장 효과 */
.terminal-log .log-line.chat-shout {
    margin: 6px 0;
    padding: 6px 12px;
    color: #fff3e0;
    font-size: 1.06em;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid rgba(255, 150, 70, 0.75);
    border-left: 5px solid #ff8a3c;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(255, 120, 40, 0.30), rgba(255, 170, 70, 0.14) 60%, rgba(255, 170, 70, 0.06));
    box-shadow: 0 0 12px rgba(255, 130, 50, 0.28), inset 0 0 14px rgba(255, 150, 70, 0.10);
    text-shadow: 0 0 8px rgba(255, 150, 70, 0.55);
    animation: chat-shout-in 0.9s ease-out;        /* 한 번만 — 계속 도는 효과는 두지 않는다 */
}
@keyframes chat-shout-in {
    0%   { transform: translateX(-10px); opacity: 0; box-shadow: 0 0 26px rgba(255, 150, 60, 0.9); }
    35%  { transform: translateX(0); opacity: 1; box-shadow: 0 0 26px rgba(255, 150, 60, 0.9); }
    100% { box-shadow: 0 0 12px rgba(255, 130, 50, 0.28), inset 0 0 14px rgba(255, 150, 70, 0.10); }
}
@media (prefers-reduced-motion: reduce) {
    .terminal-log .log-line.chat-shout { animation: none; }
}

/* 공지: 운영자가 모두에게 알리는 말 — 잡담보다 더 눈에 띄게. 가운데 정렬 · 큰 글씨 · 붉은 금빛 상자 · 위아래 금색 띠 */
.terminal-log .log-line.chat-notice {
    margin: 10px 0;
    padding: 12px 16px;
    text-align: center;
    color: #fff8dc;
    font-size: 1.2em;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.55;
    border: 2px solid #ffd24a;
    border-left: 2px solid #ffd24a;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 210, 74, 0.22), transparent 22%, transparent 78%, rgba(255, 210, 74, 0.22)),
        linear-gradient(90deg, rgba(150, 20, 30, 0.72), rgba(200, 50, 40, 0.62) 50%, rgba(150, 20, 30, 0.72));
    box-shadow: 0 0 20px rgba(255, 200, 70, 0.55), inset 0 0 20px rgba(255, 210, 74, 0.18);
    text-shadow: 0 0 10px rgba(255, 215, 90, 0.85), 0 1px 2px rgba(0, 0, 0, 0.7);
    animation: chat-notice-in 1.6s ease-out;       /* 등장할 때 세 번 번쩍이고 멈춘다 */
}
@keyframes chat-notice-in {
    0%   { transform: scale(0.92); opacity: 0; }
    15%  { transform: scale(1.03); opacity: 1; box-shadow: 0 0 38px rgba(255, 220, 100, 1); }
    30%  { transform: scale(1); box-shadow: 0 0 14px rgba(255, 200, 70, 0.4); }
    50%  { box-shadow: 0 0 38px rgba(255, 220, 100, 1); }
    70%  { box-shadow: 0 0 14px rgba(255, 200, 70, 0.4); }
    85%  { box-shadow: 0 0 34px rgba(255, 220, 100, 0.95); }
    100% { box-shadow: 0 0 20px rgba(255, 200, 70, 0.55), inset 0 0 20px rgba(255, 210, 74, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
    .terminal-log .log-line.chat-notice { animation: none; }
}

/* ══ 업적 달성 배너 — 단계가 오를수록 화려하게 (동 · 은 · 금 · 전설). 등장 효과는 한 번만. ══ */
.achv-banner {
    display: block;
    margin: 8px 0;
    padding: 9px 14px;
    font-weight: 700;
    line-height: 1.6;
    border: 1px solid;
    border-left-width: 5px;
    border-radius: 10px;
    animation: achv-in 0.9s ease-out;
}
.achv-0 { color: #f0c9a4; border-color: #b9773f; background: linear-gradient(90deg, rgba(185, 119, 63, 0.24), rgba(185, 119, 63, 0.05)); }
.achv-1 { color: #e8eef7; border-color: #aab7c9; background: linear-gradient(90deg, rgba(170, 183, 201, 0.24), rgba(170, 183, 201, 0.05)); }
.achv-2 {
    color: #ffe9a8; border-color: #f1c232;
    background: linear-gradient(90deg, rgba(241, 194, 50, 0.28), rgba(241, 194, 50, 0.07));
    text-shadow: 0 0 8px rgba(241, 194, 50, 0.6);
    box-shadow: 0 0 14px rgba(241, 194, 50, 0.3);
}
.achv-3 {
    color: #fff4d6; border-color: #ff9d3c; border-width: 2px; border-left-width: 6px;
    font-size: 1.08em; font-weight: 800; text-align: center;
    background: linear-gradient(100deg, rgba(160, 60, 200, 0.34), rgba(255, 150, 50, 0.34) 50%, rgba(160, 60, 200, 0.34));
    text-shadow: 0 0 10px rgba(255, 170, 70, 0.9), 0 0 18px rgba(200, 110, 255, 0.6);
    box-shadow: 0 0 20px rgba(255, 160, 60, 0.5), inset 0 0 16px rgba(200, 110, 255, 0.18);
    animation: achv-in-legend 1.5s ease-out;
}
@keyframes achv-in {
    0%   { transform: translateY(6px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes achv-in-legend {
    0%   { transform: scale(0.9); opacity: 0; }
    20%  { transform: scale(1.04); opacity: 1; box-shadow: 0 0 40px rgba(255, 180, 80, 1); }
    45%  { transform: scale(1); box-shadow: 0 0 14px rgba(255, 160, 60, 0.4); }
    70%  { box-shadow: 0 0 36px rgba(255, 180, 80, 0.95); }
    100% { box-shadow: 0 0 20px rgba(255, 160, 60, 0.5), inset 0 0 16px rgba(200, 110, 255, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
    .achv-banner, .achv-3 { animation: none; }
}

/* ══ 레전더리 · 에픽 장비 이름 — 배경 판 없이, 빛이 흐르는 글자와 숨 쉬는 후광 · 반짝이는 별만 ══ */
.item-rarity.rarity-legendary,
.item-rarity.rarity-epic {
    position: relative;
    display: inline-block;
    padding: 0 6px;
    margin: 0 1px;
    font-weight: 900;
    letter-spacing: 0.02em;
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
}
.item-rarity.rarity-legendary {
    background-image: linear-gradient(100deg, #ff7a18, #ffe486, #fffbe0, #ffc041, #ff7a18, #ffe486);
    background-size: 250% auto;
    animation: legendary-shine 2.2s linear infinite, rarity-legendary-glow 2.4s ease-in-out infinite;
}
.item-rarity.rarity-epic {
    background-image: linear-gradient(100deg, #ff3df5, #8f6bff, #3de8ff, #fff27a, #ff7ad9, #ff3df5, #8f6bff);
    background-size: 300% auto;
    animation: rarity-epic-flow 2.6s linear infinite, rarity-epic-glow 3s linear infinite;
}
/* 양 끝 장식: 반짝이는 별 */
.item-rarity.rarity-legendary::before, .item-rarity.rarity-legendary::after,
.item-rarity.rarity-epic::before, .item-rarity.rarity-epic::after {
    content: "✦";
    position: absolute;
    top: -0.55em;
    font-size: 0.6em;
    -webkit-text-fill-color: #fff6c8;
    text-shadow: 0 0 6px #ffd24a, 0 0 10px #ff9d2e;
    animation: rarity-twinkle 1.6s ease-in-out infinite;
    pointer-events: none;
}
.item-rarity.rarity-legendary::before, .item-rarity.rarity-epic::before { left: -3px; }
.item-rarity.rarity-legendary::after, .item-rarity.rarity-epic::after { right: -3px; top: auto; bottom: -0.5em; animation-delay: 0.8s; }
.item-rarity.rarity-epic::before, .item-rarity.rarity-epic::after {
    content: "✧";
    -webkit-text-fill-color: #ffe6ff;
    text-shadow: 0 0 6px #ff3df5, 0 0 12px #5ad0ff;
}
@keyframes rarity-legendary-glow {
    0%, 100% { filter: drop-shadow(0 0 4px #ff8d1f) drop-shadow(0 0 10px rgba(255, 199, 70, 0.6)); }
    50%      { filter: drop-shadow(0 0 7px #ffb347) drop-shadow(0 0 16px rgba(255, 215, 110, 0.95)); }
}
@keyframes rarity-epic-flow { to { background-position: 300% center; } }
@keyframes rarity-epic-glow {
    0%, 100% { filter: drop-shadow(0 0 5px #ff3df5) drop-shadow(0 0 13px rgba(255, 61, 245, 0.75)); }
    33%      { filter: drop-shadow(0 0 6px #5ad0ff) drop-shadow(0 0 14px rgba(90, 208, 255, 0.8)); }
    66%      { filter: drop-shadow(0 0 6px #fff27a) drop-shadow(0 0 14px rgba(255, 240, 120, 0.8)); }
}
@keyframes rarity-twinkle {
    0%, 100% { opacity: 0.25; transform: scale(0.7) rotate(0deg); }
    50%      { opacity: 1; transform: scale(1.25) rotate(45deg); }
}

/* ══ 칭호 — 업적으로 얻는 호칭. 가장 화려하게: 무지갯빛으로 흐르는 글자 · 금테 두른 문장(紋章) 판 ·
      판 위를 스치는 빛줄기 · 양옆의 날개 장식 · 숨 쉬듯 번지는 후광 ══ */
.title-badge {
    display: inline-block;
    padding: 0 12px;
    margin: 0 4px 0 2px;
    border-radius: 999px;
    border: 1px solid #ffe08a;
    background:
        linear-gradient(135deg, rgba(40, 10, 70, 0.95), rgba(90, 20, 60, 0.95) 50%, rgba(20, 30, 90, 0.95));
    box-shadow:
        0 0 0 1px rgba(120, 60, 0, 0.9),
        0 0 0 2px rgba(255, 215, 110, 0.85),
        0 0 12px rgba(255, 200, 80, 0.8),
        0 0 26px rgba(255, 90, 220, 0.45),
        inset 0 0 10px rgba(255, 220, 130, 0.35);
    overflow: hidden;
    /* 안쪽이 넘치지 않게 자르는 상자(overflow: hidden)는 글줄 기준선이 상자 바닥으로 잡혀 위로 떠 보인다.
       가운데 맞춤으로 양옆 글자와 높이를 맞추고, 줄 높이를 글자에 붙여 줄 간격도 벌어지지 않게 한다. */
    vertical-align: middle;
    line-height: 1.25;
    position: relative;
    top: -0.05em;
    animation: title-halo 2.4s ease-in-out infinite;
}
.title-badge .title-text {
    position: relative;
    z-index: 1;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-weight: 900;
    letter-spacing: 0.06em;
    background: linear-gradient(100deg, #ffd24a, #fff7d1, #ff8ad8, #b58cff, #6fe3ff, #fff7d1, #ffd24a, #fff7d1);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 3px rgba(255, 220, 120, 0.9));
    animation: title-flow 3s linear infinite;
}
.title-badge .title-text::before { content: "❖ "; -webkit-text-fill-color: #ffe08a; font-size: 0.8em; }
.title-badge .title-text::after  { content: " ❖"; -webkit-text-fill-color: #ffe08a; font-size: 0.8em; }
/* 판 위를 비스듬히 스치는 빛줄기 */
.title-badge::after {
    content: "";
    position: absolute;
    top: -20%;
    left: -60%;
    width: 40%;
    height: 140%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.75), transparent);
    transform: skewX(-20deg);
    animation: title-sweep 2.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes title-flow { to { background-position: 300% center; } }
@keyframes title-sweep {
    0%, 55% { left: -60%; }
    100%    { left: 130%; }
}
@keyframes title-halo {
    0%, 100% { box-shadow: 0 0 0 1px rgba(120, 60, 0, 0.9), 0 0 0 2px rgba(255, 215, 110, 0.85),
                           0 0 12px rgba(255, 200, 80, 0.8), 0 0 26px rgba(255, 90, 220, 0.45), inset 0 0 10px rgba(255, 220, 130, 0.35); }
    50%      { box-shadow: 0 0 0 1px rgba(120, 60, 0, 0.9), 0 0 0 2px rgba(255, 240, 170, 1),
                           0 0 20px rgba(255, 220, 110, 1), 0 0 38px rgba(110, 220, 255, 0.6), inset 0 0 14px rgba(255, 235, 160, 0.5); }
}
@media (prefers-reduced-motion: reduce) {
    .item-rarity.rarity-legendary, .item-rarity.rarity-epic,
    .item-rarity.rarity-legendary::before, .item-rarity.rarity-legendary::after,
    .item-rarity.rarity-epic::before, .item-rarity.rarity-epic::after,
    .title-badge, .title-badge .title-text, .title-badge::after { animation: none; }
}

/* ══ 방 안에 서 있는 보스 · 네임드 — 일반 몬스터 줄과 구분되도록 은은하게 ══
   네임드: 금빛 글자와 옅은 보랏빛 바탕, 천천히 숨 쉬는 빛.  보스: 붉은 금빛, 조금 더 굵고 뚜렷한 테두리와 맥동. */
.mob-presence {
    display: inline-block;
    padding: 1px 10px 1px 9px;
    margin: 1px 0;
    border-left: 3px solid;
    border-radius: 0 7px 7px 0;
    font-weight: 600;
}
.mob-named {
    color: #ffe6a3;
    border-left-color: #e9c46a;
    background: linear-gradient(90deg, rgba(150, 110, 255, 0.16), rgba(233, 196, 106, 0.07) 65%, transparent);
    text-shadow: 0 0 6px rgba(233, 196, 106, 0.45);
    animation: mob-named-breathe 3.2s ease-in-out infinite;
}
.mob-boss {
    color: #ffd9c2;
    font-weight: 700;
    border-left-width: 4px;
    border-left-color: #ff5a3c;
    background: linear-gradient(90deg, rgba(200, 30, 30, 0.26), rgba(255, 140, 60, 0.10) 65%, transparent);
    text-shadow: 0 0 7px rgba(255, 90, 60, 0.6);
    box-shadow: -2px 0 10px rgba(255, 70, 40, 0.35);
    animation: mob-boss-pulse 2.2s ease-in-out infinite;
}
@keyframes mob-named-breathe {
    0%, 100% { text-shadow: 0 0 6px rgba(233, 196, 106, 0.45); }
    50%      { text-shadow: 0 0 11px rgba(255, 220, 140, 0.8), 0 0 18px rgba(170, 130, 255, 0.35); }
}
@keyframes mob-boss-pulse {
    0%, 100% { box-shadow: -2px 0 10px rgba(255, 70, 40, 0.35); text-shadow: 0 0 7px rgba(255, 90, 60, 0.6); }
    50%      { box-shadow: -3px 0 18px rgba(255, 90, 50, 0.7); text-shadow: 0 0 12px rgba(255, 130, 80, 0.95); }
}
@media (prefers-reduced-motion: reduce) {
    .mob-named, .mob-boss { animation: none; }
}

/* ══ 서사 — 새로 열린 장 · 새로 발견한 땅. 오래된 양피지 느낌으로 차분하게 ══ */
.story-banner {
    display: inline-block;
    margin: 6px 0 2px;
    padding: 4px 14px;
    color: #f1e3c0;
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-top: 1px solid rgba(214, 180, 110, 0.7);
    border-bottom: 1px solid rgba(214, 180, 110, 0.7);
    background: linear-gradient(90deg, transparent, rgba(150, 110, 50, 0.28) 20%, rgba(150, 110, 50, 0.28) 80%, transparent);
    text-shadow: 0 0 8px rgba(214, 180, 110, 0.5);
}

/* ══ 지속 피해 — 종류마다 다른 색: 독 초록 · 출혈 붉은색 · 화상 주황 · 여진 흙빛 ══ */
.dot-fx { font-weight: 700; }
.dot-poison { color: #c77dff; text-shadow: 0 0 6px rgba(170, 80, 255, 0.6); }      /* 독: 보라 (숫자와 같은 색) */
.dot-bleed  { color: #ff5c6c; text-shadow: 0 0 6px rgba(255, 60, 80, 0.55); }
.dot-burn   { color: #ff9a3c; text-shadow: 0 0 6px rgba(255, 140, 40, 0.6); }
.dot-quake  { color: #d2a66a; text-shadow: 0 0 6px rgba(190, 140, 80, 0.5); }

/* ══ 몬스터 스킬 효과의 수치 — 종류마다 다른 색 ══
   마법 피해 보라 · 회복 연두 · 재생 청록 · 흡혈 자주 · 약화 남보라 · 격노 주홍 (물리 피해는 기존 dmg-taken) */
.dmg-magic { color: #7fc4ff; font-weight: 700; text-shadow: 0 0 6px rgba(90, 170, 255, 0.6); }   /* 마법 피해: 푸른빛 (독의 보라와 구분) */
.mob-fx { font-weight: 700; }
.mob-fx-heal   { color: #9dff7a; text-shadow: 0 0 6px rgba(120, 255, 90, 0.55); }
.mob-fx-regen  { color: #5fe6c4; text-shadow: 0 0 6px rgba(70, 220, 180, 0.55); }
.mob-fx-drain  { color: #ff6fae; text-shadow: 0 0 6px rgba(255, 70, 150, 0.6); }
.mob-fx-weaken { color: #a99bff; text-shadow: 0 0 6px rgba(140, 120, 255, 0.6); }
.mob-fx-enrage { color: #ff7a4a; text-shadow: 0 0 6px rgba(255, 100, 50, 0.6); }

/* ══ 전투 가시성 ══
   줄 왼쪽의 색 띠로 누가 한 일인지 구분한다: 내 행동 파랑 · 적의 행동 붉은색 · 지속 효과 흐리게 들여쓰기 · 빗나감 회색.
   턴 끝에는 내 체력 · 적 체력 · 걸린 효과를 한 줄로 보여 준다. */
.terminal-log .log-line.act-line { padding-left: 9px; border-left: 3px solid transparent; }
.terminal-log .log-line.act-me   { border-left-color: #4fa8ff; background: linear-gradient(90deg, rgba(79, 168, 255, 0.10), transparent 45%); }
.terminal-log .log-line.act-foe  { border-left-color: #ff5f52; background: linear-gradient(90deg, rgba(255, 95, 82, 0.10), transparent 45%); }
.terminal-log .log-line.act-fx   { margin-left: 16px; border-left-color: #6b6780; opacity: 0.9; font-size: 0.95em; }
.terminal-log .log-line.act-miss { border-left-color: #55516a; color: #8a879c; }
.terminal-log .log-line.act-stat {
    margin: 3px 0 1px;
    padding: 2px 9px;
    border-left-color: #c8aa6e;
    border-radius: 0 6px 6px 0;
    background: rgba(255, 255, 255, 0.045);
    color: #cfcbe0;
    font-size: 0.93em;
    font-variant-numeric: tabular-nums;
}
.hp-bar { letter-spacing: -1px; }
.hp-bar-me  { color: #5ee08a; }
.hp-bar-foe { color: #ff8a70; }
.hp-bar-low { color: #ff4040; text-shadow: 0 0 6px rgba(255, 50, 50, 0.8); }
/* 치명타: 꼬리표 + 더 큰 숫자 */
.crit-tag {
    color: #ffb13c;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-shadow: 0 0 7px rgba(255, 160, 50, 0.75);
}
.dmg-crit { font-size: 1.18em; font-weight: 800; }
/* 체력 위험 경고: 붉게 한 번 깜빡이고 멈춘다 */
.danger-banner {
    display: block;
    margin: 4px 0;
    padding: 5px 12px;
    color: #ffe1dc;
    font-weight: 800;
    text-align: center;
    border: 1px solid #ff4a3d;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(190, 20, 20, 0.55), rgba(255, 70, 50, 0.4), rgba(190, 20, 20, 0.55));
    animation: danger-flash 1.2s ease-out;
}
@keyframes danger-flash {
    0%, 40%, 80% { box-shadow: 0 0 22px rgba(255, 60, 40, 1); }
    20%, 60%, 100% { box-shadow: 0 0 6px rgba(255, 60, 40, 0.3); }
}
@media (prefers-reduced-motion: reduce) { .danger-banner { animation: none; } }

/* ══ 대상 창 — 싸우는 동안 로그 위에 고정. 로그를 읽지 않아도 적의 상태가 보인다 ══ */
.target-frame {
    flex: 0 0 auto;
    margin: 0 0 6px;
    padding: 7px 12px 8px;
    border: 1px solid #5a4a3a;
    border-left: 4px solid #ff8a70;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(40, 22, 26, 0.92), rgba(22, 16, 26, 0.92));
}
.target-frame[hidden] { display: none; }
.target-frame.tf-named { border-left-color: #e9c46a; }
.target-frame.tf-boss  { border-left-color: #ff3d2e; box-shadow: 0 0 12px rgba(255, 60, 40, 0.3); }
.tf-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tf-name { font-weight: 700; color: #ffe1d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-hp { flex: 0 0 auto; font-size: 0.9em; color: #d9d2e6; font-variant-numeric: tabular-nums; }
.tf-bar { height: 9px; margin-top: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
.tf-fill {
    height: 100%;
    width: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #ff6a4d, #ffb070);
    transition: width 0.35s ease-out;
}
.tf-fill.tf-fill-low { background: linear-gradient(90deg, #c81e1e, #ff5a4a); }
.tf-fx { margin-top: 4px; min-height: 1.1em; font-size: 0.86em; color: #b9b3cc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-fx:empty { display: none; }
/* 모바일: 몬스터 체력바도 내 막대(장미빛 체력 · 하늘빛 마력)와 같은 화사한 톤으로.
   내 체력과 헷갈리지 않게 살구빛에서 노랑으로 번지는 색을 쓰고, 30% 아래로 떨어지면 진한 분홍으로 바뀐다. */
@media (max-width: 760px) {
    .target-frame {
        border-color: #8a6fa8; border-left-color: #ffa06a;
        background: linear-gradient(180deg, rgba(78, 46, 84, 0.95), rgba(44, 30, 66, 0.95));
        box-shadow: 0 0 10px rgba(255, 160, 106, 0.22);
    }
    .target-frame.tf-named { border-left-color: #ffd86a; box-shadow: 0 0 12px rgba(255, 216, 106, 0.35); }
    .target-frame.tf-boss  { border-left-color: #ff5c8a; box-shadow: 0 0 14px rgba(255, 92, 138, 0.45); }
    .tf-name { color: #fff3ea; }
    .tf-hp { color: #f1ebff; }
    .tf-bar { height: 11px; border-radius: 6px; background: #1c1838; border: 1px solid #7a6fb0; }
    .tf-fill {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 55%),
                    linear-gradient(90deg, #ff7e5f 0%, #ffa66b 55%, #ffd76a 100%);
        box-shadow: 0 0 8px rgba(255, 170, 110, 0.7);
    }
    .tf-fill.tf-fill-low {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 55%),
                    linear-gradient(90deg, #ff3d6e 0%, #ff6f91 100%);
        box-shadow: 0 0 8px rgba(255, 90, 130, 0.75);
    }
    .tf-fx { color: #d8d1f0; }
}
/* 스킬 시전 꼬리표: 마력 소모 · 재사용 대기 — 결과 줄 끝에 작고 흐리게 */
.cast-note { font-size: 0.85em; font-weight: 400; color: #8f8aa6; text-shadow: none; }
.cast-note::before { content: "["; }
.cast-note::after { content: "]"; }

/* ══ 스킬 묘사 — 전투 공방 줄 안에서는 상자 없이 문장으로 이어진다 ══
   ([그림] 스킬 이름 ▸ 묘사 문장 (피해) · 효과 [마력 · 재사용] — 기본공격의 '묘사 (피해)' 와 같은 모양) */
.terminal-log .log-line.act-line .skill-flavor {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: none;
    font-weight: 400;
    letter-spacing: normal;
    opacity: 0.95;
}

/* ══ 상태 이상 피해의 숫자 — 종류마다 제 색 (이름표 .dot-* 와 같은 색) ══
   독 보라 · 출혈 진홍 · 화상 주황 · 여진 흙빛 */
.dmg-poison, .dmg-bleed, .dmg-burn, .dmg-quake { font-weight: 700; font-variant-numeric: tabular-nums; }
.dmg-poison { color: #c77dff; text-shadow: 0 0 6px rgba(170, 80, 255, 0.6); }
.dmg-bleed  { color: #ff5c6c; text-shadow: 0 0 6px rgba(255, 60, 80, 0.55); }
.dmg-burn   { color: #ff9a3c; text-shadow: 0 0 6px rgba(255, 140, 40, 0.6); }
.dmg-quake  { color: #d2a66a; text-shadow: 0 0 6px rgba(190, 140, 80, 0.5); }

/* ══ 창과 이야기 — 상태창 · 누구 · 서사 · 땅의 사연 · NPC 대화 ══ */
/* 창의 제목: 금빛 글자에 위아래 가는 선 */
.panel-head {
    display: inline-block;
    margin: 4px 0 2px;
    padding: 3px 16px 3px 10px;
    color: var(--gold-bright);
    font-family: 'Cinzel', 'Noto Sans KR', serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-left: 3px solid var(--border-gold);
    background: linear-gradient(90deg, rgba(200, 170, 110, 0.22), rgba(200, 170, 110, 0.05) 70%, transparent);
    text-shadow: 0 0 8px rgba(200, 170, 110, 0.45);
}
/* 갈래 제목: 밑줄이 그어진 작은 제목 */
.panel-sec {
    display: inline-block;
    min-width: min(26em, 100%);
    margin-top: 6px;
    padding: 1px 2px 2px;
    color: var(--border-gold);
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(200, 170, 110, 0.45);
}
/* 사연 글 (세계의 이야기 · 땅의 사연 · 인물의 사연): 양피지 빛, 왼쪽에 가는 줄 */
.lore-text {
    display: inline-block;
    max-width: 100%;
    margin: 2px 0;
    padding: 4px 12px;
    color: #dccba2;
    line-height: 1.75;
    border-left: 2px solid rgba(214, 180, 110, 0.55);
    background: linear-gradient(90deg, rgba(120, 95, 50, 0.16), transparent 85%);
}
/* 말한 이의 이름: 사람은 초록, 적은 붉은빛 */
.speaker { font-weight: 700; }
.speaker-npc { color: #8fe0a2; text-shadow: 0 0 6px rgba(110, 220, 140, 0.35); }
.speaker-foe { color: #ff9c8a; text-shadow: 0 0 6px rgba(255, 110, 90, 0.4); }
/* 대사: 따옴표째 따뜻한 흰빛 */
.say-line { color: #f3ead6; font-style: normal; }
/* 흐린 글 (도움말 한 줄 · 아직 열리지 않은 것) */
.dim-text { color: var(--text-muted); }
/* 목록에서 내 줄 */
.row-me { color: var(--gold-bright); font-weight: 700; background: rgba(200, 170, 110, 0.14); }

/* ══ 방 이름 띠 — 사냥터 종류별 배경 ══
   마을 · 안전지대는 기본(청록) · 일반 사냥터는 숲빛 · 정예 던전은 보랏빛 · 신들의 시련은 금빛과 핏빛 */
.room-title.room-field {
    color: #c8f0a0;
    background: linear-gradient(135deg, rgba(90, 150, 60, 0.30), rgba(150, 120, 60, 0.26));
    border-color: rgba(150, 210, 110, 0.55);
    border-left-color: #9ad26a;
    text-shadow: 0 0 10px rgba(150, 220, 110, 0.6);
    box-shadow: 0 0 16px rgba(120, 190, 90, 0.18), inset 0 0 12px rgba(120, 190, 90, 0.07);
}
.room-title.room-elite {
    color: #e3c4ff;
    background: linear-gradient(135deg, rgba(120, 60, 190, 0.38), rgba(60, 40, 120, 0.34));
    border-color: rgba(182, 92, 255, 0.65);
    border-left-color: #b65cff;
    text-shadow: 0 0 12px rgba(182, 92, 255, 0.85);
    box-shadow: 0 0 20px rgba(160, 80, 240, 0.30), inset 0 0 14px rgba(160, 80, 240, 0.12);
}
.room-title.room-trial {
    color: #ffe9b0;
    background: linear-gradient(135deg, rgba(200, 150, 40, 0.40), rgba(150, 30, 40, 0.38) 60%, rgba(60, 20, 70, 0.36));
    border-color: rgba(255, 200, 90, 0.75);
    border-left-color: #ffc85a;
    text-shadow: 0 0 14px rgba(255, 190, 80, 0.9);
    box-shadow: 0 0 24px rgba(255, 170, 60, 0.34), inset 0 0 16px rgba(255, 120, 60, 0.14);
}

/* 물약 빛깔 — 이름에 은은하게. 체력 붉은 · 마력 푸른 · 둘 다 보랏빛, 비율 물약은 고유 빛깔 */
.potion-tint { font-weight: 600; }
.tint-hp      { color: #ff8a8a; }
.tint-mp      { color: #8ab8ff; }
.tint-mix     { color: #d2a8ff; }
.tint-life    { color: #ff6b6b; text-shadow: 0 0 6px rgba(255, 80, 80, 0.35); }    /* 세계수의 생명수: 진홍 */
.tint-phoenix { color: #ffb347; text-shadow: 0 0 7px rgba(255, 170, 60, 0.45); }   /* 불사조의 눈물: 금빛 불꽃 */
.tint-moon    { color: #7fd4ff; text-shadow: 0 0 6px rgba(120, 200, 255, 0.4); }   /* 달빛 마나 영약: 달빛 청색 */
.tint-arcane  { color: #c08cff; text-shadow: 0 0 7px rgba(180, 120, 255, 0.45); }  /* 대마법사의 비전 정수: 보랏빛 */

/* ⭐ 퀵메뉴: 화면 위에 떠 있는 즐겨찾기 단추 (끌어서 옮기기) */
.qm-fab {
    position: fixed; z-index: 900; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--border-gold);
    background: radial-gradient(circle at 35% 30%, rgba(80, 66, 120, 0.95), rgba(26, 21, 40, 0.95));
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 10px rgba(255, 210, 120, 0.25);
    font-size: 1.35rem; line-height: 1; color: #fff; cursor: grab;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
    opacity: 0.88;
}
.qm-fab.qm-open { opacity: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 16px rgba(255, 210, 120, 0.6); }
.qm-fab.qm-dragging { cursor: grabbing; opacity: 1; transform: scale(1.1); }
.qm-fab.qm-snap { transition: left 0.2s ease, top 0.2s ease; }
.qm-panel {
    position: fixed; z-index: 901; display: flex; gap: 6px; padding: 6px;
    border: 1px solid var(--border-gold); border-radius: 10px;
    background: rgba(24, 20, 36, 0.94); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}
.qm-panel[hidden] { display: none; }
.qm-items { display: flex; gap: 6px; min-width: 0; min-height: 0; scrollbar-width: none; }
.qm-items::-webkit-scrollbar { display: none; }
.qm-tools { display: flex; gap: 4px; flex: none; }
/* 가로 정렬: 한 줄, 넘치면 옆으로 밀어 보기 */
.qm-panel.qm-h { flex-direction: row; align-items: center; }
.qm-h .qm-items { flex-direction: row; overflow-x: auto; }
.qm-h .qm-tools { flex-direction: row; padding-left: 6px; border-left: 1px solid rgba(255, 255, 255, 0.12); }
/* 세로 정렬: 한 열, 넘치면 위아래로 밀어 보기 */
.qm-panel.qm-v { flex-direction: column; width: 132px; }
.qm-v .qm-items { flex-direction: column; overflow-y: auto; flex: 1 1 auto; }
.qm-v .qm-tools { flex-direction: row; justify-content: space-between; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.qm-item {
    flex: none; min-height: 38px; padding: 6px 10px; border-radius: 7px; font-size: 0.85rem; color: var(--gold-bright);
    border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(60, 52, 90, 0.55);
    white-space: nowrap; cursor: pointer; text-align: left;
}
.qm-v .qm-item { overflow: hidden; text-overflow: ellipsis; }
.qm-item:active { background: #3a3260; }
.qm-tool {
    width: 34px; height: 34px; border-radius: 7px; font-size: 0.95rem; line-height: 1; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12); background: transparent; color: #c9bfe0;
}
.qm-tool:active { background: #3a3260; }
.qm-count { font-size: 0.75rem; color: #c9bfe0; font-weight: normal; }
.qm-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.qm-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.qm-row-name { flex: 1; min-width: 0; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-row-name small { margin-left: 6px; color: #9d92b8; font-size: 0.72rem; }
.qm-mini {
    width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(60, 52, 90, 0.55); color: var(--gold-bright); cursor: pointer;
}
.qm-mini:disabled { opacity: 0.3; cursor: default; }
.qm-mini.qm-del { color: #ff8a8a; }
.qm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qm-chip {
    padding: 6px 10px; border-radius: 14px; font-size: 0.8rem; color: var(--gold-bright); cursor: pointer;
    border: 1px solid rgba(255, 210, 120, 0.35); background: rgba(60, 52, 90, 0.45);
}
.qm-chip:disabled { opacity: 0.35; cursor: default; }
.qm-custom { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.qm-custom input {
    flex: 1 1 140px; min-width: 0; padding: 8px; border-radius: 6px; font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.35); color: var(--gold-bright);
}
/* 모바일: 입력 중(화면 키보드가 떠 있을 때)엔 숨긴다. PC 는 입력창에 늘 커서가 있으므로 숨기지 않는다. */
@media (max-width: 760px) {
    body.typing .qm-fab, body.typing .qm-panel { display: none; }
}
/* PC: 마우스를 올렸을 때의 반응 */
@media (hover: hover) {
    .qm-fab:hover { opacity: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 16px rgba(255, 210, 120, 0.55); }
    .qm-item:hover, .qm-tool:hover { background: #3a3260; }
}

/* ── 모바일: 출력창 배너(레벨업 · 만월 · 핏빛달 · 승급 · 업적 등)를 작고 촘촘하게 ── */
@media (max-width: 760px) {
    .levelup-banner, .fullmoon-banner, .bloodmoon-banner, .skillup-banner, .achv-banner, .maxlevel-banner {
        margin: 5px 0; padding: 7px 10px; letter-spacing: 0; line-height: 1.4; word-break: keep-all;
    }
    .levelup-banner { font-size: 1.02rem; }
    .fullmoon-banner { font-size: 0.92rem; }
    .bloodmoon-banner { font-size: 0.85rem; }
    .bloodmoon-banner::first-line { font-size: 1rem; letter-spacing: 0; }
    .skillup-banner, .skillup-banner.tierup-1, .skillup-banner.tierup-2 { font-size: 0.9rem; }
    .skillup-banner.tierup-3 { font-size: 0.95rem; }
    .skillup-banner.tierup-4 { font-size: 1rem; }
    .achv-banner { font-size: 0.85rem; }
    .maxlevel-banner { font-size: 1.1rem; padding: 10px 12px; }
    .newskill-banner, .dungeon-banner {
        display: block; padding: 5px 10px; font-size: 0.85rem; letter-spacing: 0; word-break: keep-all;
    }
    .story-banner { padding: 3px 10px; font-size: 0.85rem; }
    .danger-banner { padding: 4px 10px; font-size: 0.82rem; word-break: keep-all; }
}

/* 지도 칸의 빛깔 — 글자 폭은 그대로(굵기 변화 없음) 두어 줄이 어긋나지 않게 한다 */
.map-q    { color: #ffd54a; text-shadow: 0 0 6px rgba(255, 213, 74, 0.55); }   /* 퀘스트 목표: 금빛 */
.map-n    { color: #c58bff; text-shadow: 0 0 6px rgba(190, 130, 255, 0.45); }  /* 네임드: 보라 */
.map-b    { color: #ff5c5c; text-shadow: 0 0 6px rgba(255, 80, 80, 0.5); }     /* 보스: 붉은 */
.map-me   { color: #06202b; background: #5fd7ff; border-radius: 3px; box-shadow: 0 0 7px rgba(95, 215, 255, 0.6); }   /* 현재 위치: 하늘색 바탕 */
.map-safe { color: #7ddc8a; }                                                  /* 안전지대: 초록 */

/* 신들의 시련 몬스터의 이름 — 시련(신화)마다 다른 빛깔로 은은하게 빛난다 */
.myth-name { font-weight: 700; color: var(--myth, #e8e8e8); text-shadow: 0 0 7px color-mix(in srgb, var(--myth, #fff) 60%, transparent); }
.myth-finnish  { --myth: #9fdcff; }   /* 삼포의 서리숲: 서리빛 */
.myth-slavic   { --myth: #b79cff; }   /* 체르노보그의 검은 숲: 어스름 보라 */
.myth-celtic   { --myth: #7fe08a; }   /* 발로르의 사안: 클로버 초록 */
.myth-persia   { --myth: #ff9a4d; }   /* 꺼지지 않는 불의 신전: 불꽃 주황 */
.myth-avalon   { --myth: #c9d6e8; }   /* 안개의 아발론: 안개 은빛 */
.myth-hindu    { --myth: #ffcf5c; }   /* 랑카의 십면마왕: 황금 */
.myth-valhalla { --myth: #fff27a; }   /* 황혼의 발할라: 번개 노랑 */
.myth-tiamat   { --myth: #4fd6c8; }   /* 티아마트의 심연 신전: 심해 청록 */
.myth-mictlan  { --myth: #e6dcc0; }   /* 믹틀란 아홉 지옥: 뼈빛 */
.myth-egypt    { --myth: #f0c36a; }   /* 두아트의 혼돈대사: 모래 금빛 */
.myth-greek    { --myth: #ff7a6b; }   /* 타르타로스의 괴물아비: 용암 붉은빛 */

/* ── 운영자 이벤트(경험치 · 아이템) 배너: 금빛 축제 띠 ── */
.event-banner {
    display: block;
    text-align: center;
    margin: 8px 0;
    padding: 10px 14px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.5;
    color: #fff4c9;
    background: linear-gradient(100deg, rgba(120, 60, 0, 0.35), rgba(255, 190, 60, 0.30), rgba(120, 60, 0, 0.35));
    border: 1px solid rgba(255, 210, 110, 0.7);
    border-radius: 10px;
    text-shadow: 0 0 10px #ffcf5c, 0 0 22px rgba(255, 170, 40, 0.75);
    box-shadow: 0 0 18px rgba(255, 180, 60, 0.4), inset 0 0 14px rgba(255, 220, 140, 0.18);
    animation: levelup-pop 0.5s ease-out, event-glow 2.2s ease-in-out infinite 0.5s;
}
@keyframes event-glow {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 180, 60, 0.35), inset 0 0 12px rgba(255, 220, 140, 0.15); }
    50%      { box-shadow: 0 0 26px rgba(255, 200, 80, 0.65), inset 0 0 18px rgba(255, 230, 160, 0.28); }
}
@media (max-width: 760px) {
    .event-banner { margin: 5px 0; padding: 7px 10px; letter-spacing: 0; line-height: 1.4; word-break: keep-all; font-size: 0.95rem; }
}
@media (prefers-reduced-motion: reduce) { .event-banner { animation: none; } }
