/* ==========================================================================
   SCIENCE QUIZ SYSTEM - 千葉日本大学第一中学高等学校 科学部
   近未来・サイエンスラボ風 ネオンデザイン
   ========================================================================== */

:root {
  --bg-deep: #030712;
  --bg-panel: #060c1c;
  --cyan: #00f2fe;
  --cyan-soft: rgba(0, 242, 254, 0.35);
  --yellow: #fffb00;
  --green: #39ff88;
  --red: #ff3366;
  --text-main: #eaf6ff;
  --text-dim: #7f93b8;
  --font-en: 'Orbitron', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-jp);
  overflow: hidden;
}

/* ---------- 背景演出：グリッド ---------- */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 242, 254, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 242, 254, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 40%, transparent 100%);
  animation: gridPulse 6s ease-in-out infinite;
}
@keyframes gridPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

/* ---------- 背景演出：走査線 ---------- */
.scanline {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 242, 254, 0.05) 50%, transparent 100%);
  background-size: 100% 6px;
  opacity: 0.4;
}

/* ---------- 光の粒子 ---------- */
#particle-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.particle {
  position: absolute;
  bottom: -10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px 2px var(--cyan-soft);
  opacity: 0.7;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ---------- 画面共通 ---------- */
#app {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100vh;
  padding: 32px 48px 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  display: none;
  width: 100%;
  max-width: 1700px;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

.fade-slide {
  animation: fadeSlideUp 0.75s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= セット選択画面 ================= */
.header-block { text-align: center; margin-bottom: 18px; }
.eyebrow {
  font-family: var(--font-en);
  letter-spacing: 4px;
  color: var(--text-dim);
  font-size: 16px;
  margin: 0 0 10px;
}
.site-title {
  font-family: var(--font-en);
  font-size: 68px;
  font-weight: 900;
  margin: 0;
  letter-spacing: 4px;
  color: var(--text-main);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 30px var(--cyan-soft),
    0 0 60px rgba(0, 242, 254, 0.4);
}
.site-title span {
  color: var(--yellow);
  text-shadow:
    0 0 10px var(--yellow),
    0 0 30px rgba(255, 251, 0, 0.5),
    0 0 60px rgba(255, 251, 0, 0.3);
}
.subtitle {
  font-size: 20px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-top: 8px;
}
.select-instruction {
  color: var(--text-dim);
  font-size: 18px;
  margin: 4px 0 26px;
  letter-spacing: 1px;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 14px;
  width: 100%;
  max-height: 58vh;
  overflow-y: auto;
  padding: 6px;
}
.set-grid::-webkit-scrollbar { width: 8px; }
.set-grid::-webkit-scrollbar-thumb { background: var(--cyan-soft); border-radius: 4px; }

.set-panel {
  position: relative;
  background: linear-gradient(160deg, rgba(0,242,254,0.06), rgba(6,12,28,0.9));
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 10px;
  padding: 16px 6px;
  text-align: center;
  cursor: pointer;
  font-family: var(--font-en);
  color: var(--text-main);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  animation: fadeSlideUp 0.6s both;
}
.set-panel .num {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-soft);
}
.set-panel .label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-top: 4px;
}
.set-panel:hover {
  transform: translateY(-6px) scale(1.05);
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(255, 251, 0, 0.45), 0 0 40px rgba(0, 242, 254, 0.25);
  background: linear-gradient(160deg, rgba(255,251,0,0.08), rgba(6,12,28,0.95));
}
.set-panel:hover .num { color: var(--yellow); text-shadow: 0 0 10px var(--yellow); }

/* ================= クイズ画面 ================= */
#screen-quiz { justify-content: flex-start; padding-top: 10px; }

.quiz-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 26px;
}
.mini-btn {
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  font-family: var(--font-jp);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mini-btn:hover { border-color: var(--cyan); color: var(--cyan); }

.set-label {
  font-family: var(--font-en);
  font-size: 20px;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255,251,0,0.6);
  white-space: nowrap;
  letter-spacing: 2px;
}
.progress-wrap {
  flex: 1;
  height: 16px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid var(--cyan-soft);
  border-radius: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
  box-shadow: 0 0 12px var(--cyan);
  transition: width 0.6s cubic-bezier(.22,1,.36,1);
}
.question-count {
  font-family: var(--font-en);
  font-size: 22px;
  color: var(--cyan);
  white-space: nowrap;
  text-shadow: 0 0 8px var(--cyan-soft);
}

.question-box {
  width: 100%;
  background: linear-gradient(160deg, rgba(0,242,254,0.05), rgba(6,12,28,0.85));
  border: 2px solid var(--cyan);
  border-radius: 16px;
  box-shadow: 0 0 25px rgba(0,242,254,0.25), inset 0 0 40px rgba(0,242,254,0.05);
  padding: 34px 46px;
  margin-bottom: 30px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.category-chip {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-en);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--bg-deep);
  background: var(--yellow);
  box-shadow: 0 0 14px rgba(255,251,0,0.6);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.question-text {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0;
  color: var(--text-main);
  text-shadow: 0 0 14px rgba(234,246,255,0.25);
}

.answers-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.answer-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(6, 12, 28, 0.85);
  border: 2px solid rgba(0, 242, 254, 0.4);
  border-radius: 14px;
  padding: 22px 28px;
  cursor: default;
  transition: all 0.4s ease;
  text-align: left;
}
.answer-label {
  font-family: var(--font-en);
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
  border: 2px solid var(--cyan);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 8px var(--cyan-soft);
  box-shadow: 0 0 10px rgba(0,242,254,0.3);
}
.answer-text {
  font-size: 26px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
}

/* 正解表示アニメーション */
.answers-grid.revealed .answer-btn {
  opacity: 0.28;
  transform: scale(0.97);
  filter: grayscale(0.5);
}
.answers-grid.revealed .answer-btn.is-correct {
  opacity: 1;
  transform: scale(1.06);
  filter: none;
  border-color: var(--green);
  background: linear-gradient(160deg, rgba(57,255,136,0.18), rgba(6,12,28,0.9));
  box-shadow: 0 0 35px rgba(57,255,136,0.75), 0 0 70px rgba(57,255,136,0.35);
  animation: correctPulse 1s ease-in-out infinite;
}
.answers-grid.revealed .answer-btn.is-correct .answer-label {
  color: var(--green);
  border-color: var(--green);
  text-shadow: 0 0 14px var(--green);
}
@keyframes correctPulse {
  0%, 100% { box-shadow: 0 0 35px rgba(57,255,136,0.75), 0 0 70px rgba(57,255,136,0.35); }
  50% { box-shadow: 0 0 50px rgba(57,255,136,0.95), 0 0 90px rgba(57,255,136,0.5); }
}

/* 解説オーバーレイ */
.comment-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.86);
  backdrop-filter: blur(6px);
}
.comment-overlay.show { display: flex; }
.comment-box {
  max-width: 1150px;
  width: 88%;
  background: linear-gradient(160deg, rgba(0,242,254,0.08), rgba(6,12,28,0.96));
  border: 2px solid var(--yellow);
  border-radius: 20px;
  box-shadow: 0 0 50px rgba(255,251,0,0.4), 0 0 90px rgba(0,242,254,0.2);
  padding: 50px 60px;
  text-align: center;
  animation: fadeSlideUp 0.6s cubic-bezier(.22,1,.36,1) both;
}
.correct-burst {
  font-family: var(--font-en);
  font-size: 26px;
  color: var(--green);
  letter-spacing: 6px;
  text-shadow: 0 0 18px var(--green);
  margin-bottom: 14px;
}
.comment-title {
  font-family: var(--font-en);
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255,251,0,0.6);
  margin: 0 0 20px;
}
#comment-text {
  font-size: 30px;
  line-height: 1.7;
  color: var(--text-main);
  margin: 0;
  font-weight: 500;
}

/* ================= エンディング画面 ================= */
.ending-inner { text-align: center; max-width: 1200px; }
.ending-title {
  font-family: var(--font-en);
  font-size: 60px;
  font-weight: 900;
  letter-spacing: 3px;
  margin: 0 0 20px;
  color: var(--text-main);
  text-shadow: 0 0 20px var(--cyan), 0 0 50px var(--cyan-soft);
}
.ending-title span {
  color: var(--green);
  text-shadow: 0 0 20px var(--green), 0 0 50px rgba(57,255,136,0.4);
}
.ending-setinfo {
  font-family: var(--font-en);
  font-size: 22px;
  color: var(--yellow);
  letter-spacing: 3px;
  margin-bottom: 34px;
  text-shadow: 0 0 12px rgba(255,251,0,0.5);
}
.typing-text {
  font-size: 26px;
  line-height: 1.9;
  color: var(--text-main);
  min-height: 140px;
  margin: 0 auto 36px;
  max-width: 900px;
}
.typing-text::after {
  content: '_';
  color: var(--cyan);
  animation: blink 0.9s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ================= 司会者用ボタン ================= */
.host-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 18px 0 22px;
  background: linear-gradient(to top, rgba(3,7,18,0.95), transparent);
}
.host-btn {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 18px;
  padding: 14px 40px;
  border-radius: 40px;
  border: 1.5px solid var(--text-dim);
  background: rgba(6,12,28,0.7);
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.25s ease;
}
.host-btn:hover { transform: translateY(-2px); }
.host-btn.primary {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(0,242,254,0.35);
}
.host-btn.primary:hover {
  background: rgba(0,242,254,0.12);
  box-shadow: 0 0 26px rgba(0,242,254,0.6);
}
#btn-next {
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 0 16px rgba(255,251,0,0.3);
}
#btn-next:hover {
  background: rgba(255,251,0,0.12);
  box-shadow: 0 0 26px rgba(255,251,0,0.55);
}
.host-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ================= レスポンシブ（保険） ================= */
@media (max-width: 1000px) {
  .site-title { font-size: 38px; }
  .set-grid { grid-template-columns: repeat(5, 1fr); }
  .question-text { font-size: 28px; }
  .answer-text { font-size: 20px; }
  .answers-grid { grid-template-columns: 1fr; }
}
