@font-face {
    font-family: "Saitamaar";
    src: url("/assets/fonts/Saitamaar.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-2ch: #EFEFEF;
    --box-green: #CCFFCC;
    --box-border: #88AA88;
    --title-red: #FF0000;
    --name-green: #008000;
    --link-blue: #0000FF;
    --link-visited: #660099;
    --text-main: #000000;
    --popup-bg: #FFFFEE;
    --aa-font: "MS PGothic", "IPAMonaPGothic", "Saitamaar", "Mona", sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-2ch);
    color: var(--text-main);
    font-family: var(--aa-font);
    font-size: 16px;
    line-height: 18px;
}

a {
    color: var(--link-blue);
    text-decoration: underline;
}

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

a:hover {
    color: #FF0000;
}

.board-wrap, .thread-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 8px 14px 28px;
}

.board-header {
    text-align: center;
    margin-bottom: 10px;
}

.board-banner {
    background: #FFFFFF;
    border: 2px solid #008000;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.board-banner h1 {
    margin: 0;
    font-size: 22px;
    line-height: 26px;
    color: #006600;
}

.board-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #444;
}

.quick-nav {
    font-size: 14px;
    padding: 4px 0;
}

.box-green {
    background-color: var(--box-green);
    border: 1px solid #99BB99;
    padding: 10px 14px;
    margin: 10px 0 16px;
}

.box-title {
    font-weight: bold;
    font-size: 15px;
    color: #004400;
}

.local-rule-body {
    margin-top: 6px;
    font-size: 14px;
    line-height: 19px;
}

.thread-list-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.search-inline {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.subject-links {
    font-size: 14px;
    line-height: 22px;
}

.subject-item {
    display: inline-block;
    margin-right: 12px;
}

.sub-jump {
    font-size: 11px;
    text-decoration: none;
    margin-left: 2px;
    color: #555;
}

.subject-more {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dotted #77AA77;
    font-size: 14px;
    text-align: right;
}

.thread-preview-box {
    background-color: var(--bg-2ch);
    border: 1px solid #CCCCCC;
    padding: 10px 14px;
    margin: 16px 0;
}

.thread-preview-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.thread-index {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.thread-title, .thread-main-title {
    margin: 0;
    color: var(--title-red);
    font-size: 20px;
    line-height: 24px;
    font-weight: bold;
}

.thread-title a {
    color: var(--title-red);
    text-decoration: none;
}

.thread-title a:hover {
    text-decoration: underline;
}

.res-total {
    font-size: 15px;
    color: #333;
    font-weight: normal;
}

.badge {
    display: inline-block;
    font-size: 11px;
    line-height: 14px;
    padding: 1px 5px;
    border-radius: 2px;
    font-weight: bold;
    color: #FFF;
}

.badge-pin { background: #007700; }
.badge-lock { background: #CC0000; }
.badge-kako { background: #555555; }

.thread-dl {
    margin: 8px 0;
    padding: 0;
}

.post-head {
    margin-top: 12px;
    font-size: 15px;
    line-height: 19px;
    word-break: break-word;
}

.res-num[data-reply-num] {
    cursor: pointer;
    font-weight: bold;
}

.res-num[data-reply-num]:hover {
    text-decoration: underline;
    color: #FF0000;
}

.poster-name {
    color: var(--name-green);
    font-weight: bold;
}

.poster-mail {
    color: var(--link-blue);
    text-decoration: underline;
}

.poster-mail .poster-name {
    color: var(--link-blue);
}

.trip {
    color: var(--name-green);
    font-weight: normal;
}

.cap-name {
    color: #CC0000;
    font-weight: bold;
}

.poster-id {
    font-family: monospace;
    font-size: 14px;
}

.abone-text {
    color: #777777;
    font-style: italic;
}

.post-body {
    margin: 4px 0 10px 32px;
    font-family: var(--aa-font);
    font-size: 16px;
    line-height: 18px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.aa-post {
    white-space: nowrap;
    overflow-x: auto;
    overflow-wrap: normal;
    word-break: normal;
    padding-bottom: 4px;
}

.omitted-note {
    margin: 10px 0 6px 16px;
    color: #666;
    font-size: 13px;
}

.thread-preview-actions {
    margin: 10px 0;
    font-size: 14px;
}

.inline-reply-wrap {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #BBBBBB;
}

.thread-closed-note {
    background: #FFE5E5;
    border: 1px solid #CC8888;
    color: #990000;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 14px;
}

.bbs-form {
    font-size: 14px;
}

.bbs-form .form-row {
    margin: 6px 0;
}

.bbs-form .form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.bbs-form input[type="text"],
.bbs-form textarea {
    font-family: var(--aa-font);
    font-size: 14px;
    padding: 3px 5px;
    border: 1px solid #888888;
    background: #FFFFFF;
}

.bbs-form textarea {
    max-width: 100%;
    box-sizing: border-box;
    line-height: 18px;
}

.btn-submit {
    padding: 4px 12px;
    font-size: 14px;
    cursor: pointer;
}

.hint {
    font-size: 12px;
    color: #555;
}

.sage-check {
    cursor: pointer;
    user-select: none;
}

/* Honeypot placed off-screen via CSS */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.thread-nav-top, .thread-nav-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 14px;
    margin: 6px 0;
}

.classic-hr {
    border: 0;
    border-top: 1px solid #BBBBBB;
    margin: 10px 0;
}

.reply-section {
    margin: 16px 0;
}

/* Back-reference badge & popup */
.backref-btn {
    display: inline-block;
    font-size: 12px;
    color: #0000FF;
    background: #E2E2E2;
    border: 1px solid #BBBBBB;
    padding: 0 4px;
    margin-left: 4px;
    cursor: pointer;
    text-decoration: none;
}

.res-popup {
    position: fixed;
    z-index: 9999;
    max-width: min(680px, 94vw);
    max-height: 75vh;
    overflow: auto;
    background: var(--popup-bg);
    border: 1px solid #888888;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.28);
    padding: 8px 12px;
    font-size: 15px;
    line-height: 18px;
}

.res-popup .post-head {
    margin-top: 4px;
}

.res-popup .post-body {
    margin-left: 16px;
}

/* Ad slots (unobtrusive, centered) */
.ad-slot {
    margin: 12px auto;
    text-align: center;
    max-width: 760px;
}

.ad-label {
    font-size: 10px;
    color: #777777;
    margin-bottom: 2px;
}

.ad-body {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
}

/* Subback & Kako */
.subback-list {
    font-size: 14px;
    line-height: 24px;
    padding-left: 24px;
}

.search-snippet {
    font-size: 12px;
    color: #444;
    margin-left: 8px;
}

.kako-table {
    width: 100%;
    border-collapse: collapse;
    background: #FFFFFF;
    font-size: 14px;
}

.kako-table th, .kako-table td {
    border: 1px solid #99BB99;
    padding: 6px 8px;
    text-align: left;
}

.kako-table th {
    background: #E6FFE6;
}

/* Error Box */
.error-box {
    max-width: 560px;
    margin: 40px auto;
    background: #FFFFFF;
    border: 2px solid #CC0000;
    padding: 20px;
    text-align: center;
}

.error-box h1 {
    color: #FF0000;
    margin-top: 0;
}

.error-msg {
    background: #FFF2F2;
    border: 1px solid #EEAAAA;
    padding: 12px;
    margin: 14px 0;
}

.bbs-footer {
    margin-top: 24px;
    padding-top: 10px;
    border-top: 1px solid #CCCCCC;
    text-align: center;
    font-size: 13px;
    color: #555;
}

.footer-note {
    margin-top: 4px;
    font-size: 11px;
    color: #777;
}

/* Admin UI */
.admin-page {
    background: #F4F5F7;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.admin-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: #223322;
    color: #FFFFFF;
    padding: 12px 18px;
    border-radius: 4px;
    margin-bottom: 14px;
}

.admin-header h1 {
    margin: 0;
    font-size: 18px;
}

.admin-header a {
    color: #CCFFCC;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.admin-tabs a {
    padding: 7px 12px;
    background: #FFFFFF;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    text-decoration: none;
    color: #222;
}

.admin-tabs a.active {
    background: #006600;
    color: #FFFFFF;
    border-color: #006600;
}

.admin-card {
    background: #FFFFFF;
    border: 1px solid #DDDDDD;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.admin-card h2 {
    margin-top: 0;
    font-size: 16px;
    border-bottom: 1px solid #EEEEEE;
    padding-bottom: 6px;
}

.admin-flash {
    background: #E6FFE6;
    border: 1px solid #55AA55;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.admin-error {
    background: #FFEAEA;
    border: 1px solid #CC4444;
    color: #990000;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.stat-box {
    background: #F8FAF8;
    border: 1px solid #D5E5D5;
    padding: 12px;
    text-align: center;
    border-radius: 4px;
}

.stat-box strong {
    display: block;
    font-size: 22px;
    color: #006600;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th, .admin-table td {
    border: 1px solid #DDDDDD;
    padding: 6px 8px;
    vertical-align: top;
    text-align: left;
}

.admin-table th {
    background: #F0F4F0;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.admin-grid label {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inline-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.btn-danger {
    background: #BB2222;
    color: #FFF;
    border: 1px solid #991111;
    cursor: pointer;
}

.muted {
    font-size: 12px;
    color: #666;
}

.spam-log-pre {
    background: #1B1B1B;
    color: #D8F0D8;
    padding: 10px;
    max-height: 300px;
    overflow: auto;
    font-size: 12px;
}

.ad-config-block {
    border: 1px solid #E2E2E2;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

/* Mobile responsiveness while keeping AA alignment intact */
@media (max-width: 767px) {
    .board-wrap, .thread-wrap {
        padding: 6px 8px 20px;
    }

    .post-body {
        margin-left: 10px;
        font-size: 15px;
        line-height: 18px;
    }

    .aa-post {
        font-size: 12px;
        line-height: 14px;
    }

    .bbs-form .input-subject,
    .bbs-form .input-name,
    .bbs-form .input-mail,
    .bbs-form textarea {
        width: 100%;
        box-sizing: border-box;
    }

    .bbs-form .form-inline label {
        width: 100%;
    }
}

/* PC Left & Right 2-Column Side Rails + Main Column */
.page-shell {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 8px;
}

.page-main {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.side-rail {
    display: none;
}

@media (min-width: 1200px) {
    .side-rail {
        display: block;
        flex: 0 0 160px;
        width: 160px;
        position: sticky;
        top: 12px;
        padding-top: 10px;
    }
}

.ad-slot-left_pc, .ad-slot-right_pc {
    margin: 0;
    max-width: 160px;
}

.ad-placeholder-side {
    width: 160px;
    min-height: 600px;
    box-sizing: border-box;
    border: 1px dashed #88AA88;
    background: #E8F0E8;
    padding: 12px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    line-height: 16px;
    color: #445544;
}

.ad-placeholder-title {
    font-weight: bold;
    color: #006600;
}

.ad-placeholder-note {
    font-size: 11px;
    color: #556655;
}

.ad-placeholder-link {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dotted #99BB99;
    font-size: 12px;
}

/* WordPress iframe embed box */
.wp-embed-box {
    margin: 10px 0 16px;
}

.wp-embed-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wp-track-btn {
    display: inline-block;
    background: #FFFFFF;
    border: 1px solid #007700;
    color: #006600;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
}

.wp-track-btn:hover {
    background: #007700;
    color: #FFFFFF;
}

.wp-embed-frame-wrap {
    background: #FFFFFF;
    border: 1px solid #88AA88;
    overflow: hidden;
}

.wp-embed-frame {
    display: block;
    width: 100%;
    border: 0;
    background: #FFFFFF;
}

.wp-thread-link {
    text-align: center;
    margin: 10px 0;
    font-size: 13px;
}
