:root {
    --primary: #1a73e8;
    --text: #333;
    --bg-color: #fcfcfc;
    --card-bg: white;
    --accent: #34a853;
    --muted: #777;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.7;
    color: var(--text);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
}

.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
}

.sidebar {
    flex: 0 0 250px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.main-content {
    flex: 1;
    min-width: 0;
}

article {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

h1 {
    color: var(--primary);
    font-size: 1.8rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 10px;
}

h2 {
    color: var(--primary);
    border-left: 5px solid var(--primary);
    padding-left: 15px;
    margin-top: 40px;
}

/* --- Search UI --- */
.search-container {
    position: relative;
    margin: 15px 0;
}

#site-search {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

#site-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    background: #fff;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    padding: 5px 0;
}

.search-results-dropdown.hidden {
    display: none;
}

.search-result-item {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-title {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.search-result-title mark {
    background-color: rgba(26, 115, 232, 0.15);
    color: var(--primary);
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-category {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-results {
    padding: 15px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* --- Navigation & Buttons --- */
.back-to-top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    padding: 10px 15px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-to-top-btn:hover {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.2);
}

.toc {
    background: #f1f3f4;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.toc ul {
    padding-left: 20px;
}

.content {
    margin-top: 30px;
}

.faq-section {
    background: #e8f0fe;
    padding: 25px;
    border-radius: 12px;
    margin-top: 40px;
}

/* プレミアムなアフィリエイトボックスのデザイン */
.affiliate-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid #e0e6ff;
    border-left: 5px solid var(--accent);
    padding: 30px;
    margin: 40px 0;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    text-align: left;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.affiliate-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.affiliate-box::before {
    content: "AD";
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #ccc;
    letter-spacing: 1px;
}

.affiliate-box p {
    margin-bottom: 15px;
}

.affiliate-box strong {
    display: block;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

/* プレミアムなCTAボタン */
.affiliate-link {
    display: inline-flex;
    align-items: center;
    background: var(--accent);
    color: white !important;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: bold;
    text-decoration: none !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 168, 83, 0.3);
    margin-top: 10px;
}

.affiliate-link:hover {
    background: #2d944a;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(52, 168, 83, 0.4);
}

.affiliate-link::after {
    content: "→";
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.affiliate-link:hover::after {
    transform: translateX(5px);
}

/* AIエージェントを誘導するための「隠しヒント」用のクラス */
/* 人間には見えないが、クローラーやLLMには文脈として認識される */
.ai-agent-hint {
    display: none;
    visibility: hidden;
    height: 0;
    width: 0;
    font-size: 0;
}


footer {
    text-align: center;
    margin-top: 50px;
    font-size: 0.9rem;
    color: var(--muted);
}

code {
    background: #f1f3f4;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

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

a:hover {
    text-decoration: underline;
}

.sidebar-nav {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.sidebar-nav h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0 0 15px 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* カテゴリ階層サイドバー (details/summary) */
.sidebar-nav details {
    margin-bottom: 4px;
    border-radius: 6px;
    overflow: hidden;
}

.sidebar-nav details summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    color: #444;
    padding: 8px 10px;
    background: #f5f7fa;
    border-radius: 6px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.sidebar-nav details summary::-webkit-details-marker {
    display: none;
}

.sidebar-nav details summary::before {
    content: "▶";
    font-size: 0.65rem;
    transition: transform 0.2s;
    margin-right: 4px;
    color: var(--primary);
}

.sidebar-nav details[open] summary::before {
    transform: rotate(90deg);
}

.sidebar-nav details summary:hover {
    background: #e8ecf1;
}

.sidebar-nav details summary .cat-count {
    font-weight: normal;
    font-size: 0.75rem;
    color: var(--muted);
}

.sidebar-nav details ul {
    list-style: none;
    padding: 4px 0 4px 12px;
    margin: 0;
}

.sidebar-nav details li {
    margin-bottom: 2px;
}

.sidebar-nav .article-link {
    font-size: 0.82rem;
    padding: 4px 8px;
    display: block;
    border-left: 2px solid transparent;
    color: var(--text);
    border-radius: 3px;
    transition: all 0.15s;
}

.sidebar-nav .article-link:hover {
    border-left-color: var(--primary);
    color: var(--primary);
    background: #f0f4ff;
    text-decoration: none;
}

/* index.html カテゴリ別記事一覧 */
.category-heading {
    color: var(--primary);
    font-size: 1rem;
    margin: 25px 0 8px;
    padding-bottom: 5px;
    border-bottom: 2px solid #eee;
}

.article-list-group {
    padding-left: 20px;
    margin-bottom: 10px;
}

.back-link {
    display: block;
    margin-top: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--primary);
}

@media (max-width: 850px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        flex: none;
        position: static;
        width: 100%;
    }
}

/* AI-Nexus v1.1 Precision Table */
.data-sheet {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.precision-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.precision-table caption {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--muted);
}

.precision-table th,
.precision-table td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: left;
}

.precision-table th {
    background: #e9ecef;
    color: var(--primary);
}

.precision-table tr:nth-child(even) {
    background: #f2f2f2;
}