/* ========================================
   Error Code:013 - EC013 Database Theme
   JSXデザインをHTMLに変換
   ======================================== */

/* リセット */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* カラー変数 */
:root {
    --bg: #2b2b2b;
    --bg-alt: #595857;
    --surface: #2b2b2b;
    --surface-alt: #595857;
    --border: #595857;
    --border-light: #6a6968;
    --text: #f2f2f2;
    --text-muted: #c0c0c0;
    --text-dark: #888888;
    --accent: #9e3d3f;
    --accent-light: #b85456;
    --accent-dark: #7a2f31;
    --beige: #eae5e3;
}

/* ベース */
html, body {
    height: 100%;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

a {
    color: var(--accent-light);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

/* ========================================
   エンターページ
   ======================================== */
.enter-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.enter-page.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.enter-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(255,255,255,0.01) 2px, rgba(255,255,255,0.01) 4px);
    pointer-events: none;
}

.enter-title {
    font-family: 'Noto Sans Mono', monospace;
    font-size: 14px;
    letter-spacing: 4px;
    color: var(--text);
    margin-bottom: 48px;
}

.enter-title .cursor {
    animation: blink 1.06s step-end infinite;
}

.enter-title .cursor.complete {
    color: var(--accent);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.enter-button-container {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.enter-button-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.enter-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 12px 32px;
    font-family: 'Noto Sans Mono', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enter-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.enter-footer {
    position: absolute;
    bottom: 32px;
    font-family: 'Noto Sans Mono', monospace;
    font-size: 9px;
    color: var(--text-dark);
    letter-spacing: 1px;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.enter-footer.visible {
    opacity: 0.6;
}

/* ========================================
   メインコンテナ
   ======================================== */
.main-container {
    display: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    min-height: 100vh;
}

.main-container.visible {
    display: block;
    opacity: 1;
}

/* ========================================
   ノイズ・スキャンライン効果
   ======================================== */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.05s;
}

.noise-overlay.visible {
    opacity: 1;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
    pointer-events: none;
    z-index: 9998;
}

/* ========================================
   ヘッダー
   ======================================== */
.header {
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    margin: 0;
    font-size: 14px;
    font-weight: normal;
    letter-spacing: 4px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text);
}

.header-subtitle {
    font-size: 10px;
    color: var(--text-dark);
    margin-top: 4px;
    font-family: 'Noto Sans Mono', monospace;
}

.header-access {
    font-size: 10px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 4px 12px;
}

/* ハンバーガーメニュー */
.menu-icon {
    display: none;
    background: none;
    border: 1px solid var(--border);
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.menu-icon span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s, opacity 0.2s;
}

.menu-icon.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.menu-icon.open span:nth-child(2) {
    opacity: 0;
}

.menu-icon.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ========================================
   レイアウト
   ======================================== */
.content-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* ========================================
   サイドバー
   ======================================== */
.sidebar {
    width: 200px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    color: var(--text-dark);
    font-family: 'Noto Sans Mono', monospace;
}

.nav-item {
    padding: 8px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-family: 'Noto Sans Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.5px;
    display: block;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
}

.nav-item.active {
    border-left-color: var(--accent);
    background: rgba(139, 0, 0, 0.15);
    color: var(--accent-light);
}

.sidebar-footer {
    margin-top: 32px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 10px;
    color: var(--text-dark);
    font-family: 'Noto Sans Mono', monospace;
}

/* モバイルメニュー */
.mobile-menu {
    display: none;
    position: fixed;
    top: 53px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    z-index: 99;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu .nav-item {
    padding: 12px 16px;
    font-size: 14px;
}

/* ========================================
   メインコンテンツ
   ======================================== */
.main-content {
    flex: 1;
    padding: 24px;
    background: var(--bg);
    max-width: 100%;
    overflow: hidden;
}

.content-area {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-area.hidden {
    opacity: 0;
    transform: translateY(4px);
}

/* ========================================
   ドキュメントヘッダー
   ======================================== */
.doc-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.doc-title {
    margin: 0;
    font-size: 16px;
    font-weight: normal;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* 機密スタンプ */
.classified-stamp {
    display: inline-block;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 2px 8px;
    font-size: 10px;
    font-family: 'Noto Sans Mono', monospace;
    letter-spacing: 2px;
    transform: rotate(-2deg);
    margin-left: 8px;
}

.classified-stamp.secret {
    border-color: var(--accent-dark);
    color: var(--accent-dark);
}

.classified-stamp.caution {
    border-color: var(--text-dark);
    color: var(--text-dark);
}

/* ========================================
   コードブロック
   ======================================== */
.code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.code-window-bar {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 11px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.code-window-bar span {
    white-space: nowrap;
}

.code-content {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 13px;
}

.code-content .line-number {
    font-family: 'Noto Sans Mono', monospace;
}

.code-line {
    display: flex;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.code-line.anomaly {
    background: rgba(139, 0, 0, 0.15);
}

.line-number {
    width: 48px;
    padding: 4px 8px;
    border-right: 1px solid var(--border);
    color: var(--text-dark);
    background: var(--surface-alt);
    flex-shrink: 0;
    text-align: right;
}

.line-number.anomaly {
    color: var(--accent-light);
}

.line-content {
    padding: 4px 12px;
    color: var(--text);
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

.line-content.anomaly {
    color: var(--accent-light);
}

/* グリッチテキスト */
.glitch-char {
    color: var(--accent-light);
}

/* ========================================
   画像ギャラリー
   ======================================== */
.gallery {
    margin-bottom: 24px;
}

.gallery-header {
    font-size: 10px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gallery-header::before {
    content: '◆';
    color: var(--accent);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-item:hover {
    border-color: var(--accent);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    font-size: 9px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text-muted);
}

/* ライトボックス */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
    opacity: 1;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border: 1px solid var(--border);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans Mono', monospace;
}

.lightbox-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lightbox-caption {
    margin-top: 12px;
    font-size: 11px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text-dark);
    text-align: center;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-nav:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .lightbox-nav {
        display: none;
    }

    .lightbox-content {
        max-width: 95vw;
    }
}

/* ========================================
   フッター情報
   ======================================== */
.doc-footer {
    margin-top: 24px;
    padding: 12px;
    border: 1px dashed var(--border);
    font-size: 10px;
    font-family: 'Noto Sans Mono', monospace;
    color: var(--text-dark);
}

/* ========================================
   セクション（非表示管理）
   ======================================== */
.section-content {
    display: none;
}

.section-content.active {
    display: block;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 768px) {
    .menu-icon {
        display: flex;
    }

    .sidebar {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .header {
        padding: 12px 16px;
    }

    .header-title {
        font-size: 12px;
    }

    .header-subtitle {
        display: none;
    }

    .header-access {
        padding: 4px 8px;
    }

    .main-content {
        padding: 16px;
    }

    .doc-title {
        font-size: 14px;
    }

    .code-content {
        min-width: 300px;
    }
}

/* ========================================
   スクロールバー
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-alt);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ========================================
   選択
   ======================================== */
::selection {
    background: var(--accent);
    color: var(--text);
}
