:root {
    --bg-dark: #0a0a0c;
    --panel-bg: url('../img/washi_texture_paper.png');
    --accent-gold: #d4af37;
    --accent-gold-bright: #f9d71c;
    --accent-gold-dark: #8a6d1a;
    --text-primary: #000;
    --text-on-dark: #f0f0f0;
    --border-gold: 2px solid #543;
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5);
    --font-jp: 'Noto Serif JP', 'Shippori Mincho', serif;
}

.glass-panel {
    background: var(--panel-bg) !important;
    background-size: cover !important;
    border: var(--border-gold) !important;
    box-shadow: var(--shadow-premium) !important;
    color: var(--text-primary) !important;
    position: relative;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(0,0,0,0.1);
    pointer-events: none;
}

.panel-title {
    background: linear-gradient(90deg, var(--accent-gold-dark), var(--accent-gold), var(--accent-gold-dark));
    color: #fff;
    padding: 4px 12px;
    font-weight: bold;
    border-bottom: 2px solid #000;
    text-shadow: 1px 1px 2px #000;
}

.menu-btn {
    background: #222;
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-jp);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn:hover {
    background: var(--accent-gold);
    color: #000;
    box-shadow: 0 0 15px var(--accent-gold);
}

.value {
    color: #8b0000; /* Deep red for values on washi */
    font-weight: bold;
}

#resource-panel .value {
    color: #8b0000;
}

.win-header {
    background: linear-gradient(90deg, #333 0%, #111 100%);
    color: var(--accent-gold);
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: move;
    border-bottom: 2px solid #d4af37;
    letter-spacing: 2px;
}

.vertical-menu {
    top: 50%;
    right: 40px;
    transform: translateY(-50%);
    width: 140px;
    padding: 8px;
    background: #000;
    border: 4px double #d4af37;
}

.menu-btn {
    background: linear-gradient(180deg, #2c2c2c 0%, #1a1a1a 100%);
    color: #eee;
    border: 1px solid #555;
    margin-bottom: 4px;
    padding: 15px 5px;
    font-family: var(--font-jp);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 6px;
    height: 100px;
    width: 100%;
}

.menu-btn:hover {
    background: linear-gradient(180deg, #d4af37 0%, #8a6d1a 100%);
    color: #000;
    transform: translateX(-5px);
    box-shadow: -5px 0 15px rgba(212, 175, 55, 0.4);
}

.info-win {
    top: 10px;
    left: 300px;
    width: 320px;
}

.minimap-win {
    top: 250px;
    left: 10px;
    width: 280px;
}

.log-win {
    bottom: 20px;
    right: 200px;
    width: 480px;
    height: 250px;
    border: 1px solid #444;
    resize: both;
    overflow: hidden;
    min-width: 200px;
    min-height: 100px;
}

#log-content {
    background: #050505;
    color: #00ff00;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    overflow-y: auto;
    height: calc(100% - 30px);
    padding: 8px;
    line-height: 1.4;
}

.log-entry {
    border-bottom: 1px solid #222;
    padding-bottom: 2px;
    margin-bottom: 4px;
}

.log-entry.debug {
    color: #888;
}

.log-entry.event {
    color: #c60;
    font-weight: bold;
}

.log-entry.battle {
    color: #ff4444;
}

.log-entry.tactic {
    color: #f9d71c;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(249, 215, 28, 0.4);
}

.cmd-btn-small {
    background: #111;
    border: 1px solid #d4af37;
    color: #fff;
    padding: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.cmd-btn-small:hover {
    background: #d4af37;
    color: #000;
    font-weight: bold;
}

.officer-list,
.tech-tree {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.officer-item-small,
.tech-item-small {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

#minimap-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 200px;
    height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--accent-gold);
    z-index: 200;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

.trait-tag {
    background: #4a2a1a;
    color: gold;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    border: 1px solid gold;
    margin-right: 4px;
}

/* 戦法カットイン演出 */
.tactic-cutin {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    overflow: hidden;
}

.tactic-bg {
    position: absolute;
    width: 200%;
    height: 300px;
    background: linear-gradient(90deg, transparent, rgba(197, 160, 89, 0.8), transparent);
    transform: rotate(-5deg);
    animation: tacticBgSlide 2.5s ease-in-out forwards;
}

#main-area {
    flex: 1;
    position: relative;
    background-color: #000;
    overflow: hidden;
}

#map-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
}

#map-canvas:active {
    cursor: grabbing;
}

.tactic-text {
    position: relative;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 1);
}

.officer-name {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.5rem;
    opacity: 0;
    transform: translateX(-100px);
    animation: tacticTextIn 0.5s 0.2s ease-out forwards;
}

.tactic-name {
    font-size: 5rem;
    font-weight: bold;
    color: var(--accent-gold);
    margin-top: 1rem;
    opacity: 0;
    transform: scale(2);
    animation: tacticNameIn 0.6s 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes tacticBgSlide {
    0% {
        transform: translateX(-100%) rotate(-5deg);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        transform: translateX(50%) rotate(-5deg);
        opacity: 0;
    }
}

@keyframes tacticTextIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tacticNameIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 辞世の句演出 */
.death-poem-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: poemFade 6s ease-in-out forwards;
    pointer-events: none;
}

.poem-content {
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: #eee;
    font-family: 'Shippori Mincho', serif;
    letter-spacing: 0.8rem;
}

.poem-text {
    font-size: 2.2rem;
    line-height: 1.5;
}

.poem-author {
    font-size: 1.2rem;
    margin-right: 2rem;
    align-self: flex-end;
}

@keyframes poemFade {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.mine-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
}

.mine-badge.gold {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.mine-badge.silver {
    background: linear-gradient(135deg, #c0c0c0, #808080);
    color: #000;
    box-shadow: 0 0 5px rgba(192, 192, 192, 0.5);
}

.relation-tag {
    font-size: 0.6em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: bold;
}

.relation-tag.family {
    background: #8b0000;
    color: #ffd700;
    border: 1px solid #ffd700;
}

/* プレミアムなガラス質感パネル */
/* --- Premium Sengoku UI System --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700&family=Shippori+Mincho:wght@400;700&display=swap');

:root {
    --gold: #d4af37;
    --gold-bright: #f9d71c;
    --glass-bg: rgba(15, 20, 30, 0.85);
    --washi-bg: rgba(245, 240, 220, 0.9);
    --border-gold: 2px solid var(--gold);
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #050a10;
    font-family: 'Shippori Mincho', 'Outfit', serif;
    color: #e0e0e0;
}

.glass-panel, .ui-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: var(--border-gold);
    border-radius: 2px;
    box-shadow: var(--shadow-premium);
    position: absolute;
    color: #000 !important;
    padding: 10px;
    z-index: 100;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}

.officer-portrait {
    width: 120px;
    height: 120px;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    background-size: cover;
    background-position: center;
    position: relative;
}

.officer-portrait::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* 金枠の装飾 */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
    margin-bottom: 12px;
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* 情報パネルの配置 */
#resource-panel {
    top: 10px; left: 10px; width: 240px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.9rem;
}

.resource-grid div {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
}

.resource-grid .value {
    color: var(--gold-bright);
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
}


#castle-info-panel {
    top: 10px; left: 245px; width: 280px; min-height: 180px;
}

#unit-detail-panel {
    bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 600px; height: 120px;
    display: flex; gap: 20px; align-items: center;
}

#log-window {
    bottom: 20px; right: 100px; width: 350px; height: 180px;
    overflow-y: auto; font-size: 0.9rem;
}

/* メインメニュー (右側縦並び) */
#main-menu {
    width: 100px;
    z-index: 120;
}

.menu-btn {
    width: 80px; height: 34px;
    background: linear-gradient(135deg, rgba(60, 60, 70, 0.9), rgba(20, 20, 25, 0.9));
    border: 1px solid var(--gold);
    color: #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; justify-content: center;
    writing-mode: horizontal-tb;
}

.menu-btn:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 15px var(--gold);
    transform: scale(1.05);
}

/* サブメニュー (ポップアップ用) */
.sub-menu {
    position: absolute; right: 100px; top: 0;
    background: var(--glass-bg);
    border: var(--border-gold);
    display: flex; flex-direction: column; gap: 5px;
    padding: 10px; min-width: 120px;
}

/* 城・部隊のマーカー */
.map-marker {
    position: absolute; transform: translate(-50%, -50%);
    cursor: pointer; z-index: 50;
    transition: transform 0.2s;
}

.map-marker:hover { transform: translate(-50%, -50%) scale(1.2); }

.castle-icon {
    width: 32px; height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8));
}

.unit-icon {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* ダイアログ関係 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: url('https://www.transparenttextures.com/patterns/papyrus.png'), #f5f0dc;
    border: 5px double var(--gold);
    color: #222; padding: 15px; border-radius: 2px;
    max-width: 600px; position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,1);
}

.modal-content h2 {
    color: #800; font-family: 'Shippori Mincho', serif;
    border-bottom: 2px solid #800; padding-bottom: 10px;
}

/* 季節報告などのリッチなウィンドウ */
.report-window {
    width: 800px; height: 500px;
    background: rgba(20, 25, 35, 0.95);
    border: 2px solid var(--gold);
    padding: 15px;
}

.relation-tag.veteran {
    background: #000080;
    color: #c0c0c0;
    border: 1px solid #c0c0c0;
}
.tech-tree-large { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 15px; }
.tech-card { background: rgba(0,0,0,0.6); border: 2px solid #d4af37; padding: 15px; text-align: center; transition: 0.2s; }
.tech-card h3 { color: #f9d71c; font-size: 1.4rem; margin-bottom: 10px; }
.tech-card p { font-size: 1rem; color: #ccc; margin-bottom: 15px; }
.tech-card.learned { background: rgba(212, 175, 55, 0.2); }
.speed-controls button { width: 25px; height: 25px; font-size: 11px; padding: 0; font-weight: bold; }

/* ===== 通知システム強化 ===== */
#notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 5000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.notification {
    background: linear-gradient(135deg, rgba(10,5,0,0.92), rgba(30,20,5,0.92));
    border-left: 4px solid var(--accent-gold, #d4af37);
    border-right: 1px solid rgba(212,175,55,0.3);
    border-top: 1px solid rgba(212,175,55,0.3);
    border-bottom: 1px solid rgba(212,175,55,0.3);
    color: #f0e6cc;
    padding: 10px 16px;
    font-size: 0.9rem;
    pointer-events: auto;
    animation: notifSlideIn 0.35s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6), 0 0 8px rgba(212,175,55,0.1);
    word-break: break-all;
}

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== ドラッグ可能ウィンドウ強化 ===== */
.draggable-window {
    position: absolute;
    background: rgba(5,2,0,0.90);
    border: 2px solid var(--accent-gold, #d4af37);
    border-radius: 2px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
    min-width: 200px;
    color: #e8dcc0;
    z-index: 200;
}

.draggable-window header, .win-header {
    background: linear-gradient(90deg, #1a0e00, #2a1a00, #1a0e00);
    border-bottom: 1px solid var(--accent-gold, #d4af37);
    color: var(--accent-gold, #d4af37);
    padding: 8px 12px;
    cursor: move;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 0.9rem;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.win-content { padding: 6px; font-size: 0.9rem; line-height: 1.6; }

.cmd-btn, .cmd-btn-small {
    background: linear-gradient(180deg, #2a1e00, #1a1200);
    border: 1px solid rgba(212,175,55,0.7);
    color: #e8dcc0;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.cmd-btn:hover, .cmd-btn-small:hover {
    background: linear-gradient(180deg, #4a3800, #2a2000);
    border-color: var(--accent-gold, #d4af37);
    color: #f9d71c;
    box-shadow: 0 0 10px rgba(212,175,55,0.3);
}

/* ===== 城情報サイドバー ===== */
#castle-info-sidebar {
    width: 280px;
    background: var(--panel-bg);
    border: 2px solid #543;
    border-top: 5px solid #822;
    z-index: 300;
}

#castle-sidebar-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent-gold, #d4af37);
    letter-spacing: 3px;
}

#castle-lord-portrait {
    width: 80px;
    height: 80px;
    border: 2px solid var(--accent-gold, #d4af37);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

#time-progress-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold, #d4af37), #f9d71c);
    transition: width 0.1s linear;
    box-shadow: 0 0 6px rgba(212,175,55,0.5);
}

#minimap-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 220px;
    height: 165px;
    border: 2px solid var(--accent-gold, #d4af37);
    background: rgba(0,0,0,0.8);
    z-index: 250;
    box-shadow: 0 4px 16px rgba(0,0,0,0.8);
}


.officer-list-row:hover, .castle-list-row:hover {
    background: rgba(212, 175, 55, 0.15) !important;
    transform: translateX(5px);
    box-shadow: inset 5px 0 0 var(--accent-gold);
}

.trait-tag {
    transition: all 0.2s;
}

.trait-tag:hover {
    background: var(--accent-gold) !important;
    color: #000 !important;
    transform: scale(1.1);
}

/* ★washi(明るい和紙)背景のダイアログ内のフォームラベルは、オレンジ(--accent-gold)だと低コントラストで読めない
   (報告: 輸送指令の目的地/金銭/兵数ラベル)。明るい背景上のラベルは黒系に統一して可読性を確保する。
   インラインの color:var(--accent-gold) を !important で上書き。タイトルバー(win-header)等は対象外。 (v2.10.48) */
.washi-theme label {
    color: #222 !important;
}

/* ★暗い半透明パネル(rgba(0,0,0,...))の中のラベルは、上の#222ルールだと黒背景に黒で見えなくなる
   (報告: 大名選択のゲーム開始設定の戦死/斬首/大名地入れ替え/全国廃止/各除外ラベルがグレーで読めない)。
   .dark-panel を付けた暗いパネル内のラベルだけ明るいオレンジ系に上書きして可読性を確保。(v2.10.62) */
.washi-theme .dark-panel label {
    color: #f0d8a8 !important;
}
