/* talkwolf.css - トークウルフ機能 */

/* ── レイアウト（主催者） ── */
.ww-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.ww-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ww-topbar h1 { margin: 0; font-size: 1.6rem; }

.ww-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ww-participant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── 接続ステータス ── */
.ww-connection {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.ww-connection.connected    { background: #d1fae5; color: #065f46; }
.ww-connection.disconnected { background: #fee2e2; color: #991b1b; }
.ww-connection .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── カード ── */
.ww-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.ww-card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* ── 共有カード ── */
.ww-share-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.ww-url-block { flex: 1; min-width: 200px; }
.ww-url-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 600; }
.ww-url-row   { display: flex; gap: 0.5rem; }

.ww-url-input {
  flex: 1;
  font-size: 0.85rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
}

#ww-qrcode { width: 96px; height: 96px; flex-shrink: 0; }
#ww-qrcode img, #ww-qrcode canvas { width: 96px !important; height: 96px !important; }

/* ── フェーズバナー ── */
.ww-phase-banner {
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.ww-phase-banner.lobby      { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.ww-phase-banner.distribute { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.ww-phase-banner.discussion { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.ww-phase-banner.vote       { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.ww-phase-banner.result     { background: #f5f3ff; color: #4c1d95; border-color: #ddd6fe; }

/* ── お題選択 ── */
.ww-pair-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-muted);
  border: 2px dashed var(--border-color);
  margin: 0.75rem 0;
  transition: all 0.2s;
  min-height: 72px;
}

.ww-pair-display.selected {
  border-style: solid;
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--card-bg));
}

.ww-pair-word {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.ww-pair-vs {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
}

.ww-pair-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.2rem;
}

/* カテゴリータブ */
.ww-category-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.ww-cat-btn {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-color);
  background: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.ww-cat-btn:hover,
.ww-cat-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--card-bg));
}

.ww-pairs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ww-pair-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.ww-pair-btn:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--card-bg)); }
.ww-pair-btn.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--card-bg));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}
.ww-pair-btn.custom {
  border-style: dashed;
  position: relative;
}
.ww-pair-del {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
  border-radius: 999px;
  line-height: 1;
}
.ww-pair-del:hover { background: var(--secondary, #ef4444); color: #fff; }

/* ── 設定行 ── */
.ww-settings-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.ww-setting-item { flex: 1; min-width: 120px; }

.ww-setting-item label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ww-setting-item select {
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}

/* ── 参加者リスト（ロビー） ── */
.ww-player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ww-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  animation: ww-chip-in 0.2s ease;
}

@keyframes ww-chip-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── 確認進捗バー ── */
.ww-confirm-progress {
  margin: 0.75rem 0;
}

.ww-confirm-progress-bar-wrap {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.ww-confirm-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ── タイマー ── */
.ww-timer-wrap {
  text-align: center;
  margin: 1rem 0;
}

.ww-timer-text {
  font-size: clamp(3rem, 10vw, 4.5rem);
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ww-timer-text.warning  { color: var(--warning, #f59e0b); }
.ww-timer-text.critical { color: var(--danger, #ef4444); }

.ww-timer-bar-wrap {
  height: 10px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.ww-timer-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--success, #10b981);
  transition: width 0.5s linear, background 0.5s ease;
}

.ww-timer-bar.warning  { background: var(--warning, #f59e0b); }
.ww-timer-bar.critical { background: var(--danger, #ef4444); }

/* ── 投票集計（主催者 vote フェーズ） ── */
.ww-vote-tally {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ww-vote-tally-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.ww-vote-tally-item:last-child { border-bottom: none; }
.ww-vote-tally-name { flex: 1; font-weight: 600; }
.ww-vote-tally-count { font-weight: 700; color: var(--primary); }

/* ── 結果 ── */
.ww-result-header {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
}

.ww-result-wolf-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.ww-result-wolf-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.ww-result-wolf-names {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-main);
}

.ww-word-pair-reveal {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.ww-word-block {
  flex: 1;
  border-radius: var(--radius-md);
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.ww-word-block.majority {
  background: color-mix(in srgb, var(--primary) 10%, var(--card-bg));
  border: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.ww-word-block.minority {
  background: color-mix(in srgb, var(--secondary) 10%, var(--card-bg));
  border: 2px solid color-mix(in srgb, var(--secondary) 35%, transparent);
}

.ww-word-block-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.ww-word-block.majority .ww-word-block-label { color: var(--primary); }
.ww-word-block.minority .ww-word-block-label { color: var(--secondary); }

.ww-word-block-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-main);
}

/* 結果テーブル */
.ww-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ww-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  animation: fade-in-left 0.2s ease both;
}

.ww-result-item:last-child { border-bottom: none; }

.ww-result-item.is-wolf {
  background: color-mix(in srgb, var(--secondary) 8%, var(--card-bg));
  border-radius: var(--radius-md);
}

.ww-result-name { flex: 1; font-weight: 700; }
.ww-wolf-badge  {
  font-size: 0.7rem;
  background: var(--secondary);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
}

.ww-vote-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 80px;
}

.ww-vote-bar {
  height: 6px;
  background: var(--primary);
  border-radius: 999px;
  min-width: 2px;
  transition: width 0.6s ease;
}

.ww-vote-num { font-size: 0.85rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ════════════════════════════════════════════════════════════
   参加者ページ
   ════════════════════════════════════════════════════════════ */

.ww-p-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

.ww-p-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.ww-p-icon    { font-size: 3rem; margin-bottom: 0.5rem; }
.ww-p-label   {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* 参加者 - お題確認カード */
.ww-p-reveal-area {
  perspective: 800px;
  margin: 1rem auto;
}

.ww-p-reveal-card {
  position: relative;
  height: 220px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: var(--radius-lg);
}

.ww-p-reveal-card.flipped { transform: rotateY(180deg); }

.ww-p-reveal-front,
.ww-p-reveal-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 1.25rem;
}

.ww-p-reveal-front {
  background: var(--bg-muted);
  border: 2px dashed var(--border-color);
}

.ww-p-reveal-front-icon { font-size: 2.5rem; }
.ww-p-reveal-front-text { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); }
.ww-p-reveal-front-hint { font-size: 0.8rem; color: var(--text-muted); }

.ww-p-reveal-back {
  background: var(--primary);
  transform: rotateY(180deg);
  color: white;
}

.ww-p-reveal-word {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

.ww-p-reveal-note {
  font-size: 0.8rem;
  opacity: 0.8;
  text-align: center;
}

.ww-p-reveal-countdown {
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.85;
  background: rgba(255,255,255,0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* 参加者 - 討論タイマー */
.ww-p-timer-wrap {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 0.5rem;
}

.ww-p-timer-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success, #10b981);
  transition: width 0.5s linear, background 0.5s ease;
}

.ww-p-timer-fill.warning  { background: var(--warning, #f59e0b); }
.ww-p-timer-fill.critical { background: var(--danger, #ef4444); }

.ww-p-timer-text {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ww-p-timer-text.warning  { color: var(--warning, #f59e0b); }
.ww-p-timer-text.critical { color: var(--danger, #ef4444); }

/* 参加者 - 投票 */
.ww-p-vote-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.ww-p-vote-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.ww-p-vote-btn:hover:not(:disabled) {
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 8%, var(--card-bg));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ww-p-vote-btn:active:not(:disabled) { transform: scale(0.98); }
.ww-p-vote-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ww-p-vote-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.85rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 参加者 - 結果 */
.ww-p-result-word {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 900;
  color: var(--text-main);
  margin: 0.5rem 0;
}

.ww-p-result-role {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  display: inline-block;
  margin: 0.25rem 0 0.75rem;
}

.ww-p-result-role.majority {
  background: color-mix(in srgb, var(--primary) 12%, var(--card-bg));
  color: var(--primary);
}

.ww-p-result-role.wolf {
  background: color-mix(in srgb, var(--secondary) 12%, var(--card-bg));
  color: var(--secondary);
}

.ww-p-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.ww-p-result-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.ww-p-result-list li:last-child { border-bottom: none; }
.ww-p-result-list .r-name { flex: 1; font-weight: 600; }

/* ── アニメーション ── */
@keyframes fade-in-left {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes ww-pop-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── hidden ── */
.hidden { display: none !important; }
