/* ==========================================================================
   早押しクイズ Webアプリ スタイルシート (スマホファースト & TVクイズ番組風UI)
   ========================================================================== */

:root {
  --bg-dark: #0a0e1a;
  --bg-panel: rgba(20, 28, 48, 0.88);
  --bg-panel-light: rgba(32, 44, 72, 0.92);
  --border-glow: rgba(99, 179, 237, 0.28);
  --accent-gold: #fbbf24;
  --accent-amber: #f59e0b;
  --accent-cyan: #22d3ee;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444;
  --accent-red-dark: #b91c1c;
  --accent-green: #10b981;
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

/* 背景の光の演出 */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.35;
}

.glow-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: -80px;
  left: -80px;
}

.glow-2 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, #ec4899, transparent 70%);
  bottom: -100px;
  right: -80px;
}

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 16px;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-logo {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-cyan);
}

.sound-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* メインコンテナ (スマホ最適化サイズ) */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 40px;
}

.screen {
  display: none;
  animation: fadeIn 0.28s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   1. スタート＆大会告知画面
   ========================================================================== */
.promo-card {
  background: linear-gradient(145deg, rgba(30, 41, 75, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-card);
  text-align: center;
  margin-bottom: 16px;
}

.event-badge {
  display: inline-block;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.event-title {
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 2px 12px rgba(251, 191, 36, 0.35);
  margin-bottom: 6px;
}

.event-subtitle {
  font-size: 0.88rem;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 14px;
}

.event-info-box {
  background: rgba(10, 14, 26, 0.65);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.event-info-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.event-info-row:last-child {
  margin-bottom: 0;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

.info-value {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.event-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
  text-align: left;
  line-height: 1.55;
}

/* ルールボックス */
.rule-box {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.rule-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.rule-list {
  list-style: none;
  font-size: 0.86rem;
  color: var(--text-sub);
}

.rule-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 7px;
}

.rule-list li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-weight: bold;
}

.rule-list strong {
  color: #fff;
}

/* アクションボタン */
.action-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 16px 20px;
  font-size: 1.1rem;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-pulse {
  animation: gentlePulse 2.2s infinite;
}

@keyframes gentlePulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45); }
  50% { box-shadow: 0 6px 28px rgba(251, 191, 36, 0.75); }
}

.btn-secondary-link {
  display: block;
  text-align: center;
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
}

/* ==========================================================================
   2. クイズ出題＆早押し画面
   ========================================================================== */
.quiz-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.q-badge {
  background: var(--accent-blue);
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 999px;
}

.q-category {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.total-score-pill {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
}

.total-score-pill strong {
  color: var(--accent-gold);
  font-size: 0.98rem;
}

/* リアルタイム得点メーター */
.point-meter-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.point-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.meter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sub);
}

.potential-score-wrap {
  color: var(--accent-gold);
  font-weight: 900;
}

.potential-score {
  font-size: 1.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pt-unit {
  font-size: 0.85rem;
  margin-left: 2px;
}

.meter-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.meter-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #fbbf24, #ef4444);
  border-radius: 999px;
  transition: width 0.08s linear;
}

.meter-sub-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* 問題文表示ボード */
.question-board {
  min-height: 145px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(23, 37, 84, 0.9));
  border: 2px solid rgba(96, 165, 250, 0.45);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin-bottom: 18px;
  box-shadow: inset 0 0 24px rgba(30, 58, 138, 0.45), 0 8px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
}

.question-board.buzzed {
  border-color: var(--accent-gold);
  box-shadow: inset 0 0 24px rgba(251, 191, 36, 0.25), 0 0 20px rgba(251, 191, 36, 0.3);
}

.question-text {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.65;
  color: #fff;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.reading-cursor {
  display: inline-block;
  color: var(--accent-cyan);
  margin-left: 2px;
  animation: blinkCursor 0.6s infinite;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 早押しボタン (3Dブザー風) */
.buzzer-area {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}

.buzzer-btn {
  position: relative;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.buzzer-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #475569, #1e293b);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65), inset 0 2px 4px rgba(255, 255, 255, 0.25);
}

.buzzer-surface {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6b6b, #ef4444 55%, #b91c1c 100%);
  box-shadow:
    0 10px 0 #7f1d1d,
    0 14px 24px rgba(239, 68, 68, 0.55),
    inset 0 4px 10px rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}

.buzzer-btn:active .buzzer-surface {
  transform: translateY(7px);
  box-shadow:
    0 3px 0 #7f1d1d,
    0 6px 14px rgba(239, 68, 68, 0.6),
    inset 0 3px 8px rgba(255, 255, 255, 0.4);
}

.buzzer-main-text {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.buzzer-sub-text {
  font-size: 0.78rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 2px;
}

/* 回答入力パネル */
.answer-panel {
  background: var(--bg-panel-light);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease-out;
}

.hidden {
  display: none !important;
}

.answer-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.locked-point-badge {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.locked-point-badge strong {
  font-size: 1.15rem;
}

.answer-timer-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.12);
  padding: 3px 10px;
  border-radius: 999px;
}

.answer-timer-badge.urgent {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.35);
}

.input-hint {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.answer-input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  padding: 12px 14px;
  outline: none;
}

.answer-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.btn-submit-answer {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 18px;
  font-size: 0.95rem;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

/* 1問ごとの正誤判定モーダル */
.judge-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 18, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.judge-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.judge-badge {
  display: inline-block;
  font-size: 1.35rem;
  font-weight: 900;
  padding: 6px 22px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.judge-badge.correct {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 2px solid #10b981;
}

.judge-badge.wrong {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 2px solid #ef4444;
}

.judge-score {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-gold);
  margin-bottom: 14px;
}

.judge-comparison {
  background: rgba(10, 14, 26, 0.65);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  text-align: left;
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  font-size: 0.9rem;
}

.comp-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.comp-val {
  font-weight: 800;
  color: #fff;
  text-align: right;
}

.comp-val.answer-highlight {
  color: var(--accent-gold);
  font-size: 1.05rem;
}

.full-question-review {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.review-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.review-question-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #fff;
}

.review-question-text .pressed-part {
  color: #f87171;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.review-question-text .unread-part {
  color: #94a3b8;
}

.explanation-text {
  font-size: 0.82rem;
  color: var(--text-sub);
  text-align: left;
  line-height: 1.55;
  margin-bottom: 16px;
}

/* ==========================================================================
   3. リザルト＆大会告知・シェア画面
   ========================================================================== */
.result-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.result-header-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.rank-badge-wrap {
  display: inline-flex;
   flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.25), rgba(234, 88, 12, 0.1));
  border: 3px solid var(--accent-gold);
  margin-bottom: 10px;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.35);
}

.rank-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-sub);
  line-height: 1;
}

.rank-letter {
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--accent-gold);
  line-height: 1.1;
}

.result-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.result-comment {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 16px;
}

.final-score-box {
  background: rgba(10, 14, 26, 0.7);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.final-score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 800;
}

.final-score-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-gold);
  line-height: 1.2;
  margin: 4px 0 8px;
}

.final-score-max {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 700;
}

.final-stats-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-sub);
}

/* 履歴リスト */
.history-section {
  text-align: left;
}

.history-heading {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  border-left: 4px solid var(--accent-blue);
}

.history-item.correct {
  border-left-color: var(--accent-green);
}

.history-item.wrong {
  border-left-color: var(--accent-red);
}

.history-top {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: 3px;
}

.history-q-Preview {
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* シェアボックス */
.share-box {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.share-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-share {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.92rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s;
}

.btn-share:active {
  opacity: 0.85;
}

.btn-share-x {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-share-line {
  background: #06c755;
}

.btn-share-copy {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 大会告知CTAバナー */
.cta-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(88, 28, 135, 0.95));
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  text-align: center;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.cta-badge {
  display: inline-block;
  background: var(--accent-gold);
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.cta-title {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.cta-info {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.cta-desc {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-bottom: 14px;
}

.btn-cta-entry {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #0f172a;
  text-decoration: none;
  font-weight: 900;
  font-size: 1rem;
  padding: 14px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.4);
}

.retry-area {
  text-align: center;
}

.btn-retry {
  width: 100%;
  background: transparent;
  color: var(--text-sub);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 13px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
