@import url("https://cdn.jsdelivr.net/npm/galmuri@latest/dist/galmuri.css");

:root {
  --desktop: #bfd4e6;
  --desktop-2: #96b8d6;
  --paper: #f5f2eb;
  --paper-deep: #dedbd3;
  --white: #fffefa;
  --ink: #171717;
  --muted: #6b6861;
  --accent: #df644f;
  --mint: #48a77d;
  --line: 1px;
  --radius-window: 12px;
  --radius-control: 7px;
  --ui: 13px;
  --small: 11px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scrollbar-gutter: stable; }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--desktop);
  font-family: "Galmuri11", "Apple SD Gothic Neo", sans-serif;
  font-size: var(--ui);
  line-height: 1.5;
  font-synthesis: none;
}
body::after { content: ""; position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .045; background-image: radial-gradient(var(--ink) .45px, transparent .55px); background-size: 4px 4px; mix-blend-mode: multiply; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
strong, b, h1, h2 { font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

body.time-morning { --desktop: #cfe6ef; --desktop-2: #a9d4e0; }
body.time-day { --desktop: #bfd4e6; --desktop-2: #96b8d6; }
body.time-evening { --desktop: #f0c9b4; --desktop-2: #e6947a; }
body.time-night { --desktop: #37416b; --desktop-2: #1f2444; }

.menu-bar { position: sticky; top: 0; z-index: 30; height: 36px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 0 18px; border-bottom: var(--line) solid var(--ink); background: var(--paper); font-size: var(--small); }
.brand, .menu-status, .menu-bar nav { display: flex; align-items: center; }
.brand { width: fit-content; gap: 8px; }
.brand img { width: 16px; height: 16px; display: block; object-fit: contain; image-rendering: pixelated; }
.menu-bar nav { height: 100%; gap: 4px; }
.menu-bar nav a { height: 100%; display: grid; place-items: center; padding: 0 10px; border-radius: var(--radius-control); }
.menu-bar nav a:hover, .menu-bar nav a.is-current { background: var(--ink); color: var(--paper); }
.menu-status { min-width: 0; height: 100%; justify-self: end; gap: 8px; }
.menu-status time { margin-left: 6px; font-variant-numeric: tabular-nums; }
.status-dot { position: relative; width: 16px; height: 16px; flex: none; border: 0; background: transparent; }
.status-dot::before { content: ""; position: absolute; inset: 4px; border: var(--line) solid var(--ink); border-radius: 50%; background: var(--mint); }
.account-link { width: 16px; height: 16px; display: grid; flex: none; place-items: center; border: 0; background: transparent; font-family: "Galmuri11", monospace; font-size: 16px; line-height: 16px; transform: translateY(-2px); }
.account-link:hover { color: var(--accent); transform: translateY(-2px) rotate(18deg); }
.account-link:focus-visible { outline: var(--line) solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.account-link.is-login-cta { width: auto; height: auto; padding: 3px 8px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--paper); font-size: var(--small); line-height: 1; transform: none; }
.account-link.is-login-cta:hover { background: var(--ink); color: var(--paper); transform: none; }
.mobile-nav { display: none; }
main {
  min-height: calc(100dvh - 36px);
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 48px clamp(48px, 8vw, 128px) 56px;
  background-color: var(--desktop);
  background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(135deg, var(--desktop) 0%, var(--desktop-2) 50%, var(--desktop) 100%);
  background-size: 8px 8px, 8px 8px, 300% 300%;
  animation: desktop-drift 18s ease-in-out infinite;
}
@keyframes desktop-drift {
  0%, 100% { background-position: 0 0, 0 0, 0% 0%; }
  50% { background-position: 0 0, 0 0, 100% 100%; }
}
@media (prefers-reduced-motion: reduce) { main { animation: none; } }

.board-window { width: min(1160px, 100%); overflow: hidden; border: var(--line) solid var(--ink); border-radius: var(--radius-window); background: var(--paper); box-shadow: 0 14px 32px rgba(23,23,23,.22), 0 2px 0 rgba(23,23,23,.2); }
.title-bar { min-height: 28px; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; padding: 0 7px; border-bottom: var(--line) solid var(--ink); border-radius: calc(var(--radius-window) - 1px) calc(var(--radius-window) - 1px) 0 0; background: repeating-linear-gradient(0deg, var(--paper) 0 2px, #a7a39a 2px 3px); }
.title-bar h1, .title-bar h2 { justify-self: center; margin: 0; padding: 2px 11px; border-inline: 4px solid var(--paper); background: var(--paper); font-size: var(--small); line-height: 1.4; }
.window-controls { width: fit-content; padding: 1px 7px 1px 2px; background: var(--paper); }
.window-controls span, .window-zoom { position: relative; width: 14px; height: 14px; display: block; border: var(--line) solid var(--ink); border-radius: 3px; background: var(--paper); box-shadow: inset 1px 1px 0 var(--white); }
.window-controls span::before, .window-controls span::after { content: ""; position: absolute; top: 6px; left: 2px; width: 8px; height: 1px; background: var(--ink); transform: rotate(45deg); transform-origin: center; }
.window-controls span::after { transform: rotate(-45deg); }
.window-zoom { justify-self: end; margin-right: 2px; box-shadow: inset -3px -3px 0 var(--paper-deep), inset 1px 1px 0 var(--white); }

.board-header { min-height: 92px; display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 20px 22px 16px; border-bottom: var(--line) solid var(--ink); }
.board-header p, .board-header h2 { margin: 0; }
.board-header > div > p { margin-bottom: 4px; color: var(--muted); font-size: var(--small); }
.board-header h2 { font-size: 24px; }
.board-count { font-size: var(--small); }
.board-count strong { color: var(--accent); font-size: var(--ui); font-variant-numeric: tabular-nums; }
.board-message { min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 8px 16px; border-bottom: var(--line) solid var(--ink); background: var(--white); font-size: var(--ui); }
.board-message strong { flex: none; color: var(--accent); }
.board-message span { min-width: 0; }

.board-tools { display: grid; grid-template-columns: 1fr minmax(260px, 340px); align-items: end; gap: 18px; padding: 12px 16px; border-bottom: var(--line) solid var(--ink); background: var(--paper-deep); }
.category-tabs { display: flex; gap: 4px; }
.category-tabs button, .write-button, .pagination button, .compose-actions button, .compose-page-header button, .post-page button, .comment-form button, .reply-form button { min-height: 32px; padding: 0 12px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--paper); box-shadow: inset -1px -1px 0 #bdb9af; }
.category-tabs button:hover, .category-tabs button.is-active, .pagination button.is-current { background: var(--ink); color: var(--paper); box-shadow: none; }
.board-search { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; font-size: var(--small); }
.board-search input, .compose-body input, .compose-body select, .compose-body textarea { width: 100%; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--white); outline: none; }
.board-search input { height: 34px; padding: 0 10px; }
.board-search input:focus, .compose-body input:focus, .compose-body select:focus, .compose-body textarea:focus { box-shadow: 0 0 0 2px var(--accent); }

.board-table { background: var(--white); }
.board-row { min-height: 35px; display: grid; grid-template-columns: 58px 68px 96px minmax(0,1fr) 100px 80px 50px; align-items: center; border-bottom: var(--line) solid #c4c0b7; }
.board-row > span, .board-row > button { min-width: 0; padding: 7px 8px; }
.board-columns { min-height: 30px; background: var(--ink); color: var(--paper); font-size: var(--small); text-align: center; }
.board-columns span { padding-block: 5px; }
.post-row { font-variant-numeric: tabular-nums; }
.post-row:hover { background: #f0ede5; }
.post-row > span { text-align: center; color: var(--muted); font-size: var(--small); }
.author-name.is-admin {
  color: var(--ink);
  font-family: "Galmuri11-Bold", "Galmuri11", sans-serif;
  text-shadow: 2px 2px 0 var(--mint);
  cursor: help;
}
.post-row .post-category { color: var(--ink); }
.post-row .post-stock { overflow: hidden; color: var(--accent); font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.post-title { width: 100%; overflow: hidden; border: 0; background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.post-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.post-title small { margin-left: 6px; color: var(--accent); font-size: 10px; }
.board-empty { margin: 0; padding: 72px 20px; border-bottom: var(--line) solid var(--ink); background: var(--white); text-align: center; }

.board-footer { min-height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px 16px; }
.write-button { justify-self: start; background: var(--ink); color: var(--paper); box-shadow: none; }
.pagination { display: flex; gap: 4px; }
.pagination button { min-width: 32px; padding: 0 8px; }
.page-size { justify-self: end; color: var(--muted); font-size: var(--small); }
.board-access-note { margin: 13px 4px 0; color: var(--muted); font-size: var(--small); text-align: center; }
body.time-night .board-access-note { color: rgba(245, 242, 235, .72); }

.compose-page { min-height: 570px; background: var(--white); }
.compose-page-header { min-height: 82px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; padding: 14px 20px; border-bottom: var(--line) solid var(--ink); background: var(--paper-deep); }
.compose-page-header div { text-align: center; }
.compose-page-header p, .compose-page-header h2 { margin: 0; }
.compose-page-header p { margin-bottom: 3px; color: var(--muted); font-size: var(--small); }
.compose-page-header h2 { font-size: 20px; }
.compose-body { width: min(860px, 100%); margin: 0 auto; padding: 28px 24px 34px; }
.compose-grid { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.compose-body label > span, .stock-picker legend, .content-field > span { display: block; margin-bottom: 6px; font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; font-size: var(--small); }
.compose-body input, .compose-body select { min-height: 38px; padding: 0 10px; }
.stock-picker { position: relative; margin: 16px 0; padding: 12px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); }
.stock-picker legend { padding: 0 5px; }
.stock-picker legend small { color: var(--muted); font-family: "Galmuri11", sans-serif; }
.selected-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.selected-tags:empty { display: none; }
.selected-tags button { padding: 5px 7px; border: var(--line) solid var(--ink); border-radius: 4px; background: var(--paper-deep); font-size: var(--small); }
.stock-options { position: absolute; z-index: 3; top: calc(100% - 11px); left: 12px; right: 12px; overflow: hidden; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--white); box-shadow: 0 8px 16px rgba(23,23,23,.18); }
.stock-options button { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-bottom: var(--line) solid #c4c0b7; background: transparent; text-align: left; }
.stock-options button:last-child { border-bottom: 0; }
.stock-options button:hover { background: var(--ink); color: var(--paper); }
.content-field textarea { display: block; resize: vertical; padding: 10px; line-height: 1.7; }
.compose-help { margin: 7px 0 0; color: var(--muted); font-size: var(--small); }
.compose-actions { display: flex; justify-content: center; gap: 7px; padding: 13px 14px; border-top: var(--line) solid var(--ink); background: var(--paper-deep); }
.compose-actions button.primary { min-width: 82px; background: var(--ink); color: var(--paper); box-shadow: none; }

.post-page { background: var(--white); }
.post-page-header { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border-bottom: var(--line) solid var(--ink); background: var(--paper-deep); }
.post-page-header button, .post-page-footer button { background: var(--paper); }
.owner-actions { display: flex; gap: 6px; }
.post-article { min-height: 280px; padding: 24px 28px 34px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; padding-bottom: 13px; border-bottom: var(--line) solid #aaa69d; color: var(--muted); font-size: var(--small); }
.detail-meta strong { color: var(--accent); }
.post-article h2 { margin: 22px 0 26px; font-size: 22px; line-height: 1.5; }
.detail-content { min-height: 120px; white-space: pre-line; line-height: 1.9; }
.post-reactions { display: flex; gap: 7px; padding: 13px 28px; border-top: var(--line) solid #aaa69d; border-bottom: var(--line) solid var(--ink); background: var(--paper); }
.post-reactions button:first-child { background: var(--ink); color: var(--paper); box-shadow: none; }
.comments-section { padding: 24px 28px 8px; }
.comments-section > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.comments-section h3, .related-section h3 { margin: 0; font-size: var(--ui); }
.comment-form { padding: 13px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--paper-deep); }
.comment-form label { display: block; margin-bottom: 7px; font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; font-size: var(--small); }
.comment-form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.comment-form textarea, .reply-form textarea, [data-edit-comment-form] textarea { width: 100%; padding: 9px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--white); font: inherit; line-height: 1.6; resize: vertical; }
.comment-form button, .reply-form button:first-child { background: var(--ink); color: var(--paper); box-shadow: none; }
.comments-list { margin-top: 15px; }
.comment-thread { border-bottom: var(--line) solid #aaa69d; }
.comment { padding: 14px 4px; }
.comment.is-reply { margin-left: 42px; padding-left: 15px; border-left: var(--line) solid var(--accent); background: #f7f4ed; }
.comment header { display: flex; align-items: baseline; gap: 9px; }
.comment header span { color: var(--muted); font-size: var(--small); }
.comment-content { margin: 8px 0 9px; line-height: 1.75; }
.comment-content.is-deleted { color: var(--muted); }
.comment footer { display: flex; flex-wrap: wrap; gap: 4px; }
.comment footer button { min-height: 26px; padding: 0 7px; border: 0; background: transparent; box-shadow: none; color: var(--muted); font-size: var(--small); }
.comment footer button:hover { color: var(--ink); text-decoration: underline; }
.reply-form { margin: 0 0 14px 42px; padding: 12px; border-left: var(--line) solid var(--accent); background: var(--paper-deep); }
.reply-form label { display: grid; gap: 7px; font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; font-size: var(--small); }
.reply-form > div, [data-edit-comment-form] > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; }
.comments-empty { margin: 0; padding: 32px 0; color: var(--muted); text-align: center; }
.related-section { margin-top: 16px; padding: 21px 28px 24px; border-top: var(--line) solid var(--ink); background: var(--paper); }
.related-section h3 { margin-bottom: 10px; }
.related-section [data-related-list] { border-top: var(--line) solid #aaa69d; }
.related-section button { width: 100%; display: grid; grid-template-columns: 60px 110px 1fr; gap: 9px; align-items: center; min-height: 38px; padding: 6px 8px; border: 0; border-bottom: var(--line) solid #aaa69d; border-radius: 0; background: transparent; box-shadow: none; text-align: left; }
.related-section button:hover { background: var(--white); }
.related-section button span { color: var(--muted); font-size: var(--small); }
.related-section button strong { overflow: hidden; color: var(--accent); font-size: var(--small); text-overflow: ellipsis; white-space: nowrap; }
.related-section button em { overflow: hidden; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.post-page-footer { display: flex; justify-content: center; padding: 14px; border-top: var(--line) solid var(--ink); background: var(--paper-deep); }
.mock-toast { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 14px; border: var(--line) solid var(--ink); border-radius: var(--radius-control); background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 rgba(23,23,23,.25); font-size: var(--small); }

@media (max-width: 760px) {
  body { padding-bottom: 66px; }
  .menu-bar { grid-template-columns: 1fr auto; height: 36px; padding: 0 12px; }
  .menu-bar nav, .menu-status > span:not(.status-dot), .menu-status time { display: none; }
  main { display: block; min-height: calc(100dvh - 36px); padding: 20px 12px 36px; }
  .title-bar { grid-template-columns: 48px 1fr 48px; min-height: 27px; }
  .title-bar h1 { font-size: 10px; }
  .board-header { min-height: 80px; padding: 16px 14px 12px; }
  .board-header h2 { font-size: 20px; }
  .board-message { align-items: flex-start; min-height: 40px; padding: 8px 10px; font-size: 12px; line-height: 1.6; }
  .board-tools { grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  .category-tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
  .category-tabs button { min-width: 0; padding: 0 4px; }
  .board-search { grid-template-columns: 1fr; gap: 4px; }
  .board-search > span { display: none; }
  .board-row { grid-template-columns: 64px minmax(0,1fr) 58px; min-height: 54px; }
  .board-columns { min-height: 28px; }
  .board-columns span { display: none; }
  .board-columns span:nth-child(2), .board-columns span:nth-child(4), .board-columns span:nth-child(6) { display: block; }
  .post-row > span { display: none; }
  .post-row .post-category { display: block; }
  .post-row .post-time { display: block; }
  .post-row .post-stock { position: absolute; }
  .post-title { display: grid; gap: 3px; padding-block: 7px; }
  .post-title::before { content: attr(data-stock); color: var(--accent); font-family: "Galmuri11-Bold", "Galmuri11", sans-serif; font-size: 10px; }
  .post-title small { display: none; }
  .board-footer { grid-template-columns: auto 1fr; }
  .pagination { justify-self: end; }
  .page-size { display: none; }
  .pagination button { min-width: 29px; padding-inline: 6px; }
  .compose-grid { grid-template-columns: 1fr; }
  .compose-body { padding: 15px; }
  .compose-page { min-height: 520px; }
  .compose-page-header { min-height: 70px; gap: 10px; padding: 10px; }
  .compose-page-header h2 { font-size: 17px; }
  .post-page-header { padding: 8px 10px; }
  .post-article { min-height: 220px; padding: 18px 14px 26px; }
  .post-article h2 { margin: 18px 0 21px; font-size: 18px; }
  .post-reactions { padding: 10px 14px; }
  .comments-section { padding: 20px 14px 6px; }
  .comment-form > div { grid-template-columns: 1fr; }
  .comment-form button { justify-self: end; }
  .comment.is-reply, .reply-form { margin-left: 18px; }
  .related-section { padding: 19px 14px 21px; }
  .related-section button { grid-template-columns: 48px 86px 1fr; }
  .mobile-nav { position: fixed; z-index: 30; left: 8px; right: 8px; bottom: 8px; height: 58px; display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: var(--line) solid var(--ink); border-radius: 10px; background: var(--paper); box-shadow: 0 7px 18px rgba(23,23,23,.22); }
  .mobile-nav a { display: grid; place-items: center; align-content: center; min-width: 0; padding: 4px 2px; border-right: var(--line) solid #aaa69d; font-size: 9px; text-align: center; }
  .mobile-nav a:last-child { border-right: 0; }
  .mobile-nav a.is-current { background: var(--ink); color: var(--paper); }
}

@media (max-width: 430px) {
  .window-zoom { display: none; }
}
