@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Outfit:wght@300;400;600;700&display=swap');

/* -------------------------------------------------------------
   Common Reset & Global variables
------------------------------------------------------------- */
:root {
    --bg-main: #0c0c0f;
    --bg-panel: rgba(20, 20, 26, 0.75);
    --bg-card: rgba(30, 30, 40, 0.85);
    --border-gold: #d4af37;
    --border-gold-dim: #8e7225;
    --glow-gold: 0 0 15px rgba(212, 175, 55, 0.35);
    
    --color-text: #e2e2e9;
    --color-text-dim: #9595a5;
    --color-gold: #f39c12;
    --color-mana: #9b59b6;
    --color-order: #e67e22;
    
    --positive-color: #2ecc71;
    --positive-bg: rgba(46, 204, 113, 0.15);
    --negative-color: #e74c3c;
    --negative-bg: rgba(231, 76, 60, 0.15);
    
    --font-royal: 'Cinzel', serif;
    --font-ui: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--color-text);
    font-family: var(--font-ui);
    overflow: hidden;
    user-select: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f0f13;
}
::-webkit-scrollbar-thumb {
    background: var(--border-gold-dim);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-gold);
}

/* -------------------------------------------------------------
   Header & Status Bar
------------------------------------------------------------- */
header {
    background: linear-gradient(180deg, #131318 0%, #0c0c0f 100%);
    border-bottom: 2px solid var(--border-gold-dim);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.game-title h1 {
    font-family: var(--font-royal);
    font-size: 22px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 2px 4px #000;
}

.game-title span {
    font-family: var(--font-ui);
    font-size: 10px;
    color: var(--border-gold);
    letter-spacing: 4px;
    display: block;
    text-transform: uppercase;
    margin-top: 2px;
}

.resources-bar {
    display: flex;
    gap: 20px;
}

.resource-box {
    background: rgba(18, 18, 22, 0.9);
    border: 1px solid var(--border-gold-dim);
    border-radius: 8px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    min-width: 140px;
}

.resource-box .icon {
    font-size: 20px;
}

.resource-box .details {
    display: flex;
    flex-direction: column;
}

.resource-box .label {
    font-size: 10px;
    color: var(--color-text-dim);
    text-transform: uppercase;
}

.resource-box .value-container {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.resource-box .value {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
}

.resource-box .rate {
    font-size: 10px;
    font-weight: 400;
}

/* Resource specific colors */
#gold-box { border-color: rgba(243, 156, 18, 0.4); }
#gold-box .value { color: var(--color-gold); }
#gold-box .rate { color: #f1c40f; }

#mana-box { border-color: rgba(155, 89, 182, 0.4); }
#mana-box .value { color: var(--color-mana); }
#mana-box .rate { color: #d8b4e2; }

#order-box {
    border-color: rgba(230, 126, 34, 0.4);
    min-width: 180px;
}
#order-box .value { color: var(--color-order); }
.public-order-gauge {
    width: 100px;
    height: 6px;
    background: #252530;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}
.public-order-bar {
    height: 100%;
    width: 80%;
    background-color: var(--color-order);
    transition: width 0.4s ease, background-color 0.4s ease;
}

/* -------------------------------------------------------------
   Main Split View Layout
------------------------------------------------------------- */
.main-container {
    flex: 1;
    display: flex;
    height: calc(100vh - 66px);
}

.left-panel {
    width: 45%;
    border-right: 2px solid rgba(212, 175, 55, 0.35); /* 황금 광택 구분선 */
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #16151c 0%, #0d0d10 100%);
    padding: 20px;
    gap: 24px;
    overflow-y: auto;
    box-shadow: inset -10px 0 25px rgba(0, 0, 0, 0.5);
}

.right-panel {
    width: 55%;
    display: flex;
    flex-direction: column;
    background-color: #0c0c0f;
}

/* Section Titles */
.section-title {
    font-family: var(--font-royal);
    font-size: 13px;
    color: #ffffff;
    border-bottom: 2px solid rgba(212, 175, 55, 0.25); /* 황금 테두리 밑줄 */
    padding-bottom: 8px;
    margin-bottom: 12px;
    letter-spacing: 1.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.section-title span {
    font-size: 9px;
    color: var(--border-gold);
    font-family: var(--font-ui);
    letter-spacing: 1px;
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* -------------------------------------------------------------
   Left Panel: Upgrades and Management
------------------------------------------------------------- */
.upgrades-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 마탑 추가로 4열 배치 */
    gap: 8px;
}

.upgrade-btn {
    background: linear-gradient(135deg, #201e25 0%, #111014 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 105px; /* 그래픽 아이콘 안착 공간 확보 */
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 0 6px rgba(255,255,255,0.03);
}

.upgrade-btn:hover:not(.disabled) {
    border-color: var(--border-gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.45), inset 0 0 8px rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

.upgrade-btn:hover:not(.disabled) .upgrade-graphic {
    transform: scale(1.2) translateY(-2px);
}

.upgrade-graphic {
    font-size: 22px;
    margin-top: 4px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.upgrade-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.upgrade-info {
    text-align: center;
}

.upgrade-info .facility-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    display: block;
}

.upgrade-info .facility-lv {
    font-size: 10px;
    color: var(--border-gold);
    display: block;
    margin-top: 2px;
}

.upgrade-cost {
    font-size: 11px;
    color: var(--color-gold);
    font-weight: 700;
}

/* Tavern & Hiring */
.tavern-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tavern-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hero-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hero-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 8px;
}

.card-header .hero-class {
    font-family: var(--font-royal);
    font-size: 12px;
    font-weight: 700;
}

.card-header .hero-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.card-header .hero-lv {
    font-size: 11px;
    color: var(--color-text-dim);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hero-stats {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--color-text-dim);
}

.hero-traits-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.trait-tag {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.trait-tag.positive {
    color: var(--positive-color);
    background-color: var(--positive-bg);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.trait-tag.negative {
    color: var(--negative-color);
    background-color: var(--negative-bg);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Buttons inside Cards */
.btn-hire {
    background: linear-gradient(135deg, #1e1e24 0%, #15151a 100%);
    border: 1px solid var(--border-gold-dim);
    color: #fff;
    font-size: 11px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-hire:hover {
    background: var(--border-gold);
    color: #000;
    border-color: var(--border-gold);
    box-shadow: var(--glow-gold);
}

/* Party Cards Layout */
.party-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.party-card {
    height: 140px;
    position: relative;
}

.hp-bar-container {
    background: #15151e;
    height: 14px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hp-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.hp-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    top: 0;
    line-height: 12px;
}

.btn-dismiss {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: var(--negative-color);
    font-size: 10px;
    padding: 3px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 50px;
    transition: all 0.2s ease;
}

.btn-dismiss:hover {
    background: var(--negative-color);
    color: #fff;
}

.btn-refresh {
    background: none;
    border: 1px solid var(--border-gold-dim);
    color: var(--border-gold);
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.btn-refresh:hover {
    background: var(--border-gold-dim);
    color: #fff;
}

.empty-msg {
    grid-column: span 2;
    text-align: center;
    color: var(--color-text-dim);
    font-size: 12px;
    padding: 30px 10px;
    line-height: 1.6;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* -------------------------------------------------------------
   Right Panel: Canvas, Control, Cemetery
------------------------------------------------------------- */
.canvas-container {
    position: relative;
    border-bottom: 2px solid var(--border-gold-dim);
}

#dungeon-canvas {
    display: block;
    width: 100%;
    height: 300px;
    background-color: #121216;
}

.tactical-control {
    background: #131317;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tactical-title {
    font-size: 11px;
    color: var(--color-text-dim);
}

.btn-mana-cast {
    background: linear-gradient(135deg, #8e44ad 0%, #6c5ce7 100%);
    border: 1px solid #a29bfe;
    color: #fff;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.3);
}

.btn-mana-cast:hover {
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.6);
    transform: translateY(-1px);
}

/* Cemetery tab styling */
.cemetery-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    background: linear-gradient(180deg, #0e0e12 0%, #08080a 100%);
}

.cemetery-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grave-item {
    background: rgba(20, 20, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.2s ease;
}

.grave-item:hover {
    background: rgba(30, 30, 40, 0.8);
    border-color: rgba(212, 175, 55, 0.15);
    box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

.grave-tombstone {
    font-size: 24px;
    color: var(--color-text-dim);
    filter: drop-shadow(0 2px 4px #000);
}

.grave-details {
    flex: 1;
}

.grave-title {
    font-size: 12px;
    color: #fff;
}

.grave-name {
    font-weight: 600;
}

.grave-stats {
    font-size: 10px;
    color: var(--color-text-dim);
    margin-top: 4px;
}

.grave-cause {
    font-size: 10px;
    color: #e74c3c;
    font-style: italic;
    margin-top: 2px;
}

/* -------------------------------------------------------------
   Modals (TRPG, GameOver)
------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Royal Letter style for TRPG Event */
.letter-box {
    background: #eadeca; /* 피지선 색상 */
    border: 8px double #8e7225;
    border-radius: 4px;
    width: 500px;
    max-width: 90%;
    color: #2c2518;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 0 1px #d4af37;
    transform: scale(0.9) rotate(-1deg);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.modal-overlay.active .letter-box {
    transform: scale(1.0) rotate(0deg);
}

.letter-box::before {
    content: "📜";
    font-size: 40px;
    position: absolute;
    top: -24px;
    right: 20px;
}

.letter-title {
    font-family: var(--font-royal);
    font-size: 18px;
    font-weight: 700;
    border-bottom: 2px solid #8e7225;
    padding-bottom: 10px;
    text-align: center;
    letter-spacing: 1px;
}

.letter-desc {
    font-family: 'Cinzel', var(--font-ui);
    font-size: 13px;
    line-height: 1.7;
    text-align: justify;
    font-style: italic;
    background: rgba(0,0,0,0.03);
    padding: 14px;
    border-radius: 4px;
    border-left: 3px solid #b8860b;
}

.letter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.letter-btn {
    background: #3a2e1d;
    border: 1px solid #8e7225;
    color: #f7e7ce;
    font-family: var(--font-ui);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.letter-btn:hover {
    background: #b8860b;
    color: #000;
    border-color: #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

/* GameOver Portal style */
.gameover-box {
    background: linear-gradient(135deg, #1c0505 0%, #0d0101 100%);
    border: 2px solid #c0392b;
    border-radius: 12px;
    width: 420px;
    max-width: 90%;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 0 30px rgba(192, 57, 43, 0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gameover-box h2 {
    font-family: var(--font-royal);
    color: #e74c3c;
    font-size: 26px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.gameover-box p {
    font-size: 13px;
    color: var(--color-text-dim);
    line-height: 1.6;
}

.gameover-stats {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    text-align: left;
}

.gameover-stats div {
    display: flex;
    justify-content: space-between;
}

.gameover-stats span {
    color: #fff;
    font-weight: 700;
}

.btn-restart {
    background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
    border: 1px solid #e74c3c;
    color: #fff;
    font-family: var(--font-ui);
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-restart:hover {
    background: #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
}

/* -------------------------------------------------------------
   Turn-based UI Enhancements
------------------------------------------------------------- */
.disabled-panel {
    opacity: 0.45;
    pointer-events: none !important;
    filter: grayscale(40%) blur(0.5px);
    transition: all 0.35s ease;
}

.disabled-card {
    opacity: 0.6;
    pointer-events: none !important;
}

.btn-expedition {
    box-shadow: 0 0 15px rgba(211, 84, 0, 0.4);
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-expedition:hover:not(.disabled):not(:disabled) {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%) !important;
    box-shadow: 0 0 20px rgba(230, 126, 34, 0.75);
    transform: translateY(-1px);
}

.btn-expedition.disabled,
.btn-expedition:disabled {
    background: #2b2b35 !important;
    border-color: #3b3b4a !important;
    color: #727282 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.btn-mana-cast:disabled {
    background: #201a24 !important;
    border-color: #312836 !important;
    color: #5d5066 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* -------------------------------------------------------------
   Hero Grades Visual Styling
------------------------------------------------------------- */
.hero-card.grade-rare {
    border: 1px solid rgba(52, 152, 219, 0.6) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 0 8px rgba(52, 152, 219, 0.1) !important;
    background: linear-gradient(135deg, #101525 0%, #15151f 100%) !important;
}

.hero-card.grade-rare:hover {
    border-color: #3498db !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 12px rgba(52, 152, 219, 0.4) !important;
}

.hero-card.grade-legendary {
    border: 1px solid rgba(241, 196, 15, 0.6) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 10px rgba(241, 196, 15, 0.2), inset 0 0 10px rgba(241, 196, 15, 0.15) !important;
    background: linear-gradient(135deg, #221a0a 0%, #121218 100%) !important;
}

.hero-card.grade-legendary:hover {
    border-color: #f1c40f !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 18px rgba(241, 196, 15, 0.5) !important;
    transform: translateY(-2px) scale(1.01);
}

/* -------------------------------------------------------------
   Hero Anime Portraits Visual Styling & 3.5x Hover Magnify Zoom
------------------------------------------------------------- */
.card-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 8px;
    position: relative;
}

.hero-portrait {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    background-color: #2c2c35;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    transition: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 2;
    transform-origin: center center;
}

.hero-card:hover .hero-portrait {
    border-color: rgba(212, 175, 55, 0.6);
}

.hero-portrait:hover {
    border-color: #d4af37 !important;
    transform: scale(5.5) !important;
    z-index: 999 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8), 0 0 15px rgba(212, 175, 55, 0.65);
}

/* 64종 다양성 시각 튜닝: 3번(웜톤) 및 4번(쿨톤/흑화) 필터 */
.filter-warm {
    filter: hue-rotate(28deg) saturate(1.3) contrast(1.1);
}
.filter-cool {
    filter: hue-rotate(-40deg) brightness(0.9) saturate(1.2);
}

.header-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    gap: 2px;
}

.header-details .hero-class {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
}

.header-details .hero-name {
    font-size: 13px;
    font-weight: 600;
}

.grave-portrait {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    object-fit: cover;
    background-color: #1e1e24;
    filter: grayscale(100%) opacity(0.65);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    margin-right: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 2;
    transform-origin: center center;
}

.grave-portrait:hover {
    filter: grayscale(0%) opacity(1.0) !important;
    border-color: #e74c3c;
    transform: scale(5.5) !important;
    z-index: 999 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8), 0 0 15px rgba(231, 76, 60, 0.7);
}

/* 📜 실시간 상소문 보관함 (Appeals Box) 스타일 */
.appeals-chest-box {
    background: linear-gradient(135deg, #1e1b26 0%, #0d0b10 100%);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
}

.appeals-chest-box:hover {
    border-color: var(--border-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.35), inset 0 0 8px rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

/* 상소문이 쌓여 있을 때 경고 테두리 펄스 모션 */
.appeals-chest-box.danger-pulse {
    border-color: #ff6b6b;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.45);
    animation: pulseRed 1.4s infinite alternate;
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 4px rgba(231, 76, 60, 0.3);
    }
    100% {
        box-shadow: 0 0 16px rgba(231, 76, 60, 0.7);
    }
}

.chest-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chest-icon {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.chest-details {
    display: flex;
    flex-direction: column;
}

.chest-title {
    font-family: var(--font-royal);
    font-size: 13px;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 1px;
}

.chest-status-desc {
    font-size: 10px;
    color: #a4b0be;
    margin-top: 2px;
}

.chest-badge {
    background-color: var(--border-gold);
    color: #000;
    font-size: 12px;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.appeals-chest-box.danger-pulse .chest-badge {
    background-color: #ff6b6b;
    color: #fff;
}



/* 🏰 제국 통치 영토 및 수도 조감도 (Kingdom View Dashboard) */
.kingdom-view-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kingdom-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
    gap: 8px;
}

.kingdom-tab-btn {
    background: none;
    border: none;
    color: var(--color-text-dim);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.kingdom-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.kingdom-tab-btn.active {
    color: var(--border-gold);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: inset 0 0 5px rgba(212, 175, 55, 0.15);
}

.kingdom-tab-content {
    display: none;
}

.kingdom-tab-content.active {
    display: block;
}

/* 🗺️ 영토 확장 지도 영역 */
.territory-map-wrapper {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.territory-map-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/kingdom_map_background.png');
    background-size: cover;
    background-position: center;
    filter: brightness(0.65) contrast(1.1);
    z-index: 1;
}

/* 5대 주 속령 구역 오버레이 */
.province-overlay {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.18);
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
    color: #fff;
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 8px;
    font-weight: 700;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: help;
}

/* 잠겨있거나 수복하지 않은 주 */
.province-overlay.locked {
    background: rgba(20, 20, 20, 0.75);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    color: rgba(255, 255, 255, 0.4);
}

.province-overlay.locked .province-flag {
    filter: grayscale(1);
    opacity: 0.6;
}

.province-overlay .province-flag {
    font-size: 10px;
    margin-bottom: 1px;
    animation: flag-pulse 1.8s infinite ease-in-out;
}

.province-overlay.locked .province-flag {
    animation: none;
}

.province-name {
    text-shadow: 1px 1px 3px #000;
}

/* 10대 주로 absolute 배치 고정 (percentage로 자동 정렬 및 중앙 정렬) */
#province-1 { top: 20px; left: 8%; }
#province-2 { top: 75px; left: 17%; }
#province-3 { top: 20px; left: 26%; }
#province-4 { top: 75px; left: 35%; }
#province-5 { top: 20px; left: 44%; }
#province-6 { top: 75px; left: 53%; }
#province-7 { top: 20px; left: 62%; }
#province-8 { top: 75px; left: 71%; }
#province-9 { top: 20px; left: 80%; }
#province-10 { top: 75px; left: 89%; }

.territory-info {
    text-align: center;
    font-size: 11px;
    color: var(--color-text-dim);
    margin-top: 6px;
}

.territory-info strong {
    color: var(--border-gold);
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

/* 🏰 수도 발전 전경 (Capital City Panorama) */
.capital-panorama-container {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.5s ease;
}

.panorama-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: background 0.8s ease;
}

/* 5개 티어별 수도 전경 하늘 그라데이션 및 분위기 선언 */
.capital-panorama-container.pan-tier-1 .panorama-sky {
    background: linear-gradient(180deg, #3498db 0%, #aed6f1 70%, #2ecc71 100%);
}
.capital-panorama-container.pan-tier-2 .panorama-sky {
    background: linear-gradient(180deg, #1f3a60 0%, #e67e22 70%, #2c3e50 100%);
}
.capital-panorama-container.pan-tier-3 .panorama-sky {
    background: linear-gradient(180deg, #0f172a 0%, #5b21b6 60%, #1e1b4b 100%);
}
.capital-panorama-container.pan-tier-4 .panorama-sky {
    background: linear-gradient(180deg, #0c0a0f 0%, #1d1135 60%, #0d0118 100%);
}
.capital-panorama-container.pan-tier-5 .panorama-sky {
    background: linear-gradient(180deg, #78350f 0%, #fbbf24 60%, #78350f 100%);
}

.panorama-cityscape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.panorama-item {
    position: absolute;
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
    transition: all 0.5s ease;
}

.panorama-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.85) 100%);
    padding: 8px 12px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.panorama-tier-label {
    font-family: var(--font-royal);
    font-size: 11px;
    font-weight: 700;
    color: var(--border-gold);
    text-shadow: 0 0 5px rgba(212,175,55,0.4);
    margin-bottom: 2px;
}

.panorama-tier-desc {
    font-size: 9px;
    color: #cbd5e1;
    line-height: 1.3;
}

/* 🏛️ 업그레이드 버튼 자체의 등급별 수려한 진화 */
.upgrade-btn {
    position: relative;
    overflow: hidden;
}

.btn-tier-label {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 7.5px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    padding: 1px 3px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Tier 1 - Wood/Camp */
.upgrade-btn.btn-tier-1 {
    background: linear-gradient(135deg, #1e1c22 0%, #0f0f12 100%);
    border-color: rgba(142, 137, 126, 0.35);
}
.upgrade-btn.btn-tier-1:hover:not(.disabled) {
    border-color: rgba(142, 137, 126, 0.8);
    box-shadow: 0 0 8px rgba(142, 137, 126, 0.2);
}

/* Tier 2 - Stone/Fort */
.upgrade-btn.btn-tier-2 {
    background: linear-gradient(135deg, #151e29 0%, #0c121a 100%);
    border-color: rgba(52, 152, 219, 0.4);
}
.upgrade-btn.btn-tier-2 .btn-tier-label {
    background: rgba(52, 152, 219, 0.2);
    color: #5dade2;
}
.upgrade-btn.btn-tier-2:hover:not(.disabled) {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.4);
}

/* Tier 3 - Marble/Metropolis */
.upgrade-btn.btn-tier-3 {
    background: linear-gradient(135deg, #1e132c 0%, #100a18 100%);
    border-color: rgba(155, 89, 182, 0.45);
}
.upgrade-btn.btn-tier-3 .btn-tier-label {
    background: rgba(155, 89, 182, 0.2);
    color: #af7ac5;
}
.upgrade-btn.btn-tier-3:hover:not(.disabled) {
    border-color: #9b59b6;
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.5);
}

/* Tier 4 - Mana/Floating */
.upgrade-btn.btn-tier-4 {
    background: linear-gradient(135deg, #0e2417 0%, #08140d 100%);
    border-color: rgba(46, 204, 113, 0.5);
}
.upgrade-btn.btn-tier-4 .btn-tier-label {
    background: rgba(46, 204, 113, 0.2);
    color: #58d68d;
}
.upgrade-btn.btn-tier-4:hover:not(.disabled) {
    border-color: #2ecc71;
    box-shadow: 0 0 16px rgba(46, 204, 113, 0.6);
}

/* Tier 5 - Divine Golden Empire */
.upgrade-btn.btn-tier-5 {
    background: linear-gradient(135deg, #2c1e0a 0%, #171004 100%);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 0 8px rgba(212, 175, 55, 0.15);
}
.upgrade-btn.btn-tier-5 .btn-tier-label {
    background: rgba(212, 175, 55, 0.25);
    color: var(--border-gold);
    box-shadow: 0 0 4px rgba(212, 175, 55, 0.4);
}
.upgrade-btn.btn-tier-5:hover:not(.disabled) {
    border-color: var(--border-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.8), 0 0 10px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}

/* 🌀 Micro animations */
@keyframes flag-pulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.15); }
}

@keyframes float-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes float-gold {
    0%, 100% { transform: translateY(0) scale(1.05); }
    50% { transform: translateY(-5px) scale(1.1); }
}


