/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'SimHei', Arial, sans-serif;
  background-color: #000;
  overflow: hidden;
}

/* 游戏容器 */
#game-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 标题栏 */
#title-bar {
  background: linear-gradient(to bottom, rgba(10,5,30,0.95), rgba(10,5,30,0.5));
  color: #fff;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

#game-title {
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(100,150,255,0.5), 2px 2px 4px rgba(0,0,0,0.8);
  background: linear-gradient(135deg, #a0c4ff, #c9b1ff, #ffd6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#title-buttons {
  display: flex;
  gap: 10px;
}

.title-button {
  background: rgba(100,150,255,0.15);
  border: 1px solid rgba(100,150,255,0.3);
  color: #a0c4ff;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.title-button:hover {
  background: rgba(100,150,255,0.3);
  transform: translateY(-2px);
  box-shadow: 0 2px 10px rgba(100,150,255,0.3);
}

/* 背景层 */
#background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.8s ease;
  z-index: 1;
}

/* 特效层 */
#effects-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* 角色层 */
#characters {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 10%;
  z-index: 3;
  pointer-events: none;
}

.character {
  max-height: 80%;
  max-width: 40%;
  object-fit: contain;
  transition: opacity 0.5s, transform 0.3s;
  filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
}

.character-left {
  align-self: flex-end;
  margin-left: 0;
}

.character-right {
  align-self: flex-end;
  margin-right: 0;
}

.character-center {
  align-self: flex-end;
  margin: 0 auto;
}

/* 弹幕层 */
#danmaku-layer {
  position: absolute;
  top: 80px;
  left: 0;
  width: 100%;
  height: 40%;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  color: rgba(255,255,255,0.85);
  font-size: 16px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  animation: danmaku-scroll 8s linear forwards;
}

@keyframes danmaku-scroll {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

/* 对话框层 */
#dialogue-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 20px;
}

#dialogue-box {
  background: linear-gradient(135deg, rgba(10,5,30,0.92), rgba(20,10,50,0.92));
  border: 1px solid rgba(100,150,255,0.25);
  border-radius: 12px;
  padding: 25px 30px;
  max-width: 1200px;
  margin: 0 auto;
  box-shadow: 0 4px 30px rgba(0,0,0,0.6), inset 0 1px 0 rgba(100,150,255,0.1);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

#speaker-name {
  color: #a0c4ff;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 12px;
  text-shadow: 0 0 8px rgba(100,150,255,0.4);
}

#speaker-name.narrator {
  color: #c9b1ff;
  font-style: italic;
}

#dialogue-text {
  color: #e0e0e0;
  font-size: 18px;
  line-height: 1.8;
  min-height: 60px;
  white-space: pre-wrap;
}

/* 选项容器 */
#choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.choice-button {
  background: linear-gradient(135deg, rgba(30,15,60,0.85), rgba(50,25,90,0.85));
  border: 1px solid rgba(100,150,255,0.3);
  color: #e0e0e0;
  padding: 15px 25px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  backdrop-filter: blur(5px);
}

.choice-button:hover {
  background: linear-gradient(135deg, rgba(50,30,100,0.9), rgba(80,50,140,0.9));
  transform: translateX(10px);
  box-shadow: 0 0 20px rgba(100,150,255,0.3);
  border-color: rgba(100,150,255,0.6);
  color: #fff;
}

.choice-button .choice-label {
  color: #a0c4ff;
  font-weight: bold;
  margin-right: 8px;
}

.continue-button {
  background: linear-gradient(135deg, rgba(20,30,60,0.85), rgba(30,50,90,0.85));
  text-align: center;
  border-color: rgba(100,200,255,0.3);
}

.continue-button:hover {
  background: linear-gradient(135deg, rgba(30,50,90,0.9), rgba(50,80,130,0.9));
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(100,200,255,0.3);
}

/* 变量显示面板 */
#variables-panel {
  position: absolute;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, rgba(10,5,30,0.85), rgba(20,10,50,0.85));
  border: 1px solid rgba(100,150,255,0.2);
  border-radius: 8px;
  padding: 15px;
  min-width: 180px;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.variable-item {
  margin-bottom: 12px;
}

.variable-item:last-child {
  margin-bottom: 0;
}

.variable-label {
  color: #a0c4ff;
  font-size: 13px;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.variable-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(100,150,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.variable-bar {
  height: 100%;
  transition: width 0.5s ease;
  border-radius: 3px;
}

.courage-bar {
  background: linear-gradient(to right, #ff6b6b, #ff9a56);
  box-shadow: 0 0 5px #ff6b6b;
}

.sincerity-bar {
  background: linear-gradient(to right, #56c4ff, #a0c4ff);
  box-shadow: 0 0 5px #56c4ff;
}

.humanity-bar {
  background: linear-gradient(to right, #56ffa0, #a0ffc4);
  box-shadow: 0 0 5px #56ffa0;
}

.conviction-bar {
  background: linear-gradient(to right, #c9b1ff, #ffd6ff);
  box-shadow: 0 0 5px #c9b1ff;
}

/* 菜单 */
#game-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(10,5,30,0.97), rgba(20,10,50,0.97));
  border: 1px solid rgba(100,150,255,0.3);
  border-radius: 12px;
  padding: 30px;
  min-width: 400px;
  z-index: 200;
  display: none;
  backdrop-filter: blur(15px);
}

.menu-title {
  color: #a0c4ff;
  font-size: 24px;
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(100,150,255,0.4);
}

.menu-section {
  margin-bottom: 20px;
}

.menu-section-title {
  color: #c9b1ff;
  font-size: 16px;
  margin-bottom: 10px;
}

.save-slot {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.save-button, .load-button {
  flex: 1;
  background: rgba(50,25,90,0.6);
  border: 1px solid rgba(100,150,255,0.2);
  color: #e0e0e0;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.save-button:hover, .load-button:hover {
  background: rgba(80,50,140,0.8);
  border-color: rgba(100,150,255,0.5);
}

.close-menu-button {
  width: 100%;
  background: rgba(150, 50, 50, 0.5);
  border: 1px solid rgba(255, 100, 100, 0.3);
  color: #ff9a9a;
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
  font-size: 14px;
}

.close-menu-button:hover {
  background: rgba(180, 70, 70, 0.7);
}

/* 章节标题过渡 */
.chapter-title-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 150;
  animation: chapterFade 3s ease forwards;
}

.chapter-title-overlay h2 {
  color: #a0c4ff;
  font-size: 36px;
  text-shadow: 0 0 20px rgba(100,150,255,0.5);
  margin-bottom: 10px;
}

.chapter-title-overlay p {
  color: #c9b1ff;
  font-size: 18px;
}

@keyframes chapterFade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

/* 响应式设计 */
@media (max-width: 768px) {
  #game-title {
    font-size: 16px;
  }

  .title-button {
    padding: 6px 12px;
    font-size: 12px;
  }

  #dialogue-box {
    padding: 18px 20px;
  }

  #speaker-name {
    font-size: 16px;
  }

  #dialogue-text {
    font-size: 15px;
  }

  .choice-button {
    padding: 12px 18px;
    font-size: 14px;
  }

  #variables-panel {
    top: 60px;
    right: 10px;
    min-width: 140px;
    padding: 10px;
  }

  .character {
    max-width: 45%;
  }

  #game-menu {
    min-width: 300px;
    padding: 20px;
  }

  .danmaku-item {
    font-size: 13px;
  }
}

/* 数值变化浮动提示 */
#stat-notifications {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.stat-notification {
  font-size: 28px;
  font-weight: bold;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9),
               0 0 20px rgba(0, 0, 0, 0.8);
  padding: 15px 30px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid;
  animation: floatUp 2s ease-out forwards;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.stat-notification.positive {
  color: #4ade80;
  border-color: #4ade80;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.stat-notification.negative {
  color: #f87171;
  border-color: #f87171;
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.4);
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1.1);
  }
  40% {
    transform: translateY(-10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0.9);
  }
}

/* 淡入淡出动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

.fade-out {
  animation: fadeOut 0.5s ease;
}

/* 加载动画 */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #a0c4ff;
  font-size: 20px;
  z-index: 1000;
  text-shadow: 0 0 10px rgba(100,150,255,0.5);
}

/* 粒子效果 */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(100,150,255,0.6);
  border-radius: 50%;
  pointer-events: none;
  animation: float-up 4s ease-in infinite;
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(0) scale(0); }
  20% { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { opacity: 0; transform: translateY(-200px) scale(0.5); }
}
