/* ============================
   全体レイアウト（盤面ツール）
============================ */

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background-color: #f5f5f5;
  color: #333;

  /* ★ 画面全体を縦flexにして footer を最下部へ */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================
   ヘッダー
============================ */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #283593;
  color: #fff;
  padding: 10px 16px;
  flex-shrink: 0; /* ヘッダーが縮まない */
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
}

/* ヘッダー右側（ボタン＋バージョン） */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-label {
  font-size: 12px;
  opacity: 0.8;
}

/* ヘッダー右側ボタン共通デザイン */
.header-btn {
  display: inline-block;
  padding: 6px 12px;
  background: #4a90e2;
  color: #fff;
  border-radius: 5px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  font-weight: bold;
  white-space: nowrap;
}

.header-btn:hover {
  background: #3b78c4;
}

/* aタグもボタン風 */
.header-btn-link {
  text-decoration: none;
  line-height: 1.2;
}

/* ============================
   メイン
============================ */

.app-main {
  padding: 10px 16px 16px;

  /* ★ main を「残りの高さ全部」使わせる */
  flex: 1 1 auto;

  /* main 内も縦方向に積めるように */
  display: flex;
  flex-direction: column;

  /* 子要素の overflow が効くための定番 */
  min-height: 0;
}

/* ============================
   ツールバー
============================ */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.toolbar-left button,
.toolbar-right button {
  margin-right: 6px;
}

.toolbar button {
  padding: 6px 10px;
  font-size: 13px;
}

/* ============================
   コンテンツエリア
============================ */

.content {
  display: flex;
  gap: 12px;

  /* ★ footer を下に押しやすくする（main内で伸びる） */
  flex: 1 1 auto;

  /* 子要素のスクロール事故防止 */
  min-height: 0;
}

/* テーブル側 */
.table-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px;

  /* ここがスクロール領域 */
  overflow: auto;

  /* contentが伸びても中がスクロールできるように */
  min-height: 0;
}

/* ============================
   盤面テーブル
============================ */

#boardTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#boardTable th,
#boardTable td {
  border: 1px solid #ccc;
  padding: 4px;
  font-size: 13px;
}

#boardTable thead {
  background: #e3f2fd;
}

#boardTable th {
  text-align: center;
}

/* 列幅調整 */
#boardTable th:nth-child(1),
#boardTable td:nth-child(1) {
  width: 72px; /* キル / 吊り */
}

#boardTable th:nth-child(2),
#boardTable td:nth-child(2) {
  width: 110px; /* 名前 */
}

/* 編集可能セル */
.editable {
  cursor: text;
}

.editable:focus {
  outline: 2px solid #64b5f6;
}

/* ステータスセル */
.status-cell {
  text-align: center;
  white-space: nowrap;
}

.status-cell label {
  font-size: 11px;
  margin-right: 2px;
}

/* 選択行 */
tr.selected-row {
  outline: 2px solid #42a5f5;
}

/* 死亡行（キル / 吊り） */
tr.dead-row td {
  background: #dddddd !important;
  color: #666666;
}

/* 役職セルの色（自動） */
.role-cell.innocent {
  background: #4caf50;
  color: #fff;
}
.role-cell.wolf {
  background: #e53935;
  color: #fff;
}
.role-cell.third {
  background: #1e88e5;
  color: #fff;
}
.role-cell.both {
  background: #fb8c00;
  color: #fff;
}

/* ============================
   役職パネル
============================ */

.role-panel {
  flex: 0 0 260px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 600px;
  overflow: auto;

  /* content内でスクロール可能に */
  min-height: 0;
}

.role-panel h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.role-panel-help {
  margin: 0 0 10px;
  font-size: 12px;
  color: #555;
}

.role-section {
  margin-bottom: 10px;
}

.role-title {
  margin: 4px 0;
  font-size: 13px;
}

.role-title.innocent { color: #2e7d32; }
.role-title.wolf     { color: #b71c1c; }
.role-title.third    { color: #1565c0; }
.role-title.both     { color: #ef6c00; }

.role-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.role-button {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: #fafafa;
  cursor: pointer;
}

.role-button:hover {
  background: #e3f2fd;
}

/* ============================
   名前セル用カラーパレット
============================ */

.color-palette {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.color-palette.hidden { display: none; }

.color-palette-inner {
  background: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 260px;
}

.color-palette-title {
  font-size: 13px;
  margin-bottom: 6px;
}

.color-palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: 6px;
  margin-bottom: 8px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #666;
  cursor: pointer;
}

.color-clear-button,
.color-close-button {
  font-size: 12px;
  padding: 4px 8px;
  margin-right: 4px;
}

/* ============================
   フッター（SNSを含めて最下部へ）
============================ */

.app-footer {
  background: #eeeeee;
  border-top: 1px solid #cccccc;
  font-size: 11px;
  color: #555;
  padding: 0;

  /* ★ main が短いときでも footer が一番下へ */
  margin-top: auto;

  flex-shrink: 0;
}

.footer-section {
  padding: 8px 12px;
}

/* 作者SNS ブロック */
.author-section {
  border-bottom: 1px solid #cccccc;
}

.author-section a {
  color: #3366cc;
  text-decoration: none;
}

.author-section a:hover {
  text-decoration: underline;
}

/* 非公式表記（notice-section） */
.notice-section {
  font-size: 10px;
  color: #777;
  line-height: 1.5;
  border-bottom: 1px solid #cccccc;
  background: #f2f2f2;
}

/* 下段のタイトル */
.bottom-section {
  text-align: left;
  font-weight: bold;
}

/* ============================
   モーダル（役職一覧 / 行動順 / 規約 等）
============================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 80%;
  max-width: 1100px;
  height: 80vh;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

#modal-title {
  font-size: 15px;
  font-weight: bold;
}

#modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#modal-close:hover {
  transform: scale(1.1);
}

.modal-body {
  border-top: 1px solid #eee;
  margin-top: 6px;
  padding-top: 8px;
  flex: 1;
  overflow: auto;
  font-size: 14px;
  line-height: 1.8;
}

/* iframeで役職一覧などを表示する場合 */
.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* モーダル表示中は画面全体のスクロールを止める */
body.modal-open {
  overflow: hidden;
}

/* ============================
   利用規約ボックス（必要なら）
============================ */

.terms-box {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  text-align: center;
}

.terms-text {
  font-size: 14px;
  margin-bottom: 10px;
  color: #444;
}

.terms-button {
  display: inline-block;
  padding: 8px 16px;
  background-color: #4a90e2;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
}

.terms-button:hover {
  background-color: #3b78c4;
}

/* ============================
   スマホ・狭い画面用
============================ */

@media (max-width: 900px) {
  .content {
    flex-direction: column;
  }

  .role-panel {
    flex: 1 1 auto;
    max-height: none;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .header-right {
    align-self: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

/* ============================
   管理画面：役職一覧テーブル用
   （roles_admin.php など）
============================ */

.roles-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.roles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.roles-table thead tr {
  background: #e0e7ff;
}

.roles-table th,
.roles-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #ccc;
  vertical-align: top;
}

.roles-table tbody tr:nth-child(even) { background: #f7f7f7; }
.roles-table tbody tr:nth-child(odd)  { background: #ffffff; }

.roles-table tbody tr:hover {
  background: #e3f2fd;
}

.role-row { color: #222222 !important; }

.role-row.faction-innocent { background: rgba(120, 200, 120, 0.25) !important; }
.role-row.faction-wolf     { background: rgba(255, 120, 120, 0.25) !important; }
.role-row.faction-both     { background: rgba(255, 190, 120, 0.25) !important; }
.role-row.faction-third    { background: rgba(140, 180, 255, 0.25) !important; }

.role-row:hover { filter: brightness(0.95); }

.role-id-cell {
  color: #666;
  text-align: center;
  white-space: nowrap;
}

.role-main-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-main-bottom {
  margin-top: 4px;
}

.role-main-bottom,
.role-desc,
.roles-table .desc,
.description-cell {
  font-size: 11px;
  color: #222 !important;
  line-height: 1.4;
}

.role-sort-cell,
.role-updated-cell,
.role-actions-cell {
  font-size: 11px;
  white-space: nowrap;
}

.role-faction-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 999px;
  color: #fff;
  line-height: 1.4;
}

.badge-faction-innocent { background: #4caf50; }
.badge-faction-wolf     { background: #e53935; }
.badge-faction-both     { background: #fb8c00; }
.badge-faction-third    { background: #1e88e5; }
.badge-faction-unknown  { background: #757575; }

/* ============================
   アクセスログテーブル用
============================ */

.access-table {
  width: 100%;
  border-collapse: collapse;
}

.access-table thead th {
  padding: 6px 8px;
  font-size: 12px;
  vertical-align: top;
  border-bottom: 1px solid #ccc;
}

.access-table tbody td {
  padding: 6px 8px;
  font-size: 12px;
  vertical-align: top;
}

/* 行ベースの境界線 */
.access-table tbody tr + tr td {
  border-top: 1px solid #ccc;
}

/* 列ごとの縦線 */
.access-table th,
.access-table td {
  border-left: 1px solid #eee;
}
.access-table th:first-child,
.access-table td:first-child {
  border-left: none;
}


/* ============================
   管理ログイン画面（login.php）
============================ */

.login-body {
  min-height: 100vh;
  margin: 0;
  font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: #222;
  display: flex;
  flex-direction: column;

  /* 背景をちょっと“ちゃんとしてる感”に */
  background:
    radial-gradient(900px 400px at 20% 10%, rgba(40, 53, 147, 0.18), transparent 60%),
    radial-gradient(800px 380px at 90% 40%, rgba(74, 144, 226, 0.18), transparent 60%),
    linear-gradient(180deg, #f6f7fb, #eef1f6);
}

.login-wrapper {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
}

.login-card {
  width: 100%;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.15);
  padding: 18px 18px 14px;
  backdrop-filter: blur(10px);
}

.login-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 12px;
}

.login-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.3px;
  color: #1f2a6b; /* #283593 より少し落ち着かせる */
}

.login-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #556;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #283593, #4a90e2);
  box-shadow: 0 8px 20px rgba(40, 53, 147, 0.25);
  white-space: nowrap;
}

.login-badge::before {
  content: "●";
  font-size: 10px;
  opacity: 0.9;
}

.login-description {
  margin: 10px 0 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #334;
  background: #f6f8ff;
  border: 1px solid rgba(40, 53, 147, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
}

.login-description code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 6px;
}

.login-description small {
  display: block;
  margin-top: 6px;
  color: #667;
}

.login-error {
  background: rgba(229, 57, 53, 0.10);
  border: 1px solid rgba(229, 57, 53, 0.28);
  color: #b71c1c;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin: 8px 0 12px;
}

.login-form-group {
  margin: 10px 0;
}

.login-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #223;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease;
}

.login-input:focus {
  border-color: rgba(74, 144, 226, 0.75);
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.18);
}

.login-button-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #283593;
  background: rgba(40, 53, 147, 0.06);
  border: 1px solid rgba(40, 53, 147, 0.16);
  font-weight: 700;
  font-size: 13px;
}

.btn-ghost:hover {
  background: rgba(40, 53, 147, 0.10);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  background: linear-gradient(90deg, #283593, #4a90e2);
  box-shadow: 0 10px 24px rgba(40, 53, 147, 0.25);
  min-width: 120px;
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(1px);
}

.login-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.login-links {
  font-size: 12px;
  color: #556;
}

.login-links a {
  color: #3366cc;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-version {
  font-size: 11px;
  color: #667;
}

/* スマホ時の詰め */
@media (max-width: 480px) {
  .login-card {
    padding: 16px 14px 12px;
    border-radius: 12px;
  }
  .login-button-row {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .btn-primary, .btn-ghost {
    width: 100%;
    justify-content: center;
  }
}

.seo-intro{
      max-width: 980px;
      margin: 32px auto;
      padding: 16px 20px;
      font-size: 13px;
      line-height: 1.75;
      color: #1f2937;
      background: #f8f9fb;
      border: 1px solid #e3e6ee;
      border-radius: 12px;
    }
    .seo-intro h1{
      font-size: 16px;
      margin: 0 0 8px;
      font-weight: 800;
    }
    .seo-intro h2{
      font-size: 14px;
      margin: 12px 0 6px;
      font-weight: 700;
    }
    .seo-intro ul{
      margin: 0 0 8px 1.2em;
      padding: 0;
    }
    .seo-intro li{ margin: 2px 0; }
    .seo-intro a{
      color: #2563eb;
      text-decoration: underline;
    }

    

    /* author-section を2カラム化 */
.author-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

/* 左：作者SNS */
.author-left {
  font-size: 11px;
  line-height: 1.6;
}

/* 右：バナー */
.author-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

/* バナーははみ出さない */
.author-right .snow-bh {
  max-width: 100%;
}

/* スマホ時は縦並び */
@media (max-width: 600px) {
  .author-section {
    grid-template-columns: 1fr;
  }

  .author-right {
    justify-content: flex-start;
    margin-top: 6px;
  }
}

.seo-lead-wrap {
  margin: 14px 12px 10px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
}

.seo-lead-summary {
  padding: 10px 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  list-style: none;
}

.seo-lead-summary::-webkit-details-marker {
  display: none; /* デフォルトの三角を消す */
}

.seo-lead {
  padding: 0 12px 10px;
  line-height: 1.7;
}
/* 全体ボックス */
.seo-box {
  margin: 14px 12px 10px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  overflow: hidden; /* 角丸をきれいに */
}

/* タイトル（クリック領域） */
.seo-box-title {
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  background: #fafafa;
  border-bottom: 1px solid #e6e6e6;
}

/* デフォルトの三角を消す */
.seo-box-title::-webkit-details-marker {
  display: none;
}

/* 開閉アイコン（CSSだけ） */
.seo-box-title::after {
  content: "▲";
  float: right;
  font-size: 12px;
  opacity: 0.7;
}

/* 閉じているとき */
.seo-box:not([open]) .seo-box-title::after {
  content: "▼";
}

/* 中身 */
.seo-box-body {
  padding: 10px 12px;
  line-height: 1.7;
}



/* 名前セルを角丸の「チップ」風に */
#boardTable td.name-cell{
  position: relative;
  padding: 6px 10px;
  border-radius: 12px;
  border: 2px solid rgba(0,0,0,.18);
  background-clip: padding-box;
  font-weight: 700;
}

/* 選択行でも枠が見えるように */
#boardTable tr.selected-row td.name-cell{
  border-color: rgba(0,0,0,.28);
}

/* 死亡行のときの視認性（任意） */
#boardTable tr.dead-row td.name-cell{
  border-color: rgba(0,0,0,.10);
}

/* ドロップ先のハイライト */
#boardTable td.drop-hover{
  outline: 2px dashed rgba(0,0,0,.35);
  outline-offset: -3px;
}

/* 名前セル：ドラッグ取っ手 */
#boardTable td.name-cell{ position:relative; padding-left:28px; }
#boardTable td.name-cell .drag-handle{
  position:absolute; left:8px; top:50%; transform:translateY(-50%);
  cursor:grab; opacity:.75; user-select:none;
}
#boardTable td.name-cell .drag-handle:active{ cursor:grabbing; opacity:1; }

/* ドロップ強調 */
#boardTable td.drop-hover{ outline:2px dashed rgba(0,0,0,.35); outline-offset:-3px; }

/* 〇日目セル用：タグ表示（角丸矩形＋色） */
#boardTable .day-pill{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-weight:700;
  line-height:1.2;
  background:#eee;   /* 色が無い時のデフォ */
  color:#111;
}


/* day-pill が無い/弱い場合の保険（結果にも同じ見た目が乗る） */
/* 角丸pill（1日目＆結果共通） */
.day-pill,
.result-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.15);
  background:#fff;
  font-size:12px;
  line-height:1.6;
  vertical-align:middle;
  user-select:none;
}

/* ドロップ中の強調 */
.drop-hover{
  outline:2px dashed rgba(0,0,0,.25);
  outline-offset:-2px;
}
