:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: #f2f2f2;
  color: #1a1a1a;
  --brand-color: #1d4d7a;
  --brand-border: #c4c4c4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 960px;
  padding: 24px 16px 64px;
  background-color: #f2f2f2;
  line-height: 1.5;
}

main,
.home-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.board-header {
  background: #e8e8e8;
  border: 1px solid var(--brand-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-nav {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-size: 0.9rem;
}

.board-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--brand-color);
}

.board-desc,
.board-header .muted {
  margin: 0;
  color: #3c3c3c;
  font-size: 0.95rem;
}

.post-form,
.request-form,
.request-list-container,
.thread {
  background: #fff;
  border: 1px solid var(--brand-border);
  padding: 14px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: var(--brand-color);
}

.form-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 14px;
  align-items: center;
}

.form-grid label {
  text-align: right;
  font-size: 0.9rem;
  color: #2f2f2f;
}

.form-grid input,
.form-grid textarea {
  font: inherit;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #b0b0b0;
  background: #fff;
}

.form-grid textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

button {
  padding: 6px 12px;
  border: 1px solid #b0b0b0;
  background: #f5f5f5;
  cursor: pointer;
  font: inherit;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button.vote-button,
button.vote-button.voted {
  font-size: 0.85rem;
  padding: 4px 10px;
}

button.vote-button.voted {
  background: #fff;
}

.error,
.success {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid #b0b0b0;
  background: #fafafa;
  font-size: 0.9rem;
}

.success {
  color: #165a35;
}

.flash-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  max-width: 280px;
}

.flash-toast {
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font: inherit;
  text-align: left;
  color: #fff;
  background: var(--brand-color);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.flash-toast:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.flash-toast:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.flash-toast.flash-error {
  background: #b91c1c;
}

.flash-toast.flash-success {
  background: #15803d;
}

.muted {
  color: #555;
  font-size: 0.9rem;
}

.board-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.board-card {
  display: block;
  background: #fff;
  border: 1px solid var(--brand-border);
  padding: 14px;
}

.board-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.board-card p {
  margin: 0;
  color: #3f3f46;
  font-size: 0.95rem;
}

.board-requests {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.request-panel {
  border: 1px solid var(--brand-border);
  background: #fff;
  padding: 12px;
}

.request-panel summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.request-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.request-form label {
  font-size: 0.9rem;
  color: #333;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.request-form textarea {
  resize: vertical;
}

.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.requests-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.request-list li {
  background: #fff;
  border: 1px solid var(--brand-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.request-summary h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--brand-color);
}

.request-summary p {
  margin: 0;
  color: #3f3f46;
  font-size: 0.95rem;
}

.request-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.threads {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thread header {
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
  color: #303030;
}

.post-meta {
  color: var(--brand-color);
  font-weight: 600;
}

.post-date {
  color: #505050;
}

.thread-body {
  display: flex;
  gap: 12px;
}

.thread-body.no-image {
  flex-direction: column;
}

.attachment {
  display: flex;
}

.thread-replies {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.thread-reply {
  margin-top: 16px;
}

.thread-body img {
  max-width: 220px;
  border: 1px solid var(--brand-border);
}

.thread-text {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-text strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-color);
}

.id-link {
  border: none;
  background: none;
  color: var(--brand-color);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.id-link:hover {
  text-decoration: none;
}

.reply-list {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  color: #4b4b4b;
}

.status-pill {
  color: #a11e1e;
  font-weight: 600;
}

.reply {
  border-left: 2px solid var(--brand-border);
  padding-left: 10px;
  margin-top: 10px;
}

.reply.highlight {
  background: rgba(253, 230, 138, 0.35);
}

.comment-form {
  margin-top: 10px;
  border: 1px solid var(--brand-border);
  background: #fafafa;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-form label {
  font-size: 0.85rem;
  color: #303030;
}

.comment-form input,
.comment-form textarea {
  border: 1px solid #b0b0b0;
  padding: 6px;
  font: inherit;
}

.spinner {
  font-weight: 600;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  body {
    padding: 20px 12px 48px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label {
    text-align: left;
  }

  .thread-body {
    flex-direction: column;
  }

  .thread-body img {
    max-width: 100%;
  }

  .board-nav {
    justify-content: flex-start;
  }
}

.thread-body img,
.board-card img,
.request-summary img {
  max-width: 220px;
  height: auto;
}

.attachment img,
.comment-attachment img {
  max-width: 200px;
  height: auto;
}

.comment-attachment img {
  border: 1px solid var(--brand-border);
}

.bulletin-board {
  background: #fff7d6;
  border: 1px solid #d5c894;
  padding: 12px;
  color: #3d3d1f;
}

.bulletin-board h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.bulletin-board ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bulletin-board li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.request-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.popular-posts {
  border: 1px solid var(--brand-border);
  background: #fff;
  padding: 14px;
}

.popular-posts h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.popular-posts ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.popular-posts li {
  font-size: 0.95rem;
}

.site-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: #4b4b4b;
}

.member-auth {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-auth .request-panel {
  margin-top: 12px;
}

.member-card {
  border: 1px solid var(--brand-border);
  background: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.auth-form {
  border: 1px solid var(--brand-border);
  background: #f9f9f9;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form.active {
  background: #fff;
  border-color: var(--brand-color);
  box-shadow: 0 0 0 2px rgba(29, 77, 122, 0.1);
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #333;
}

.auth-form input {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #b0b0b0;
  background: #fff;
}

.auth-form button {
  align-self: flex-start;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--brand-border);
  background: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  text-decoration: none;
  background: #f5f5f5;
}

.logout-form {
  margin: 0;
}
