:root {
  --bg: #000;
  --bg-panel: #16181c;
  --border: #2f3336;
  --text: #e7e9ea;
  --text-dim: #71767b;
  --accent: #d4a24e;
  --accent-text: #000;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }

.shell {
  display: flex;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
}

/* 左ペイン */
.pane-left {
  width: 240px;
  flex-shrink: 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-size: 22px; font-weight: 700; padding: 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 9999px;
  font-size: 18px;
}
.nav-item:hover { background: var(--bg-panel); }
.nav-item.active { font-weight: 700; }
.nav-item.disabled { color: var(--text-dim); cursor: default; }
.nav-item .icon { font-size: 22px; width: 26px; text-align: center; }
.post-button {
  margin-top: 12px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 9999px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  display: block;
}

/* 中央ペイン */
.pane-center {
  flex: 1;
  max-width: 600px;
  min-height: 100vh;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.page-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.composer { padding: 16px; border-bottom: 1px solid var(--border); }
.composer textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  resize: none;
  outline: none;
}
.composer-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; }
.composer-actions .button-primary { padding: 8px 20px; font-size: 15px; }
.composer-attach { cursor: pointer; font-size: 20px; margin-right: auto; }
.composer-attach input[type="file"] { font-size: 12px; color: var(--text-dim); max-width: 220px; }

/* 投稿画像 */
.post-images { display: grid; gap: 4px; margin-top: 8px; border-radius: 12px; overflow: hidden; }
.post-images.cols-1 { grid-template-columns: 1fr; }
.post-images.cols-2 { grid-template-columns: 1fr 1fr; }
.post-images img { width: 100%; height: 100%; max-height: 400px; object-fit: cover; display: block; }
.empty-state { padding: 48px 32px; color: var(--text-dim); text-align: center; }

/* アバター（既定: 色相ハッシュ + 頭文字） */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: hsl(var(--h, 210), 45%, 40%);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  text-decoration: none;
}
.avatar-sm { width: 40px; height: 40px; font-size: 18px; }
img.avatar { object-fit: cover; background: var(--bg-panel); }
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 40px;
  border: 4px solid var(--bg);
  margin-top: -48px;
}

/* プロフィール（X 型: バナー + 重なるアバター + タブ） */
.profile-topbar { display: flex; align-items: center; gap: 20px; }
.topbar-back { font-size: 20px; }
.topbar-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.topbar-sub { color: var(--text-dim); font-size: 13px; font-weight: 400; }
.profile-banner {
  height: 160px;
  background: linear-gradient(120deg, hsl(var(--h, 210), 45%, 28%), hsl(calc(var(--h, 210) + 60), 45%, 38%));
  background-size: cover;
  background-position: center;
}
.profile-card { padding: 12px 16px 4px; }
.profile-avatar-row { display: flex; justify-content: space-between; align-items: flex-start; }
.profile-action { padding-top: 8px; }
.profile-action .button-primary, .profile-action .button-secondary { padding: 8px 18px; font-size: 14px; }
.profile-name { font-size: 20px; margin: 8px 0 0; }
.profile-handle { color: var(--text-dim); margin: 0 0 8px; }
.profile-bio { margin: 8px 0; }
.profile-meta { color: var(--text-dim); font-size: 14px; margin: 8px 0 4px; }
.profile-stats { color: var(--text-dim); font-size: 14px; margin: 4px 0 8px; }
.profile-stats b { color: var(--text); font-weight: 700; }
.profile-tabs { display: flex; border-bottom: 1px solid var(--border); }
.profile-tabs .tab {
  flex: 1;
  text-align: center;
  padding: 14px 0 10px;
  color: var(--text-dim);
  font-size: 15px;
  border-bottom: 3px solid transparent;
}
.profile-tabs .tab.active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--accent);
}
.profile-tabs .tab.disabled { cursor: default; opacity: 0.5; }
.profile-tabs .tab:not(.disabled):hover { background: var(--bg-panel); }

/* 設定フォーム */
.settings-form { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.settings-form label { display: flex; flex-direction: column; gap: 6px; color: var(--text-dim); font-size: 14px; }
.settings-form input, .settings-form textarea {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
}
.form-error { padding: 12px 16px; color: #f4212e; }
.settings-check { flex-direction: row !important; align-items: center; gap: 8px !important; }

/* 左ナビのログアウト */
.logout-form { margin-top: auto; }
.nav-button {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 18px;
  font-family: inherit;
}

/* 投稿カード */
.post { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }
.post-main { flex: 1; min-width: 0; }
.repost-note { width: 100%; color: var(--text-dim); font-size: 13px; padding-left: 30px; }
.repost-note a { font-weight: 700; }
.post-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post-name { font-weight: 700; }
.post-handle, .post-time { color: var(--text-dim); font-size: 14px; }
.press-label {
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
}
.post-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { margin-top: 4px; font-size: 13px; display: flex; gap: 16px; align-items: center; }
.action-link { color: var(--text-dim); padding: 6px 10px; margin-left: -10px; border-radius: 9999px; }
.action-link:hover { color: var(--accent); background: var(--bg-panel); }
.action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 9999px;
  font-family: inherit;
}
.action-btn:hover { background: var(--bg-panel); }
.action-btn:hover { color: var(--accent); }
.action-btn.is-liked { color: #f91880; }
.action-btn.is-reposted { color: #00ba7c; }
.action-btn.is-bookmarked { color: var(--accent); }
.action-btn.is-voted { color: var(--accent); font-weight: 700; }
.post-tombstone { color: var(--text-dim); font-style: italic; }

/* 掲示板 */
.board-category {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
  padding: 14px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.board-card { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.board-card:hover { background: var(--bg-panel); }
.board-name { font-size: 17px; font-weight: 700; }
.board-desc { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.board-desc-page { color: var(--text-dim); font-size: 14px; padding: 8px 16px; margin: 0; border-bottom: 1px solid var(--border); }
.board-meta { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.new-thread { border-bottom: 1px solid var(--border); }
.new-thread summary { padding: 12px 16px; cursor: pointer; color: var(--accent); font-weight: 700; }
.thread-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: baseline; }
.thread-row:hover { background: var(--bg-panel); }
.thread-title { font-weight: 700; min-width: 0; }
.thread-meta { color: var(--text-dim); font-size: 13px; flex-shrink: 0; }
.thread-heading { font-size: 18px; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.res { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.res-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; flex-wrap: wrap; }
.res-no { color: var(--accent); font-weight: 700; }
.res-name { font-weight: 700; }
.res-handle, .res-time { color: var(--text-dim); font-size: 13px; }
.res-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.res-aborn { color: var(--text-dim); font-style: italic; }
.res-vote { margin-left: auto; }
.res-votes { margin-left: auto; color: var(--text-dim); font-size: 13px; }
.res-anchor { color: var(--accent); }
.res:target { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* 固定ポスト */
.pinned-note {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 10px 16px 0;
}

/* 検索 */
.search-form { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-res { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-res:hover { background: var(--bg-panel); }
.search-res-thread { color: var(--text-dim); font-size: 13px; }
.search-res-body { margin-top: 4px; }

/* 通知 */
.nav-badge {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  margin-left: auto;
}
.notif { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-icon { font-size: 20px; width: 28px; text-align: center; }
.notif-body p { margin: 0; }
.notif-excerpt { display: block; color: var(--text-dim); font-size: 14px; margin: 4px 0; }
.notif-body .post-time { font-size: 12px; }

/* 右ペイン */
.pane-right {
  width: 350px;
  flex-shrink: 0;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.search-box {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.widget {
  background: var(--bg-panel);
  border-radius: 16px;
  margin-top: 16px;
  padding: 12px 16px;
}
.widget h2 { font-size: 18px; margin: 4px 0 8px; }
.widget .placeholder { color: var(--text-dim); font-size: 14px; }

/* 管理ページ */
.admin-section {
  border-bottom: 1px solid var(--border);
  padding: 16px;
}
.admin-section h2 { font-size: 16px; margin: 0 0 8px; }
.admin-section .placeholder { color: var(--text-dim); font-size: 14px; }
.invite-issued { font-size: 14px; margin: 0 0 8px; }
.invite-url { width: 100%; margin-bottom: 12px; font-family: monospace; }
.invite-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.invite-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-dim); }
.invite-form select, .invite-form input {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
.invite-form .button-primary { padding: 8px 20px; font-size: 14px; }
.invite-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invite-table th, .invite-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.invite-table th { color: var(--text-dim); font-weight: 600; }
.invite-table .button-secondary { padding: 4px 12px; font-size: 12px; white-space: nowrap; }

/* ランディング */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
}
.landing h1 { font-size: 40px; margin: 0; }
.landing .lead { color: var(--text-dim); max-width: 480px; }
.landing .actions { display: flex; gap: 12px; margin-top: 16px; }
.button-primary, .button-secondary {
  border-radius: 9999px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.button-primary { background: var(--accent); color: var(--accent-text); border: none; }
.button-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }

/* レスポンシブ（ui.spec §2.1） */
@media (max-width: 1279px) {
  .pane-left { width: 72px; padding: 8px; align-items: center; }
  .pane-left .label { display: none; }
  .nav-item { padding: 12px; }
  .post-button { width: 48px; height: 48px; padding: 0; }
}
@media (max-width: 1023px) {
  .pane-right { display: none; }
}
@media (max-width: 767px) {
  .shell { flex-direction: column; }
  .pane-left {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: auto;
    height: 56px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 0;
    z-index: 10;
  }
  .brand, .post-button { display: none; }
  .pane-center { max-width: 100%; border: none; padding-bottom: 64px; }
}
