/* ==========================================================================
   1. 基本設定
   ========================================================================== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: auto; /* プルリフレッシュを有効化 */
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #F9F9F9;
}

.app {
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 420px; /* モバイルサイズ固定 */
}

/* ==========================================================================
   2. ヘッダー（3カラム構成）
   ========================================================================== */
.header {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  flex-shrink: 0;
  min-height: 60px;
}

/* 左：戻るボタン */
.header-left {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.back {
  font-size: 20px;
  cursor: pointer;
  color: #F9F9F9;
}

/* 中央：対局名（センター） */
.header-center {
  flex: 2;
  display: flex;
  justify-content: center;
  text-align: center;
}

.title-main {
  font-size: 16px;
  font-weight: bold;
  line-height: 1.3;
  word-break: break-all;
}

/* 右：対局者 */
.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.players-info {
  font-size: 11px;
  text-align: left;
}

.player-row {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.stone {
  margin-right: 4px;
  font-size: 12px;
}

/* ==========================================================================
   3. 碁盤エリア
   ========================================================================== */
.board {
  padding: 0 16px 10px 16px; /* 上を0にしてヘッダーと密着 */
  flex-shrink: 0;
}

.board img {
  width: 100%;
  border-radius: 6px;
}

/* ==========================================================================
   4. 下部エリア（タブ・コンテンツ）
   ========================================================================== */
.bottom {
  background: #ffffff; /* コメント欄と同じ純白に統一 */
  color: #000;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabs {
  display: flex;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom: 1px solid #eee;
  background-color: #ffffff;
  color: #000;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 15px;
  font-size: 15px;
  cursor: pointer;
  font-weight: normal;
}

.tab.active {
  border-bottom: 2px solid #000;
  font-weight: 700;
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  background-color: #ffffff;
  padding: 10px 20px;
  padding-bottom: 140px; /* 投稿フォーム＋ナビ分の見切れ防止 */
  -webkit-overflow-scrolling: touch;
}

.tab-content.active {
  display: block;
}

/* ==========================================================================
   5. コメント・チップ・ギミック
   ========================================================================== */
.comment {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* スライドのアニメーション */
  margin-left: 20px; /* ドット表示とスライド用の余白 */
}

/* 現在の手数と一致した時のスタイル */
.comment.active-move {
  transform: translateX(-15px); /* 左にずらす */
}

.comment.active-move::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background-color: #000;
  border-radius: 50%;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.name {
  font-size: 13px;
  font-weight: normal; /* 太文字解除 */
}

.text {
  margin-top: 5px;
  font-size: 13px;
  color: #333;
}

/* @手数チップ */
.move-chip {
  display: inline-block;
  background-color: #000;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 6px;
  cursor: pointer;
  font-weight: bold;
}

.like {
  font-size: 12px;
  color: #888;
}

/* ==========================================================================
   6. 対局情報タブ
   ========================================================================== */
.info-list {
  background-color: #ffffff;
  padding: 10px 0;
}

.info-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  width: 90px;
  color: #999999;
  font-size: 14px;
  flex-shrink: 0;
}

.info-value {
  color: #333333;
  font-size: 15px;
  font-weight: bold;
}

/* ==========================================================================
   7. 入力エリア・フッターナビ
   ========================================================================== */

/* ==========================================================================
   追加：浮遊ボタン（FAB）と入力エリアの挙動
   ========================================================================== */

/* 浮遊するメッセージアイコン */
.fab-message {
  position: fixed;
  bottom: 80px; /* ナビ(60px)の上に配置 */
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: #000;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 110;
  /* 立体感と影 */
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  transition: transform 0.2s, background-color 0.2s;
}

/* タップ時の沈み込み演出 */
.fab-message:active {
  transform: scale(0.9);
  background-color: #333;
}

@keyframes slideUp {
  /*
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
  */
}

/* 閉じるボタン（×） */
#close-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 15px;
  color: #000;
  font-size: 30px;
}

/* 投稿ボタン */
.send-btn {
  padding: 8px 16px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  height: 40px;
  cursor: pointer;
}

/* --- 以下の部分を style.css の該当箇所と差し替え、または末尾に追加 --- */

/* 入力エリア（z-indexを高くし、以前の重複定義を削除） */
.input-area {
  display: none;
  position: sticky;
  bottom: 0px;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  min-height: 60vh; /* 以前の60pxより少し高く */
  background: #ffffff;
  border-top: 1px solid #eee;
  padding: 15px;
  gap: 8px;
  z-index: 140; /* 盤(130)より上に設定 */
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.comment-area {
  display: flex;
  align-items: flex-end;
}

body.is-typing .board-wrapper {
  height: 50vh;
}

/* 盤の縮小（transitionを追加して滑らかに） */
body.is-typing .board {
  /*position: fixed;
  top: 20px;
  /* bottom: 135px;  */
  /* left: 0; */
  /* right: 0; */
  z-index: 130;
  background: #000;
  padding: 10px;
  transform: scale(0.85); 
  margin-bottom: calc(-15%);
  transform-origin: top center;
  box-shadow: 0 -5px 15px rgba(0,0,0,0.5);
  border-radius: 10px 10px 0 0;
  transition: all 0.3s ease; /* 盤が降りてくるアニメ */
}

body.is-typing .app{
  height: auto;
}

.comment-area textarea {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
  line-height: 20px;
  height: 40px;
  margin-right: 10px;
  resize: none;        /* 手動リサイズ禁止 */
  overflow: hidden;    /* スクロールバー消す */
  max-height: 60px;   /* 上限（重要） */
}

.comment-area button {
  padding: 8px 16px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
}

/* ==========================================================================
   入力モード時の碁盤レイアウト（縮小版）
   ========================================================================== */

/* 盤が浮いている間、背後のコンテンツ（元の位置の残像など）を整理 */
body.is-typing .header {
  opacity: 0.3; /* 完全に消さず、少し透かす程度に */
  pointer-events: none;
}

/* 修正後 */
body.is-typing .bottom {
  background-color: #000000; /* ここを黒に固定 */
}

/* ついでに中のコメントも見えないようにしたいなら、透過も合わせると良いです */
body.is-typing .bottom .tab-content {
  opacity: 0; /* 入力中は中身を消して真っ黒に見せる */
}

/* 入力欄自体は常に最前面 */
body.is-typing .input-area {
  z-index: 140;
}

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 60px;
  background: #fff;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 101;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #444;
  cursor: pointer;
}

.nav-item i {
  font-size: 18px;
  margin-bottom: 2px;
}



/* ==========================================================================
   8. WGo.js プレイヤースタイル調整
   ========================================================================== */
.wgo-ctrlgroup.wgo-ctrlgroup-left,
.wgo-ctrlgroup.wgo-ctrlgroup-right,
.wgo-infobox {
  display: none !important;
}

.wgo-player-control {
  border-top: 1px solid #444 !important;
  background-color: #000 !important;
}

.wgo-player-control .wgo-button {
  color: #E0E0E0 !important;
}

input[type="text"].wgo-player-mn-value {
  background-color: initial !important;
  border: none;
  color: #E0E0E0 !important;
  font-size: 16px;
  cursor: default;
  pointer-events: none;
}

button.wgo-button {
  border: none;
  background: none;
  width: 44px;
  height: 44px;
}

.wgo-control-wrapper {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
}

.wgo-ctrlgroup.wgo-ctrlgroup-control {
  display: flex !important;
  justify-content: space-around !important;
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  min-height: 44px; /* ボタンの高さに合わせる */
  align-items: center;
}

/* ==========================================================================
   追加スタイル（Phase 1）
   ========================================================================== */

.nav-active {
  color: #000 !important;
  font-weight: bold;
}

.header-icon {
  font-size: 18px;
  cursor: pointer;
  color: #F9F9F9;
  padding: 4px 8px;
}

/* 検索画面ヘッダー */
.header.search-header {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  height: auto;
}
.header-search-title {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #F9F9F9;
}
.search-bar-wrapper {
  position: relative;
  width: 100%;
}
.search-bar-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 14px;
}
.search-input {
  width: 100%;
  height: 40px;
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 12px 0 38px;
  font-size: 14px;
  color: #000;
  outline: none;
}
.bottom.search-results {
  background: #fff;
  color: #000;
  overflow-y: auto;
  flex: 1;
  padding: 10px 0 80px;
}

/* カード */
.post-card {
  background: transparent;
  color: #000;
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.post-card:last-child { border-bottom: none; }
.post-card:active { background: #f9f9f9; }

.goban-mini {
  width: 85px;
  height: 85px;
  background-color: #e4a853;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.15) 1px, transparent 1px);
  background-size: 10% 100%, 100% 10%;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.post-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.post-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}
.post-title {
  font-size: 13px;
  font-weight: bold;
  line-height: 1.4;
  color: #000;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tag-item {
  background: #000;
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
}
.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.post-date, .post-meta {
  font-size: 10px;
  color: #666;
}

/* フォーム */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #333;
  margin-bottom: 6px;
}
.required { color: #e53e3e; }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #000;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}
.form-input:focus { border-color: #000; }
.form-textarea {
  height: 120px;
  resize: vertical;
  font-family: monospace;
  font-size: 12px;
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-half { flex: 1; }
.radio-group {
  display: flex;
  gap: 20px;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}
.submit-btn {
  width: 100%;
  height: 48px;
  font-size: 15px;
  margin-top: 8px;
}

/* いいね */
.like {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  min-width: 28px;
}
.like.liked { color: #e53e3e; }
.like i { font-size: 16px; }
