/* ======================================================================
   board.css | 掲示板ページ固有
   - 新規投稿フォーム & スレッド表示
====================================================================== */

.board {
  padding: var(--space-7);
}

/* 新規投稿フォーム */
.new-post-form {
  background: #101010;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  margin-bottom: var(--space-10);
}

.new-post-form h3 {
  margin: 0 0 var(--space-5) 0;
  font-size: var(--fz-18);
}

.new-post-form textarea {
  width: 100%;
  height: 100px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: var(--space-5);
  font-size: var(--fz-16);
  resize: vertical;
  margin-bottom: var(--space-5);
  box-sizing: border-box;
}

.new-post-form .form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.new-post-form .name-input {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fz-14);
  width: 150px;
  outline: none;
}

.new-post-form button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fz-15);
  cursor: pointer;
  transition: background .2s;
}

.new-post-form button:hover {
  background: var(--color-hover);
}

/* スレッド一覧（旧UI用） */
.thread {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-7) 0;
}

.thread:last-child {
  border-bottom: none;
}

.thread-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--fz-14);
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.thread-header .post-number {
  font-weight: 600;
  color: #d9d9d9;
}

.thread-header .post-author {
  font-weight: 600;
  color: var(--color-primary);
}

.thread-body {
  font-size: var(--fz-16);
  line-height: 1.5;
  color: #d9d9d9;
  margin: 0;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.thread-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.thread-link:hover {
  background: #111;
  border-radius: var(--radius-sm);
}

/* ==========================
   Tabs / List / Ask UI
========================== */

.qa-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
}

.qa-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  padding: 0 12px;
  overflow-x: auto;
	height:48px;
}

.qa-tab {
  flex: 1 0 33.33%;
  display: grid;
  place-items: center;
  height: 46px;
  font-weight: 700;
  color: #dfe3e7;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.qa-tab[aria-selected="true"] {
  color: #fff;
}

.qa-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: #fff;
}

.qa-error {
  margin: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 100, 100, .45);
  background: #121416;
  color: #ffd2d2;
}

/* LIST CARD */
.q-list-card {
  display: block;
  background: #121416;
  border: 1px solid #3a3f45;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 12px;
  color: inherit;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
  word-break: break-word;
  max-width: calc(100% - 24px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.q-list-card:hover {
  background: #14171a;
  border-color: #46505a;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  min-width: 0;
  padding-bottom: 2px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

/* ✅ Avatar（枠はラッパーに一本化：外枠が楕円になるのを根絶） */
.avatar-wrap {
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #fff;
  flex: 0 0 40px;
  display: inline-block;
}

.avatar-wrap>img.avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border: none !important;
  /* 枠は wrap 側 */
  border-radius: 0 !important;
  /* wrap が丸 */
}

.avatar-wrap>.avatar-dummy {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
}

/* Text */
.head-text {
  flex: 1;
  min-width: 0;
}

.name {
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  line-height: 1.2;
  display: block;
}

.name-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.under-meta {
  color: var(--color-muted);
  font-size: 12px;
  margin-top: 2px;
}

.meta-sep {
  margin: 0 6px;
  opacity: .7;
}

.meta-date {
  color: var(--color-muted);
  font-size: 12px;
}

.thread-status {
  position: absolute;
  right: 0;
  top: 0;
  transform: translateY(-4px);
  padding: 4px 10px;
  border: 1px solid #4a5561;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: #0f0f0f;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .04);
  white-space: nowrap;
}

.thread-status.pending {
  background: rgba(255, 60, 60, .10);
  color: #ff9b9b;
  border-color: rgba(255, 60, 60, .35);
}

.thread-status.answered {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .25);
}

.thread-status.done {
  background: rgba(80, 160, 255, .12);
  color: #93c5fd;
  border-color: rgba(80, 160, 255, .35);
}

.q-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin: 10px 0 8px;
  line-height: 1.35;
}

.q-body {
  font-size: 14px;
  color: #d0d3d6;
  line-height: 1.8;
  margin: 0;
}

.cut-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ASK */
.ask-panel {
  margin: 12px;
  padding: 14px;
  border: 1px solid #3a3f45;
  border-radius: 12px;
  background: #121416;
}

.ask-panel label {
  display: block;
  color: #e5e7eb;
  font-size: 13px;
  margin-top: 10px;
}

.ask-panel select,
.ask-panel input,
.ask-panel textarea {
  width: 100%;
  margin-top: 6px;
  background: #0f0f0f;
  color: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
}

.ask-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.ask-actions button {
  background: #fff;
  color: #111;
  border: none;
  padding: 10px 14px;
  border-radius: 9999px;
  font-weight: 700;
  cursor: pointer;
}

.ask-actions .ghost {
  background: transparent;
  color: #fff;
  border: 1px solid #3a3f45;
}

/* ====== Mobile ======
   ここで “小さく見える” のを抑える（文字を下げすぎない / padding減らしすぎない） */
@media (max-width:600px) {

  /* カードが小さく見える原因になりやすい max-width を解除 */
  .q-list-card {
    max-width: none;
    padding: 16px 16px;
    margin: 12px 12px;
  }

  /* avatar */
  .avatar-wrap {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }

  /* 文字サイズを落としすぎない */
  .q-title {
    font-size: 17px;
  }

  .q-body {
    font-size: 14px;
  }

  .name {
    font-size: 13px;
  }

  .role-badge {
    font-size: 10px;
    padding: 3px 7px;
  }

  /* バッジ位置が窮屈なら */
  .thread-status {
    transform: translateY(0);
  }
}

/* =========================================
   Light mode fixes
========================================= */
:root[data-theme="light"] .qa-topbar {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

:root[data-theme="light"] .qa-tab {
  color: var(--color-muted);
}

:root[data-theme="light"] .qa-tab[aria-selected="true"] {
  color: var(--color-text);
}

:root[data-theme="light"] .qa-tab[aria-selected="true"]::after {
  background: var(--color-text);
}

:root[data-theme="light"] .q-list-card {
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: none;
}

:root[data-theme="light"] .q-list-card:hover {
  background: rgba(2, 6, 23, .03);
  border-color: var(--color-border);
}

:root[data-theme="light"] .name {
  color: var(--color-text);
}

:root[data-theme="light"] .under-meta,
:root[data-theme="light"] .meta-date {
  color: var(--color-muted);
}

:root[data-theme="light"] .q-title {
  color: var(--color-text);
}

:root[data-theme="light"] .q-body {
  color: var(--color-text);
}

:root[data-theme="light"] .role-badge {
  border-color: rgba(2, 6, 23, .18);
  background: rgba(2, 6, 23, .06);
  color: var(--color-text);
}

:root[data-theme="light"] .ask-panel {
  background: var(--color-surface);
  border-color: var(--color-border);
}

:root[data-theme="light"] .ask-panel label {
  color: var(--color-text);
}

:root[data-theme="light"] .ask-panel select,
:root[data-theme="light"] .ask-panel input,
:root[data-theme="light"] .ask-panel textarea {
  background: var(--color-input-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

:root[data-theme="light"] .ask-actions .ghost {
  color: var(--color-text);
  border-color: var(--color-border);
}

:root[data-theme="light"] .thread-status.answered {
  background: rgba(100, 116, 139, .12);
  color: #475569;
  border-color: rgba(100, 116, 139, .28);
}