/* テーマ機能は削除済み。固定配色に一本化 */

/* コメントヘッダー（右上返信ボタン配置） */
.comment-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7em;
  position: relative;
}
.comment-header .reply-btn {
  position: absolute;
  right: 0.2em;
  top: 0.2em;
  font-size: 1em;
  padding: 2px 6px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  color: #6366f1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.08);
}
.comment-header .reply-btn:hover {
  background: #6366f1;
  color: #fff;
}
/* ベース */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  background: #f5f7fa;
  color: #222;
  font-family: "Segoe UI", "Noto Sans JP", system-ui, -apple-system, Arial,
    sans-serif;
  line-height: 1.6;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
img {
  max-width: 100%;
  height: auto;
}

/* モーダル */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(25, 28, 36, 0.24);
  backdrop-filter: blur(2px);
}
.modal-content {
  background: #fff;
  margin: 8% auto;
  padding: 2em 2em 1em 2em;
  border-radius: 16px;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.12);
  position: relative;
}
.close-modal {
  position: absolute;
  right: 1em;
  top: 1em;
  background: none;
  border: none;
  color: #6366f1;
  cursor: pointer;
  font-size: 2em;
}
header,
h1,
h2 {
  text-align: center;
  font-weight: 700;
  margin-top: 1.5em;
}
.container {
  margin: 2rem auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  padding: 1.5rem 2rem;
  max-width: 960px;
  width: calc(100% - 2rem);
}
.comment {
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 1.2em;
  padding: 1em 1.2em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
}
.comment-no {
  background: #6366f1;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  width: 2em;
  height: 2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.7em;
  font-size: 1.1em;
}
.comment img {
  margin-top: 0.7em;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}
form {
  margin-top: 2em;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}
input[type="text"] {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.7em;
  font-size: 1em;
  background: #f8fafc;
  transition: border-color 0.2s;
  width: 100%;
}
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.7em;
  font-size: 1em;
  background: #f8fafc;
  transition: border-color 0.2s;
  width: 100%;
  min-height: 2.5em;
  resize: vertical;
}
input[type="text"]:focus,
textarea:focus {
  border-color: #6366f1;
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
input[type="file"] {
  margin-top: 0.5em;
}
button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75em 1.2em;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
  transition: transform 0.08s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
}
button:hover {
  transform: translateY(-1px);
}
button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
}
a:hover {
  text-decoration: underline;
}
.error {
  color: #ef4444;
  font-weight: bold;
  margin-bottom: 1em;
  text-align: center;
}
.thread-list {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.thread-item {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}
.thread-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.thread-meta {
  color: #64748b;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.thread-new-comment-time {
  margin-bottom: 0.2rem;
  color: #475569;
}
.thread-comment-count {
  background: #2563eb;
  color: #fff;
  border-radius: 1em;
  padding: 0.2em 0.8em;
  font-size: 0.95em;
  margin-left: 0.5em;
}
/* 最後の行（コメント数/新着）を横並びにする */
.thread-item > div:last-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* FAB（テーマボタン） */
.fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  border-radius: 50%;
  border: none;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
  z-index: 1000;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.fab:hover {
  transform: translateY(-1px);
}
.fab:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

/* モーダル微調整 */
.modal-content {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}
/* テーマ選択用のボタン類は削除 */

/* レスポンシブ */
@media (max-width: 1024px) {
  .container {
    padding: 1.25rem 1.25rem;
    max-width: 840px;
  }
}
@media (max-width: 860px) {
  .thread-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .container {
    width: calc(100% - 1rem);
    margin: 1rem auto;
    border-radius: 12px;
  }
  h1 {
    font-size: 1.5rem;
    margin: 1rem 0;
  }
}

/* ===== 3D ワールド（index.html）専用スタイル ===== */
body.three,
body.three html {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
}
.three #tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: rgba(20, 22, 30, 0.9);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transform: translate(8px, 8px);
  display: none;
}
.three #menuTab {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: none;
  z-index: 6;
  background: rgba(14, 18, 36, 0.7);
  color: #e5e7eb;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}
/* 右上の小さな『開く』ボタン群 */
.three .open-buttons {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 7;
  display: flex;
  flex-direction: column; /* 右上から縦に並べる */
  align-items: flex-end; /* 右端に寄せる */
  gap: 8px;
  pointer-events: auto;
}
/* メニュータグに合わせた未来感のあるガラス風スタイル */
.three .open-buttons .btn {
  background: rgba(14, 18, 36, 0.72);
  color: #e5e7eb;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.18);
  max-width: min(42vw, 320px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateY(-4px);
  opacity: 0;
  animation: openButtonsIn 220ms ease forwards;
}
.three .open-buttons .btn:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.5);
}
.three .open-buttons .btn:active {
  transform: translateY(0) scale(1);
}

@keyframes openButtonsIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* トースト */
.three .toasts {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.three .toasts .toast {
  background: rgba(17, 24, 39, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.three .toasts .toast.show {
  opacity: 1;
  transform: translateY(0);
}
.three #menu {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  color: #e5e7eb;
  background: rgba(14, 18, 36, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 10px 12px;
  border-radius: 10px;
  display: none;
  min-width: 260px;
  backdrop-filter: blur(4px);
}
.three #menu h4 {
  margin: 0 0 6px 0;
  color: #fff;
}
.three #menu .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
}
.three #menu input[type="range"] {
  width: 140px;
}
.three #menu select {
  width: 140px;
}
.three #menu input[type="text"] {
  width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #0b1020;
  color: #e5e7eb;
}
.three #searchLimitValue {
  min-width: 2ch;
  text-align: right;
}
.three #menu .menu-section + .menu-section {
  border-top: 1px solid rgba(99, 102, 241, 0.25);
  padding-top: 6px;
  margin-top: 8px;
}
.three #menu .row > span:first-child {
  flex: 0 0 90px;
  color: #cbd5e1;
  font-size: 12px;
}
.three #menu .checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
}
.three .btn.small {
  padding: 4px 8px;
  font-size: 12px;
}
.three #menu .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  background: rgba(17, 24, 39, 0.55);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #374151;
}
.three .modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.6);
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* オーバーレイは透過し、外側でワールド操作可 */
}
.three .modal .box {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 16px 18px;
  width: min(92vw, 540px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  pointer-events: auto; /* モーダル本体は操作可能 */
}
.three .modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.three .btn {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.three .btn.secondary {
  background: #374151;
}
.three input[type="text"],
.three select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #0b1020;
  color: #e5e7eb;
}

/* ===== スレッド ウィンドウ（複数） ===== */
.thread-windows {
  position: fixed;
  inset: 0;
  pointer-events: none; /* 背景のクリックは通す。各ウィンドウ内のみイベント有効 */
  z-index: 21;
}
.thread-window {
  position: absolute;
  top: 60px;
  left: 60px;
  width: 420px;
  height: 70vh;
  min-width: 320px;
  min-height: 320px;
  max-width: 96vw;
  max-height: 92vh;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  pointer-events: auto; /* 自身は受ける */
}
.thread-window .titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  cursor: move;
  user-select: none;
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
}
.thread-window .titlebar h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.thread-window .actions {
  display: flex;
  gap: 6px;
}
.thread-window .actions .btn {
  padding: 6px 10px;
  font-size: 12px;
}
.thread-window iframe {
  flex: 1;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #fff;
  margin: 8px;
}
.thread-window .resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: se-resize;
  background: linear-gradient(
    135deg,
    transparent 50%,
    rgba(255, 255, 255, 0.35) 50%
  );
  border-bottom-right-radius: 12px;
}
