/* 主样式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #ff6b9d;
  --pink-light: #ffb3d1;
  --pink-dark: #e84580;
  --warm: #fff5f7;
  --text: #333;
  --text-light: #666;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
  --radius: 12px;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: #1a1a2e;
  color: var(--text);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* 主菜单 */
.menu-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../assets/bg/menu-photo-clean.jpg') center / cover no-repeat;
  z-index: 0;
}

.menu-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(8,10,14,0.08), rgba(8,10,14,0.48));
}

#name-screen {
  background: url('../assets/bg/name-screen-image2.jpg') center / cover no-repeat;
}

#name-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 20, 0.42);
}

.name-content {
  position: relative;
  z-index: 1;
  background: rgba(7, 14, 22, 0.78);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  color: #f4f0e8;
}

.menu-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.game-title {
  font-size: 4rem;
  font-weight: 700;
  color: var(--pink);
  text-shadow: 0 0 30px rgba(255,107,157,0.5), 0 0 60px rgba(255,107,157,0.3);
  margin-bottom: 0.5rem;
  letter-spacing: 0.2em;
}

.game-subtitle {
  font-size: 1.2rem;
  color: var(--pink-light);
  margin-bottom: 3rem;
  font-weight: 300;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.menu-btn {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: white;
  border: none;
  padding: 14px 48px;
  font-size: 1.1rem;
  font-family: inherit;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  box-shadow: 0 4px 15px rgba(255,107,157,0.4);
}

.menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255,107,157,0.6);
}

.menu-btn:active {
  transform: translateY(0);
}

.menu-btn.small {
  padding: 10px 30px;
  font-size: 0.9rem;
  min-width: auto;
}

/* 名字输入界面 */
.name-content {
  background: rgba(7, 14, 22, 0.78);
  padding: 3rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  max-width: 500px;
  width: 90%;
  color: #f4f0e8;
}

.name-content h2 {
  color: #f4f0e8;
  margin-bottom: 1.5rem;
}

.name-content input {
  width: 100%;
  padding: 12px 20px;
  font-size: 1.2rem;
  font-family: inherit;
  border: 2px solid var(--pink-light);
  border-radius: 8px;
  outline: none;
  text-align: center;
  transition: border-color 0.3s;
}

.name-content input:focus {
  border-color: var(--pink);
}

.personality-select {
  margin: 2rem 0;
}

.personality-select h3 {
  color: rgba(244,240,232,0.72);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.personality-options {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.personality-btn {
  padding: 8px 20px;
  border: 2px solid var(--pink-light);
  background: white;
  color: var(--pink-dark);
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.personality-btn.selected {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
}

.personality-btn:hover {
  border-color: var(--pink);
}

/* 游戏主界面 */
.game-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: background-image 0.5s ease;
}

.character-sprite {
  position: absolute;
  right: clamp(18px, 6vw, 96px);
  bottom: 145px;
  width: min(30vw, 390px);
  height: min(58vh, 620px);
  z-index: 2;
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.character-sprite img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 6px;
  -webkit-mask-image: linear-gradient(to bottom, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 86%, transparent 100%);
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
}

.character-sprite.is-cutout {
  right: clamp(12px, 4vw, 64px);
  bottom: 118px;
  width: min(46vw, 620px);
  height: min(78vh, 780px);
  animation: character-enter 0.5s ease both;
}

.character-sprite.is-cutout img {
  border-radius: 0;
  mask-image: none;
  -webkit-mask-image: none;
  filter: drop-shadow(0 18px 26px rgba(0,0,0,0.32));
}

@keyframes character-enter {
  from { opacity: 0; transform: translateX(6%); }
  to { opacity: 1; transform: translateX(0); }
}

/* 状态栏 */
.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
  color: white;
  z-index: 10;
  font-size: 0.9rem;
}

.game-tools {
  position: absolute;
  top: 68px;
  right: 18px;
  z-index: 21;
  display: flex;
  gap: 8px;
}

.tool-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 6px;
  background: rgba(20,25,35,0.62);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.tool-btn:hover { background: var(--pink-dark); }

.action-icon {
  display: block;
  margin-bottom: 5px;
  font-size: 1.35rem;
}

.action-grid.disabled { opacity: 0.45; pointer-events: none; }

#review-content ul { margin: 14px 0 22px 20px; line-height: 1.8; }

.status-left, .status-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.relationship-meter {
  width: clamp(90px, 12vw, 170px);
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 4px;
  background: rgba(0,0,0,0.35);
}

.relationship-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #67d6a3, #ff6b9d);
  transition: width 0.45s ease;
}

/* CG 展示 */
.cg-display {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  background: #050910;
  background-image: linear-gradient(90deg, #03060b 0%, #101824 50%, #03060b 100%);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-moment {
  position: relative;
  width: min(100%, calc(100vh * 9 / 16));
  height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #050910;
}

.event-copy {
  position: absolute;
  left: clamp(24px, 6vw, 88px);
  bottom: clamp(74px, 13vh, 132px);
  z-index: 2;
  width: min(560px, calc(100% - 48px));
  padding: 0;
  color: white;
  text-shadow: 0 2px 18px rgba(0,0,0,0.72);
}

.event-kicker {
  display: block;
  margin-bottom: 18px;
  color: #74d9ad;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
}

.event-copy h2 {
  margin-bottom: 14px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.2;
}

.event-copy p {
  color: rgba(255,255,255,0.68);
  line-height: 1.8;
}

.event-photo {
  position: absolute;
  inset: 0;
  background: #090b10;
}

.event-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(3,7,12,0.58) 0%, transparent 58%), linear-gradient(0deg, rgba(3,7,12,0.82) 0%, transparent 48%);
}

.event-photo img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  animation: event-scene-in 0.7s ease both;
}

@keyframes event-scene-in {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

.event-continue {
  position: absolute;
  right: clamp(20px, 4vw, 58px);
  bottom: clamp(20px, 4vh, 38px);
  z-index: 3;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 6px;
  background: #f4f4f4;
  color: #151820;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* 好感度提示 */
.affinity-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,107,157,0.9);
  color: white;
  padding: 12px 30px;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 500;
  z-index: 40;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.1); }
}

/* 行动选择 */
.action-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(10,12,18,0.97) 0%, rgba(18,20,28,0.92) 100%);
  padding: 2rem;
  z-index: 20;
  color: white;
  text-align: center;
}

.action-box h3 {
  color: var(--pink-light);
  margin-bottom: 0.5rem;
}

.action-meta {
  display: flex;
  justify-content: center;
  gap: 28px;
  color: var(--pink);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.action-tabs {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
}

.action-tab {
  border: 0;
  border-radius: 4px;
  padding: 8px 20px;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-family: inherit;
  cursor: pointer;
}

.action-tab.active {
  background: var(--pink-dark);
  color: white;
}

.action-hint {
  min-height: 20px;
  margin-bottom: 12px;
  color: rgba(255,255,255,0.62);
  font-size: 0.82rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.action-btn {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  color: white;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.action-btn:hover {
  background: rgba(255,107,157,0.3);
  border-color: var(--pink);
}

.action-btn small {
  display: block;
  margin-top: 5px;
  min-height: 28px;
  color: rgba(255,255,255,0.58);
  font-size: 0.7rem;
  line-height: 1.35;
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 晚间回顾 */
.review-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.95);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 30;
  max-width: 500px;
  width: 90%;
  text-align: center;
}

.review-box h3 {
  color: var(--pink-dark);
  margin-bottom: 1.5rem;
}

#review-content {
  text-align: left;
  margin-bottom: 1.5rem;
  line-height: 1.8;
  color: var(--text);
}

/* 回忆相册 */
.gallery-content {
  background: rgba(255,255,255,0.95);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.gallery-content h2 {
  color: var(--pink-dark);
  margin-bottom: 1.5rem;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gallery-item {
  aspect-ratio: 16/9;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s;
}

.gallery-item:hover {
  transform: scale(1.05);
}

.gallery-item.locked {
  filter: brightness(0);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #191919;
}

@media (max-width: 768px) {
  .cg-display {
    padding: 0;
  }

  .event-moment {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  .event-copy { left: 20px; bottom: 82px; width: calc(100% - 40px); }
  .event-kicker { margin-bottom: 8px; }
  .event-copy h2 { margin-bottom: 7px; font-size: 1.45rem; }
  .event-copy p { font-size: 0.84rem; line-height: 1.55; }
  .event-photo img { object-position: center; }
  .event-continue { right: 18px; bottom: 18px; }
  .relationship-meter { width: 72px; }
}

.gallery-item .gallery-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  padding: 8px;
  font-size: 0.8rem;
}

/* 设置 */
.settings-content {
  background: rgba(255,255,255,0.95);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 90%;
}

.settings-content h2 {
  color: var(--pink-dark);
  margin-bottom: 1.5rem;
  text-align: center;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
}

.setting-item label {
  color: var(--text);
  font-size: 0.95rem;
  min-width: 80px;
}

.setting-item input[type="range"] {
  flex: 1;
  accent-color: var(--pink);
}

.setting-item span {
  color: var(--text-light);
  font-size: 0.85rem;
  min-width: 40px;
  text-align: right;
}

.toggle-btn {
  padding: 6px 16px;
  border: 2px solid var(--pink-light);
  background: white;
  color: var(--pink-dark);
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.toggle-btn.active {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
}

/* 存档 */
.save-content {
  background: rgba(255,255,255,0.95);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 90%;
}

.save-content h2 {
  color: var(--pink-dark);
  margin-bottom: 1.5rem;
  text-align: center;
}

.save-slots {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.save-slot {
  background: #f9f9f9;
  border: 2px solid #eee;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.save-slot:hover {
  border-color: var(--pink);
  background: var(--warm);
}

.save-slot .slot-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.save-slot .slot-info {
  font-size: 0.8rem;
  color: var(--text-light);
}

.save-slot.empty {
  color: #ccc;
  text-align: center;
}

/* 结局 */
.ending-content {
  background: rgba(0,0,0,0.9);
  padding: 3rem;
  border-radius: var(--radius);
  text-align: center;
  color: white;
  max-width: 600px;
  width: 90%;
}

.ending-content h2 {
  color: var(--pink);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.ending-content p {
  color: var(--pink-light);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.ending-cg img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 2rem;
}

/* 加载 */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: white;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 响应式 */
@media (max-width: 768px) {
  .game-tools { top: 58px; right: 10px; }
  .tool-btn { width: 38px; height: 38px; }
  .game-title {
    font-size: 2.5rem;
  }
  .menu-btn {
    padding: 12px 36px;
    font-size: 1rem;
  }
  .action-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  .action-box {
    max-height: calc(100vh - 54px);
    overflow-y: auto;
    padding: 1rem;
  }
  .action-meta { gap: 18px; }
  .character-sprite {
    right: 2vw;
    bottom: 155px;
    width: 46vw;
    height: 44vh;
  }
  .character-sprite.is-cutout {
    right: -6vw;
    bottom: 142px;
    width: 72vw;
    height: 64vh;
  }
}
