/* ===================================================
   Polytech Memorial Web版 - style.css
   基準解像度: 1920x1080
   =================================================== */

/* ---------- リセット・基本 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* touch-action は非継承プロパティのため全要素に明示適用してダブルタップズームを抑止 */
* {
  touch-action: manipulation;
}

/* ---------- ゲームラッパー ---------- */
#game-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

/* ---------- ゲームコンテナ (1920x1080基準) ---------- */
#game-container {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform-origin: top left;
  background: #111;
}

/* ---------- 画面共通 ---------- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
}

.screen.active { display: block; }
.screen.hidden  { display: none; }

/* ---------- 「スタートへ戻る」ボタン共通 ---------- */
.btn-back-to-title {
  position: absolute;
  top: 24px;
  right: 30px;
  z-index: 100;
  padding: 18px 36px;
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  background: rgba(30, 30, 80, 0.85);
  border: 3px solid #aad4ff;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn-back-to-title:hover {
  background: rgba(60, 60, 160, 0.9);
  transform: scale(1.05);
}
.btn-back-to-title:active { transform: scale(0.97); }

/* ========================================================
   スプラッシュ画面
   ======================================================== */
#screen-splash {
  background: #000;
  cursor: pointer;
}

#splash-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
}

#splash-title {
  font-size: 88px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.1em;
  text-shadow: 0 0 50px rgba(140, 200, 255, 0.9), 0 2px 16px rgba(0, 0, 0, 0.85);
  opacity: 0;
  animation: splash-fadein 1.5s ease 0.5s forwards;
  margin-bottom: 50px;
  white-space: nowrap;
}

#splash-tap-text {
  font-size: 44px;
  color: #b8ddff;
  letter-spacing: 0.12em;
  text-shadow: 0 0 24px rgba(80, 160, 255, 0.85), 0 2px 10px rgba(0, 0, 0, 0.9);
  animation: splash-text-pulse 2s ease-in-out 2s infinite;
}

@keyframes splash-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes splash-text-pulse {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  70%  { opacity: 1; }
  88%  { opacity: 0.25; }
  100% { opacity: 0.25; }
}

/* タップ後のフェードアウト */
#screen-splash.splash-fadeout {
  animation: splash-screen-out 0.7s ease forwards;
  pointer-events: none;
}

@keyframes splash-screen-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ========================================================
   ローディング画面
   ======================================================== */
#screen-loading {
  background: url('../assets/images/polytech_outside.webp') center/cover no-repeat;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

#loading-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 0;
}

#loading-text-area {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

#loading-message {
  font-size: 42px;
  color: #cce8ff;
  letter-spacing: 0.06em;
  text-shadow: 0 0 20px rgba(100,200,255,0.8);
}

#loading-progress-bar-wrap {
  width: 500px;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  overflow: hidden;
}

#loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4fc3f7, #81d4fa);
  border-radius: 10px;
  transition: width 0.3s ease;
}

#loading-gif {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 173px;
  height: auto;
  z-index: 1;
}

#loading-tap-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading-tap-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 60px 80px;
  background: rgba(0,0,0,0.6);
  border-radius: 24px;
  backdrop-filter: blur(4px);
  /* 中央より少し上に配置（読み込み完了テキストとの重なりを回避） */
  margin-bottom: 80px;
}

#loading-tap-overlay.hidden { display: none; }

#tap-to-start-text {
  font-size: 60px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 30px rgba(100,200,255,0.9);
}

/* モード選択ボタン */
#mode-btn-row {
  display: flex;
  gap: 60px;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 460px;
  padding: 48px 48px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.mode-btn:hover, .mode-btn:focus {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  outline: none;
}

.mode-btn:active {
  transform: translateY(-2px);
}

.mode-btn-1 {
  background: linear-gradient(145deg, #e91e8c, #c2185b);
  border: 2px solid rgba(255,160,200,0.5);
}

.mode-btn-2 {
  background: linear-gradient(145deg, #0288d1, #01579b);
  border: 2px solid rgba(100,200,255,0.5);
}

.mode-btn-title {
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.mode-btn-desc {
  font-size: 28px;
  color: rgba(255,255,255,0.85);
  text-align: center;
  line-height: 1.4;
}

#recommend-landscape {
  font-size: 36px;
  color: #aad4ff;
  letter-spacing: 0.05em;
}

#ios-hint {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.80);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  padding: 32px 56px;
  text-align: center;
  font-size: 38px;
  color: #fff;
  line-height: 1.9;
  white-space: nowrap;
}
#ios-hint.hidden { display: none; }

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ========================================================
   タイトル画面
   ======================================================== */
#screen-title {
  background: #000;
}

#title-bg-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#title-bg {
  position: absolute;
  width: 110%;
  height: 110%;
  top: -5%;
  left: -5%;
  object-fit: cover;
  transform-origin: center center;
}

#title-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
}

#title-logo-panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 72%;
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 28px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  box-shadow:
    0 8px 48px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
#title-logo-panel.hidden { display: none; }

#title-mode2-overlay {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 75%;
  height: auto;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}
#title-mode2-overlay.hidden { display: none; }
#title-mode2-overlay.mode1 {
  top: 5%;
  width: 70%;
}

#title-text {
  position: absolute;
  top: 120px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 120px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 4px 6px 20px rgba(0,0,0,0.8), 0 0 40px rgba(100,200,255,0.6);
  z-index: 10;
}

#title-buttons-wrap {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  overflow: visible;
  padding-bottom: 16px;
}

#title-buttons {
  display: flex;
  gap: 36px;
  flex-wrap: nowrap;
  overflow: visible;
}

.title-btn {
  min-width: 280px;
  padding: 30px 36px;
  font-size: 40px;
  font-weight: bold;
  color: #fff;
  background: rgba(20, 40, 100, 0.82);
  border: 4px solid rgba(170, 210, 255, 0.7);
  border-radius: 60px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 6px 30px rgba(0,0,80,0.5);
  white-space: nowrap;
}
.title-btn:hover {
  background: rgba(40, 80, 180, 0.9);
  box-shadow: 0 6px 40px rgba(100,160,255,0.5);
  transform: scale(1.05);
}
.title-btn:active { transform: scale(0.97); }

/* モード選択ボタン（タイトル画面 右上） */
#btn-mode-select {
  position: absolute;
  top: 40px;
  right: 60px;
  z-index: 20;
  padding: 18px 44px;
  font-size: 32px;
  font-weight: bold;
  color: #fff;
  background: rgba(10, 30, 80, 0.75);
  border: 2px solid rgba(170, 210, 255, 0.6);
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 80, 0.5);
  white-space: nowrap;
}
#btn-mode-select:hover {
  background: rgba(40, 80, 180, 0.9);
  box-shadow: 0 4px 30px rgba(100, 160, 255, 0.5);
  transform: scale(1.05);
}
#btn-mode-select:active { transform: scale(0.97); }

/* ========================================================
   名前入力画面
   ======================================================== */
#screen-name-input {
  background: #0a0a1a;
  overflow: hidden;
}

#name-input-bg-wrap {
  position: absolute;
  inset: 0;
}
#name-input-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
}
#name-input-bg-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
}

/* スライドコンテナ */
#name-input-slide-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  width: 200%; /* 2画面分 */
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

#name-input-slide-container.slide-left {
  transform: translateX(-50%);
}

.name-phase {
  width: 1920px;
  height: 1080px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.name-card {
  background: rgba(10, 20, 60, 0.8);
  border: 3px solid rgba(170, 210, 255, 0.6);
  border-radius: 30px;
  padding: 56px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 1020px;
  width: 100%;
  box-shadow: 0 10px 60px rgba(0,0,80,0.8);
}

.name-card-title {
  font-size: 56px;
  font-weight: bold;
  color: #aad4ff;
  letter-spacing: 0.06em;
  text-shadow: 0 0 20px rgba(100,200,255,0.6);
}

.name-card-desc {
  font-size: 30px;
  color: #cce8ff;
  text-align: center;
  line-height: 1.6;
}

.name-text-input {
  width: 100%;
  padding: 24px 32px;
  font-size: 42px;
  background: rgba(255,255,255,0.12);
  border: 3px solid rgba(170,210,255,0.5);
  border-radius: 16px;
  color: #fff;
  outline: none;
  text-align: center;
}
.name-text-input::placeholder { color: rgba(255,255,255,0.35); }
.name-text-input:focus { border-color: #4fc3f7; background: rgba(255,255,255,0.18); }

.name-btn-primary {
  padding: 22px 60px;
  font-size: 38px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 6px 30px rgba(0,0,100,0.6);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.name-btn-primary:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 40px rgba(30,100,255,0.5);
}
.name-btn-primary:active { transform: scale(0.97); }

/* 先生名画面 ボタン行（横並び固定） */
#teacher-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

/* シャッフルボタン */
.name-btn-shuffle {
  padding: 22px 48px;
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 6px 30px rgba(0, 80, 0, 0.5);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.name-btn-shuffle:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 40px rgba(30, 160, 60, 0.5);
}
.name-btn-shuffle:active { transform: scale(0.97); }

/* 先生名入力フィールド */
#teacher-name-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.teacher-name-row {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

.teacher-label {
  font-size: 28px;
  color: #aad4ff;
  min-width: 270px;
  text-align: left;
  white-space: nowrap;
}

.teacher-name-input {
  flex: 1;
  min-width: 0;
  padding: 12px 20px;
  font-size: 30px;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(170,210,255,0.4);
  border-radius: 12px;
  color: #fff;
  outline: none;
}
.teacher-name-input:focus { border-color: #4fc3f7; background: rgba(255,255,255,0.16); }

#name-input-gif {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 147px;
  height: auto;
  z-index: 20;
}

/* ========================================================
   ストーリー画面
   ======================================================== */
#screen-story { background: #111; }

#story-bg-wrap {
  position: absolute;
  inset: 0;
}
#story-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#story-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.story-char-img {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  height: 75%;
  object-fit: contain;
  z-index: 10;
  filter: drop-shadow(0 8px 30px rgba(0,0,0,0.7));
}

#story-msg-window {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 20, 60, 0.92);
  border-top: 4px solid rgba(170, 210, 255, 0.5);
  padding: 30px 60px 36px;
  z-index: 20;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#story-msg-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

#story-teacher-name {
  font-size: 42px;
  font-weight: bold;
  color: #aad4ff;
  text-shadow: 0 0 15px rgba(100,200,255,0.5);
}

#story-msg-body {
  flex: 1;
  overflow-y: auto;
}

#story-msg-text {
  font-size: 36px;
  color: #eef6ff;
  line-height: 1.7;
  white-space: pre-wrap;
}

.story-next-btn {
  align-self: flex-end;
  padding: 18px 52px;
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  background: rgba(20, 40, 120, 0.9);
  border: 3px solid rgba(170, 210, 255, 0.6);
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.story-next-btn:hover { background: rgba(40, 80, 180, 0.9); transform: scale(1.04); }
.story-next-btn:active { transform: scale(0.97); }

/* ========================================================
   クイズ画面
   ======================================================== */
#screen-quiz { background: #111; }

#quiz-bg-wrap {
  position: absolute;
  inset: 0;
}
#quiz-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#quiz-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* 左エリア 45% */
#quiz-left {
  position: absolute;
  left: 0;
  top: 0;
  width: 45%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 80px;
  padding-bottom: 0;
}

#quiz-intimacy-display {
  position: absolute;
  top: 30px;
  left: 40px;
  background: rgba(10, 20, 60, 0.88);
  border: 3px solid rgba(170,210,255,0.5);
  border-radius: 20px;
  padding: 14px 36px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}

#quiz-intimacy-label {
  font-size: 36px;
  color: #aad4ff;
  font-weight: bold;
}

#quiz-intimacy-value {
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  transition: transform 0.15s ease;
}

.quiz-char-img {
  height: 85%;
  max-height: 840px;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.6));
  transition: opacity 0.2s;
}

#intimacy-effect {
  position: absolute;
  font-size: 72px;
  font-weight: bold;
  pointer-events: none;
  z-index: 30;
  animation: intimacy-float 1.2s ease-out forwards;
}
#intimacy-effect.hidden { display: none; }
#intimacy-effect.positive { color: #FFD700; }
#intimacy-effect.negative { color: #64b5f6; }

@keyframes intimacy-float {
  0%   { opacity: 1; transform: scale(1.6) translateY(0); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scale(0.7) translateY(-120px); }
}

#confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  display: none;
}

/* 右エリア 55% */
#quiz-right {
  position: absolute;
  right: 0;
  top: 0;
  width: 55%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 24px 40px 24px 20px;
  gap: 16px;
}

/* 問題文カード */
#quiz-question-card {
  height: auto;
  min-height: 26%;
  max-height: 310px;
  background: rgba(10, 20, 60, 0.9);
  border: 3px solid rgba(170, 210, 255, 0.5);
  border-radius: 20px;
  padding: 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-shrink: 0;
}

#quiz-q-num {
  font-size: 34px;
  color: #aad4ff;
  font-weight: bold;
}

#quiz-question-text {
  font-size: 36px;
  color: #eef6ff;
  line-height: 1.55;
  overflow-y: auto;
  flex: 1;
}

/* 選択肢 */
#quiz-choices {
  flex: 1;
  height: auto;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.quiz-choice-btn {
  flex: none;
  height: auto;
  min-height: 80px;
  font-size: 34px;
  font-weight: bold;
  color: #fff;
  background: rgba(20, 40, 100, 0.85);
  border: 3px solid rgba(170, 210, 255, 0.5);
  border-radius: 16px;
  cursor: pointer;
  padding: 16px 28px;
  text-align: left;
  line-height: 1.4;
  transition: background 0.15s, transform 0.1s;
  overflow: visible;
  word-break: break-word;
}
.quiz-choice-btn:hover:not(:disabled) {
  background: rgba(40, 80, 180, 0.9);
  transform: scale(1.015);
}
.quiz-choice-btn:active:not(:disabled) { transform: scale(0.98); }
.quiz-choice-btn:disabled { opacity: 0.7; cursor: default; }
.quiz-choice-btn.correct { background: rgba(30, 120, 50, 0.9); border-color: #69f0ae; }
.quiz-choice-btn.wrong   { background: rgba(120, 30, 30, 0.9); border-color: #ef5350; }

/* メッセージウィンドウ */
#quiz-msg-window {
  flex-shrink: 0;
  height: auto;
  min-height: 260px;
  background: rgba(10, 20, 60, 0.92);
  border: 3px solid rgba(170, 210, 255, 0.5);
  border-radius: 20px;
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

#quiz-msg-header {
  flex-shrink: 0;
}

#quiz-teacher-name {
  font-size: 34px;
  font-weight: bold;
  color: #aad4ff;
}

#quiz-msg-body {
  flex: 1;
  overflow-y: auto;
}

#quiz-msg-text {
  font-size: 30px;
  color: #eef6ff;
  line-height: 1.6;
  white-space: pre-wrap;
}

.quiz-next-btn {
  align-self: flex-end;
  flex-shrink: 0;
  padding: 12px 40px;
  font-size: 30px;
  font-weight: bold;
  color: #fff;
  background: rgba(20, 40, 120, 0.9);
  border: 3px solid rgba(170, 210, 255, 0.6);
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.quiz-next-btn:hover { background: rgba(40, 80, 180, 0.9); transform: scale(1.04); }
.quiz-next-btn:active { transform: scale(0.97); }
.quiz-next-btn.hidden { display: none; }

/* ========================================================
   エンディング画面
   ======================================================== */
#screen-ending { background: #111; }

#ending-bg-wrap {
  position: absolute;
  inset: 0;
}

#ending-bg-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* キャラクターコンテナ */
#ending-chars-container {
  position: absolute;
  top: 144px;
  bottom: 332px;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 30px;
  z-index: 10;
  padding: 0 60px;
}

.ending-char-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ending-char-img {
  max-height: 480px;
  object-fit: contain;
  filter: drop-shadow(0 8px 30px rgba(0,0,0,0.7));
}

.ending-char-name {
  font-size: 38px;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 3px 10px rgba(0,0,0,0.8);
}

#ending-type-text {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 80px;
  font-weight: bold;
  z-index: 15;
  text-shadow: 0 0 30px rgba(255,200,0,0.8);
  background: rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 14px 60px;
  white-space: nowrap;
}

#ending-msg-window {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 20, 60, 0.92);
  border-top: 4px solid rgba(170, 210, 255, 0.5);
  padding: 30px 60px 36px;
  z-index: 20;
}

#ending-msg-body { overflow-y: auto; max-height: 262px; }

#ending-msg-text {
  font-size: 36px;
  color: #eef6ff;
  line-height: 1.65;
  white-space: pre-wrap;
}



#ending-confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  display: none;
}

/* ========================================================
   開発チーム画面（リニューアル版）
   ======================================================== */
#screen-developer {
  background: #020818;
}

/* 背景写真（暗くぼかす） */
#dev-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/images/polytech_outside.webp') center / cover no-repeat;
  filter: brightness(0.25) blur(4px);
}

/* パーティクルキャンバス */
#dev-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* メインコンテンツ領域 */
#dev-content {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 80px 120px;
  gap: 36px;
  overflow-y: auto;
}

/* ---- ヘッダー ---- */
#dev-header {
  text-align: center;
  flex-shrink: 0;
  animation: dev-fade-down 0.7s ease both;
}

#dev-header-label {
  font-size: 22px;
  letter-spacing: 0.3em;
  color: #60b8ff;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
}

#dev-main-title {
  font-size: 80px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ffffff 0%, #a0d8ff 50%, #60b8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin: 0 0 12px;
  line-height: 1;
}

#dev-sub-title {
  font-size: 26px;
  color: rgba(180, 220, 255, 0.85);
  letter-spacing: 0.05em;
  margin: 0 0 20px;
}

#dev-title-line {
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #60b8ff, transparent);
  margin: 0 auto;
  border-radius: 2px;
}

/* ---- カードグリッド ---- */
#dev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 28px;
  width: 100%;
  max-width: 1500px;
  flex-shrink: 0;
  animation: dev-fade-up 0.8s 0.2s ease both;
}

/* 共通カードスタイル（グラスモーフィズム） */
.dev-card {
  background: rgba(10, 25, 70, 0.65);
  border: 1px solid rgba(100, 180, 255, 0.35);
  border-radius: 24px;
  padding: 36px 44px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 80, 200, 0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.dev-card:hover {
  border-color: rgba(100, 180, 255, 0.7);
  box-shadow: 0 8px 40px rgba(0, 100, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.12);
}

/* カードヘッダー */
.dev-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(100, 180, 255, 0.25);
}
.dev-card-icon {
  font-size: 34px;
  line-height: 1;
}
.dev-card-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #60b8ff;
  text-transform: uppercase;
}

/* カードボディ */
.dev-card-body {
  color: rgba(220, 240, 255, 0.9);
}

/* チームカード */
#dev-card-team {
  grid-column: 1;
  grid-row: 1;
}
.dev-team-main {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.dev-team-sub {
  font-size: 26px;
  color: rgba(180, 220, 255, 0.8);
}

/* Special Thanksカード */
#dev-card-thanks {
  grid-column: 2;
  grid-row: 1;
}
.dev-thanks-item {
  font-size: 26px;
  margin-bottom: 10px;
  padding-left: 18px;
  position: relative;
}
.dev-thanks-item::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: #60b8ff;
}

/* Tech Stackカード（横長） */
#dev-card-tech {
  grid-column: 1 / 3;
  grid-row: 2;
}
.dev-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.dev-badge {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 2px solid;
}
.dev-badge-lang {
  background: rgba(0, 100, 220, 0.3);
  border-color: rgba(80, 160, 255, 0.6);
  color: #a0d0ff;
}
.dev-badge-ai {
  background: rgba(120, 0, 200, 0.3);
  border-color: rgba(180, 80, 255, 0.6);
  color: #d0a0ff;
}
.dev-badge-media {
  background: rgba(0, 150, 100, 0.3);
  border-color: rgba(0, 220, 150, 0.6);
  color: #80ffcc;
}
.dev-badge-platform {
  background: rgba(180, 100, 0, 0.3);
  border-color: rgba(255, 160, 50, 0.6);
  color: #ffc880;
}

/* リリースカード */
#dev-card-release {
  grid-column: 1 / 3;
  grid-row: 3;
}
.dev-release-date {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}
.dev-release-note {
  font-size: 24px;
  color: rgba(180, 220, 255, 0.7);
}

/* ---- 詳細テキストエリア ---- */
#dev-detail-area {
  width: 100%;
  max-width: 1500px;
  flex-shrink: 0;
  animation: dev-fade-up 0.8s 0.35s ease both;
}

#dev-detail-label {
  font-size: 22px;
  letter-spacing: 0.3em;
  color: #60b8ff;
  font-weight: 700;
  margin-bottom: 16px;
}

#dev-text {
  width: 100%;
  background: rgba(10, 25, 70, 0.55);
  border: 1px solid rgba(100, 180, 255, 0.25);
  border-radius: 20px;
  padding: 36px 44px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 26px;
  color: rgba(200, 230, 255, 0.85);
  line-height: 1.9;
  white-space: pre-wrap;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  box-sizing: border-box;
}

/* ---- フッター ---- */
#dev-footer {
  text-align: center;
  flex-shrink: 0;
  animation: dev-fade-up 0.8s 0.4s ease both;
}
#dev-copyright {
  font-size: 22px;
  color: rgba(140, 190, 255, 0.6);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
#dev-powered {
  font-size: 20px;
  color: rgba(100, 160, 255, 0.5);
  font-style: italic;
  letter-spacing: 0.08em;
}

/* アニメーション */
@keyframes dev-fade-down {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dev-fade-up {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   スクロールバースタイル（全体）
   ======================================================== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: rgba(170,210,255,0.4); border-radius: 10px; }

/* ========================================================
   ユーティリティ
   ======================================================== */
.hidden { display: none !important; }

/* 入力欄シェイクアニメーション */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-8px); }
  80%       { transform: translateX(8px); }
}
.shake {
  animation: shake 0.4s ease-in-out;
  border-color: #ef5350 !important;
}

/* ========================================================
   ステージクリアオーバーレイ
   ======================================================== */
#quiz-clear-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: transparent;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20px;
}

#quiz-clear-text {
  font-size: 64px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 40px rgba(255,200,0,0.9), 0 4px 20px rgba(0,0,0,0.8);
  animation: clear-pulse 0.8s ease-in-out infinite alternate;
  pointer-events: none;
  position: relative;
  z-index: 17;
}

@keyframes clear-pulse {
  0%   { transform: scale(1.0); opacity: 0.9; }
  100% { transform: scale(1.08); opacity: 1; }
}

/* ========================================================
   問題閲覧モード画面
   ======================================================== */
#screen-quiz-editor {
  background: #050510;
}

#qe-bg {
  position: absolute;
  inset: 0;
  background-image: url('../assets/images/opening_old.webp');
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
}

#qe-content {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 40px 80px 100px;
  gap: 24px;
}

#qe-title {
  font-size: 60px;
  font-weight: bold;
  color: #aad4ff;
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(100,200,255,0.6);
  flex-shrink: 0;
}

#qe-tabs {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.qe-tab-btn {
  padding: 16px 36px;
  font-size: 32px;
  font-weight: bold;
  color: #aad4ff;
  background: rgba(20, 40, 100, 0.6);
  border: 2px solid rgba(170,210,255,0.4);
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.2s;
}
.qe-tab-btn.active {
  background: rgba(40, 80, 200, 0.9);
  border-color: #aad4ff;
  color: #fff;
}
.qe-tab-btn:hover:not(.active) { background: rgba(30, 60, 150, 0.7); }

#qe-question-list {
  flex: 1;
  overflow-y: auto;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(170,210,255,0.3);
  border-radius: 20px;
  padding: 30px 50px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.qe-question-item {
  background: rgba(10, 20, 60, 0.85);
  border: 2px solid rgba(170,210,255,0.25);
  border-radius: 16px;
  padding: 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qe-q-num {
  font-size: 26px;
  color: #4fc3f7;
  font-weight: bold;
}

.qe-q-text {
  font-size: 30px;
  color: #eef6ff;
  line-height: 1.5;
}

.qe-q-answer {
  font-size: 26px;
  color: #69f0ae;
  font-weight: bold;
}

.qe-q-wrong {
  font-size: 26px;
  color: #ef9a9a;
}

.qe-q-exp {
  font-size: 24px;
  color: #b0bec5;
  font-style: italic;
}

#qe-loading {
  font-size: 40px;
  color: #aad4ff;
  text-align: center;
  padding: 60px;
}

/* ========================================================
   音楽テスト画面
   ======================================================== */
#screen-music-test {
  background: #050510;
}

#mt-bg {
  position: absolute;
  inset: 0;
  background-image: url('../assets/images/opening_old.webp');
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
}

#mt-content {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 40px 80px 100px;
  gap: 24px;
  overflow-y: auto;
}

#mt-title {
  font-size: 60px;
  font-weight: bold;
  color: #aad4ff;
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(100,200,255,0.6);
  flex-shrink: 0;
}

.mt-section-title {
  font-size: 42px;
  font-weight: bold;
  color: #7ec8e3;
  border-bottom: 2px solid rgba(170,210,255,0.3);
  padding-bottom: 10px;
  flex-shrink: 0;
}

.mt-track-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

/* 楽曲リストの1行 */
.mt-track-row {
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgba(10, 20, 60, 0.7);
  border: 2px solid rgba(170,210,255,0.25);
  border-radius: 16px;
  padding: 16px 32px;
  justify-content: space-between;
  transition: border-color 0.2s, background 0.2s;
}
/* 再生中の楽曲行をハイライト表示 */
.mt-track-row.mt-playing {
  border-color: rgba(100, 200, 255, 0.8);
  background: rgba(20, 60, 120, 0.85);
}

.mt-btn-group {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.mt-track-name {
  flex: 1;
  font-size: 34px;
  color: #eef6ff;
}

.mt-play-btn, .mt-stop-btn {
  padding: 14px 36px;
  font-size: 30px;
  font-weight: bold;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  border: none;
}
.mt-play-btn {
  background: rgba(30, 120, 50, 0.85);
  color: #fff;
}
.mt-play-btn:hover { background: rgba(50, 180, 80, 0.9); transform: scale(1.04); }
.mt-stop-btn {
  background: rgba(120, 30, 30, 0.85);
  color: #fff;
}
.mt-stop-btn:hover { background: rgba(200, 50, 50, 0.9); transform: scale(1.04); }

/* ========================================================
   トーストメッセージ
   ======================================================== */
#game-toast {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  padding: 24px 60px;
  border-radius: 60px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}
.toast-show {
  animation: toast-in 0.3s ease forwards;
}
.toast-hide {
  animation: toast-out 0.5s ease forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* キャラ人数に応じた画像サイズ調整 */
#ending-chars-container[data-count="1"] .ending-char-img { max-height: 560px; }
#ending-chars-container[data-count="2"] .ending-char-img { max-height: 540px; }
#ending-chars-container[data-count="3"] .ending-char-img { max-height: 490px; }
#ending-chars-container[data-count="4"] .ending-char-img { max-height: 410px; }
#ending-chars-container[data-count="5"] .ending-char-img { max-height: 360px; }
#ending-chars-container[data-count="4"] .ending-char-name,
#ending-chars-container[data-count="5"] .ending-char-name {
  font-size: 26px;
}

/* 浮遊星パーティクル（GOOD END・filter なし軽量版） */
.end-star {
  position: absolute;
  pointer-events: none;
  z-index: 16;
  font-style: normal;
  animation: star-float linear infinite;
  opacity: 0;
  user-select: none;
}
@keyframes star-float {
  0%   { transform: translateY(0px) rotate(0deg) scale(0.6);   opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 0.9; }
  100% { transform: translateY(-220px) rotate(400deg) scale(1.3); opacity: 0; }
}

/* 落下光粒パーティクル（NORMAL END・box-shadow なし軽量版） */
.end-drop {
  position: absolute;
  pointer-events: none;
  z-index: 16;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: drop-fall linear infinite;
  opacity: 0;
}
@keyframes drop-fall {
  0%   { transform: translateY(0px) scaleX(0.85);   opacity: 0; }
  8%   { opacity: 0.75; }
  92%  { opacity: 0.4; }
  100% { transform: translateY(160px) scaleX(0.85); opacity: 0; }
}


/* ===================================================
   画面遷移アニメーション
   =================================================== */

/* 黒フェードオーバーレイ */
#scene-transition {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.25s ease;
}
#scene-transition.fade-in {
  opacity: 1;
  pointer-events: auto;
}

/* フォアグラウンドラッパー（背景を除く全要素を包む） */
.screen-foreground {
  position: absolute;
  inset: 0;
}

/* 右からスライドインしながらフェードイン */
@keyframes sc-slide-in-right {
  from { transform: translateX(60px) scale(0.94); opacity: 0; }
  to   { transform: translateX(0)    scale(1);    opacity: 1; }
}

/* 下からせり上がりながらフェードイン（エンディング用） */
@keyframes sc-slide-in-up {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.anim-slide-in-right {
  animation: sc-slide-in-right 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.anim-slide-in-up {
  animation: sc-slide-in-up 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* 左に縮小しながら退場（ストーリー・クイズ共通） */
@keyframes sc-exit-to-left {
  from { transform: translateX(0)     scale(1);    opacity: 1; }
  to   { transform: translateX(-60px) scale(0.94); opacity: 0; }
}

/* スケールアップしながらフェードイン（スライドなし） */
@keyframes sc-enter-scale-up {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.anim-exit-to-left {
  animation: sc-exit-to-left 0.3s cubic-bezier(0.55, 0, 1, 0.45) both;
}

.anim-enter-scale-up {
  animation: sc-enter-scale-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
