/* ============================================================
   早押しクイズシステム – 共通スタイルシート
   対応: PC / タブレット / スマートフォン
   カラーテーマ: 白ベース + 落ち着いた青系アクセント
   ============================================================ */

/* ---------- CSS カスタムプロパティ（変数） ---------- */
:root {
  /* ブランドカラー */
  --color-primary:       #2563eb;  /* 青 – 主要アクション */
  --color-primary-dark:  #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-success:       #16a34a;  /* 緑 – 成功・参加 */
  --color-success-dark:  #15803d;
  --color-success-light: #dcfce7;
  --color-danger:        #dc2626;  /* 赤 – 危険・終了 */
  --color-danger-dark:   #b91c1c;
  --color-danger-light:  #fee2e2;
  --color-warning:       #d97706;  /* 橙 – 警告 */
  --color-warning-light: #fef3c7;
  --color-secondary:     #6b7280;  /* グレー – 補助ボタン */
  --color-secondary-light: #f3f4f6;

  /* 背景・テキスト */
  --bg-page:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-header:  #1e40af;
  --text-main:  #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border:     #e5e7eb;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.1);
  --shadow-md:  0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.15);

  /* 早押しボタン専用 */
  --buzz-active:   #16a34a;
  --buzz-pressed:  #1d4ed8;
  --buzz-disabled: #9ca3af;
  --buzz-size:     min(64vw, 360px);

  /* フォント */
  --font-base: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  --font-size-base: 16px;

  /* 角丸・余白 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* ---------- リセット & ベース ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-base); scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .9em;
}

/* ---------- ユーティリティ ---------- */
.hidden { display: none !important; }
.center-content { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.text-center { text-align: center; }
.error-msg {
  color: var(--color-danger);
  background: var(--color-danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: .9rem;
}
.empty-msg {
  color: var(--text-muted);
  font-size: .9rem;
  padding: 12px 0;
  text-align: center;
}
.label-text {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.hint-text {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.6;
}

/* ---------- サイトヘッダー ---------- */
.site-header {
  background: var(--bg-header);
  color: #fff;
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
}
.site-header.teacher-bg { background: #1e3a5f; }
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.header-left { display: flex; flex-direction: column; gap: 6px; }
.header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-title i { font-size: 1.4rem; }
.site-subtitle {
  font-size: .85rem;
  opacity: .8;
}
.room-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.room-badge strong { font-size: 1.1rem; letter-spacing: .1em; }
.btn-icon {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color .2s;
}
.btn-icon:hover { color: #fff; }

/* ---------- 接続ステータス ---------- */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  background: rgba(255,255,255,.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.status-icon { font-size: .65rem; }
.status-icon.connected    { color: #4ade80; }
.status-icon.disconnected { color: #f87171; }
.status-icon.connecting   { color: #fbbf24; animation: blink 1s infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}

/* ---------- カード ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
}
.card-header i { color: var(--color-primary); font-size: 1.05rem; }
.card-body { padding: 16px 18px; }

/* カードヘッダー色バリエーション */
.teacher-header { background: var(--color-primary-light); }
.teacher-header i, .teacher-header h2 { color: var(--color-primary-dark); }
.student-header { background: var(--color-success-light); }
.student-header i, .student-header h2 { color: var(--color-success-dark); }

/* ---------- フォーム要素 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-main);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-input-large {
  font-size: 1.3rem;
  padding: 14px 18px;
  letter-spacing: .05em;
}
/* カラーピッカー */
input[type="color"] {
  width: 44px; height: 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 2px;
  background: #fff;
}
/* 数値入力 */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, transform .1s, box-shadow .18s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--color-primary);   color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.btn-success   { background: var(--color-success);   color: #fff; box-shadow: var(--shadow-sm); }
.btn-success:hover:not(:disabled) { background: var(--color-success-dark); }

.btn-danger    { background: var(--color-danger);    color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover:not(:disabled) { background: var(--color-danger-dark); }

.btn-secondary { background: var(--color-secondary-light); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #e5e7eb; }

.btn-sm   { padding: 6px 14px; font-size: .85rem; }
.btn-large { padding: 14px 28px; font-size: 1.15rem; width: 100%; border-radius: var(--radius-lg); }
.btn-xlarge { padding: 16px 24px; font-size: 1.1rem; width: 100%; border-radius: var(--radius-lg); }

/* 早押し有効・無効ボタン */
.btn-enable-buzz  { background: #16a34a; color: #fff; }
.btn-enable-buzz:hover:not(:disabled) { background: #15803d; }
.btn-disable-buzz { background: #dc2626; color: #fff; }
.btn-disable-buzz:hover:not(:disabled) { background: #b91c1c; }
.btn-reset        { background: #d97706; color: #fff; }
.btn-reset:hover:not(:disabled) { background: #b45309; }

/* ---------- バッジ ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 700;
  padding: 0 6px;
  margin-left: 6px;
}

/* ---------- 区切り線 ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: .85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   トップページ（index.html）
   ============================================================ */
.page-top .top-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.page-top .site-header {
  text-align: center;
  padding: 24px 16px;
}
.page-top .header-inner { flex-direction: column; align-items: center; }

.teacher-section .card-header { background: #eff6ff; }
.student-section .card-header { background: #f0fdf4; }

.qr-hint {
  margin-top: 20px;
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.qr-hint i { font-size: 1.2rem; margin-bottom: 4px; display: block; }

/* ---------- サイトフッター ---------- */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ============================================================
   教師画面（teacher.html）
   ============================================================ */
.page-teacher { background: #f1f5f9; }

.teacher-main {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  grid-template-rows: auto;
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── サイドバー（左）── */
.teacher-sidebar { grid-column: 1; }

/* ── 中央パネル ── */
.teacher-buzz-panel { grid-column: 2; }

/* ── 右パネル ── */
.teacher-score-panel { grid-column: 3; }

/* QRコードコンテナ */
#qrcode-container {
  width: 160px; height: 160px;
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
#qrcode-container canvas, #qrcode-container img {
  width: 100% !important;
  height: 100% !important;
}
.join-url-box {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}
.join-url-text {
  font-size: .8rem;
  color: var(--text-muted);
  word-break: break-all;
  margin: 6px 0;
  line-height: 1.5;
}

/* 参加者リスト */
.participant-list { max-height: 280px; overflow-y: auto; }
.participant-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  border-bottom: 1px solid #f3f4f6;
}
.participant-item:hover { background: #f8fafc; }
.participant-team-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.participant-name { flex: 1; font-size: .95rem; font-weight: 500; }
.participant-team-name { font-size: .8rem; color: var(--text-muted); }
.participant-actions { display: flex; gap: 4px; }
.btn-kick {
  background: none; border: none;
  color: var(--color-danger);
  font-size: .85rem;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.btn-kick:hover { background: var(--color-danger-light); }
.btn-change-team {
  background: none; border: none;
  color: var(--color-primary);
  font-size: .85rem;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.btn-change-team:hover { background: var(--color-primary-light); }

/* チームリスト */
.team-add-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.team-add-form .form-input { flex: 1; min-width: 100px; }
.team-list { max-height: 220px; overflow-y: auto; }
.team-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid #f3f4f6;
  transition: background .15s;
}
.team-item:hover { background: #f8fafc; }
.team-color-swatch {
  width: 16px; height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.1);
}
.team-item-name { flex: 1; font-size: .95rem; font-weight: 600; }
.team-member-count { font-size: .8rem; color: var(--text-muted); }
.btn-edit-team, .btn-delete-team {
  background: none; border: none;
  font-size: .85rem;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.btn-edit-team   { color: var(--color-primary); }
.btn-edit-team:hover { background: var(--color-primary-light); }
.btn-delete-team { color: var(--color-danger); }
.btn-delete-team:hover { background: var(--color-danger-light); }

/* ── 早押し管理カード ── */
.buzz-control-card .card-header { background: #1e3a5f; }
.buzz-control-card .card-header h2,
.buzz-control-card .card-header i { color: #fff; }

.buzz-status-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-weight: 700;
  background: #dc2626;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.buzz-status-badge.enabled { background: #16a34a; }

.buzz-control-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.buzz-control-btns .btn-reset { grid-column: 1 / -1; }

/* ── 早押し結果カード ── */
.buzz-result-card { margin-top: 16px; }
.result-count {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* 1位表示 */
.first-place-display {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.first-place-empty { color: var(--text-muted); }
.first-place-empty i { font-size: 2.5rem; margin-bottom: 10px; opacity: .4; display: block; }
.first-place-empty p { font-size: .95rem; }

.first-place-content { width: 100%; }
.first-crown { font-size: 2rem; margin-bottom: 4px; }
.first-rank-label { font-size: .8rem; color: #92400e; font-weight: 700; letter-spacing: .1em; }
.first-name {
  font-size: 2rem;
  font-weight: 800;
  color: #78350f;
  margin: 4px 0;
  word-break: break-all;
}
.first-team-badge {
  display: inline-block;
  padding: 3px 14px;
  border-radius: var(--radius-full);
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  margin-top: 6px;
}
.first-time { font-size: .8rem; color: #92400e; margin-top: 6px; }

/* 2位以降ランキング */
.buzz-ranking { display: flex; flex-direction: column; gap: 6px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.rank-num {
  width: 28px; height: 28px;
  background: var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.rank-name { flex: 1; font-size: .95rem; font-weight: 600; }
.rank-team {
  font-size: .8rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  color: #fff;
  font-weight: 600;
}
.rank-time { font-size: .78rem; color: var(--text-muted); }

/* ── 得点ボード ── */
.score-board { display: flex; flex-direction: column; gap: 8px; }
.score-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  transition: border-color .2s;
}
.score-item:hover { border-color: var(--color-primary); }
.score-team-color {
  width: 14px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.score-team-name { flex: 1; font-size: .95rem; font-weight: 700; }
.score-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-primary);
  min-width: 40px;
  text-align: center;
}
.score-btns { display: flex; gap: 4px; }
.btn-score {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  cursor: pointer;
}
.btn-score-plus  { background: var(--color-success-light); color: var(--color-success); border-color: #86efac; }
.btn-score-plus:hover  { background: var(--color-success); color: #fff; }
.btn-score-minus { background: var(--color-danger-light);  color: var(--color-danger);  border-color: #fca5a5; }
.btn-score-minus:hover { background: var(--color-danger);  color: #fff; }

/* ── 問題管理 ── */
.question-display { text-align: center; margin-bottom: 14px; }
.question-num-display {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  padding: 10px 20px;
  display: inline-block;
  margin-top: 4px;
}
.question-nav-btns { display: flex; gap: 8px; margin-bottom: 12px; }
.question-nav-btns .btn { flex: 1; }
.question-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.question-input-row label { font-size: .85rem; font-weight: 600; white-space: nowrap; }

/* ── 操作ログ ── */
.operation-log { max-height: 200px; overflow-y: auto; padding: 0; }
.log-item {
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: .82rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}
.log-time { color: var(--text-light); font-size: .78rem; flex-shrink: 0; }

/* ============================================================
   モーダル
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}
.modal-desc {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.6;
}
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ============================================================
   生徒画面（student.html）
   ============================================================ */
.page-student {
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ローディング */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.loading-content { text-align: center; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-content p { color: var(--text-muted); font-size: 1rem; }

/* 参加フォーム */
.join-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.join-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.join-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-success-dark);
}

/* チーム選択 */
.team-select-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.team-select-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.team-select-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.welcome-msg {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: .95rem;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.team-select-btn {
  padding: 20px 10px;
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.team-select-btn:hover { transform: scale(1.04); box-shadow: var(--shadow-md); }
.team-select-btn .member-count {
  display: block;
  font-size: .78rem;
  font-weight: 400;
  opacity: .85;
  margin-top: 4px;
}
.no-team-option { text-align: center; margin-top: 8px; }

/* ── 早押し画面 ── */
.buzz-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* 上部ステータスバー */
.student-header {
  background: #1e3a5f;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.student-info { display: flex; flex-direction: column; gap: 2px; }
.student-name-display {
  font-size: 1.1rem;
  font-weight: 700;
}
.student-team-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  opacity: .9;
}
.team-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.student-header-right { display: flex; align-items: center; gap: 12px; }
.question-indicator {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  font-size: .95rem;
  font-weight: 700;
}

/* メイン早押しエリア */
.buzz-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f1f5f9;
  overflow: hidden;
}

/* ── 早押しボタン ── */
.buzz-button-area { text-align: center; }

.buzz-btn {
  width: var(--buzz-size);
  height: var(--buzz-size);
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #22c55e, #16a34a);
  box-shadow:
    0 8px 0 #15803d,
    0 12px 24px rgba(22,163,74,.4);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .15s;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 押したときのへこみ効果 */
.buzz-btn:active,
.buzz-btn.pressed {
  transform: translateY(6px);
  box-shadow:
    0 2px 0 #15803d,
    0 4px 10px rgba(22,163,74,.3);
  background: linear-gradient(145deg, #16a34a, #15803d);
}

/* 無効状態 */
.buzz-btn.disabled {
  background: linear-gradient(145deg, #d1d5db, #9ca3af);
  box-shadow:
    0 6px 0 #6b7280,
    0 10px 20px rgba(0,0,0,.15);
  cursor: not-allowed;
}
.buzz-btn.disabled:active { transform: none; }

/* 既に押した状態 */
.buzz-btn.already-pressed {
  background: linear-gradient(145deg, #3b82f6, #2563eb);
  box-shadow:
    0 6px 0 #1d4ed8,
    0 10px 20px rgba(37,99,235,.4);
  cursor: default;
}
.buzz-btn.already-pressed:active { transform: translateY(6px); }

.buzz-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.buzz-icon { font-size: calc(var(--buzz-size) * .22); color: #fff; }
.buzz-label {
  font-size: calc(var(--buzz-size) * .1);
  font-weight: 900;
  color: #fff;
  letter-spacing: .05em;
  text-shadow: 0 2px 4px rgba(0,0,0,.3);
}

/* リップル効果 */
.buzz-btn::after {
  content: '';
  position: absolute;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .4s;
  border-radius: 50%;
}
.buzz-btn.ripple::after { opacity: 1; animation: ripple .4s ease-out; }
@keyframes ripple {
  0%   { transform: scale(0); opacity: .5; }
  100% { transform: scale(2); opacity: 0; }
}

.buzz-hint {
  margin-top: 20px;
  font-size: 1rem;
  color: var(--text-muted);
}

/* 待機エリア */
.buzz-waiting-area { text-align: center; }
.waiting-icon { font-size: 4rem; color: var(--text-light); margin-bottom: 16px; }
.waiting-msg  { font-size: 1.1rem; color: var(--text-muted); }

/* 押下済みエリア */
.buzz-done-area { text-align: center; }
.done-display { }
.done-icon { font-size: 4rem; color: var(--color-primary); margin-bottom: 16px; }
.done-msg  { font-size: 1.4rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.done-rank {
  font-size: 1.1rem;
  color: var(--text-muted);
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  padding: 8px 20px;
  display: inline-block;
}
.done-rank.first-rank {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  border: 2px solid #f59e0b;
  font-weight: 700;
}

/* ルーム終了エリア */
.room-ended-area { text-align: center; }
.ended-icon { font-size: 4rem; color: var(--color-secondary); margin-bottom: 16px; display: block; }
.ended-display h3 { font-size: 1.5rem; margin-bottom: 10px; }
.ended-display p  { color: var(--text-muted); }

/* ── スコアフッター ── */
.student-score-footer {
  background: #1e3a5f;
  padding: 8px 12px;
  flex-shrink: 0;
}
.score-mini-board {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.score-mini-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}
.score-mini-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.score-mini-pts { font-size: .9rem; font-weight: 800; }

/* ============================================================
   レスポンシブ対応
   ============================================================ */

/* ── タブレット（〜1100px） ── */
@media (max-width: 1100px) {
  .teacher-main {
    grid-template-columns: 260px 1fr 240px;
  }
}

/* ── タブレット縦（〜900px） ── */
@media (max-width: 900px) {
  .teacher-main {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .teacher-sidebar     { grid-column: 1; }
  .teacher-score-panel { grid-column: 2; }
  .teacher-buzz-panel  { grid-column: 1 / -1; order: -1; }

  .page-top .top-main {
    grid-template-columns: 1fr;
    max-width: 480px;
  }
}

/* ── スマートフォン（〜640px） ── */
@media (max-width: 640px) {
  :root { --buzz-size: min(72vw, 300px); }

  .teacher-main {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .teacher-sidebar,
  .teacher-buzz-panel,
  .teacher-score-panel {
    grid-column: 1;
    order: 0;
  }

  .site-header { padding: 12px 14px; }
  .site-title   { font-size: 1.2rem; }

  .buzz-control-btns {
    grid-template-columns: 1fr;
  }
  .buzz-control-btns .btn-reset { grid-column: 1; }

  .btn-large { padding: 12px 20px; font-size: 1rem; }
  .buzz-label { font-size: calc(var(--buzz-size) * .12); }

  .question-nav-btns { flex-direction: column; }

  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-right { width: 100%; }
}

/* ── 非常に小さい画面（〜360px） ── */
@media (max-width: 360px) {
  :root { --buzz-size: 80vw; }
  .student-header { padding: 8px 10px; }
  .student-name-display { font-size: .95rem; }
}

/* ============================================================
   印刷スタイル（QRコードプリントアウト用）
   ============================================================ */
@media print {
  .site-header, .teacher-sidebar, .teacher-score-panel,
  .teacher-buzz-panel, .site-footer { display: none; }
  #room-info-card { display: block; box-shadow: none; }
}

/* ============================================================
   アニメーション（早押しフィードバック）
   ============================================================ */
@keyframes buzz-success {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.08); }
  40%  { transform: scale(.95); }
  60%  { transform: scale(1.04); }
  80%  { transform: scale(.98); }
  100% { transform: scale(1); }
}
.buzz-btn.buzz-success-anim {
  animation: buzz-success .4s ease;
}

/* チームカラーが無い参加者のドット */
.team-color-dot.no-team {
  background: var(--text-light);
}

/* スクロールバー（webkit） */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
