* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    background: #f6f6f6;
    color: #222;
    line-height: 1.6;
}

/* 言語切り替え用ユーティリティ */
.lang-ja {
    display: block;
}

.lang-en {
    display: none;
}

body.lang-en .lang-ja {
    display: none;
}

body.lang-en .lang-en {
    display: block;
}

a {
    color: #0645ad;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #3366cc;
}

a.internal {
    font-weight: 500;
}

a.internal:visited {
    color: #0b0080;
}

/* トップナビゲーション */
.wiki-topbar {
    background: #1a1a1a;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.wiki-topbar-left {
    display: flex;
    gap: 20px;
    align-items: center;
}

.wiki-topbar-logo {
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
}

.wiki-lang-toggle {
    display: flex;
    gap: 8px;
}

.wiki-lang-toggle button {
    padding: 4px 10px;
    border: 1px solid #666;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.wiki-lang-toggle button.active {
    background: #0645ad;
    color: #fff;
    border-color: #0645ad;
}

.wiki-lang-toggle button:hover {
    border-color: #0645ad;
}

.wiki-topbar-user {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wiki-topbar-user a {
    color: #ccc;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.wiki-topbar-user a:hover {
    color: #fff;
}

.wiki-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.wiki-header {
    background: linear-gradient(90deg, #234a5b 0%, #2f6d74 100%);
    color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wiki-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.wiki-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
}

.wiki-subtitle {
    margin: 6px 0 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

.wiki-user {
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 4px;
}

.wiki-layout {
    display: grid;
    grid-template-columns: minmax(250px, 280px) 1fr;
    gap: 20px;
}

.wiki-sidebar {
    order: 1;
}

.wiki-main {
    order: 2;
}

.wiki-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.wiki-card h2,
.wiki-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    color: #234a5b;
    font-size: 1.2rem;
}

/* Infobox スタイル */
.wiki-infobox {
    float: right;
    margin: 0 0 16px 16px;
    width: 280px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wiki-infobox > h3:first-child {
    margin-top: 0;
    text-align: center;
    border: none;
    padding: 0;
}

.wiki-infobox-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.wiki-infobox-label {
    font-weight: bold;
    color: #234a5b;
    text-align: left;
}

.wiki-infobox-value {
    color: #222;
}

.wiki-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.wiki-list li {
    margin-bottom: 6px;
}

.wiki-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.btn {
    display: inline-block;
    border: 1px solid #0645ad;
    background: #0645ad;
    color: #fff;
    padding: 10px 16px;
    border-radius: 3px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: #0430a5;
    border-color: #0430a5;
}

.btn.secondary {
    background: #f0f0f0;
    color: #0645ad;
    border-color: #0645ad;
}

.btn.secondary:hover {
    background: #e0e0e0;
}

input[type="text"],
input[type="search"],
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 3px;
    font-size: 0.95rem;
    background: #fff;
}

input[type="text"]:focus,
input[type="search"]:focus,
textarea:focus {
    outline: none;
    border-color: #0645ad;
    box-shadow: 0 0 0 2px rgba(6, 69, 173, 0.1);
}

textarea {
    min-height: 420px;
    line-height: 1.6;
    font-family: Consolas, Monaco, monospace;
    resize: vertical;
}

.notice {
    border-left: 4px solid #0645ad;
    background: #eef3f8;
    padding: 12px;
    border-radius: 3px;
    margin: 12px 0;
}

.notice.warning {
    border-left-color: #d00;
    background: #fee7e6;
}

.meta {
    color: #666;
    font-size: 0.85rem;
    margin-top: 10px;
    padding: 10px;
    border-top: 1px solid #eee;
}

.metadata {
    color: #999;
    font-size: 0.9rem;
    margin: 8px 0 0;
}

/* コンテンツ本体 */
.wiki-body {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wiki-body h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid #0645ad;
    padding-bottom: 8px;
    margin: 1.2em 0 0.5em;
    color: #234a5b;
}

.wiki-body h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #0645ad;
    padding-bottom: 6px;
    margin: 1em 0 0.5em;
    color: #234a5b;
}

.wiki-body h3 {
    font-size: 1.2rem;
    margin: 0.8em 0 0.4em;
    color: #234a5b;
}

.wiki-body p {
    line-height: 1.8;
    margin: 0 0 1em;
}

/* テーブルスタイル */
.wiki-body table,
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    border: 1px solid #ddd;
}

.wiki-body table th,
table th {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-weight: bold;
    color: #234a5b;
}

.wiki-body table td,
table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.wiki-body table tr:nth-child(odd),
table tr:nth-child(odd) {
    background: #fafafa;
}

.wiki-body table tr:hover,
table tr:hover {
    background: #f0f0f0;
}

/* コードブロック */
.wiki-body code,
code {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
    color: #c00;
}

.wiki-body pre,
pre {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 12px;
    overflow-x: auto;
    line-height: 1.5;
    margin: 1em 0;
}

.wiki-body pre code,
pre code {
    background: none;
    border: none;
    padding: 0;
    color: #222;
}

/* リスト */
.wiki-body ul,
.wiki-body ol {
    margin: 0.5em 0;
    padding-left: 2em;
}

.wiki-body li {
    margin: 0.4em 0;
}

/* ===== Rektテーマ上書き ===== */
:root {
    --rekt-bg: #0f1115;
    --rekt-bg2: #161b26;
    --rekt-card: #11151d;
    --rekt-border: #242b3b;
    --rekt-text: #e8ecf8;
    --rekt-subtext: #a5b2cc;
    --rekt-blue: #1a9fd8;
    --rekt-blue2: #60a5fa;
    --rekt-violet: #5865f2;
}

body {
    background: radial-gradient(circle at 15% 10%, rgba(26, 159, 216, 0.1), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(88, 101, 242, 0.08), transparent 35%),
                var(--rekt-bg);
    color: var(--rekt-text);
}

a {
    color: #6eb6ff;
}

a:hover {
    color: #9bccff;
}

.wiki-shell {
    max-width: 1320px;
    padding: 20px;
}

.wiki-header {
    background: linear-gradient(120deg, rgba(26, 159, 216, 0.28), rgba(32, 66, 120, 0.3));
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.wiki-title,
.wiki-card h2,
.wiki-card h3,
.wiki-body h1,
.wiki-body h2,
.wiki-body h3 {
    color: #7fd4ff;
}

.wiki-card,
.wiki-body,
.wiki-edit-form {
    background: linear-gradient(160deg, rgba(20, 26, 37, 0.98), rgba(16, 21, 30, 0.98));
    border: 1px solid var(--rekt-border);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.metadata,
.meta,
.wiki-subtitle {
    color: var(--rekt-subtext);
}

input[type="text"],
input[type="search"],
textarea {
    background: #0d1119;
    border: 1px solid #2a3347;
    color: var(--rekt-text);
}

.notice {
    background: rgba(26, 159, 216, 0.15);
    border-left-color: #1a9fd8;
    color: #d7efff;
}

.btn {
    background: linear-gradient(135deg, #1a9fd8 0%, #5865f2 100%);
    border-color: #4a63e3;
}

.btn:hover {
    background: linear-gradient(135deg, #1590c6 0%, #4d58cf 100%);
    border-color: #5865f2;
}

.btn.secondary {
    background: rgba(26, 159, 216, 0.1);
    color: #9ed9ff;
    border-color: rgba(96, 165, 250, 0.45);
}

.wiki-body table,
table,
.wiki-body table th,
table th,
.wiki-body table td,
table td {
    border-color: #2a3347;
}

.wiki-body table th,
table th {
    background: #182334;
    color: #9ed9ff;
}

.wiki-body table tr:nth-child(odd),
table tr:nth-child(odd) {
    background: #101722;
}

.wiki-body table tr:hover,
table tr:hover {
    background: #182334;
}

/* ===== Rekt風ヘッダー ===== */
.rekt-header {
    background: linear-gradient(180deg, #0c1220 0%, #0a101b 100%);
    border-bottom: 1px solid #1c2a42;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.rekt-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rekt-brand-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(26, 159, 216, 0.4));
}

.rekt-brand-text h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    color: #35b7ff;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.rekt-brand-text p {
    margin: 4px 0 0;
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: #e1c86c;
    font-weight: 700;
}

.rekt-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rekt-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #2d3d58;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
}

.rekt-pill:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.rekt-pill-steam {
    background: linear-gradient(135deg, #1f334a, #152535);
}

.rekt-pill-discord {
    background: linear-gradient(135deg, #5865f2, #4752c4);
    border-color: #5865f2;
}

.discord-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.rekt-user-panel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #121c30, #101829);
    border: 1px solid #2b4d9a;
    border-radius: 12px;
    padding: 7px 10px;
}

.rekt-user-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
}

.rekt-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #60a5fa;
}

.rekt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-weight: 700;
    color: #f9fbff;
    font-size: 0.85rem;
}

.rekt-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 800;
    background: linear-gradient(135deg, #5865f2, #7e59f9);
    color: #fff;
    border: 1px solid #6f63ff;
}

.rekt-login-btn:hover {
    text-decoration: none;
    color: #fff;
}

.rekt-login-btn-logout {
    background: linear-gradient(135deg, #a33d62, #813454);
    border-color: #b44e73;
}

.wiki-lang-toggle {
    gap: 6px;
}

.wiki-lang-toggle button {
    border-color: #44658f;
    color: #c5d7f2;
}

.wiki-lang-toggle button.active {
    background: #1a9fd8;
    border-color: #1a9fd8;
}

/* 検索フォーム */
.wiki-search {
    margin: 16px 0;
}

.wiki-search input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ページリスト */
.wiki-pagelist {
    margin: 0;
    padding: 0;
}

.wiki-pagelist li {
    list-style: none;
    margin-bottom: 8px;
}

.wiki-pagelist a {
    display: block;
    padding: 8px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 3px;
    transition: all 0.2s;
}

.wiki-pagelist a:hover {
    background: #efefef;
    border-color: #ddd;
    text-decoration: none;
}

/* 編集表示 */
.wiki-edit-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wiki-edit-form h2 {
    margin-top: 0;
    border-bottom: 2px solid #0645ad;
    padding-bottom: 10px;
}

/* ダークテーマサポート */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .wiki-card,
    .wiki-body,
    .wiki-edit-form,
    input[type="text"],
    input[type="search"],
    textarea {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .wiki-infobox {
        background: #333;
        border-color: #444;
    }
    
    .wiki-body table th {
        background: #3a3a3a;
        border-color: #444;
    }
    
    .wiki-body table tr:nth-child(odd) {
        background: #272727;
    }
    
    .wiki-body table tr:hover {
        background: #3a3a3a;
    }
    
    .notice {
        background: #1a3a4a;
        border-color: #0645ad;
    }
}

/* レスポンシブ */
@media (max-width: 860px) {
    .wiki-layout {
        grid-template-columns: 1fr;
    }
    
    .wiki-sidebar {
        order: 2;
    }
    
    .wiki-main {
        order: 1;
    }
    
    .wiki-infobox {
        float: none;
        width: 100%;
        margin: 0 0 16px 0;
    }
    
    .wiki-title {
        font-size: 1.4rem;
    }
    
    .rekt-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .rekt-brand-text h1 {
        font-size: 1.35rem;
    }

    .rekt-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .rekt-user-panel {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .wiki-shell {
        padding: 8px;
    }
    
    .wiki-card {
        padding: 12px;
    }
    
    .wiki-body {
        padding: 12px;
    }
    
    .wiki-title {
        font-size: 1.2rem;
    }
    
    .wiki-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }

    .rekt-brand-logo {
        width: 38px;
        height: 38px;
    }

    .rekt-pill,
    .rekt-login-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Rekt風フッター ===== */
.rekt-footer {
    background: linear-gradient(180deg, #0a0e20 0%, #070a17 100%);
    border-top: 1px solid #1c2a42;
    margin-top: 60px;
    padding: 40px 18px 20px;
    color: var(--rekt-text);
}

.rekt-footer-content {
    max-width: 1320px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.rekt-footer-section h4 {
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #35b7ff;
    font-weight: 800;
    margin: 0 0 16px;
    border-bottom: 2px solid #1a9fd8;
    padding-bottom: 10px;
}

.rekt-footer-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rekt-footer-section li {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.rekt-footer-section a {
    color: #a5b2cc;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rekt-footer-section a:hover {
    color: #35b7ff;
    text-decoration: underline;
    transform: translateX(2px);
}

.wiki-lang-footer-btn {
    display: inline-block;
    padding: 8px 14px;
    margin: 4px;
    background: rgba(26, 159, 216, 0.2);
    color: #9ed9ff;
    border: 1px solid rgba(26, 159, 216, 0.4);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.wiki-lang-footer-btn:hover,
.wiki-lang-footer-btn.active {
    background: #1a9fd8;
    color: #fff;
    border-color: #1a9fd8;
}

.rekt-footer-bottom {
    max-width: 1320px;
    margin: 0 auto;
    border-top: 1px solid #1c2a42;
    padding-top: 20px;
    text-align: center;
    color: #6b7c9f;
    font-size: 0.85rem;
}

.rekt-footer-bottom p {
    margin: 6px 0;
}

.rekt-footer-powered {
    color: #e1c86c;
    font-weight: 600;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .rekt-footer {
        padding: 30px 12px 16px;
    }

    .rekt-footer-content {
        gap: 20px;
        grid-template-columns: 1fr;
    }

    .rekt-footer-section h4 {
        font-size: 0.9rem;
    }

    .rekt-footer-section a {
        font-size: 0.85rem;
    }
}
