/* 人狼テーブル試作 — 仮デザイン。ダークな円卓の雰囲気だけ意識している。 */
:root {
  --bg: #14161f;
  --panel: #1f2333;
  --panel2: #262b40;
  --text: #e8eaf2;
  --muted: #9aa1b5;
  --accent: #e8b34b;
  --danger: #e05d5d;
  --ok: #5dc98a;
  --wolf: #b0526b;
  --seer: #5279b0;
  --guard: #52b08a;
  --villager: #8a8fa3;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  /* アプリシェル：ヘッダー／スクロールする本文／下部メニューを
     縦に積み、メニューは本文に重ねない（固定メニューがボタンを
     隠して押せなくなる事故を構造的に防ぐ） */
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.app-header { flex: none; }
#app-main { flex: 1; overflow-y: auto; min-height: 0; }
.hidden { display: none !important; }
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid #000;
}
.app-header h1 { font-size: 18px; margin: 0; }
.badge { background: var(--accent); color: #222; font-size: 11px; padding: 2px 6px; border-radius: 8px; vertical-align: middle; }
.header-user { color: var(--muted); font-size: 13px; }
.screen { padding: 16px; max-width: 1080px; margin: 0 auto; }
.card {
  background: var(--panel); border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.card h2 { margin-top: 0; }
label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; padding: 10px; margin-top: 4px; border-radius: 8px;
  border: 1px solid #3a405c; background: var(--panel2); color: var(--text); font-size: 15px;
}
button {
  background: var(--panel2); color: var(--text); border: 1px solid #3a405c;
  padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
button.primary { background: var(--accent); color: #222; border: none; font-weight: bold; }
button.small { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.active { background: var(--accent); color: #222; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.status { color: var(--muted); font-size: 13px; min-height: 1em; }
hr { border: none; border-top: 1px solid #3a405c; margin: 16px 0; }

.radio-row label { display: inline-block; margin: 6px 16px 6px 0; color: var(--text); font-size: 14px; }
.public-room-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed #333a55; font-size: 14px;
}
.lobby-count { font-weight: bold; color: var(--accent); }
.lobby-players { list-style: none; padding: 0; margin: 8px 0; }
.lobby-players li { padding: 3px 0; font-size: 14px; border-bottom: 1px dashed #333a55; }

.room-topbar {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
}
.phase-banner { font-size: 18px; font-weight: bold; }
.phase-timer { color: var(--accent); font-variant-numeric: tabular-nums; }
.winner-banner {
  background: var(--accent); color: #222; font-weight: bold; text-align: center;
  padding: 12px; border-radius: 12px; margin-bottom: 12px; font-size: 18px;
}

.room-main { display: flex; gap: 16px; flex-wrap: wrap; }
.table-wrap {
  position: relative; width: min(92vw, 540px); aspect-ratio: 1; flex: none;
  margin: 0 auto;
}
.table-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #2e4a3a 0%, #22392c 70%);
  border: 6px solid #4a3826;
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.seat {
  position: absolute; width: 84px; margin-left: -42px; margin-top: -42px;
  text-align: center;
}
.seat .avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto;
  background: var(--panel2); border: 3px solid var(--villager);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.seat.me .avatar { border-color: var(--accent); box-shadow: 0 0 10px #e8b34b88; }
.seat.dead { opacity: 0.45; filter: grayscale(1); }
.seat .seat-name { font-size: 11px; margin-top: 2px; word-break: break-all; }
.seat .seat-state { font-size: 10px; color: var(--danger); min-height: 1em; }

.side-panel { flex: 1; min-width: 280px; }
.role-card {
  border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--panel);
  border-left: 8px solid var(--villager);
}
.role-card.werewolf { border-left-color: var(--wolf); }
.role-card.seer { border-left-color: var(--seer); }
.role-card.bodyguard { border-left-color: var(--guard); }
.role-card h3 { margin: 0 0 6px; }
.role-card p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.action-panel { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.action-panel .action-title { width: 100%; font-weight: bold; }
.action-panel button.target { border-color: var(--accent); }
.event-log {
  background: var(--panel); border-radius: 12px; padding: 10px 14px;
  max-height: 220px; overflow-y: auto; font-size: 13px;
}
.event-log div { padding: 3px 0; border-bottom: 1px dashed #333a55; }

.chat-panel { margin-top: 16px; }
.chat-tabs { display: flex; gap: 8px; margin-bottom: 8px; }

/* 上級者モード LP風予告ページ（ロビーのモードタブ） */
.advanced-lp { padding: 8px 0 4px; }
.advanced-lp .lp-badge {
  display: inline-block; background: var(--accent); color: #222;
  font-size: 12px; font-weight: bold; padding: 2px 10px; border-radius: 10px; margin: 0;
}
.advanced-lp .lp-title { margin: 8px 0 4px; font-size: 22px; }
.advanced-lp .lp-catch { color: var(--muted); margin: 4px 0 12px; }
.advanced-lp .lp-roles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.advanced-lp .lp-role-card {
  background: var(--panel); border-radius: 12px; padding: 10px 12px;
  border-left: 8px solid var(--villager);
}
.advanced-lp .lp-role-art { font-size: 28px; text-align: center; padding: 6px 0; }
.advanced-lp .lp-role-card h5 { margin: 0 0 4px; font-size: 15px; text-align: center; }
.advanced-lp .lp-role-card p { margin: 0; font-size: 12px; color: var(--muted); }
.advanced-lp .lp-features { margin: 4px 0 12px; padding-left: 20px; }
.advanced-lp .lp-features li { margin: 4px 0; font-size: 14px; }
.advanced-lp .lp-note { color: var(--muted); font-size: 13px; }
.chat-messages {
  height: 180px; overflow-y: auto; background: var(--panel2);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.chat-messages .msg { padding: 2px 0; }
.chat-messages .msg .from { color: var(--accent); font-weight: bold; }
.chat-messages .msg.wolf { color: #f0b7c4; }
.chat-input-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-input-row input { flex: 1; }

.talk-area {
  position: sticky; bottom: 0; padding: 12px 0 20px; text-align: center;
  background: linear-gradient(transparent, var(--bg) 30%);
  /* 半透明の帯はクリックを横取りしない（ボタンだけが受ける）。
     これが無いと画面下部のチャット送信ボタン等が押せなくなる。 */
  pointer-events: none;
}
.talk-area .talk-button { pointer-events: auto; }
.voice-status { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.talk-button {
  width: 104px; height: 104px; border-radius: 50%; font-size: 15px; font-weight: bold;
  background: radial-gradient(circle, #3a405c, #262b40); border: 4px solid #4a5170;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.talk-button.ready { border-color: var(--accent); }
.talk-button.speaking { background: radial-gradient(circle, #e05d5d, #a83a3a); border-color: #ff8a8a; color: #fff; }
.talk-button.waiting { border-color: var(--seer); }

.lobby-players li { display: flex; align-items: center; gap: 8px; }
.lobby-players li .kick-btn { margin-left: auto; }

/* 個人チャット（DM） */
.dm-layout { display: flex; gap: 16px; flex-wrap: wrap; }
.dm-conversations { width: 240px; flex: none; }
.dm-thread-wrap { flex: 1; min-width: 280px; }
.dm-conversation-item {
  padding: 8px 10px; border-bottom: 1px dashed #333a55; cursor: pointer; border-radius: 6px;
}
.dm-conversation-item:hover { background: var(--panel2); }
.dm-conversation-item.active { background: var(--panel2); outline: 1px solid var(--accent); }
.dm-conversation-item .dm-peer { font-weight: bold; font-size: 14px; }
.dm-conversation-item .dm-preview {
  color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-messages {
  height: 260px; overflow-y: auto; background: var(--panel2);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.dm-messages .msg { padding: 2px 0; }
.dm-messages .msg .from { color: var(--accent); font-weight: bold; }
.dm-messages .msg.mine { text-align: right; }
.invite-card {
  background: var(--panel); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 8px;
}
.invite-card button { align-self: flex-start; }

/* アプリシェル（下部メニュー＋待機室に戻る帯＋マイページ） */
.place-label { color: var(--accent); font-size: 14px; font-weight: bold; }
.bottom-chrome {
  flex: none;
  display: flex; flex-direction: column;
}
.return-band {
  border: none; border-radius: 0; width: 100%;
  background: var(--accent); color: #222; font-weight: bold;
  padding: 10px; font-size: 14px; cursor: pointer;
}
.bottom-nav {
  display: flex; background: var(--panel); border-top: 1px solid #000;
}
.nav-btn {
  flex: 1; position: relative; border: none; border-radius: 0;
  background: transparent; padding: 8px 4px 10px; font-size: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-btn span { font-size: 11px; }
.nav-btn.active { background: var(--panel2); color: var(--accent); }
.unread-badge {
  position: absolute; top: 4px; right: calc(50% - 22px);
  background: var(--danger); color: #fff; font-size: 11px; font-weight: bold;
  min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px;
  padding: 0 5px; text-align: center;
}
/* スクロール位置合わせの際の余白（本文スクロール領域の下端対策） */
.screen button, .screen input, .screen textarea, .screen label {
  scroll-margin-bottom: 24px;
}

.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--panel2); border: 3px solid var(--villager);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 18px; font-weight: bold; }
.profile-bio { white-space: pre-wrap; font-size: 14px; }
textarea {
  width: 100%; padding: 10px; margin-top: 4px; border-radius: 8px;
  border: 1px solid #3a405c; background: var(--panel2); color: var(--text);
  font-size: 15px; font-family: inherit;
}

/* 招待ピッカー */
.invite-picker {
  margin-top: 12px; background: var(--panel2); border-radius: 10px; padding: 12px;
}
.invite-picker h4 { margin: 0 0 8px; }
.invite-picker-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 6px 0; border-bottom: 1px dashed #333a55; font-size: 14px;
}

/* プロフィール画面レイアウト v1（バナー／ギフト帯／関係図／フレンド） */
.profile-banner {
  height: 110px; border-radius: 10px; background: var(--panel2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 6px;
}
.profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-banner-empty { color: var(--muted, #8a90a8); font-size: 13px; }
.profile-avatar-overlap {
  margin-top: -38px; margin-left: 10px; position: relative; z-index: 1;
  background: var(--panel);
}
.gift-band {
  margin-top: 14px; background: var(--panel2); border-radius: 10px; padding: 10px 12px;
}
.gift-band h3 { margin: 6px 0; font-size: 14px; }
.relations-frame {
  border: 1px dashed #3a405c; border-radius: 10px; padding: 14px;
  text-align: center;
}
.action-sheet {
  margin: 10px 0; background: var(--panel2); border-radius: 10px; padding: 12px;
  outline: 1px solid var(--accent);
}
.action-sheet-title { font-weight: bold; margin-bottom: 8px; }
/* 人物アイコンは四角・大きさ統一がアプリ全体のデザインルール
   （2026-11-23 おぎ決定）。フレンドまわり（フレンド一覧・
   ユーザー検索結果）のアイコンはこの .friend-icon-btn が正本：
   44px の四角（角丸は小さく）。他画面（席・プロフィール）の
   統一は装飾／UIフェーズで合わせる。 */
.friend-icon-btn {
  width: 44px; height: 44px; border-radius: 8px; font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
}
.friend-icon-btn img { width: 100%; height: 100%; object-fit: cover; }
/* フレンド一覧のオンライン状態ドット（2026-11-23 おぎ決定）：
   アイコンの右下に重ね、オンライン＝緑／オフライン＝グレー */
.friend-icon-wrap { position: relative; display: inline-flex; flex: none; }
.presence-dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid var(--panel); background: #6e7488;
  pointer-events: none;
}
.presence-dot.online { background: var(--ok); }
.seat { cursor: pointer; }

/* ギフト（B 帯のチップ／ピッカー／DM カード／演出プレースホルダ） */
.gift-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.gift-chip {
  background: var(--panel); border: 1px solid #3a405c; border-radius: 999px;
  padding: 3px 10px; font-size: 13px; white-space: nowrap;
}
.gift-chip .gift-count { font-weight: bold; margin-left: 2px; }
.gift-all-list { margin-top: 6px; }
.gift-picker {
  position: fixed; inset: 0; z-index: 60; background: rgba(5, 6, 12, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.gift-picker-card {
  background: var(--panel); border-radius: 14px; padding: 16px;
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  outline: 1px solid var(--accent);
}
.gift-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px; margin-top: 8px;
}
.gift-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel2); border: 1px solid #3a405c; border-radius: 10px;
  padding: 10px 4px; cursor: pointer; color: inherit; font: inherit;
}
.gift-item:hover { outline: 1px solid var(--accent); }
.gift-item:disabled { opacity: 0.45; cursor: default; }
.gift-item-icon { font-size: 26px; line-height: 1.1; }
.gift-item-name { font-size: 12px; }
.gift-item-price { font-size: 12px; font-weight: bold; }
.gift-card {
  border: 1px solid #7a5b1e; background: #2b2410; border-radius: 10px;
  padding: 10px 12px; margin: 6px 0; display: flex; flex-direction: column; gap: 4px;
}
.gift-effect {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gift-effect-icon { font-size: 64px; }
.gift-effect-label {
  margin-top: 8px; font-size: 15px; font-weight: bold;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.gift-effect.tier-pop .gift-effect-icon { animation: gift-pop 0.9s ease-out; }
.gift-effect.tier-animation .gift-effect-icon { animation: gift-rise 1.4s ease-out; }
.gift-effect.tier-effect .gift-effect-icon { animation: gift-burst 2s ease-out; font-size: 84px; }
.gift-effect.tier-fullscreen, .gift-effect.tier-fullscreen-deluxe {
  background: radial-gradient(circle at center, rgba(255, 210, 90, 0.25), rgba(5, 6, 12, 0.55));
}
.gift-effect.tier-fullscreen .gift-effect-icon { animation: gift-burst 2.6s ease-out; font-size: 110px; }
.gift-effect.tier-fullscreen-deluxe .gift-effect-icon { animation: gift-burst 3.4s ease-out; font-size: 140px; }
@keyframes gift-pop {
  0% { transform: scale(0.3); opacity: 0; }
  55% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes gift-rise {
  0% { transform: translateY(46px) scale(0.6); opacity: 0; }
  60% { transform: translateY(-6px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes gift-burst {
  0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
  45% { transform: scale(1.3) rotate(4deg); opacity: 1; }
  75% { transform: scale(1.05) rotate(0deg); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
