*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: #eef2ff;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
  background: #eef2ff;
  overflow-x: hidden;
}

button,
input,
textarea {
  font-family: inherit;
}

a {
  color: #34345c;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  border-bottom: 1px solid #b7c5d9;
  background: linear-gradient(#dbe7f7, #c8d9f1);
}

.topbar-inner {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}

.home-link {
  font-weight: 700;
}

.tagline {
  color: #3f4f6f;
  margin-left: 8px;
}

.content {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 40px;
}

body.thread-page .content {
  width: min(1380px, calc(100% - 24px));
}

.board-header {
  text-align: center;
  margin: 18px 0 20px;
}

.board-header h1 {
  margin: 0;
  color: #af0a0f;
  font-size: 28px;
}

.error-box {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #d99;
  background: #f7e6e6;
  color: #900;
}

.post-box {
  margin: 0 auto 22px;
  width: min(520px, 100%);
  border: 1px solid #b7c5d9;
  background: #d6daf0;
}

.post-box h2 {
  margin: 0;
  padding: 8px 10px;
  font-size: 16px;
  border-bottom: 1px solid #b7c5d9;
  background: #c7d5ea;
}

.post-form {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.post-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.post-form input,
.post-form textarea,
.post-form button {
  font: inherit;
}

.post-form input,
.post-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #8aa0b8;
  background: #fff;
}

.post-form textarea {
  min-height: 140px;
  resize: vertical;
}

.post-form button {
  justify-self: start;
  padding: 7px 14px;
  border: 1px solid #8a8a8a;
  background: linear-gradient(#fff, #ddd);
  cursor: pointer;
}

.thread-list,
.thread-view {
  display: grid;
  gap: 14px;
}

body.thread-page .thread-view {
  max-width: 900px;
}

.thread-card {
  border: 1px solid #b7c5d9;
  background: #f8fbff;
  padding: 10px 12px;
  min-width: 0;
}

.thread-card.is-targeted {
  background: #fff7d8;
  box-shadow: 0 0 0 2px #d99;
}

.op-card {
  background: #f0e0d6;
}

.reply-card {
  width: calc(100% - clamp(0px, 3vw, 32px));
  max-width: 920px;
  margin-left: auto;
}

.index-reply-card {
  margin-top: 12px;
}

.meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #545454;
}

.meta-no {
  font-weight: 700;
}

.post-no {
  color: #800000;
}

.author-line {
  margin-top: 6px;
  color: #117743;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.thread-card h2,
.thread-card h3 {
  margin: 10px 0 4px;
  color: #0f0c5d;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.post-body {
  margin: 10px 0 0;
  white-space: normal;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: break-word;
}

.quote-line {
  color: #789922;
}

.quote-link,
.backlink {
  color: #d00;
}

.quote-link:hover,
.backlink:hover,
.post-no:hover {
  color: #f60;
}

.post-actions,
.backlink-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
}

.file-block {
  margin-top: 10px;
}

.file-block::after {
  content: "";
  display: block;
  clear: both;
}

.file-meta {
  margin-bottom: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.media-link {
  display: inline-block;
  float: left;
  margin: 0 16px 10px 0;
  max-width: 100%;
}

.post-media {
  display: block;
  border: 1px solid #b7c5d9;
  background: #fff;
  max-width: 100%;
  height: auto;
}

.post-media--op {
  max-width: 250px;
  max-height: 250px;
}

.post-media--reply {
  max-width: 180px;
  max-height: 180px;
}

.quote-button {
  border: 0;
  background: transparent;
  color: #34345c;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.quote-button:hover {
  text-decoration: underline;
}

.post-preview {
  position: fixed;
  z-index: 30;
  width: min(480px, calc(100vw - 20px));
  display: none;
  pointer-events: none;
}

.post-preview .thread-card {
  background: #f0e0d6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.reply-link,
.site-links a {
  font-size: 13px;
}

.empty-note {
  font-size: 14px;
  color: #555;
}

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

body.thread-page .post-box {
  width: auto;
  margin: 0;
  border: 0;
  background: transparent;
}

body.thread-page .thread-composer-shell {
  position: static;
}

body.thread-page .composer-panel {
  position: fixed;
  top: 112px;
  right: max(16px, calc((100vw - 1380px) / 2 + 12px));
  width: min(520px, calc(100vw - 940px));
  min-width: 360px;
  max-width: calc(100vw - 24px);
  border: 1px solid #8f85d8;
  background: #d6daf0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  z-index: 20;
}

body.thread-page .composer-panel.is-dragging {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

body.thread-page .composer-panel.is-collapsed .post-form--floating {
  display: none;
}

body.thread-page .composer-panel.is-hidden {
  display: none;
}

body.thread-page .composer-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #8f85d8;
  background: #9f8fe6;
  color: #111;
  cursor: move;
  user-select: none;
  touch-action: none;
}

body.thread-page .composer-panel.is-dragging .composer-panel-bar {
  cursor: grabbing;
}

body.thread-page .composer-panel-title {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
}

body.thread-page .composer-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

body.thread-page .composer-action {
  width: 30px;
  height: 30px;
  margin: 0;
  border: 1px solid rgba(17, 17, 17, 0.35);
  background: rgba(255, 255, 255, 0.78);
  color: #111;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

body.thread-page .composer-action:hover {
  background: #fff;
}

body.thread-page .post-form--floating {
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - 172px);
  overflow: auto;
  padding: 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.thread-page .post-form--floating label,
body.thread-page .post-form--floating button {
  margin: 0 10px 10px;
}

body.thread-page .composer-dock {
  display: none;
}

body.thread-page .composer-dock.is-visible {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: block;
  z-index: 21;
}

body.thread-page .composer-open-button {
  padding: 10px 14px;
  border: 1px solid #6d61ba;
  background: #9f8fe6;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

@media (max-width: 720px) {
  .content,
  .topbar-inner {
    width: min(1100px, calc(100% - 16px));
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .tagline {
    display: block;
    margin: 4px 0 0;
  }

  .reply-card {
    width: 100%;
    margin-left: 0;
  }

  .thread-card {
    padding: 10px;
  }

  .media-link {
    float: none;
    margin: 0 0 10px;
  }

  .post-preview {
    display: none !important;
  }
}

@media (max-width: 1240px) {
  body.thread-page .content {
    width: min(1100px, calc(100% - 24px));
  }

  body.thread-page .thread-view {
    max-width: none;
  }

  body.thread-page .composer-panel {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-shadow: none;
  }

  body.thread-page .composer-panel.is-hidden,
  body.thread-page .composer-panel.is-collapsed {
    display: block;
  }

  body.thread-page .composer-panel-bar,
  body.thread-page .composer-dock {
    display: none;
  }

  body.thread-page .post-form--floating {
    max-height: none;
    padding: 10px;
    border: 1px solid #b7c5d9;
    box-shadow: none;
  }
}
