:root {
    --navy: #173d6a;
    --blue: #265d96;
    --blue-soft: #eaf2fb;
    --ink: #1f2937;
    --muted: #687588;
    --line: #dbe2ea;
    --surface: #ffffff;
    --background: #f4f6f9;
    --danger: #b42318;
    --success: #157347;
    --control-height: 44px;
    --tool-height: 36px;
    --control-radius: 8px;
    --control-gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
    color: var(--ink);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); font-size: 16px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    white-space: nowrap; flex-shrink: 0;
    height: var(--control-height); padding: 0 16px; border: 1px solid #cfd7e1; border-radius: var(--control-radius); font-size: 14px; line-height: 20px; font-weight: 500;
    background: white; color: var(--ink); text-decoration: none; cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: #f0f4f8; border-color: #9aadc1; }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { color: white !important; background: var(--navy) !important; border-color: var(--navy) !important; }
a { color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: white; }
.skip-link:focus { top: 12px; }

.site-header { border-top: 4px solid var(--navy); background: white; }
.header-inner { max-width: 1220px; margin: auto; padding: 27px 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: var(--navy); font-size: 27px; font-weight: 800; letter-spacing: -1.2px; text-decoration: none; }
.brand small { display: block; margin-top: 4px; color: #8592a3; font-size: 10px; letter-spacing: 1.6px; }
.account { display: flex; align-items: center; gap: 7px; }
.account-label { color: var(--muted); font-size: 12px; }
.site-nav { background: var(--navy); color: white; }
.site-nav > div { max-width: 1220px; margin: auto; padding: 0 20px; display: flex; align-items: center; gap: 4px; }
.site-nav a { padding: 14px 18px; text-decoration: none; font-weight: 700; }
.site-nav a[hidden] { display: none !important; }
.site-nav a:hover { background: #ffffff16; }
.site-nav span { margin-left: auto; color: #d2deeb; font-size: 12px; }

.layout { max-width: 1220px; margin: 26px auto; padding: 0 20px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
aside section { margin-bottom: 15px; padding: 20px 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
aside h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: -.3px; }
.usage-guide { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.board-link { font-size: 14px; display: block; margin: 2px 0; padding: 9px 10px; border-radius: 5px; text-decoration: none; }
.board-link:hover, .board-link.selected { color: var(--navy); background: var(--blue-soft); font-weight: 700; }
.card { min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 20px #173d6a05; }
h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.4; letter-spacing: -.7px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.subtitle, .help { margin: 6px 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.muted { color: var(--muted); font-size: 14px; }
.heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.push { margin-left: auto; }

.table-wrap { overflow-x: auto; border-top: 2px solid var(--navy); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 8px; border-bottom: 1px solid var(--line); background: #f7f9fb; color: #59677a; font-weight: 500; }
td { padding: 13px 8px; border-bottom: 1px solid #e9edf2; text-align: center; }
td.title { width: 58%; text-align: left; }
td.title a { text-decoration: none; }
td.title a:hover { text-decoration: underline; }
td.number { color: var(--muted); }
.notice-row td { background: #fbfdff; }
.notice-badge { display: inline-flex; align-items: center; gap: 3px; margin-right: 7px; padding: 2px 6px; border-radius: 4px; background: #eaf2fb; color: #1f5d98; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.notice-badge.pinned { background: #dceafa; }
.notice-badge svg { width: 12px; height: 12px; fill: currentColor; }
.count { margin-left: 6px; color: var(--blue); font-weight: 700; }
.new { margin-left: 5px; color: #dd4a2d; font-size: 10px; font-weight: 800; }
.pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; margin: 25px 0; }
.pages .active { color: white; background: var(--navy); border-color: var(--navy); }
.search, .inline-form, .inline-controls, .form-row { display: flex; align-items: center; gap: var(--control-gap); }
.search { justify-content: center; }
.search input { width: min(300px, 50vw); }

label { display: block; margin: 14px 0 7px; font-size: 14px; font-weight: 600; }
label small { margin-left: 8px; color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; max-width: 100%; padding: 10px 12px; border: 1px solid #ccd5df; border-radius: var(--control-radius); background: white; color: var(--ink); font-size: 14px; line-height: 22px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select { height: var(--control-height); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy); }
input[type="file"] { padding: 5px 8px; line-height: 30px; }
input[type="file"]::file-selector-button { height: 30px; margin-right: 10px; padding: 0 12px; border: 0; border-radius: 5px; background: #edf2f8; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%2368798c' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #6ba7df66; outline-offset: 1px; border-color: #5593cc; }
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
.grow { flex: 1; }
.align-end { align-self: end; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--blue); }
.notice, .warning, .error-panel { margin: 15px 0; padding: 14px 16px; border-radius: 6px; }
.notice { border: 1px solid #cfe0f3; background: #f2f7fc; color: #415a75; }
.warning { border: 1px solid #efd69d; background: #fff8e6; color: #77591f; }
.error-panel { border: 1px solid #f0c7c4; background: #fff3f2; color: var(--danger); }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 7px; color: #40536b; font-size: 17px; }
.loading { padding: 70px 20px; color: var(--muted); text-align: center; }

.post-header { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.post-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.post-body { min-height: 150px; padding: 25px 0; overflow-wrap: anywhere; }
.text-block { white-space: pre-wrap; line-height: 1.9; }
.content-heading { margin: 30px 0 8px; color: #233f61; }
.content-list { line-height: 1.9; }
.post-body figure { margin: 24px 0; }
.post-body figure img { display: block; max-width: 100%; max-height: 820px; border-radius: 6px; object-fit: contain; }
.post-body figcaption { margin-top: 7px; color: var(--muted); font-size: 12px; }
.link-block { display: flex; align-items: center; gap: 9px; padding: 12px; border-radius: 5px; background: #f4f7fa; }
.link-block span { color: var(--muted); font-size: 11px; }
.link-block a { color: var(--blue); word-break: break-all; }
.file-card { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; }
.file-card:hover { border-color: #93b7da; background: #f8fbff; }
.file-card small { display: block; color: var(--muted); }
.file-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 20px; }
.unknown-block { padding: 10px; border: 1px dashed #cbd4df; color: var(--muted); }
.comments { margin-top: 28px; padding-top: 20px; border-top: 2px solid var(--navy); }
.comments h2 span { color: var(--blue); }
.comment { position: relative; padding: 16px 0; border-bottom: 1px solid #e7ebef; }
.comment p { white-space: pre-wrap; }
.comment .author { margin-right: 10px; font-weight: 700; }
.comment-actions { position: absolute; top: 10px; right: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment-actions button { height: var(--tool-height); min-height: 0; padding: 4px 8px; border: 0; color: var(--muted); font-size: 12px; }

.editor-heading { display: flex; justify-content: space-between; align-items: end; margin-top: 22px; }
.block-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px solid #e0e7ef; border-radius: 8px; background: #f8fafc; }
.block-palette span { margin-right: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.block-palette button { height: var(--tool-height); min-height: 0; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.block-list { display: grid; gap: 12px; margin: 12px 0; }
.editor-block { border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 2px 8px #142d4810; overflow: hidden; }
.editor-block > header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f3f6f9; }
.editor-block > header button { height: var(--tool-height); min-height: 0; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.drag-label { color: #536479; font-size: 12px; font-weight: 700; }
.danger-text { color: var(--danger); }
.editor-block-body { padding: 5px 14px 15px; }
.editor-block .block-palette { margin: 0 12px 12px; }
.upload-block img { display: block; max-width: min(100%, 620px); max-height: 460px; margin: 10px 0; border-radius: 6px; object-fit: contain; }
.upload-placeholder { display: grid; min-height: 90px; margin: 10px 0; place-items: center; border: 1px dashed #b8c4d1; border-radius: 5px; color: var(--muted); }
.selected-file { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 12px; border-radius: 5px; background: #f5f8fb; }
.selected-file small { margin-left: auto; color: var(--muted); }
.upload-status { color: var(--blue); font-weight: 700; }

.activity-list { display: grid; gap: 8px; margin-bottom: 25px; }
.activity-list article { padding: 13px; border: 1px solid var(--line); border-radius: 6px; }
.activity-list article > div { display: flex; justify-content: space-between; }
.status { display: inline-flex; margin-right: 8px; padding: 2px 6px; border-radius: 99px; background: #edf1f5; color: #566476; font-size: 11px; }
.status-visible { background: #e6f4eb; color: var(--success); }
.status-hidden { background: #fff2d8; color: #7b5315; }
.status-deleted { background: #fbe9e8; color: var(--danger); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.admin-grid > div { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 7px; }
.admin-grid h2, .admin-grid h3 { margin-top: 0; }
.manage-row, .record-row, .file-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e7ebef; }
.manage-row p { margin: 0; }
.manage-row > div:last-child { display: flex; flex-shrink: 0; gap: 4px; }
.manage-row button { height: var(--tool-height); min-height: 0; padding: 0 10px; font-size: 13px; }
.limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.limit-grid .wide { grid-column: 1 / -1; }
.user-result { width: 100%; margin: 5px 0; text-align: left; }
.user-result code, .file-admin-row small, .record-row small, .record-row time { display: block; color: var(--muted); font-size: 11px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.check input { width: auto; }

dialog { width: min(92vw, 520px); max-height: 88vh; padding: 28px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 22px 70px #10243d4d; }
dialog::backdrop { background: #142b466e; }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 20px; }
#toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translateX(-50%); max-width: min(90vw, 620px); padding: 12px 18px; border-radius: 6px; background: #263f60; color: white; box-shadow: 0 8px 30px #12263f40; }
#toast[hidden] { display: none; }
#toast[data-kind="error"] { background: #8f2d26; }
#toast[data-kind="success"] { background: #23633f; }
footer { max-width: 1180px; margin: 38px auto; padding: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

@media (max-width: 860px) {
    .header-inner { padding: 20px 16px; }
    .brand { font-size: 22px; }
    .site-nav > div { padding: 0 8px; }
    .site-nav a { padding: 12px 10px; }
    .site-nav span { display: none; }
    .layout { display: block; margin: 14px auto; padding: 0 12px; }
    aside { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
    aside section { min-width: 205px; margin: 0; }
    aside section:has(#usage-guide) { display: none; }
    .card { padding: 17px; }
    .admin-grid { grid-template-columns: 1fr; }
    .heading, .section-heading { align-items: flex-start; }
}

@media (max-width: 560px) {
    .header-inner { align-items: flex-start; }
    .brand small, .account-label { display: none; }
    .account button { height: var(--tool-height); min-height: 0; padding: 0 10px; font-size: 13px; }
    .heading, .section-heading, .form-row { display: block; }
    .heading .button, .align-end { margin-top: 12px; }
    .hide-mobile, .hide-small { display: none; }
    td.title { width: auto; }
    .notice-badge { margin-bottom: 3px; }
    .search { flex-wrap: wrap; }
    .search input { width: 100%; }
    .comment-actions { position: static; margin-top: 12px; }
    .block-palette span { width: 100%; }
    .limit-grid { grid-template-columns: 1fr; }
    .limit-grid .wide { grid-column: auto; }
    footer { margin: 24px 10px; padding: 15px 5px; }
}

.toolbar { flex-wrap: wrap; }
.toolbar > select, .toolbar > input:not([type="checkbox"]) { flex: 1 1 140px; width: auto; min-width: 0; }

.board-tree, .board-tree ul { padding: 0; margin: 0; list-style: none; }
.board-tree ul { margin-left: 12px; border-left: 1px solid var(--line); padding-left: 6px; }
.board-tree summary { display: flex; align-items: center; cursor: pointer; }
.board-tree summary::before { content: '▾'; color: var(--muted); }
.board-tree details:not([open]) > summary::before { content: '▸'; }
.folder-items { display: grid; gap: 12px; }
.folder-item { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.folder-item span, .folder-item small { color: var(--muted); }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 12px; margin-bottom: 12px; padding: 14px; border: 1px solid #e1e7ef; background: #f8fafc; border-radius: 8px; }
.rich-toolbar label { display: flex; flex-direction: column; gap: 6px; margin: 0; color: #536479; font-size: 12px; line-height: 18px; font-weight: 600; }
.rich-toolbar select { width: auto; min-width: 76px; max-width: 138px; height: var(--tool-height); padding: 0 28px 0 10px; font-size: 13px; }
.rich-toolbar input[type="color"] { width: var(--tool-height); height: var(--tool-height); padding: 4px; border-radius: 6px; cursor: pointer; }
.rich-toolbar button { height: var(--tool-height); min-height: 0; padding: 0 10px; border-radius: 6px; font-size: 13px; }
.rich-toolbar button[aria-pressed=true] { background: var(--blue-soft); }
.rich-input { min-height: 160px; padding: 12px; background: white; border: 1px solid #ccd5df; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.rich-input:focus { outline: 2px solid #5593cc; }
.video-block iframe, .video-block video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; background: #111; }
.video-block figcaption { margin-top: 8px; }
.comment-thread { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }
.reply-target { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--blue-soft); margin-bottom: 10px; }
@media (max-width: 600px) {
    .comment-thread { margin-left: 5px; padding-left: 6px; }
    .rich-toolbar select { max-width: 125px; }
}

.reply-target[hidden] { display: none; }
.rich-input .content-list { padding-left: 26px; margin: 0; }
.rich-input .text-block { margin: 0; }

#admin-sidebar[hidden] { display: none; }
.admin-menu { display: grid; gap: 3px; }
.admin-menu .board-link { font-size: 14px; display: block; padding: 8px 10px; }
@media (max-width: 950px) {
    aside:has(#admin-sidebar:not([hidden])) { display: block; overflow: visible; }
    #admin-sidebar { margin-bottom: 12px; }
    #admin-sidebar .admin-menu { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
}

.rich-toolbar .color-control { display: flex; align-items: flex-end; gap: 6px; }
.format-control { display: flex; flex-direction: column; gap: 6px; }
.tool-label { color: #536479; font-size: 12px; line-height: 18px; font-weight: 600; }
.format-buttons { display: flex; align-items: center; gap: 6px; }
.format-buttons button { width: var(--tool-height); padding: 0; font-size: 17px; }
.rich-toolbar .format-status { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.rich-toolbar .format-status:empty { display: none; }
.editor-block-body { padding: 16px; }
.upload-block { display: grid; gap: 16px; }
.upload-block label { display: grid; gap: 8px; margin: 0; }
.editor-block > header > div { display: flex; gap: 8px; }
.block-palette { gap: 8px 10px; padding-top: 12px; padding-bottom: 12px; }
.activity-table { table-layout: fixed; width: 100%; }
.activity-table th:first-child, .activity-table td:first-child { width: 19%; }
.activity-table th:nth-last-child(2), .activity-table td:nth-last-child(2) { width: 72px; }
.activity-table th:last-child, .activity-table td:last-child { width: 105px; }
.activity-title > a, .activity-title > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.moderation-table { table-layout: fixed; width: 100%; min-width: 630px; }
.moderation-table th:first-child { width: 18%; }
.moderation-table th:nth-child(3) { width: 95px; }
.moderation-table th:last-child { width: 225px; }
.moderation-actions { white-space: nowrap; }
.moderation-actions button { height: var(--tool-height); min-height: 0; padding: 0 10px; margin-right: 5px; font-size: 13px; }
.moderator-table { min-width: 500px; }
.moderator-person { display: flex; flex-direction: column; gap: 3px; margin: 5px 0; }
.moderator-person small { color: var(--muted); overflow-wrap: anywhere; }
.role-editor { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 24px; }

/* Match labelled fields and their adjacent action buttons at the control edge. */
.form-row { align-items: flex-end; gap: 12px; }
.form-row > label { margin-bottom: 0; }
.form-row > button { flex-shrink: 0; }
.moderation-search { flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.moderation-search input { flex: 1; min-width: 160px; }
@media (max-width: 640px) {
    .form-row > button { margin-top: 12px; }
}

.poll { border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin: 20px 0; }
.poll-options {display: flex; flex-direction: column; gap: 10px;}
.poll-options button {justify-content: space-between; white-space: normal; text-align: left;}
.poll-options button[aria-pressed="true"] {background: #183f6c; color: white;}

.auth-input-row { display: flex; align-items: stretch; gap: 10px; }
.auth-input-row input { flex: 1; min-width: 0; width: 0; }
.auth-input-row button { flex: 0 0 auto; white-space: nowrap; padding: 9px 14px; }
.availability { margin: 7px 0 14px; min-height: 1.5em; font-size: 14px; color: #536479; }
.availability[data-state="available"] { color: #17613c; font-weight: 600; }
.availability[data-state="unavailable"] { color: #ad2222; font-weight: 600; }
.availability[data-state="pending"] { color: #183f6c; }

.editor-block-body [data-add-option] { margin-top: 18px; }

#search-form { flex-wrap: nowrap; gap: 10px; }
#search-form select { width: auto; flex: 0 0 auto; }
#search-form input { width: auto; min-width: 0; flex: 1 1 0; }
#search-form button { flex: 0 0 auto; white-space: nowrap; }

/* Shared alignment for paired controls and page actions. */
.inline-controls { flex-wrap: wrap; }
.inline-controls select, .inline-form input { width: auto; min-width: 0; }
.board-heading { align-items: flex-start; margin-bottom: 26px; }
.board-heading > div:first-child { min-width: 0; }
.list-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 10px; }
.list-count { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.list-write { height: 34px; min-width: 72px; padding: 0 14px; font-size: 13px; }
.list-summary b { font-size: 15px; }
#search-form { align-items: stretch; padding: 16px; border-radius: 10px; background: #f7f9fc; }
#search-form select { min-width: 118px; }
#search-form input { background: white; }
#search-form button { min-width: 76px; }
#post-form > label:first-child { margin-top: 0; }
.post-submit { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px; padding-top: 24px; margin-top: 26px; border-top: 1px solid var(--line); }
.post-password { flex: 0 1 360px; min-width: 0; max-width: 100%; }
.post-password label { margin: 0 0 8px; }
.post-password .help { margin: 0; font-size: 13px; }
.post-submit-actions { display: flex; gap: var(--control-gap); margin-left: auto; }
.post-submit-actions > button { width: 120px; }
.image-source-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.image-source-actions button { min-width: 166px; }
.capture-help { margin: -6px 0 0; font-size: 13px; }
.upload-placeholder { min-height: 120px; margin: 0; background: #f8fafc; border-color: #cbd7e4; border-radius: 8px; }
.capture-dialog { width: min(92vw, 860px); }
.capture-preview { display: flex; align-items: center; justify-content: center; margin-top: 18px; padding: 12px; border: 1px solid var(--line); background: #f4f6f9; border-radius: 10px; }
.capture-preview img { display: block; max-width: 100%; max-height: 56vh; object-fit: contain; }
.poll-options button { height: auto; min-height: var(--control-height); padding: 12px 16px; }
.user-result { height: auto; min-height: var(--control-height); padding: 12px 16px; }
@media (max-width: 700px) {
    .board-heading { display: flex; flex-direction: column; gap: 18px; }
    .image-source-actions { grid-template-columns: 1fr; }
    .image-source-actions button { justify-self: start; }
    .post-password { flex-basis: 100%; max-width: 360px; }
    .post-submit-actions { width: 100%; justify-content: flex-end; }
    .rich-toolbar { gap: 12px 10px; padding: 12px; }
}
@media (max-width: 420px) {
    #search-form { flex-wrap: wrap; padding: 12px; }
    #search-form select { min-width: 110px; }
    #search-form input { flex: 1 1 calc(100% - 120px); }
    #search-form button { width: 100%; }
    .post-submit-actions > button { flex: 1; width: auto; }
    .card { padding: 16px; }
}

.pages button { min-width: var(--control-height); padding: 0 12px; }

.layout.chat-layout { display:block; max-width:960px; }
.chat-room > header { margin-bottom:20px; }
.chat-room .chat-history { position:relative; height:clamp(280px,45vh,540px); overflow:auto; overscroll-behavior:auto; padding:0 16px; border-block:1px solid var(--line); background:#fafbfd; }
.chat-list { list-style:none; margin:0; padding:0; }
.chat-row { display:grid; grid-template-columns:96px minmax(0,1fr) auto; align-items:baseline; column-gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.chat-row:last-child { border:0; }
.chat-author { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--navy); font-size:14px; }
.chat-row .chat-content { min-width:0; margin:0; overflow-wrap:anywhere; }
.chat-content > span { white-space:pre-wrap; }
.chat-content time { display:inline-block; margin-left:6px; white-space:nowrap; color:var(--muted); font-size:12px; }
.chat-delete { align-self:start; height:28px; padding-inline:8px; color:var(--danger); font-size:12px; }
.deleted-message,.chat-empty,.chat-status { color:var(--muted); }
.chat-empty { text-align:center; margin:52px auto; }
.chat-older { display:block; margin:12px auto; }
.chat-room [hidden] { display:none; }
.chat-composer > div { display:flex; align-items:stretch; gap:10px; }
.chat-composer textarea { min-height:64px; }
.chat-composer button { height:auto; min-width:80px; }
.chat-identity { font-weight:400; color:var(--muted); margin-left:6px; }
.chat-status { margin:7px 0 0; font-size:14px; }
.site-nav a[aria-current] { background:#ffffff20; }
@media(max-width:600px) {
    .site-nav > div { flex-wrap:wrap; }
    .site-nav a { padding-inline:9px; }
    .chat-room .chat-history { padding-inline:10px; }
    .chat-composer button { min-width:64px; }
}

.board-pages { gap:3px; max-width:100%; margin:22px auto; }
.board-pages button { min-width:30px; height:30px; padding:0 4px; font-size:13px; line-height:18px; border-radius:5px; }
.board-pages button:disabled { opacity:.3; }
@media(max-width:600px) {
    .board-pages { gap:3px; }
    .board-pages button { min-width:28px; height:30px; padding:0 3px; }
}

.pagination-footer { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:10px; margin:22px 0; }
.pagination-footer .board-pages { grid-column:2; margin:0; }
.page-jump { grid-column:3; justify-self:end; height:28px; padding:0 10px; font-size:12px; border-radius:14px; }
@media(max-width:1100px) {
    .pagination-footer { display:flex; flex-wrap:wrap; justify-content:center; }
    .pagination-footer .board-pages { flex:1 1 100%; }
    .page-jump { margin-left:auto; }
}

/* Apply the print layout only while a post detail is rendered. */
@page board-post {
    size:A4;
    margin:16mm;
}
@media print {
    body:has([data-print-post]) {
        page:board-post;
        min-width:0;
        background:white;
    }
    body:has([data-print-post]) > :not(.layout),
    body:has([data-print-post]) .layout > :not(#main),
    body:has([data-print-post]) #main > div > :not([data-print-post]) {
        display:none !important;
    }
    body:has([data-print-post]) .layout,
    body:has([data-print-post]) #main,
    body:has([data-print-post]) #main > div {
        display:block;
        width:auto;
        max-width:none;
        min-width:0;
        margin:0;
        padding:0;
        border:0;
        border-radius:0;
        box-shadow:none;
        overflow:visible;
        background:white;
    }
    [data-print-post] .post-header { break-inside:avoid; break-after:avoid; }
    [data-print-post] h1 { overflow-wrap:anywhere; }
    [data-print-post] .post-meta { flex-wrap:wrap; gap:4px 14px; }
    [data-print-post] .post-body { min-height:0; padding:16px 0 0; }
    [data-print-post] p { orphans:3; widows:3; }
    [data-print-post] figure,
    [data-print-post] .file-card { break-inside:avoid; }
    [data-print-post] figure img {
        max-width:100%;
        max-height:240mm;
        height:auto;
        border-radius:0;
    }
    [data-print-post] .video-block iframe,
    [data-print-post] .video-block video,
    [data-print-post] .poll > .help,
    [data-print-post] .poll-status { display:none !important; }
    [data-print-post] .video-block a::after {
        content:" (" attr(href) ")";
        overflow-wrap:anywhere;
    }
    [data-print-post] .poll-options button {
        display:block;
        height:auto;
        width:100%;
        min-width:0;
        padding:6px 0;
        border:0;
        border-radius:0;
        background:transparent;
        color:inherit;
        text-align:left;
        white-space:normal;
        opacity:1;
    }
}

.mobile-disclosure, .mobile-view-label { display: none; }

@media screen and (max-width: 860px) {
    .layout > aside:not([hidden]) { display: block; overflow: visible; }
    .layout > aside[hidden] { display: none; }
    .mobile-disclosure {
        display: flex; justify-content: space-between; width: 100%; height: 44px;
        padding-inline: 14px; color: var(--navy); font-weight: 650;
    }
    .mobile-disclosure::after {
        content: ''; width: 7px; height: 7px; margin-right: 3px;
        border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
    }
    .mobile-disclosure[aria-expanded="true"]::after { transform: rotate(225deg); }
    .board-switch[aria-expanded="false"] + #board-directory { display: none; }
    #board-directory { margin-top: 6px; }
    #board-directory section { display: block; min-width: 0; padding: 12px 14px; }
    #board-directory section + section { margin-top: 6px; }
    .board-tree .board-link { min-height: 42px; overflow-wrap: anywhere; }
    .format-switch { display: none; }
}

@media screen and (max-width: 640px) {
    body { min-width: 0; }
    .layout { margin-block: 10px; padding-inline: 8px; }
    .header-inner { align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px; }
    .brand { font-size: clamp(17px, 4.8vw, 22px); }
    .brand small, .account-label { display: none; }
    .account { margin-left: auto; gap: 4px; }
    .account button { height: 40px; padding-inline: 8px; }
    .site-nav > div { gap: 0; padding-inline: 8px; }
    .site-nav a { display: grid; place-items: center; min-height: 44px; padding: 6px 10px; font-size: 14px; }
    .card { padding: 16px 12px; }
    h1 { font-size: 22px; overflow-wrap: anywhere; }
    .breadcrumb, .post-meta { flex-wrap: wrap; }
    .board-heading { margin-bottom: 16px; }
    .list-write { height: 40px; }
    .post-list-table, .post-list-table tbody { display: block; }
    .post-list-table thead {
        position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
        clip-path: inset(50%);
    }
    .post-list-table tbody tr {
        display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px;
        padding: 12px 4px; border-bottom: 1px solid var(--line);
    }
    .post-list-table td { padding: 0; border: 0; text-align: left; font-size: 13px; }
    .post-list-table .hide-mobile { display: none; }
    .post-list-table td.title { width: 100%; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
    .post-list-table .post-author { max-width: 100%; overflow-wrap: anywhere; }
    .mobile-view-label { display: inline; }
    .notice-row { background: #fbfdff; }
    #search-form {
        display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 10px;
    }
    #search-form select { min-width: 0; }
    #search-form input { width: 100%; }
    #search-form button { grid-column: 1 / -1; width: 100%; }
    input:not([type="color"]), textarea, select, .rich-input { font-size: 16px; }
    .editor-heading { display: block; }
    .editor-heading > span:empty { display: none; }
    .block-list { grid-template-columns: minmax(0, 1fr); }
    .block-palette { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px; }
    .block-palette span { grid-column: 1 / -1; }
    .block-palette button, .editor-block > header button { height: 44px; padding-inline: 6px; }
    .editor-block > header button { min-width: 44px; }
    .editor-block-body { padding: 10px; }
    .format-switch { display: flex; margin-bottom: 8px; }
    .format-switch[aria-expanded="false"] + .rich-toolbar { display: none; }
    .rich-toolbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 6px; padding: 8px; }
    .rich-toolbar > label { grid-column: span 2; min-width: 0; }
    .rich-toolbar select { width: 100%; max-width: none; min-width: 0; height: 44px; padding-inline: 6px 18px; background-position: right 4px center; font-size: 16px; }
    .rich-toolbar .color-control { grid-column: span 3; gap: 5px; }
    .rich-toolbar .color-control button { flex: 1; }
    .rich-toolbar button, .rich-toolbar input[type="color"] { height: 44px; }
    .format-control, .format-status { grid-column: 1 / -1; }
    .format-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .format-buttons button { width: 100%; }
    .post-submit { gap: 14px; }
    .post-submit-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .post-submit-actions > button { width: 100%; }
    .chat-row { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 6px; }
    .chat-composer textarea, .inline-form input, .form-row > label { min-width: 0; }
    .comment p, .record-row, .file-admin-row { overflow-wrap: anywhere; }
    dialog { padding: 18px 14px; }
}
