/* 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;

    /* ── 디자인 기준값 (design tokens) ── */
    /* 바탕 층: 숫자가 클수록 위로 떠 있는 면 */
    --surface-1: #14121e;
    --surface-2: #1a1526;
    --surface-3: #1d1a2b;
    --surface-4: #241f33;
    --surface-5: #2a2540;
    --line: #3a3450;
    --line-soft: rgba(255, 255, 255, 0.12);
    --scrim: rgba(0, 0, 0, 0.6);
    /* 금색 계열 */
    --gold-rgb: 200, 170, 110;
    --gold-mid: #e2c47f;
    --gold-light: #ffe9a8;
    /* 강조색 */
    --accent-teal: #00ffcc;
    --accent-pink: #ff3df5;
    --accent-violet: #c77dff;
    /* 모서리 */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 10px;
    --r-xl: 13px;
    --r-pill: 999px;
    /* 글자 크기 */
    --fs-2xs: 0.7rem;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8rem;
    --fs-md: 0.85rem;
    --fs-base: 0.9rem;
    --fs-lg: 1rem;
    --fs-xl: 1.1rem;
    --fs-2xl: 1.3rem;
    --fs-3xl: 1.5rem;
    /* 그림자 */
    --glow-gold: 0 0 14px rgba(200, 170, 110, 0.45);
    --shadow-panel: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    /* 글꼴 */
    --font-display: 'Cinzel', 'Noto Sans KR', serif;
    --font-body: 'Noto Sans KR', system-ui, sans-serif;
    --font-mono: 'Nanum Gothic Coding', 'Consolas', 'Courier New', monospace;
    /* 움직임 */
    --t-fast: 0.15s;
    --t-base: 0.2s;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    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: var(--font-body);
    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(var(--gold-rgb), 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: var(--r-xs);
}

.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, var(--accent-pink), #ff9bfb, var(--accent-pink), #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 var(--accent-pink)) 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: var(--font-display);
    font-size: var(--fs-2xl);
    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: var(--r-lg);
    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: var(--font-display);
    font-size: var(--fs-3xl);
    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: var(--r-xl);
    text-shadow: 0 0 10px rgba(255,220,120,0.95), 0 0 22px rgba(255,120,220,0.7), 0 2px 3px var(--scrim);
    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: var(--r-md);
    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: var(--font-display);
    font-size: var(--fs-xl);
    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: var(--r-lg);
    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: var(--font-body);
    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: var(--r-lg);
    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: var(--font-display);
    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: var(--r-xl);
    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: var(--fs-sm);
    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: var(--r-sm);
    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: var(--fs-md);
    color: var(--border-gold);
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-size: var(--fs-lg);
    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: var(--fs-xl);
    opacity: 0.65;
    transition: opacity var(--t-base), transform var(--t-base);
    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: var(--fs-sm);
    color: var(--text-muted);
    user-select: none;
    transition: color var(--t-base);
}

.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: var(--r-xs);
    background: var(--surface-1);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    transition: all var(--t-base);
}

.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: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}

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

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--border-gold), #967332);
    border: none;
    border-radius: var(--r-sm);
    color: #0d0c10;
    font-weight: bold;
    font-size: var(--fs-lg);
    cursor: pointer;
    transition: transform 0.1s, box-shadow var(--t-base);
}

.btn-primary:hover {
    box-shadow: var(--glow-gold);
    transform: translateY(-1px);
}

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

/* 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: var(--r-md);
    padding: 12px 20px;
    box-shadow: var(--shadow-panel), 0 0 18px rgba(var(--gold-rgb), 0.06);
}

.badge {
    padding: 4px 10px;
    background: #2a253a;
    border: 1px solid var(--border-gold);
    border-radius: var(--r-xs);
    font-size: var(--fs-md);
    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:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 40%),
        var(--panel-bg);
    border: 1px solid #332f48;
    border-radius: var(--r-md);
    padding: 15px;
    box-shadow: var(--shadow-panel);
}

.panel-box h3 {
    font-size: var(--fs-lg);
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 6px;
}

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

.bar-label {
    font-size: var(--fs-sm);
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.progress-bar {
    height: 14px;
    background: var(--surface-1);
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--line);
}

.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: var(--surface-1);
    padding: 10px;
    border-radius: var(--r-sm);
}

.stat-info strong {
    font-size: var(--fs-base);
}

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

.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: var(--r-xs);
    cursor: pointer;
    font-size: var(--fs-xs);
    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: var(--r-md);
    padding: 15px;
    min-height: 0;
}

.terminal-log {
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: var(--fs-lg);
    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: var(--surface-1);
    border: 1px solid var(--border-gold);
    border-radius: var(--r-sm);
    color: var(--accent-teal);
    font-family: var(--font-mono);
    font-size: var(--fs-lg);
}

.btn-send {
    padding: 12px 20px;
    background: var(--border-gold);
    border: none;
    border-radius: var(--r-sm);
    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 var(--line);
    color: var(--text-primary);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: var(--fs-sm);
}

.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(var(--gold-rgb), 0.2), rgba(0, 255, 204, 0.15));
    border: 1px solid var(--border-gold);
    color: var(--gold-bright);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: var(--fs-md);
    font-weight: bold;
    transition: all var(--t-base);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.btn-map-action:hover {
    background: var(--border-gold);
    color: #111;
    box-shadow: var(--glow-gold);
    transform: translateY(-1px);
}

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

.skill-btn {
    padding: 10px;
    background: linear-gradient(135deg, #1f1b2e, var(--surface-1));
    border: 1px solid var(--border-gold);
    color: var(--gold-bright);
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: left;
    font-size: var(--fs-md);
    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: var(--fs-xs);
    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: var(--r-pill);
    cursor: pointer;
    transition: background var(--t-fast) ease, transform 0.1s ease, box-shadow var(--t-fast) 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: var(--fs-base); line-height: 1; }
/* Keybinding modal */
.keybind-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.keybind-modal {
    background: linear-gradient(135deg, #221d33, var(--surface-1));
    border: 1px solid var(--border-gold);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    width: min(92vw, 420px);
    max-height: 86vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px var(--scrim);
    color: var(--gold-bright);
}
.keybind-modal h3 { margin: 0 0 6px; }
.keybind-hint { font-size: var(--fs-sm); 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: var(--fs-base); }
.keybind-input {
    width: 48px;
    text-align: center;
    font-size: var(--fs-xl);
    font-weight: 700;
    padding: 6px;
    background: #0f0d18;
    color: #fff;
    border: 1px solid var(--border-gold);
    border-radius: var(--r-sm);
}
.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: var(--r-sm);
    cursor: pointer;
    font-weight: 700;
    border: 1px solid var(--border-gold);
}
.keybind-save { background: var(--gold-bright); color: var(--surface-2); }
.keybind-cancel { background: var(--surface-5); 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: var(--fs-3xl);
    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: var(--accent-teal);
    border: 1px solid var(--accent-teal);
    border-radius: var(--r-xs);
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    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: var(--fs-md);
    letter-spacing: 0.02em;
    background: repeating-linear-gradient(
        45deg,
        rgba(var(--gold-rgb), 0.04),
        rgba(var(--gold-rgb), 0.04) 10px,
        rgba(var(--gold-rgb), 0.08) 10px,
        rgba(var(--gold-rgb), 0.08) 20px
    );
    border: 1px dashed rgba(var(--gold-rgb), 0.4);
    border-radius: var(--r-md);
}

/* ===== 사각형 광고 (로그인 화면 · 게임 메뉴 창) ===== */
.ad-rect {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
}
.ad-rect .ad-label {
    font-size: var(--fs-2xs);
    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: var(--fs-xs);
}

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

.skill-prof-badge {
    font-size: var(--fs-xs);
    color: #a0aec0;
}

.skill-prof-badge .prof-val {
    color: var(--accent-teal);
    font-weight: 700;
}

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

.skill-prof-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00b4db, var(--accent-teal));
    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(var(--gold-rgb), 0.4);
    border-color: var(--accent-teal);
}

.skill-locked {
    opacity: 0.45;
    filter: grayscale(0.8);
    border-color: var(--line);
}

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

.highlight {
    color: var(--accent-teal);
    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: var(--r-sm);
    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: var(--r-lg);
    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: var(--r-md);
    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: var(--r-xs);
    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);
}

/* 요리 재료 · 요리 — 꼬리표 없이 이름 색으로만 은은하게 구분한다 (재료 연두빛 · 요리 주황 금빛) */
.food-item .item-rarity {
    background: none !important;
    animation: none !important;
    filter: none !important;
    text-shadow: none !important;
}
.food-ingr .item-rarity {
    color: #a8d66a !important;
    -webkit-text-fill-color: #a8d66a !important;
}
.food-dish .item-rarity {
    color: #ffae42 !important;
    -webkit-text-fill-color: #ffae42 !important;
}

/* 처치 회복(체력) — 경험치 · 골드 옆, 장밋빛 글자 */
.stat-vigor {
    color: #ff7aa8;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255, 122, 168, 0.55);
}

/* 유물의 기운 — 경험치 · 골드 옆에 붙는 '깨어나는 빛': 보랏빛에서 금빛으로 번지는 꼬리표, 들어올 때 한 번 반짝인다 */
.stat-aura {
    color: #fff3c4;
    font-weight: 700;
    padding: 0 5px;
    border-radius: var(--r-sm);
    background: linear-gradient(90deg, rgba(150, 90, 255, 0.32), rgba(255, 196, 70, 0.26));
    box-shadow: inset 0 0 0 1px rgba(210, 170, 255, 0.55);
    text-shadow: 0 0 6px rgba(200, 150, 255, 0.85);
    animation: aura-glow 1.4s ease-out 1;
}

@keyframes aura-glow {
    0%   { box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.95), 0 0 12px rgba(190, 130, 255, 0.85); filter: brightness(1.35); }
    100% { box-shadow: inset 0 0 0 1px rgba(210, 170, 255, 0.55); filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    .stat-aura { animation: none; }
}

.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: var(--fs-base); }
    .top-bar { padding: 8px 14px; }
    .terminal-log { font-size: var(--fs-base); }
    .compass-grid button, .quick-actions-grid button { padding: 8px 4px; font-size: var(--fs-xs); }
    .btn-map-action { padding: 8px; font-size: var(--fs-sm); }
    #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: var(--fs-sm); 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: var(--fs-base); }
}

/* Room Title Easy-To-Read Badge */
.room-title {
    display: inline-block;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.22), rgba(var(--gold-rgb), 0.30));
    color: var(--accent-teal);
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 6px 14px;
    border: 1px solid rgba(0, 255, 204, 0.55);
    border-left: 5px solid var(--accent-teal);
    border-radius: var(--r-md);
    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: var(--r-xl);
    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(var(--gold-rgb), 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: var(--surface-2);
    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, var(--surface-4), #17131f);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: var(--r-md) var(--r-md) 0 0;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-base);
    cursor: pointer;
    transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.chat-tab:hover { color: var(--gold-bright); }
.chat-tab.active {
    color: var(--surface-2);
    background: linear-gradient(180deg, #ecdaab, var(--border-gold));
    border-color: var(--gold-bright);
    box-shadow: var(--glow-gold);
}

.chat-col .terminal-log {
    background: rgba(6, 5, 10, 0.72);
    border: 1px solid var(--surface-5);
    border-radius: var(--r-md);
    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: var(--fs-2xl);
    color: var(--surface-2);
    background: radial-gradient(circle at 32% 28%, #f6e9c2, var(--border-gold) 72%, #9a7636);
    border: 2px solid #ecdaab;
    box-shadow: var(--glow-gold);
    transition: transform 0.1s, box-shadow var(--t-fast), filter var(--t-fast);
}
.chat-col .btn-send:hover { filter: brightness(1.08); box-shadow: 0 0 16px rgba(var(--gold-rgb), 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, var(--surface-1) 75%);
    border: 3px solid var(--border-gold);
    box-shadow: 0 0 16px rgba(var(--gold-rgb), 0.35), inset 0 0 14px var(--scrim);
    flex-shrink: 0;
}
.char-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.char-level {
    font-family: 'Cinzel', serif;
    font-size: var(--fs-3xl);
    font-weight: 900;
    color: var(--gold-bright);
    line-height: 1.05;
    text-shadow: 0 0 10px rgba(var(--gold-rgb), 0.5);
}
.char-name {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.char-class { font-size: var(--fs-md); 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: var(--fs-xl); width: 22px; text-align: center; flex-shrink: 0; }
.cp-bar-track {
    position: relative;
    flex: 1;
    height: 26px;
    border-radius: var(--r-xl);
    overflow: hidden;
    background: var(--surface-1);
    border: 1px solid var(--line);
}
.cp-bar-track .progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    height: 100%;
    border-radius: var(--r-xl);
}
.cp-bar-name {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-weight: 800;
    font-size: var(--fs-sm);
    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: var(--fs-sm);
    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 var(--surface-5);
    border-radius: var(--r-lg);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cp-stats-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    color: var(--border-gold);
    font-weight: 700;
    font-size: var(--fs-base);
}
.cp-unspent { font-size: var(--fs-sm); color: var(--text-muted); }
.cp-step { display: flex; align-items: center; gap: 5px; }
.cp-step-label { font-size: var(--fs-xs); color: var(--text-muted); margin-right: 2px; }
.cp-step-btn {
    padding: 3px 11px;
    font-size: var(--fs-xs);
    font-weight: 700;
    border-radius: var(--r-pill);
    cursor: pointer;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--text-muted);
    transition: all var(--t-fast);
}
.cp-step-btn.active { background: var(--border-gold); color: var(--surface-2); border-color: var(--gold-bright); }
.cp-stat {
    display: grid;
    grid-template-columns: 26px 1fr auto 32px;
    align-items: center;
    gap: 8px;
    background: var(--surface-1);
    border: 1px solid #2d2a3e;
    border-radius: var(--r-md);
    padding: 8px 10px;
}
.cp-stat-ico { font-size: var(--fs-lg); 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: var(--fs-xl); color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.cp-plus {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: var(--fs-xl);
    font-weight: 900;
    line-height: 1;
    color: var(--surface-2);
    background: radial-gradient(circle at 30% 28%, #f6e9c2, #d7b876 70%, #a9823f);
    border: 2px solid #ecdaab;
    box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, filter var(--t-fast);
}
.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: var(--fs-xs);
    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: var(--surface-1);
    border: 1px solid #2d2a3e;
    border-radius: var(--r-md);
    padding: 8px 12px;
}
.cp-meta-ico { font-size: var(--fs-lg); width: 22px; text-align: center; }
.cp-meta-name { color: var(--text-muted); font-size: var(--fs-md); }
.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, var(--surface-4), var(--surface-1));
    border: 1px solid var(--border-gold);
    border-radius: var(--r-lg);
    color: var(--gold-bright);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: all var(--t-fast);
}
.cp-action:hover {
    background: linear-gradient(180deg, #322b49, #1d182a);
    box-shadow: 0 0 12px rgba(var(--gold-rgb), 0.3);
    transform: translateY(-1px);
}
.cp-action-ico { font-size: var(--fs-2xl); 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(var(--gold-rgb), 0.4); border-radius: var(--r-xs); }
.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(var(--gold-rgb), 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: var(--r-lg);
    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 var(--scrim);
    transition: box-shadow var(--t-fast), transform 0.1s, border-color var(--t-fast);
}
.potion-slot:hover,
.hotbar-skills .skill-btn:hover {
    box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-teal);
    transform: translateY(-2px);
}

.potion-ico { font-size: 2rem; line-height: 1; filter: drop-shadow(0 0 4px var(--scrim)); }
.potion-hp { border-color: #e0564a; }
.potion-mp { border-color: #4aa3e0; }
.potion-count {
    position: absolute;
    bottom: 3px; right: 5px;
    font-size: var(--fs-md);
    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 var(--scrim)); }
.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: var(--fs-sm); 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: var(--fs-xl); }

/* 타일 좌상단 스킬 숙련 레벨 (성장이 보이도록) */
.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: var(--accent-teal); }
    100% { box-shadow: inset 0 0 10px var(--scrim); }
}
.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 var(--scrim);
    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: var(--r-sm);
    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: var(--font-display);
    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: var(--r-lg);
    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 var(--scrim), 0 0 8px rgba(79, 209, 122, 0.4);
}
.hotbar-skills .skill-btn.rarity-high {
    border-color: #4aa3ff;
    box-shadow: inset 0 0 10px var(--scrim), 0 0 12px rgba(74, 163, 255, 0.55);
}
.hotbar-skills .skill-btn.rarity-unique {
    border-color: var(--accent-violet);
    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: var(--font-display);
    color: var(--border-gold);
    font-weight: 700;
    font-size: var(--fs-base);
    margin: 14px 0 8px;
}
.gm-section-title small { color: var(--text-muted); font-weight: 400; font-size: var(--fs-2xs); }
.gm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-btn {
    padding: 10px 6px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--text-primary);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: var(--fs-sm);
    transition: all var(--t-fast);
}
.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: var(--r-md); cursor: pointer; font-weight: 700; font-size: var(--fs-md);
    background: var(--surface-3); border: 1px solid var(--line); color: var(--text-muted);
}
.tv-tab.active { background: var(--gold-bright); border-color: var(--border-gold); color: var(--surface-2); }
.tv-note { font-size: var(--fs-xs); 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: var(--fs-md); }
.tv-item {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; flex: none;
    padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; text-align: left; font-size: var(--fs-md);
    background: var(--surface-3); border: 1px solid var(--line); color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}
.tv-item .tv-lv { flex: none; width: 86px; color: var(--text-muted); font-size: var(--fs-xs); 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: var(--fs-xs); 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: var(--fs-2xs); }
.tv-item.picked { border-color: var(--border-gold); background: var(--surface-5); 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: var(--fs-xl); }
.tv-confirm {
    margin-top: 8px; padding: 9px 10px; border-radius: var(--r-md); 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: var(--fs-sm); line-height: 1.5; color: var(--text-primary); word-break: keep-all; }
.tv-quote small { color: var(--text-muted); font-size: var(--fs-2xs); }
.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: var(--fs-sm); }
.fw-gold { flex: none; margin-bottom: 10px; }
.fw-gold-head { font-size: var(--fs-md); 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: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); color: var(--text-primary);
}
.fw-quick { display: flex; gap: 6px; margin-top: 6px; }
.fw-chip {
    flex: 1; padding: 8px 0; border-radius: var(--r-md); cursor: pointer; font-size: var(--fs-sm);
    background: var(--surface-5); border: 1px solid var(--line); color: var(--gold-bright); touch-action: manipulation;
}
.fw-label { display: flex; flex-direction: column; gap: 4px; flex: none; font-size: var(--fs-sm); 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: var(--fs-md); font-weight: 700; margin: 6px 0 2px; }
.fw-mail {
    flex: none; padding: 7px 10px; border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.45; word-break: keep-all;
    background: var(--surface-3); border: 1px solid var(--line);
}
.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: var(--fs-md); 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: var(--fs-2xs); }
.sh-price { flex: none; color: var(--gold-bright); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.sh-qty {
    display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 8px;
    border-radius: var(--r-md); background: rgba(10, 8, 16, 0.6); border: 1px solid var(--border-gold);
}
.sh-step {
    flex: none; width: 40px; height: 40px; border-radius: var(--r-md); cursor: pointer;
    font-size: var(--fs-2xl); font-weight: 700; line-height: 1;
    background: var(--surface-5); border: 1px solid var(--line); 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: var(--fs-lg);
    border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); 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: var(--fs-sm); }
.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: var(--fs-md); }
#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: var(--fs-sm); }
    .char-portrait { width: 60px; height: 60px; font-size: 1.7rem; }
    .char-level { font-size: var(--fs-2xl); }
    .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: var(--fs-xl); }
    .char-name { font-size: var(--fs-sm); }
    .char-class { font-size: var(--fs-sm); }
    .cp-bars { grid-column: 1; grid-row: 2; gap: 6px; align-self: start; }   /* 상단 왼쪽 */
    .cp-bar-ico { width: 18px; font-size: var(--fs-lg); }
    .cp-bar-track { height: 24px; min-width: 0; }
    .cp-bar-name { left: 9px; font-size: var(--fs-xs); }
    .cp-bar-val { right: 9px; font-size: var(--fs-sm); }

    /* 오른쪽 열: 가방 · 정보 · 메뉴 + 소지 골드 */
    .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, var(--surface-4), var(--surface-1));
        border: 1px solid var(--border-gold); border-radius: var(--r-lg);
        color: var(--gold-bright); font-weight: 700; font-size: var(--fs-base); cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .mc-top-btn span { font-size: var(--fs-xl); }
    .mc-top-btn:active { background: var(--border-gold); color: var(--surface-2); }
    /* 능력치 칸 (힘 · 민첩 · 지능) — 누르면 상태창 */
    .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 var(--surface-5); border-radius: var(--r-md);
        color: var(--gold-bright); font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .mc-top-stat span { font-size: var(--fs-base); line-height: 1; }
    .mc-top-stat i { font-style: normal; font-size: var(--fs-xs); 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: var(--fs-base); 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: var(--r-lg);
        background: rgba(10, 8, 16, 0.5); border: 1px solid var(--surface-5);
        color: var(--gold-bright); font-weight: 800; font-size: var(--fs-lg);
        font-variant-numeric: tabular-nums;
    }
    .mc-top-gold span { font-size: var(--fs-lg); }
    /* 골드 칸: 다른 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: var(--r-md); white-space: nowrap;
        font-size: var(--fs-md); font-weight: 800; color: var(--gold-bright);
        background: var(--surface-1); border: 1px solid var(--border-gold);
        box-shadow: 0 6px 18px var(--scrim);
        opacity: 0; transform: translateY(-4px); pointer-events: none;
        transition: opacity var(--t-fast), transform var(--t-fast);
    }
    .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: var(--fs-sm); }
    .chat-col .terminal-log { padding: 10px; font-size: var(--fs-md); }
    .chat-col .cmd-form input { padding: 10px; }
    .chat-col .btn-send { width: 46px; height: 46px; font-size: var(--fs-2xl); }

    /* ── 조작 패널: 방향 이동 + 봐 + 공격 (핫바 바로 위) ── */
    .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, var(--surface-4), var(--surface-1));
        border: 1px solid var(--border-gold); border-radius: var(--r-lg);
        color: var(--gold-bright); font-size: var(--fs-xl); 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: var(--surface-2); transform: translateY(1px); }
    /* 봐: 패드 오른쪽 큰 버튼 */
    .mc-look { border-color: var(--accent-teal); color: var(--accent-teal); }
    .mc-big { width: 86px; min-height: auto; font-size: 1.7rem; font-weight: 900; }
    .mc-big small { font-size: var(--fs-sm); }
    .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: var(--accent-violet); color: var(--accent-violet); }
    .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: var(--fs-3xl); }
    .potion-ico { font-size: var(--fs-3xl); }
    .hb-num { font-size: var(--fs-xs); }
    .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: var(--fs-lg); }
    .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: var(--r-md); }
    .mc-top-btn span { font-size: var(--fs-lg); }
    .mc-top-gold { padding: 0 6px; height: 30px; font-size: var(--fs-md); 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: var(--fs-sm); }
    .mc-top-stat b { font-size: var(--fs-sm); 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: var(--fs-2xs); }

    /* 출력창 주변 여백·탭·입력줄 축소 */
    .chat-col { padding: 5px; gap: 5px; }
    .chat-tabs { align-items: center; }
    .chat-tab { padding: 4px 9px; font-size: var(--fs-xs); }
    .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: var(--fs-xl); }

    /* 조작 패드·핫바 축소 */
    .mobile-controls { padding: 4px 6px; gap: 6px; }
    .mc-pad { gap: 4px; }
    .mc-btn { min-height: 38px; font-size: var(--fs-lg); }
    .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: var(--fs-xs); font-weight: 700; white-space: nowrap;
        background: linear-gradient(180deg, var(--surface-4), var(--surface-1));
        border: 1px solid var(--border-gold); border-radius: var(--r-md);
        color: var(--gold-bright); cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    body.pad-hidden .chat-pad-toggle { background: var(--border-gold); color: var(--surface-2); }
    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: var(--font-body); }
    .chat-col .terminal-log .log-pre {
        font-family: var(--font-mono);
        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: var(--r-md);
        font-size: 0.85em; font-weight: 800; color: var(--surface-2); 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: var(--r-xl); white-space: nowrap;
        font-size: var(--fs-xs); font-weight: 800; font-family: inherit;
        color: var(--surface-2); 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: var(--gold-mid);
        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: var(--gold-mid); 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: var(--surface-2); background: linear-gradient(180deg, var(--gold-light), #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: var(--gold-mid); 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: var(--gold-mid); }
    .mc-top-gold { background: linear-gradient(180deg, #4a3a1c, #2a2010); border-color: var(--gold-mid); 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: var(--gold-mid); color: var(--surface-2); }
    .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 var(--line-soft), inset 0 0 8px rgba(0, 0, 0, 0.35);
    }
    .hotbar-skills .skill-btn { border-color: var(--gold-mid); }
}
@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: var(--fs-sm); }
    .chat-col .terminal-log { padding: 10px 12px; }
    #cmd-input { padding: 8px 12px; }
    .chat-col .btn-send { width: 40px; height: 40px; font-size: var(--fs-xl); }

    /* ---- 캐릭터 메뉴 간소화 ---- */
    .char-col { padding: 10px; gap: 8px; }
    .char-head { gap: 10px; }
    .char-portrait { width: 44px; height: 44px; font-size: var(--fs-2xl); border-width: 2px; }
    .char-level { font-size: var(--fs-xl); }
    .char-name { font-size: var(--fs-base); }
    .char-class { font-size: var(--fs-xs); }

    .cp-bars { gap: 5px; }
    .cp-bar { gap: 6px; }
    .cp-bar-ico { font-size: var(--fs-lg); width: 18px; }
    .cp-bar-track { height: 20px; }
    .cp-bar-name { left: 9px; font-size: var(--fs-2xs); }
    .cp-bar-val { right: 9px; font-size: var(--fs-xs); }

    .cp-stats { padding: 7px 8px; gap: 5px; }
    .cp-stats-head { font-size: var(--fs-sm); }
    .cp-step-label { display: none; }
    .cp-step-btn { padding: 2px 9px; font-size: var(--fs-2xs); }
    .cp-stat { grid-template-columns: 20px 1fr auto 24px; gap: 6px; padding: 4px 8px; }
    .cp-stat-ico { font-size: var(--fs-base); }
    .cp-stat-name { font-size: var(--fs-md); }
    .cp-stat-val { font-size: var(--fs-lg); }
    .cp-plus { width: 24px; height: 24px; font-size: var(--fs-lg); 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: var(--fs-base); width: auto; }
    .cp-meta-name { display: none; }
    .cp-meta-val { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .cp-actions { gap: 5px; }
    .cp-action { padding: 6px 2px; gap: 2px; font-size: var(--fs-2xs); border-radius: var(--r-md); }
    .cp-action-ico { font-size: var(--fs-xl); }

    /* ---- 하단 핫바 ---- */
    .hotbar { padding: 6px 10px; gap: 8px; }
    .potion-slots, .hotbar-skills { gap: 7px; }
    .potion-slot, .hotbar-skills .skill-btn { width: 50px; height: 50px; border-radius: var(--r-md); }
    .hb-ico { font-size: var(--fs-3xl); }
    .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: var(--fs-2xl); }
    .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: var(--fs-xl);
    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 var(--r-sm) var(--r-sm) 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: var(--gold-light); text-shadow: 0 0 7px #ffe9a866; }
.hotbar-skills .skill-btn.hb-el-holy .hb-ico { filter: drop-shadow(0 0 5px var(--gold-light)); }
.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: var(--fs-3xl);
    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 var(--scrim); 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 var(--scrim); 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: var(--r-md);
    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 var(--r-sm) var(--r-sm) 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: var(--r-md);
    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: var(--r-lg);
    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: var(--r-lg);
    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: var(--gold-light); 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, var(--accent-pink), #8f6bff, #3de8ff, #fff27a, #ff7ad9, var(--accent-pink), #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 var(--accent-pink), 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 var(--accent-pink)) 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: var(--r-pill);
    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: var(--font-display);
    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 var(--r-sm) var(--r-sm) 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: var(--font-display);
    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: var(--accent-violet); 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: var(--border-gold);
    border-radius: 0 var(--r-sm) var(--r-sm) 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: var(--r-md);
    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: var(--r-md);
    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; }

/* ══ 버프 창: 출력창 오른쪽 위에 겹치는 반투명 창 — 버프마다 큰 그림 타일 (static/buff_art.js) ══
   타일 둘레의 빛나는 테두리가 남은 시간만큼 줄어들고, 아래에 남은 시간을 작게 적는다.
   위치는 game.js 가 출력창 모서리에 맞춘다. 창 바탕은 클릭을 아래 출력창으로 통과시킨다. */
.chat-col { position: relative; }
.buff-hud {
    position: absolute;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: min(60%, 340px);
    padding: 7px 8px 5px;
    border-radius: var(--r-xl);
    background: rgba(14, 11, 24, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}
.buff-hud[hidden] { display: none; }
.bh-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: auto;                 /* 그림 위에 올리면 이름 · 수치가 나온다 (title) */
    cursor: default;
}
/* 남은 시간 테두리: --p(남은 %) 만큼 밝은 테두리가 시계 방향으로 남는다 */
.bh-ring {
    --p: 100;
    width: 52px;
    height: 52px;
    padding: 3px;
    border-radius: var(--r-xl);
    background: conic-gradient(var(--gold-light) calc(var(--p) * 1%), var(--line-soft) 0);
    box-shadow: 0 0 10px rgba(255, 220, 140, 0.35);
}
.bh-art {
    width: 100%;
    height: 100%;
    border-radius: var(--r-md);
    overflow: hidden;
    background: #14111f;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bh-art svg { width: 100%; height: 100%; display: block; }
.bh-emoji { font-size: 1.7rem; }
.bh-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    padding: 0 4px;
    border-radius: var(--r-sm);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.45;
    color: #2a1a06;
    background: #ffd27a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.bh-badge[hidden] { display: none; }
.bh-time {
    font-size: var(--fs-2xs);
    font-weight: 700;
    color: #e9e4f5;
    text-shadow: 0 1px 2px #000;
    font-variant-numeric: tabular-nums;
}
/* 끝나 갈 때: 그림이 깜빡이고 테두리 · 시간이 붉어진다 */
.bh-ending .bh-ring { animation: bh-blink 0.6s ease-in-out infinite;
    background: conic-gradient(#ff6a6a calc(var(--p) * 1%), var(--line-soft) 0);
    box-shadow: 0 0 12px rgba(255, 90, 90, 0.6); }
.bh-ending .bh-time { color: #ff8a8a; }
@keyframes bh-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
    .bh-ending .bh-ring { animation: none; opacity: 0.6; }
}
@media (max-width: 760px) {
    .buff-hud { gap: 6px; padding: 5px 6px 4px; max-width: 70%; }
    .bh-ring { width: 42px; height: 42px; padding: 2px; border-radius: var(--r-lg); }
    .bh-art { border-radius: var(--r-md); }
    .bh-time { font-size: 0.64rem; }
}
.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: var(--r-sm); background: rgba(255, 255, 255, 0.10); overflow: hidden; }
.tf-fill {
    height: 100%;
    width: 100%;
    border-radius: var(--r-sm);
    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; }
/* 모바일: 화면이 좁아 대상 창(몬스터 이름 · 체력바)은 띄우지 않는다. 적의 체력은 전투 로그의 막대로 본다. */
@media (max-width: 760px) {
    .target-frame, .target-frame[hidden] { display: none; }
}
/* 스킬 시전 꼬리표: 마력 소모 · 재사용 대기 — 결과 줄 끝에 작고 흐리게 */
.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: var(--accent-violet); 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: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.04em;
    border-left: 3px solid var(--border-gold);
    background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.22), rgba(var(--gold-rgb), 0.05) 70%, transparent);
    text-shadow: 0 0 8px rgba(var(--gold-rgb), 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(var(--gold-rgb), 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(var(--gold-rgb), 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 var(--t-base) ease, top var(--t-base) ease; }
.qm-panel {
    position: fixed; z-index: 901; display: flex; gap: 6px; padding: 6px;
    border: 1px solid var(--border-gold); border-radius: var(--r-lg);
    background: rgba(24, 20, 36, 0.94); box-shadow: 0 8px 28px var(--scrim);
}
.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 var(--line-soft); }
/* 세로 정렬: 한 열, 넘치면 위아래로 밀어 보기 */
.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 var(--line-soft); }
.qm-item {
    flex: none; min-height: 38px; padding: 6px 10px; border-radius: var(--r-sm); font-size: var(--fs-md); color: var(--gold-bright);
    border: 1px solid var(--line-soft); 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: var(--r-sm); font-size: var(--fs-lg); line-height: 1; cursor: pointer;
    border: 1px solid var(--line-soft); background: transparent; color: #c9bfe0;
}
.qm-tool:active { background: #3a3260; }
.qm-count { font-size: var(--fs-xs); 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: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-row-name small { margin-left: 6px; color: #9d92b8; font-size: var(--fs-xs); }
.qm-mini {
    width: 32px; height: 32px; border-radius: var(--r-sm); 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: var(--r-xl); font-size: var(--fs-sm); 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: var(--r-sm); 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: var(--fs-base); }
    .bloodmoon-banner { font-size: var(--fs-md); }
    .bloodmoon-banner::first-line { font-size: var(--fs-lg); letter-spacing: 0; }
    .skillup-banner, .skillup-banner.tierup-1, .skillup-banner.tierup-2 { font-size: var(--fs-base); }
    .skillup-banner.tierup-3 { font-size: var(--fs-lg); }
    .skillup-banner.tierup-4 { font-size: var(--fs-lg); }
    .achv-banner { font-size: var(--fs-md); }
    .maxlevel-banner { font-size: var(--fs-xl); padding: 10px 12px; }
    .newskill-banner, .dungeon-banner {
        display: block; padding: 5px 10px; font-size: var(--fs-md); letter-spacing: 0; word-break: keep-all;
    }
    .story-banner { padding: 3px 10px; font-size: var(--fs-md); }
    .danger-banner { padding: 4px 10px; font-size: var(--fs-sm); 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: var(--r-xs); 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: var(--fs-xl);
    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: var(--r-lg);
    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: var(--fs-lg); }
}
@media (prefers-reduced-motion: reduce) { .event-banner { animation: none; } }

/* ══ 광고 시청 보상: 메뉴 단추 · 연습용 광고 창 (static/ads.js) ══ */
.gm-ad-btn {
    display: block;
    width: 100%;
    margin: 4px 0 10px;
    padding: 10px 12px;
    border-radius: var(--r-lg);
    border: 1px solid rgba(120, 230, 160, 0.55);
    background: linear-gradient(135deg, #1f6b43, #134a2d);
    color: #eafff1;
    font-size: var(--fs-lg);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(40, 200, 110, 0.25);
}
.gm-ad-btn b { color: #ffe27a; }
.gm-ad-btn:hover { filter: brightness(1.12); }
.reward-ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
}
.reward-ad-box {
    width: min(92vw, 360px);
    padding: 12px;
    border-radius: var(--r-xl);
    background: #17131f;
    border: 1px solid #3a3350;
    color: #e9e4f5;
}
.reward-ad-screen {
    height: 200px;
    margin: 6px 0 10px;
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    font-size: var(--fs-xl);
    background: repeating-linear-gradient(45deg, #221c30 0 12px, #1c1728 12px 24px);
    border: 1px dashed #4a4266;
}
.reward-ad-screen small { font-size: var(--fs-xs); color: #a59cc0; }
.reward-ad-bar { height: 6px; border-radius: var(--r-xs); background: #2c2640; overflow: hidden; }
.reward-ad-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3ad47e, #ffe27a); }
.reward-ad-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: var(--fs-sm); }
.reward-ad-close {
    padding: 4px 10px;
    border-radius: var(--r-sm);
    border: 1px solid #4a4266;
    background: #241e33;
    color: #cfc8e3;
    cursor: pointer;
}
/* 로그인 카드 아래 공개 문서 링크 (소개 · 가이드 · 개인정보처리방침) */
.auth-links { margin-top: 16px; font-size: var(--fs-sm); color: var(--text-muted); }
.auth-links a { color: var(--text-muted); text-decoration: none; }
.auth-links a:hover { color: var(--gold-bright); text-decoration: underline; }

/* ── 아이콘 세트 (static/icons.js) — 이모지 대신 쓰는 금빛 선 아이콘 ─────────────── */
:root {
    --ico-gold: #d9bd7e;
    --ico-red: #e0584a;
    --ico-orange: #f08a3c;
    --ico-yellow: #f3cc5a;
    --ico-green: #66c47e;
    --ico-blue: #6ab0e6;
    --ico-cyan: #7fd6e8;
    --ico-purple: #b48ce6;
    --ico-bone: #d8d2c4;
    --ico-pale: #cfd3e6;
}
.ico {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    color: var(--ico-gold);
    line-height: 1;
    flex-shrink: 0;
}
.ico svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}
/* 고정폭 전투 로그: 서버가 이모지를 두 칸으로 셈해 줄을 맞추므로 아이콘도 두 칸 너비 */
.terminal-log .ico { width: 2ch; height: 1.15em; }
.terminal-log .ico svg { width: 1.15em; margin: 0 auto; }
/* 아이콘별 색 — 기기마다 다르던 이모지 색을 한 팔레트로 */
.ico-cross, .ico-drop, .ico-heart { color: var(--ico-red); }
.ico-flame, .ico-burst, .ico-comet { color: var(--ico-orange); }
.ico-sparkle, .ico-star, .ico-bolt, .ico-sun, .ico-bulb, .ico-trophy, .ico-crown, .ico-coin, .ico-bag, .ico-medal { color: var(--ico-yellow); }
.ico-check, .ico-potion { color: var(--ico-green); }
.ico-snow, .ico-wave, .ico-wind { color: var(--ico-blue); }
.ico-gem { color: var(--ico-cyan); }
.ico-orb, .ico-spiral, .ico-wand { color: var(--ico-purple); }
.ico-skull { color: var(--ico-bone); }
.ico-moon, .ico-wing { color: var(--ico-pale); }
.ico-warning { color: var(--ico-orange); }
.ico-mana, .ico-water { color: var(--ico-blue); }
.ico-heal { color: var(--ico-green); }
.ico-fullmoon { color: #f1e3b0; }
.ico-chart { color: var(--ico-green); }
.ico-mind { color: var(--ico-purple); }
.ico-mshield { color: var(--ico-purple); }
.ico-plus { color: var(--ico-green); }

/* ── 글자 위계 (typography) ── */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, .game-title { letter-spacing: 0.04em; }
.panel-box h3 { font-weight: 700; letter-spacing: 0.06em; }
.terminal-log { letter-spacing: 0.01em; word-break: keep-all; overflow-wrap: anywhere; }
.bar-label, .badge, .progress-bar, .stat-value, .hotbar, .top-bar { font-variant-numeric: tabular-nums; }

/* ── 4단계: 배경 · 장식 ──
   밤하늘 별빛 + 아득한 탑 실루엣 + 아래쪽 안개. 화면 뒤에 고정되어 클릭을 막지 않는다. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 255, 255, 0.55), transparent 60%),
        radial-gradient(1.6px 1.6px at 27% 62%, rgba(255, 255, 255, 0.35), transparent 60%),
        radial-gradient(2.2px 2.2px at 41% 9%, rgba(255, 240, 210, 0.6), transparent 60%),
        radial-gradient(1.6px 1.6px at 58% 34%, rgba(255, 255, 255, 0.4), transparent 60%),
        radial-gradient(1.6px 1.6px at 69% 81%, rgba(255, 255, 255, 0.3), transparent 60%),
        radial-gradient(2.2px 2.2px at 83% 14%, rgba(220, 210, 255, 0.55), transparent 60%),
        radial-gradient(1.6px 1.6px at 91% 52%, rgba(255, 255, 255, 0.35), transparent 60%),
        radial-gradient(1.6px 1.6px at 6% 88%, rgba(255, 255, 255, 0.3), transparent 60%),
        radial-gradient(1.6px 1.6px at 35% 40%, rgba(255, 255, 255, 0.25), transparent 60%),
        radial-gradient(1.6px 1.6px at 76% 46%, rgba(255, 255, 255, 0.25), transparent 60%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 400'%3E%3Cpath fill='%23c8aa6e' fill-opacity='0.16' d='M100 6 L106 40 L112 40 L112 70 L118 70 L118 120 L124 120 L124 200 L132 200 L132 300 L142 300 L142 400 L58 400 L58 300 L68 300 L68 200 L76 200 L76 120 L82 120 L82 70 L88 70 L88 40 L94 40 Z'/%3E%3Crect x='97' y='90' width='6' height='12' fill='%230e0d13'/%3E%3Crect x='97' y='160' width='6' height='14' fill='%230e0d13'/%3E%3Crect x='96' y='250' width='8' height='16' fill='%230e0d13'/%3E%3C/svg%3E") center bottom / auto 72vh no-repeat,
        radial-gradient(ellipse 90% 35% at 50% 105%, rgba(120, 100, 170, 0.16), transparent 70%);
    opacity: 0.9;
}
body::after {
    /* 탑 실루엣이 은은하게만 보이도록 덮는 어둠 + 가장자리 비네트 */
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, rgba(14, 13, 19, 0.25) 0%, rgba(8, 7, 12, 0.8) 100%);
}

/* 큰 패널 네 모서리에 금색 꺾쇠 장식 */
.chat-col.panel-frame::after,
.char-col.panel-frame::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: var(--r-md);
    pointer-events: none;
    opacity: 0.7;
    --c: var(--gold-mid);
    background:
        linear-gradient(var(--c), var(--c)) left top / 12px 2px no-repeat,
        linear-gradient(var(--c), var(--c)) left top / 2px 12px no-repeat,
        linear-gradient(var(--c), var(--c)) right top / 12px 2px no-repeat,
        linear-gradient(var(--c), var(--c)) right top / 2px 12px no-repeat,
        linear-gradient(var(--c), var(--c)) left bottom / 12px 2px no-repeat,
        linear-gradient(var(--c), var(--c)) left bottom / 2px 12px no-repeat,
        linear-gradient(var(--c), var(--c)) right bottom / 12px 2px no-repeat,
        linear-gradient(var(--c), var(--c)) right bottom / 2px 12px no-repeat;
}
body.blood-moon .chat-col.panel-frame::after,
body.blood-moon .char-col.panel-frame::after { --c: #e0565e; }

/* ── 5단계: 움직임 ── */
/* 새 로그 줄은 살짝 떠오르며 나타난다 */
@keyframes log-in { from { opacity: 0; transform: translateY(4px); } }
.terminal-log > .log-line { animation: log-in 0.28s var(--ease-out); }

/* 방 이름 배지: 들어설 때 한 번 빛이 번진다 */
@keyframes room-in {
    from { box-shadow: 0 0 34px rgba(0, 255, 204, 0.55), inset 0 0 18px rgba(0, 255, 204, 0.25); filter: brightness(1.3); }
}
.room-title { animation: room-in 0.9s var(--ease-out); }

/* 체력 · 마력 · 경험치 막대 위로 빛줄기가 천천히 지나간다 */
.cp-bar-track .progress-fill { overflow: hidden; transition: width 0.35s var(--ease-out); }
.cp-bar-track .progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: translateX(-120%);
    animation: bar-sheen 5s ease-in-out infinite;
}
.cp-bar-track .mp-fill::after { animation-delay: 1.6s; }
.cp-bar-track .exp-fill::after { animation-delay: 3.2s; }
@keyframes bar-sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(300%); } }

/* 누르는 느낌 */
.cp-action:active { transform: translateY(0) scale(0.97); transition-duration: 0.05s; }

/* 접속 창이 부드럽게 떠오른다 */
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.auth-card { animation: card-in 0.5s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
    .terminal-log > .log-line, .room-title, .auth-card,
    .cp-bar-track .progress-fill::after { animation: none; }
}

/* 접속 화면은 별빛 · 탑 배경이 비치도록 덮개를 옅게 (다른 모달은 그대로) */
#auth-overlay { background: rgba(5, 5, 8, 0.45); backdrop-filter: blur(1.5px); }
