:root {
    --bg-color: #fafafa;
    --text-color: #333333;
    --link-color: #2b6cb0;
    --link-hover: #1a365d;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --header-bg: #ffffff;
    --accent-color: #d89a54;
}

body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header & Footer */
header {
    background-color: var(--header-bg);
    padding: 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.05em;
}

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

header p {
    margin: 0.5rem 0 0 0;
    color: #666;
}

.breadcrumb {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Main Content Area */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

a {
    color: var(--link-color);
}

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

/* ================================
   Top Page: Category List
   ================================ */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.category-card {
    display: block;
    background-color: var(--card-bg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.category-card:hover {
    background-color: #f7fafc;
}

.category-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: var(--link-color);
}

.tag {
    font-size: 0.8rem;
    padding: 0.3em;
}

.category-card p {
    margin: 0;
    color: #555;
}

/* External Link Icon */
.category-card.external-link h2::after {
    content: " \2197";
    /* ↗ */
    font-size: 0.9em;
    color: #888;
}

/* ================================
   Hub Pages: Index List (目次)
   ================================ */
.index-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.index-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.index-link {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.index-link:hover {
    background-color: #f7fafc;
}

.index-title {
    font-weight: bold;
    color: var(--link-color);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

/* ================================
   Content Pages: Article Style
   ================================ */
.content-section {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 1.5rem;
}

.content-section h3 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
}

.content-section h3:first-child {
    margin-top: 0;
}

.content-section h4 {
    margin-top: 1.5rem;
    color: #444;
}

.content-section code {
    background-color: #edf2f7;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
}

.content-section blockquote {
    border-left: 4px solid var(--border-color);
    margin: 1.5rem 0;
    padding-left: 1rem;
    color: #555;
}

.youtube-embed {
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 9;
    height: auto;
    margin: 1.5rem 0;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .content-section {
        padding: 1.5rem;
    }
}

.content-section .text {
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/* ================================
   Tables
   ================================ */
.table-wrapper {
    margin: 1.5rem auto;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    /* スクロールバー用の余白 */
}

.table-sub {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #555;
    font-weight: bold;
    padding-top: 1rem;
}

.table-container {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.table-container table {
    margin: 0;
}

.content-section table {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    /* 中央揃え */
    border-collapse: collapse;
    white-space: nowrap;
    /* テキストの折り返しを防ぎ、全体を縮小させる */
}

.content-section table th,
.content-section table td {
    padding: 0.5rem 0.8rem;
    /* 少し余白を詰める */
    border: 1px solid var(--border-color);
    text-align: center;
}

.content-section table th {
    background-color: #f7fafc;
    font-weight: bold;
}

.content-section table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.table-block {
    background-color: rgb(216, 235, 236) !important;
    font-weight: bold;
}

/* 複数のテーブルを横並びにするコンテナ */
figure.table-flex {
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    justify-content: flex-start;
    /* スクロール時の見切れを防ぐためにflex-startに変更 */
    gap: 2rem;
    width: fit-content;
    max-width: 100%;
    margin: 1.5rem auto;
    padding: 0 0 0.5rem 0;
    /* スクロールバー用の余白 */
    overflow-x: auto;
}

figure.table-flex table {
    margin: 0;
    /* flexアイテムとしてのマージンをリセット */
}

figure.table-flex .table-container {
    margin: 0;
}

/* ================================
   Translation Page
   ================================ */
.translation-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    -webkit-user-select: none;
    user-select: none;
}

.translation-left {
    margin: 0;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

.translation-right {
    margin: 0;
    padding-left: 1rem;
}

/* ================================
   Responsive Adjustments (Mobile)
   ================================ */
@media (max-width: 888px) {
    figure.table-flex {
        gap: 1rem;
    }

    .content-section table th,
    .content-section table td {
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 600px) {
    .content-section {
        padding: 1.5rem 0.8rem;
        /* 横の余白を減らしてスペースを確保 */
    }

    /* テーブルが画面に収まるようにフォントと余白を縮小 */
    .content-section table {
        font-size: clamp(0.6rem, 2.8vw, 0.9rem);
    }

    .content-section table th,
    .content-section table td {
        padding: 0.25rem 0.35rem;
    }

    figure.table-flex {
        gap: 0.5rem;
    }

    .table-sub {
        font-size: 0.85rem;
    }

    .translation-left {
        padding-right: 0.5rem;
    }

    .translation-right {
        padding-left: 0.5rem;
    }
}

/* ================================
   Lists (Unordered and Ordered)
   ================================ */
.content-section ul {
    list-style: none;
    padding-left: 0;
}

.content-section ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.content-section ul li::before {
    content: "\25B6";
    position: absolute;
    left: 0;
    top: 0.15rem;
    color: var(--accent-color);
    font-size: 0.9em;
}

.content-section ol {
    counter-reset: custom-counter;
    list-style: none;
    padding-left: 0;
}

.content-section ol li {
    position: relative;
    padding-left: 2.2rem;
    margin-bottom: 0.5rem;
}

.content-section ol li::before {
    counter-increment: custom-counter;
    content: counter(custom-counter);
    position: absolute;
    left: 0;
    top: 0.1rem;
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-size: 0.83rem;
    font-weight: bold;
    width: 1.4rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Span class for inline references matching the block number */
.ol-ref {
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-size: 0.83rem;
    font-weight: bold;
    width: 1.4rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* ================================
   Translation Definition List
   ================================ */

.content-section dl.translation dt {
    margin-bottom: 0.2rem;
}

.content-section dl.translation dd {
    margin: 0 0 1.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.content-section dl.translation dd:last-child {
    margin-bottom: 0;
}

.content-section dl.translation dd::before {
    content: "\25B6";
    position: absolute;
    left: 0;
    top: 0.15rem;
    color: var(--accent-color);
    font-size: 0.9em;
}