/* ========================================
   Aria — アソビゴコロのメガネ スタイルシート
   ======================================== */

/* リセット・基本 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #000;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
}

/* ゲームコンテナ（1280x720固定 → JSでscale） */
#game-container {
  position: relative;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: #1a1a2e;
  transform-origin: center center;
}

/* ========================================
   タイトル画面
   ======================================== */
#title-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  background-image: url('assets/backgrounds/bg_title.webp');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  z-index: 100;
}
.title-content { color: #fff; position: absolute; left: 160px; bottom: 260px; z-index: 1; }
.btn-start {
  padding: 14px 64px;
  font-size: 16px;
  letter-spacing: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.btn-start:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.8);
}

/* ========================================
   ゲーム画面
   ======================================== */
#game-screen {
  position: absolute;
  inset: 0;
}

/* 背景レイヤー（2枚でクロスフェード対応） */
#bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 1.2s ease;
}
#bg-layer2 {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease;
  z-index: 1;
}
/* 夕方→夜 徐変演出用ダークオーバーレイ */
#bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 40, 0);
  transition: background 2s ease;
  pointer-events: none;
}
#bg-layer.darken-1::after { background: rgba(10, 10, 40, 0.15); }
#bg-layer.darken-2::after { background: rgba(10, 10, 40, 0.3); }
#bg-layer.darken-3::after { background: rgba(10, 10, 40, 0.45); }

/* キャラクターレイヤー（bg-layer2より上） */
#char-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 720px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 40px;
  z-index: 10;
  pointer-events: none;
}
#char-sprite {
  max-height: 100%;
  width: auto;
  max-width: 500px;
  object-fit: contain;
  object-position: bottom;
  transition: opacity 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}
/* 話していないキャラをやや暗く */
#char-sprite.inactive {
  filter: brightness(0.55) drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

/* テキストボックス */
#textbox {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to bottom,
    rgba(0, 0, 20, 0.0) 0%,
    rgba(0, 0, 20, 0.85) 15%,
    rgba(0, 0, 20, 0.95) 100%);
  padding: 40px 60px 30px;
  z-index: 20;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
#speaker-name {
  font-size: 15px;
  font-weight: bold;
  color: #ffb87a;
  margin-bottom: 10px;
  padding: 2px 12px;
  border-left: 3px solid #ffb87a;
  letter-spacing: 2px;
}
/* 話者別カラー */
#speaker-name.speaker-aria {
  color: #ffb87a;
  border-left-color: #ffb87a;
}
#speaker-name.speaker-haruka {
  color: #7ac8ff;
  border-left-color: #7ac8ff;
}
#text-content {
  font-size: 17px;
  line-height: 1.85;
  color: #e8e8f0;
  letter-spacing: 0.5px;
  min-height: 60px;
}
#click-indicator {
  position: absolute;
  bottom: 16px;
  right: 30px;
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* モノローグ（心の声）スタイル */
#textbox.thought #text-content {
  color: #b8c8e8;
  font-style: italic;
}

/* ========================================
   日付ラベル
   ======================================== */
#day-label {
  position: absolute;
  top: 24px;
  left: 32px;
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 3px;
  padding: 6px 16px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  z-index: 30;
}

/* ========================================
   選択肢レイヤー
   ======================================== */
#choice-layer {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 20, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 50;
}
.choice-btn {
  width: 600px;
  padding: 20px 32px;
  font-size: 17px;
  font-family: inherit;
  background: rgba(30, 35, 60, 0.9);
  border: 1px solid rgba(255, 184, 122, 0.3);
  color: #e8e8f0;
  cursor: pointer;
  transition: all 0.25s;
  text-align: left;
  letter-spacing: 0.5px;
  line-height: 1.6;
  border-radius: 4px;
}
.choice-btn:hover {
  background: rgba(50, 60, 100, 0.95);
  border-color: rgba(255, 184, 122, 0.8);
  transform: translateX(6px);
  box-shadow: 0 0 20px rgba(255, 180, 100, 0.2);
}
.choice-label {
  font-size: 13px;
  color: #ffb87a;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

/* ========================================
   UIオーバーレイ
   ======================================== */
#ui-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 40;
  pointer-events: none;
}
#ui-overlay.active {
  pointer-events: auto;
}
#ui-overlay.result-mode {
  background: transparent;
  align-items: center;
}

/* --- リザルト画面 --- */
.ui-result {
  width: 560px;
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  margin: auto;
}
.ui-result.good {
  background: linear-gradient(135deg, rgba(46, 30, 10, 0.85), rgba(74, 50, 20, 0.85));
  border: 1px solid rgba(255, 180, 100, 0.3);
  backdrop-filter: blur(4px);
  margin-left: 60px;
  margin-right: auto;
}
.ui-result.normal {
  background: linear-gradient(135deg, #2e2a0a, #4a3e1a);
  border: 1px solid rgba(236, 201, 75, 0.3);
}
.ui-result.bad {
  background: linear-gradient(135deg, #2e0a0a, #4a1a1a);
  border: 1px solid rgba(245, 101, 101, 0.3);
}
.result-title {
  font-size: 18px;
  color: #fff;
  margin-bottom: 24px;
  line-height: 1.6;
  letter-spacing: 1px;
}
.result-message {
  margin-top: 28px;
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  line-height: 1.8;
  font-style: italic;
  letter-spacing: 1px;
}
.result-restart {
  margin-top: 28px;
  padding: 12px 48px;
  font-size: 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 4px;
  transition: all 0.3s;
}
.result-restart:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
}

/* ========================================
   トランジション・アニメーション
   ======================================== */
/* 日付トランジション */
.day-transition {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 60;
  color: #fff;
  font-size: 24px;
  letter-spacing: 6px;
  opacity: 0;
  pointer-events: none;
}
.day-transition.active {
  animation: dayTransition 2s ease forwards;
  pointer-events: auto;
}
@keyframes dayTransition {
  0% { opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ========================================
   縦持ち案内オーバーレイ
   ======================================== */
#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 20, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
  color: #fff;
}
#rotate-hint .rotate-icon {
  font-size: 64px;
  animation: rotatePhone 2s ease-in-out infinite;
}
#rotate-hint p {
  font-size: 18px;
  letter-spacing: 3px;
  opacity: 0.8;
}
@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-90deg); }
  50% { transform: rotate(-90deg); }
  75% { transform: rotate(0deg); }
}

/* スマホ縦持ち時のみ表示 */
@media (max-width: 768px) and (orientation: portrait) {
  #rotate-hint {
    display: flex;
  }
  #game-container {
    display: none;
  }
}
