/* ====================================================
   BBS-retro style — reproduces the look of the
   original erotown-style Japanese BBS (sampleSite.htm)
   ==================================================== */

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

body {
  background: #cccccc;
  color: #000;
  font-size: 15px;
  font-family: "MS UI Gothic", "Yu Gothic", "BIZ UDPGothic", system-ui, sans-serif;
  margin: 0;
  padding: 8px;
}

a { color: #0000ff; text-decoration: underline; }
a:hover { color: #ff0000; }
a:visited { color: #0000ff; }

/* ---- Site header ---- */
.site-header {
  background: #6699ff;
  border: 2px solid #330064;
  padding: 6px 12px;
  margin-bottom: 6px;
  max-width: 750px;
  margin-inline: auto;
}
.site-header h1 {
  font-size: 20px;
  color: #fff;
  margin: 0;
  text-align: center;
  font-weight: bold;
}

.site-header-front {
  padding: 2px;
}
.site-header-front .site-header-title-row {
  background: #6699ff;
  border: 1px solid #9dbdff;
  padding: 8px 10px;
}
.site-header-front h1 {
  font-size: 24px;
  line-height: 1.2;
}
.site-header-front .site-header-notice {
  margin: 2px 0 0;
  background: #b5e1ff;
  border: 1px solid #9dc6df;
  color: #cc0000;
  font-size: 12px;
  line-height: 1.45;
  padding: 7px 10px;
  font-weight: bold;
}

@media (max-width: 640px) {
  .site-header-front h1 {
    font-size: 20px;
  }
  .site-header-front .site-header-notice {
    font-size: 11px;
    line-height: 1.5;
  }
}

/* ---- Notice bar ---- */
.notice {
  background: #b5e1ff;
  border: 2px solid #330064;
  padding: 6px 10px;
  font-size: 13px;
  max-width: 750px;
  margin-inline: auto;
  margin-bottom: 6px;
}
.notice .warn { color: #cc0000; }

/* ---- Search bar ---- */
.search-bar {
  max-width: 750px;
  margin-inline: auto;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #cccccc;
  padding: 6px 8px;
  border: 1px solid #666;
}
.search-bar select,
.search-bar input[type="text"] {
  font-size: 14px;
  padding: 3px 6px;
  border: 1px solid #666;
}
.search-bar input[type="text"] { flex: 1; min-width: 180px; }
.search-mode {
  border: 1px solid #666;
  background: #e6e6e6;
  display: flex;
  gap: 8px;
  padding: 2px 6px;
  margin: 0;
  min-width: fit-content;
}
.search-mode label {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.search-filter {
  border: 1px solid #666;
  background: #e6e6e6;
  display: flex;
  gap: 8px;
  padding: 2px 6px;
  margin: 0;
  min-width: fit-content;
}
.search-filter label {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.search-bar button {
  font-size: 14px;
  padding: 3px 10px;
  cursor: pointer;
}
.search-bar .pagination-top {
  width: 100%;
  margin: 4px 0 0;
  max-width: none;
  font-size: 12px;
}

/* ---- Sticky current title ---- */
.current-title-bar {
  max-width: 750px;
  margin-inline: auto;
  position: sticky;
  z-index: 18;
  background: rgba(255, 255, 220, 0.72);
  border: 1px solid rgba(102, 102, 102, 0.8);
  border-left: 4px solid #008000;
  padding: 4px 6px;
  font-size: 13px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(8px) saturate(135%);
  backdrop-filter: blur(8px) saturate(135%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .current-title-bar {
    background: #ffffdc;
  }
}
.current-title-toggle {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0 2px;
  margin: 0;
  font-size: 15px;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
  color: #008000;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.current-title-toggle:hover { text-decoration: underline; }
.current-title-toggle:focus-visible {
  outline: 2px solid #3366cc;
  outline-offset: 1px;
}
.current-title-toggle .toggle-mark {
  flex: 0 0 1.2em;
  width: 1.2em;
  color: inherit;
}
#currentTitleText {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.current-title-labels {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px 8px;
  align-items: center;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.current-title-labels label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.current-title-labels select {
  font-size: 12px;
  padding: 1px 2px;
  margin-left: 4px;
  max-width: 92px;
}
.current-title-labels .label-status {
  max-width: 7em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .current-title-bar {
    gap: 6px;
    padding: 3px 5px;
  }
  .current-title-toggle {
    font-size: 14px;
  }
  .current-title-labels {
    gap: 2px 6px;
    font-size: 11px;
  }
  .current-title-labels select {
    max-width: 80px;
    font-size: 11px;
  }
}

/* ---- Divider ---- */
.bbs-hr {
  border: none;
  border-top: 2px dashed #bd0000;
  max-width: 750px;
  margin-inline: auto;
  margin-block: 6px;
}

/* ---- Post list wrapper ---- */
.post-list {
  max-width: 750px;
  margin-inline: auto;
}

/* ---- Single post card ---- */
.post-card { margin-bottom: 0; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  font-size: 14px;
  margin-bottom: 4px;
}
.post-num  { font-weight: bold; }
.post-title-toggle {
  color: #008000;
  font-weight: bold;
  font-size: 15px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}
.post-title-toggle:hover { text-decoration: underline; }
.post-title-toggle .toggle-mark {
  display: inline-block;
  width: 1.2em;
  color: #555;
}
.post-title {
  color: #008000;
  font-weight: bold;
  font-size: 15px;
}
.post-author { color: #000; }
.post-date   { color: #000; white-space: nowrap; }

.post-content[hidden] { display: none; }

.post-body {
  padding-left: 2em;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 15px;
  margin-bottom: 6px;
}

.label-status {
  min-height: 1em;
  color: #555;
}
.label-status.ok { color: #006600; }
.label-status.error { color: #c00000; }

.post-actions {
  font-size: 12px;
  padding-left: 2em;
  margin-bottom: 4px;
}

/* ---- Pagination ---- */
.pagination {
  max-width: 750px;
  margin-inline: auto;
  margin-top: 8px;
  font-size: 13px;
  font-family: Verdana, Helvetica, Arial, sans-serif;
}
.pagination a,
.pagination .current {
  display: inline-block;
  margin-right: 2px;
}
.pagination .current { font-weight: bold; }

/* ---- Detail page ---- */
.back-link {
  max-width: 750px;
  margin-inline: auto;
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}
.post-detail {
  max-width: 750px;
  margin-inline: auto;
}
.post-detail .post-meta { font-size: 15px; }
.post-detail .post-body { font-size: 15px; }
.source-link {
  font-size: 12px;
  padding-left: 2em;
  margin-bottom: 8px;
}

/* ---- Login page ---- */
.login-wrap {
  max-width: 360px;
  margin: 60px auto;
  background: #e8e8e8;
  border: 2px solid #330064;
  padding: 24px 28px;
}
.login-wrap h2 {
  margin: 0 0 16px;
  font-size: 18px;
  text-align: center;
}
.login-wrap label { font-size: 14px; font-weight: bold; }
.login-wrap input[type="text"],
.login-wrap input[type="password"] {
  width: 100%;
  font-size: 15px;
  padding: 4px 6px;
  margin: 4px 0 12px;
  border: 1px solid #666;
}
.login-wrap button {
  width: 100%;
  font-size: 15px;
  padding: 6px;
  cursor: pointer;
  background: #6699ff;
  color: #fff;
  border: 1px solid #330064;
}
.login-wrap button:hover { background: #4477dd; }
.login-error {
  color: #cc0000;
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

/* ---- Loading / error states ---- */
.status-msg {
  max-width: 750px;
  margin-inline: auto;
  padding: 8px;
  font-size: 14px;
  color: #555;
}

/* ====================================================
   Preview / blur mode (未ログイン表示)
   ==================================================== */

/* 一覧画面：プレビュークラス付きカードに小バッジ */
.post-card.preview .post-actions {
  position: relative;
}
.preview-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #fff;
  background: #888;
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
}

/* 詳細画面：本文ぼかしラッパー */
.body-preview-wrap {
  position: relative;
  overflow: hidden;
  min-height: 120px;
}
.body-preview-wrap .post-body {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}
/* ぼかし上のオーバーレイ */
.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(204, 204, 204, 0.45);
  text-align: center;
  padding: 16px;
}
.preview-overlay p {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  color: #330064;
  text-shadow: 0 0 4px #fff;
}
.preview-overlay a.login-btn {
  display: inline-block;
  padding: 7px 20px;
  background: #6699ff;
  color: #fff;
  border: 1px solid #330064;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  border-radius: 2px;
}
.preview-overlay a.login-btn:hover {
  background: #4477dd;
  color: #fff;
}
