/* Dark Theme Palette - Pixelated Gaming Aesthetic
Primary: #1a1a1a (Dark background)
Secondary: #0a0a0a (Darker sections)
Accent: #FF0000 (Red from logo)
Text: #ffffff (White)
Border: #333333 (Dark gray)
 */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html, body {
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    min-width: 960px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    color: #ffffff;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

h1, h2, h3, h4, h5, h6 {
    color: #FF0000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    letter-spacing: 1px;
    font-weight: 700;
}

div.章 {
    background-color: #1a1a1a;
    border: 2px solid #333333;
    margin: 5px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
}

a, a:visited, a:link {
    color: #FF0000;
    text-decoration: none;
    transition: all 0.2s;
}

a:hover, a:active {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
}

table {
    border: 2px solid #333;
    background-color: #1a1a1a;
}

td, th {
    border: 1px solid #333;
    padding: 0.5em;
    color: #ffffff;
}

div.コンテナ {
    width: 1100px;
    margin: 10px auto;
}

div.ヘッダ {
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid #333333;
    border-bottom: 3px solid #FF0000;
    color: #ffffff;
    font-size: 1.25em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 5px;
    margin-bottom: 0;
}

div.ヘッダ h2 {
    color: #FF0000;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8em;
    display: inline-block;
    margin: 0;
    padding: 0;
}

div.ヘッダ img {
    height: 80px;
    margin-right: 15px;
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3));
}

div.ヘッダ ul.リンク {
    display: inline-block;
    list-style: none;
    padding: 0;
    margin: 0 0 0 20px;
}

div.ヘッダ ul.リンク li {
    display: inline;
    margin-left: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

div.ヘッダ ul.リンク a {
    padding: 8px 16px;
    background-color: #1a1a1a;
    border: 2px solid #FF0000;
    display: inline-block;
}

div.ヘッダ ul.リンク a:hover {
    background-color: #FF0000;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

div.主要 div.左-ナビ {
    display: inline-block;
    width: 168px;
    vertical-align: top;
    white-space: normal;
    margin-right: 5px;
}

div.主要 div.左-ナビ ul {
    padding-left: 15px;
}

div.主要 div.左-ナビ h3 {
    font-size: 0.6em;
    margin: 10px 0 5px 0;
    color: #FF0000;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}

div.主要 div.左-ナビ li {
    margin: 5px 0;
    font-size: 0.85em;
    line-height: 1.4;
}

div.主要 div.左-ナビ li[style*="background-color"] {
    background-color: #FF0000 !important;
    color: #ffffff !important;
    padding: 5px;
    border: 2px solid #FF0000;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

div.主要 {
    white-space: nowrap;
    margin: 5px;
    margin-top: 15px;
}

div.主要 div.章 {
    background-color: #1a1a1a;
    border: 2px solid #333333;
    margin: 0;
    margin-right: 15px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
}

div.主要 div.内容 {
    display: inline-block;
    width: 598px;
    vertical-align: top;
    white-space: normal;
    /*margin-right: 15px;*/
}

div.主要 div.内容 div.コンテンツ {
    font-size: 1.2em;
    line-height: 1.8em;
}

div.主要 div.内容 h2 {
    border-left: 4px solid #FF0000;
    padding-left: 10px;
    margin-top: 20px;
}

div.主要 div.内容 p {
    margin: 1em 0;
}

div.主要 div.内容 code {
    background-color: #0a0a0a;
    border: 1px solid #333;
    padding: 2px 6px;
    font-family: 'Courier New', Consolas, monospace;
    color: #FF0000;
}

div.主要 div.内容 pre {
    background-color: #0a0a0a;
    border: 2px solid #333;
    padding: 15px;
    overflow-x: auto;
    box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.1);
}

div.主要 div.内容 pre code {
    background: none;
    border: none;
    color: #ffffff;
    padding: 0;
}

div.主要 div.内容 img {
    max-width: 100%;
    border: 2px solid #333;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.1);
}

div.主要 div.右-ナビ {
    display: inline-block;
    width: 217px; /* Increased from 183px to compensate for removed padding (30px) and border (4px) */
    vertical-align: top;
    white-space: normal;
}

/* Remove padding and border from right sidebar for iframe */
div.主要 div.右-ナビ.章 {
    padding: 0;
    border: none;
    margin: 0;
    box-shadow: none;
}

/* Remove the decorative line from right sidebar */
div.主要 div.右-ナビ.章::before {
    display: none;
}

div.主要 div.右-ナビ img {
    max-width: 100%;
    border: 2px solid #333;
}

li.アクティブ a, li.アクティブ a:visited {
    background-color: #FF0000;
    color: #ffffff;
    padding: 2px;
}

li.アクティブ a:hover {
    background-color: #cc0000;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

footer {
    text-align: center;
    color: #666;
    font-size: 0.85em;
    padding: 20px;
    background-color: #0a0a0a;
    border-top: 2px solid #333;
}

.reaction-badge-parent {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

a.reaction-badge {
    text-decoration: none;
    border: 2px solid #333;
    display: flex;
    padding: 1em 0.6em;
    margin-right: 0.5em;
    border-radius: 0;
    background-color: #1a1a1a;
    font-size: 0.75em;
    line-height: 1;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    transition: all 0.2s;
}

a.reaction-badge:hover {
    background-color: #FF0000;
    border-color: #FF0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.reaction-badge td {
    padding-left: 10px;
    padding-right: 10px;
    border: none;
}

ruby rt {
    user-select: none;
    -webkit-user-select: none; /* For Safari */
    -moz-user-select: none;    /* For Firefox */
    -ms-user-select: none;     /* For IE/Edge */
}

/* Pixelated accent effects */
div.章::before {
    content: '';
    display: block;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #FF0000 0px,
        #FF0000 3px,
        transparent 3px,
        transparent 6px
    );
    margin: -15px -15px 15px -15px;
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
    border: 1px solid #333;
}

::-webkit-scrollbar-thumb {
    background: #FF0000;
    border: 1px solid #333;
}

::-webkit-scrollbar-thumb:hover {
    background: #cc0000;
}

/* Selection styling */
::selection {
    background: #FF0000;
    color: #ffffff;
}

::-moz-selection {
    background: #FF0000;
    color: #ffffff;
}

/* Desktop sidebar - always show content, hide toggle mechanism */
@media (min-width: 1401px) {
    div.主要 div.左-ナビ .sidebar-toggle-checkbox {
        display: none;
    }

    div.主要 div.左-ナビ .sidebar-toggle-label {
        font-weight: bold;
        margin: 0 0 10px 0;
        display: block;
        cursor: default;
    }

    /* No arrow on desktop */
    div.主要 div.左-ナビ .sidebar-toggle-label::after {
        display: none;
    }

    /* Always show content on desktop */
    div.主要 div.左-ナビ .sidebar-content {
        display: block;
    }
}

/* Mobile responsive styles */
@media (max-width: 1400px) {
    html, body {
        min-width: 100%;
        overflow-x: hidden;
    }

    div.コンテナ {
        width: 100%;
        margin: 0;
        overflow-x: hidden;
    }

    div.ヘッダ {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        margin: 0;
    }

    div.ヘッダ img {
        width: 100%;
        height: auto;
        margin: 0 0 10px 0;
    }

    div.ヘッダ h2 {
        font-size: 0.6em;
        margin-bottom: 10px;
    }

    div.ヘッダ ul.リンク {
        margin: 0;
        width: 100%;
    }

    div.ヘッダ ul.リンク li {
        margin: 5px 0;
        display: block;
    }

    div.ヘッダ ul.リンク a {
        display: block;
        text-align: center;
    }

    div.主要 {
        white-space: normal;
        margin: 0;
    }

    div.主要 div.左-ナビ,
    div.主要 div.内容,
    div.主要 div.右-ナビ {
        display: block;
        width: 100%;
        margin: 0;
        box-sizing: border-box;
    }

    /* Ensure right sidebar has no padding/border on mobile too */
    div.主要 div.右-ナビ.章 {
        padding: 0;
        border: none;
        margin: 0;
        box-shadow: none;
    }

    /* Remove the decorative line from right sidebar on mobile */
    div.主要 div.右-ナビ.章::before {
        display: none;
    }

    div.主要 div.章 {
        margin: 5px;
        box-sizing: border-box;
    }

    div.主要 div.内容 {
        margin-right: 0;
        overflow-x: hidden;
        word-wrap: break-word;
    }

    div.主要 div.内容 div.コンテンツ {
        font-size: 1em;
        line-height: 1.6em;
        overflow-x: hidden;
    }

    div.主要 div.内容 pre {
        overflow-x: auto;
        max-width: 100%;
    }

    div.主要 div.内容 img,
    div.主要 div.内容 table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }

    div.章 {
        margin: 5px;
        padding: 10px;
        overflow-x: hidden;
    }

    div.章::before {
        margin: -10px -10px 10px -10px;
    }

    /* Collapsible blog list on mobile - CSS only */
    div.主要 div.左-ナビ {
        position: relative;
    }

    /* Hide the checkbox */
    div.主要 div.左-ナビ .sidebar-toggle-checkbox {
        display: none;
    }

    /* Style the label as the clickable heading */
    div.主要 div.左-ナビ .sidebar-toggle-label {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 30px;
        margin: 0 0 10px 0;
        font-weight: bold;
        display: block;
    }

    /* Arrow indicator - points right when collapsed (unchecked) */
    div.主要 div.左-ナビ .sidebar-toggle-label::after {
        content: '▼';
        position: absolute;
        right: 0;
        transition: transform 0.3s;
        transform: rotate(-90deg);
    }

    /* Arrow points down when expanded (checked) */
    div.主要 div.左-ナビ .sidebar-toggle-checkbox:checked + .sidebar-toggle-label::after {
        transform: rotate(0deg);
    }

    /* Hide content by default (collapsed) */
    div.主要 div.左-ナビ .sidebar-content {
        display: none;
    }

    /* Show content when checkbox is checked (expanded) */
    div.主要 div.左-ナビ .sidebar-toggle-checkbox:checked ~ .sidebar-content {
        display: block;
    }
}

/* Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-min-width, 130px), 1fr));
    gap: 15px;
    padding: 15px 0;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid #333;
    background-color: #1a1a1a;
    transition: all 0.3s;
    aspect-ratio: 1;
}

.gallery-item:hover {
    border-color: #FF0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    border: 3px solid #FF0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 40px;
    color: #FF0000;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #FF0000;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: all 0.3s;
    z-index: 10000;
}

.lightbox-close:hover {
    background-color: #FF0000;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    color: #FF0000;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #FF0000;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
    user-select: none;
    z-index: 10001;
}

.lightbox-nav:hover {
    background-color: #FF0000;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #FF0000;
    padding: 10px 20px;
    font-size: 14px;
}

.lightbox-link {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    color: #FF0000;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #FF0000;
    padding: 10px 20px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s;
    z-index: 10001;
}

.lightbox-link:hover {
    background-color: #FF0000;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

/* Mobile gallery adjustments */
@media (max-width: 1400px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-min-width-mobile, 120px), 1fr));
        gap: 10px;
    }

    .lightbox-nav {
        font-size: 30px;
        width: 50px;
        height: 50px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
}
