:root {
    --egic-navy: #1a253a;
    --egic-blue: #2d4a7c;
    --egic-cyan: #00f2ff;
    --egic-white: #f0f8ff;
    --chisa-pink: #ffb6c1;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(0, 242, 255, 0.3);
    
    --font-head: 'Barlow', sans-serif;
    --font-body: 'M PLUS Rounded 1c', sans-serif;
}

body.egic-os-theme {
    background-color: #0b1019;
    color: var(--egic-white);
    font-family: var(--font-body);
    margin: 0;
    overflow-x: hidden;
}

/* --- 背景アニメーション --- */
.bg-grid-system {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1a253a 0%, #0b1019 100%);
    perspective: 1000px;
}
.grid-line-x, .grid-line-y {
    position: absolute; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(0, 242, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}
.grid-line-x { transform: rotateX(60deg) scale(2); opacity: 0.3; top: -50%; }
.bg-gradient-orb {
    position: absolute; top: 20%; right: 10%; width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,242,255,0.1) 0%, transparent 70%);
    animation: pulseOrb 10s infinite alternate;
}
@keyframes pulseOrb { 0% { opacity: 0.3; transform: scale(1); } 100% { opacity: 0.6; transform: scale(1.2); } }

/* --- ヘッダー --- */
.os-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 30px;
    background: rgba(11, 16, 25, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}
.header-brand { font-family: var(--font-head); display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 1.5rem; font-weight: 800; color: var(--egic-cyan); letter-spacing: 2px; }
.brand-name { font-size: 0.9rem; color: #8899aa; letter-spacing: 1px; }

.os-nav a {
    color: #8899aa; text-decoration: none; font-family: var(--font-head); font-weight: 600;
    margin-left: 20px; font-size: 1.1rem; transition: color 0.3s;
    position: relative;
}
.os-nav a.active, .os-nav a:hover { color: var(--egic-cyan); }
.os-nav a.active::after {
    content: ''; position: absolute; bottom: -5px; left: 0; width: 100%; height: 2px;
    background: var(--egic-cyan); box-shadow: 0 0 10px var(--egic-cyan);
}

.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.mobile-menu-btn span { width: 25px; height: 2px; background: var(--egic-cyan); }

/* --- メインレイアウト (2カラム) --- */
.database-container {
    display: flex; max-width: 1400px; margin: 0 auto; min-height: calc(100vh - 70px);
}

/* --- 左カラム: ビジュアル --- */
.char-visual-column {
    width: 400px; flex-shrink: 0;
    padding: 40px; box-sizing: border-box;
    position: sticky; top: 70px; height: calc(100vh - 70px);
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex; flex-direction: column; justify-content: center;
}

.char-id { font-family: var(--font-head); margin-bottom: 20px; line-height: 1; }
.id-number { display: block; font-size: 1rem; color: #8899aa; margin-bottom: 5px; }
.id-name { font-size: 3rem; font-weight: 800; color: var(--egic-white); letter-spacing: 1px; }

.char-img-wrapper { position: relative; height: 350px; display: flex; align-items: center; justify-content: center; margin-bottom: 30px; }
.main-visual { max-height: 100%; max-width: 100%; z-index: 2; filter: drop-shadow(0 0 15px rgba(0,242,255,0.2)); animation: floatChar 4s ease-in-out infinite; }
.circle-ui {
    position: absolute; width: 300px; height: 300px; border-radius: 50%;
    border: 1px dashed rgba(0,242,255,0.2); z-index: 1;
    animation: spinUi 20s linear infinite;
}
@keyframes floatChar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spinUi { 100% { transform: rotate(360deg); } }

.status-summary { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px; }
.stat-row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
.stat-label { font-family: var(--font-head); color: var(--egic-cyan); font-size: 0.9rem; }
.stat-val { font-weight: bold; }

.chart-wrapper { width: 100%; height: 200px; }

/* --- 右カラム: データ --- */
.char-data-column { flex: 1; padding: 40px; box-sizing: border-box; overflow-y: auto; }

.data-header { margin-bottom: 30px; border-left: 5px solid var(--chisa-pink); padding-left: 20px; }
.data-header h2 { font-size: 2rem; margin: 0 0 10px; }
.data-caption { font-size: 1.1rem; color: #aabbcc; margin: 0; line-height: 1.6; }

/* タブナビ */
.tab-nav {
    display: flex; gap: 10px; margin-bottom: 30px; overflow-x: auto; padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: #8899aa; padding: 10px 20px; border-radius: 5px 5px 0 0;
    cursor: pointer; font-family: var(--font-body); font-weight: bold;
    transition: all 0.3s; white-space: nowrap;
}
.tab-btn:hover { background: rgba(255,255,255,0.05); color: var(--egic-cyan); }
.tab-btn.active {
    background: var(--egic-blue); color: #fff; border-color: var(--egic-blue);
    box-shadow: 0 0 15px rgba(45, 74, 124, 0.5);
}

/* タブコンテンツ */
.tab-pane { display: none; animation: fadeIn 0.5s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.data-block {
    background: var(--glass-bg); padding: 25px; border-radius: 10px;
    margin-bottom: 20px; border: 1px solid rgba(255,255,255,0.05);
}
.data-block h3 { margin-top: 0; color: var(--egic-cyan); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.data-block p { line-height: 1.8; color: #d0d0d0; }
.highlight-block { background: rgba(255, 192, 203, 0.05); border-color: var(--chisa-pink); }

/* PONレイアウト */
.pon-layout { display: flex; align-items: center; gap: 20px; margin-top: 15px; }
.pon-layout img { width: 100px; height: 100px; object-fit: contain; }

/* リスト系 */
.ability-list { list-style: none; padding: 0; }
.ability-list li { margin-bottom: 15px; padding-left: 20px; border-left: 3px solid var(--egic-blue); }
.img-in-text { display: flex; gap: 10px; margin: 10px 0; }
.img-in-text img { width: 60px; height: 60px; background: rgba(255,255,255,0.1); border-radius: 5px; padding: 5px; }

/* ファミリーグリッド */
.family-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.family-card {
    display: flex; align-items: center; gap: 15px;
    background: rgba(255,255,255,0.05); padding: 15px; border-radius: 10px;
    text-decoration: none; color: inherit; transition: transform 0.2s, background 0.2s;
}
.family-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.1); }
.f-icon { width: 70px; height: 70px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.f-icon img { width: 50px; }
.f-info h4 { margin: 0; color: var(--egic-cyan); }
.relation { font-size: 0.8rem; background: var(--egic-blue); padding: 2px 8px; border-radius: 4px; display: inline-block; margin: 5px 0; }
.f-info p { font-size: 0.85rem; margin: 0; color: #aaa; line-height: 1.4; }

/* ログ */
.log-entry { font-family: 'Courier New', monospace; border-left: 2px solid #555; padding-left: 15px; margin-bottom: 20px; }
.log-meta { font-size: 0.8rem; color: var(--egic-cyan); margin-bottom: 5px; }
.log-body { font-size: 0.95rem; }
.log-entry.special { border-color: var(--chisa-pink); }
.log-entry.special .log-meta { color: var(--chisa-pink); }

/* ギャラリー */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.g-item {
    aspect-ratio: 1; background: rgba(255,255,255,0.05); border-radius: 5px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: transform 0.2s; position: relative;
}
.g-item:hover { transform: scale(1.1); z-index: 10; background: rgba(255,255,255,0.15); }
.g-item img { max-width: 80%; max-height: 80%; }
.g-item::after {
    content: attr(title); position: absolute; bottom: 0; left: 0; width: 100%;
    background: rgba(0,0,0,0.7); font-size: 0.7rem; text-align: center;
    opacity: 0; transition: opacity 0.2s;
}
.g-item:hover::after { opacity: 1; }

/* --- Responsive (スマホ対応) --- */
@media (max-width: 900px) {
    .database-container { flex-direction: column; }
    
    .char-visual-column {
        width: 100%; height: auto; position: relative; top: 0;
        border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 20px; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 20px;
    }
    .visual-box { display: flex; flex-wrap: wrap; width: 100%; align-items: center; justify-content: space-around; }
    .char-img-wrapper { height: 200px; width: 200px; margin: 0; }
    .circle-ui { width: 180px; height: 180px; }
    .status-summary { display: none; /* スマホでは簡易表示のため隠す */ }
    .chart-wrapper { width: 150px; height: 150px; }

    .char-data-column { padding: 20px; }
    .tab-nav { justify-content: flex-start; }
    
    .pon-layout { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .header-brand .brand-name { display: none; }
    .os-nav { display: none; } /* ハンバーガーメニュー実装時はここを修正 */
    .mobile-menu-btn { display: flex; }

    .char-visual-column { flex-direction: column; }
    .char-id { text-align: center; width: 100%; }
    .chart-wrapper { display: none; /* スマホ縦では狭いので隠す */ }
    
    .data-header h2 { font-size: 1.5rem; }
    .family-grid { grid-template-columns: 1fr; }
}