* {
    box-sizing: border-box
}

:root {
    --bg: #f5f6f8;
    --card: #fff;
    --text: #1d2430;
    --muted: #687386;
    --line: #e2e6eb;
    --accent: #276ef1;
    --danger: #c63838
}

:root[data-theme=dark] {
    color-scheme: dark;
    --bg: #11151c;
    --card: #1b222c;
    --text: #e8edf5;
    --muted: #a2adbc;
    --line: #35404e;
    --accent: #72a5ff;
    --danger: #ff8585
}

html {
    scroll-behavior: smooth
}

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

.adsbygoogle {
    margin: 16px 0;
}

a {
    color: inherit
}

.wrap {
    width: min(960px, calc(100% - 28px));
    margin: auto
}

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10
}

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px
}

.brand {
    font-weight: 800;
    text-decoration: none;
    font-size: 20px
}

.my-id {
    font-size: 13px;
    color: var(--muted)
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 12px
}

.theme-toggle {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap
}

.theme-toggle:hover {
    filter: brightness(.95)
}

.header-link {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap
}

.header-link:hover,
.header-link.active {
    border-color: var(--accent);
    color: var(--accent)
}

.guide-page {
    padding-top: 28px
}

.guide-page>h1 {
    margin-bottom: 6px
}

.guide-lead {
    margin-top: 0;
    color: var(--muted)
}

.guide-section {
    margin: 18px 0
}

.guide-section h3 {
    margin: 26px 0 6px
}

.guide-section li+li {
    margin-top: 7px
}

.guide-section a {
    color: var(--accent)
}

.terms-updated {
    text-align: right;
    color: var(--muted);
    font-size: 13px
}

.error-page {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 40px 0
}

.error-card {
    width: min(560px, 100%);
    text-align: center
}

.error-code {
    margin: 0;
    color: var(--accent);
    font-size: clamp(64px, 16vw, 120px);
    font-weight: 900;
    line-height: 1
}

.error-card h1 {
    margin: 15px 0 5px
}

.error-card>p:not(.error-code) {
    margin: 0 0 24px;
    color: var(--muted)
}

.error-home-link {
    display: inline-block;
    text-decoration: none
}

.hero {
    padding: 36px 0 18px
}

.hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    margin: 0 0 8px;
    line-height: 1.25
}

.hero p {
    margin: 0;
    color: var(--muted)
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px
}

.create-card {
    margin: 8px 0 30px
}

.card h2 {
    margin-top: 0
}

label {
    display: block;
    font-weight: 700;
    margin: 14px 0 8px
}

input[type=text],
input[type=password],
textarea {
    width: 100%;
    border: 1px solid #cfd5dd;
    border-radius: 10px;
    padding: 12px;
    font: inherit;
    background: #fff
}

.admin-page {
    padding: 25px 0 50px
}

.admin-login-card {
    max-width: 520px
}

.admin-inline-form {
    margin: 0
}

.admin-error {
    color: var(--danger)
}

.admin-success {
    color: #217a3c
}

.admin-count {
    color: var(--muted)
}

.admin-post-list {
    display: grid;
    gap: 10px
}

.admin-post-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px
}

.admin-post-heading a {
    color: var(--accent)
}

.admin-post-body {
    margin-bottom: 0;
    overflow-wrap: anywhere
}

.admin-thumbnail {
    max-width: 160px;
    max-height: 120px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover
}

.danger-button {
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 6px 11px;
    background: transparent;
    color: var(--danger);
    white-space: nowrap
}

.danger-button:hover {
    background: var(--danger);
    color: #fff
}

textarea {
    resize: vertical
}

.file-label {
    font-size: 14px;
    margin-bottom: 16px;
}

.file-label input {
    display: block;
    margin: 8px 0
}

button {
    font: inherit;
    cursor: pointer
}

.primary {
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    padding: 11px 18px;
    font-weight: 700
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between
}

#thread-list-section {
    scroll-margin-top: 80px
}

.section-head h2 {
    margin-bottom: 10px
}

.sort-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px
}

.sort-nav a {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap
}

.sort-nav a:hover,
.sort-nav a.active {
    border-color: var(--accent);
    color: var(--accent)
}

.thread-list {
    display: grid;
    gap: 10px
}

.thread-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center
}

.thread-row:hover {
    border-color: #b9c7df
}

.thread-row h3 {
    margin: 0 0 4px;
    font-size: 18px
}

.thread-row p {
    margin: 0;
    color: var(--muted);
    font-size: 13px
}

.expire {
    white-space: nowrap;
    font-size: 13px;
    color: var(--danger);
    font-weight: 700
}

.empty {
    padding: 30px;
    background: #fff;
    border: 1px dashed #ccd2da;
    border-radius: 12px;
    text-align: center;
    color: var(--muted)
}

.footer {
    padding: 24px 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px
}

.thread-page {
    padding-top: 20px
}

.back {
    color: var(--muted);
    text-decoration: none
}

.thread-title {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin: 18px 0
}

.thread-title h1 {
    margin: 0;
    overflow-wrap: anywhere
}

.thread-title p {
    margin: 4px 0 0;
    color: var(--muted)
}

.countdown {
    white-space: nowrap;
    background: #fff0f0;
    color: #a62f2f;
    border: 1px solid #ffd2d2;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px
}

.posts {
    display: grid;
    gap: 10px
}

.post {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px;
    scroll-margin-top: 80px
}

.post-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.post-no {
    font-weight: 800;
    color: #394254
}

.post-no:hover,
.uid:hover {
    color: var(--accent)
}

.uid {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace
}

.filter-notice {
    background: #edf3ff;
    border: 1px solid #c7d8fa;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 13px
}

.filter-notice a {
    color: var(--accent)
}

.post-body {
    font-size: 16px;
    margin: 0;
    overflow-wrap: anywhere
}

.post-image {
    display: block;
    max-width: min(100%, 720px);
    max-height: 720px;
    border-radius: 10px;
    border: 1px solid var(--line);
    object-fit: contain;
    background: #eee
}

.protected-image-link {
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    border-radius: 10px;
    vertical-align: top
}

.protected-image-link .post-image {
    width: auto;
    max-width: 180px;
    height: auto;
    max-height: 130px;
    object-fit: cover;
    filter: blur(12px);
    transform: scale(1.08);
    transition: filter .2s ease, transform .2s ease, max-width .2s ease, max-height .2s ease
}

.image-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 9px;
    border-radius: 7px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none
}

.protected-image-link.revealed {
    display: block;
    width: fit-content
}

.protected-image-link.revealed .post-image {
    max-width: min(100%, 720px);
    max-height: 720px;
    object-fit: contain;
    filter: none;
    transform: none
}

.protected-image-link.revealed .image-hint {
    top: auto;
    bottom: 8px;
    opacity: .75
}

.admin-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px
}

:root[data-theme=dark] .site-header,
:root[data-theme=dark] .thread-row,
:root[data-theme=dark] .empty,
:root[data-theme=dark] .post,
:root[data-theme=dark] .post-actions button {
    background: var(--card);
    color: var(--text)
}

:root[data-theme=dark] input[type=text],
:root[data-theme=dark] input[type=password],
:root[data-theme=dark] textarea {
    background: #141a22;
    border-color: var(--line);
    color: var(--text)
}

:root[data-theme=dark] .post-no {
    color: var(--text)
}

:root[data-theme=dark] .countdown,
:root[data-theme=dark] .filter-notice,
:root[data-theme=dark] .replying,
:root[data-theme=dark] .notice,
:root[data-theme=dark] .reply-ref {
    background: #252e3a;
    border-color: var(--line);
    color: var(--text)
}

:root[data-theme=dark] .post-actions button:hover,
:root[data-theme=dark] .like-btn.active {
    background: #2c3745;
    color: var(--accent)
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 13px
}

.post-actions button {
    border: 1px solid #d8dde4;
    background: #fff;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 12px
}

.post-actions button:hover {
    background: #f3f5f8
}

.like-btn.active {
    background: #e8f0ff;
    border-color: #aac4ff;
    color: #1558c9
}

.reply-ref {
    display: block;
    margin: 10px 0;
    padding: 8px 10px;
    border-left: 3px solid #aab8cc;
    background: #f6f8fa;
    text-decoration: none;
    font-size: 12px;
    color: #596474
}

.reply-ref span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.composer {
    margin: 18px 0 50px;
    scroll-margin-top: 80px
}

.replying {
    background: #edf3ff;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px
}

.replying[hidden] {
    display: none
}

.replying button {
    border: 0;
    background: transparent
}

.notice {
    background: #fff7db;
    border: 1px solid #f1d785;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 13px
}

@media(max-width:650px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding: 9px 0
    }

    .header-tools {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column
    }

    .thread-title {
        align-items: flex-start;
        flex-direction: column
    }

    .thread-row {
        align-items: flex-start;
        flex-direction: column
    }

    .expire {
        align-self: flex-end
    }
}
