/* Visual Novel - 破碎的王座 */

:root {
  --vn-bg: #0a0a0f;
  --vn-gold: #c9a84c;
  --vn-gold-light: #e8d48b;
  --vn-gold-dark: #8a6d2b;
  --vn-text: #d4c9a8;
  --vn-text-dim: #7a7060;
  --vn-dialog-bg: rgba(10, 10, 15, 0.92);
  --vn-border: rgba(201, 168, 76, 0.3);
}

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

body {
  background: var(--vn-bg);
  color: var(--vn-text);
  font-family: 'Georgia', 'Noto Serif SC', serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* Screens */
.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ===== START SCREEN ===== */
.start-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(180deg, #0a0a0f 0%, #1a1520 40%, #0a0a0f 100%);
  z-index: 0;
}
.start-bg::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.start-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
}
.game-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--vn-gold);
  text-shadow: 0 0 40px rgba(201,168,76,0.3), 0 4px 8px rgba(0,0,0,0.5);
  letter-spacing: 0.3em;
  margin-bottom: 0.5rem;
  animation: fadeIn 2s ease;
}
.game-subtitle {
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  color: var(--vn-text-dim);
  letter-spacing: 0.8em;
  margin-bottom: 2rem;
  animation: fadeIn 2s ease 0.5s both;
}
.game-desc {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--vn-text);
  margin-bottom: 3rem;
  opacity: 0.7;
  animation: fadeIn 2s ease 1s both;
}

/* Buttons */
.btn-gold {
  background: linear-gradient(135deg, var(--vn-gold-dark), var(--vn-gold), var(--vn-gold-light), var(--vn-gold));
  background-size: 200% 200%;
  color: #0a0a0f;
  border: none;
  padding: 0.8rem 2.5rem;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.3s ease;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.btn-gold:hover {
  background-position: 100% 100%;
  box-shadow: 0 0 20px rgba(201,168,76,0.4);
  transform: translateY(-1px);
}
.btn-gold:active { transform: translateY(1px); }
.btn-gold.btn-secondary {
  background: transparent;
  color: var(--vn-gold);
  border: 1px solid var(--vn-border);
  font-size: 0.9rem;
  padding: 0.6rem 2rem;
  margin-top: 0.8rem;
}
.btn-gold.btn-secondary:hover {
  background: rgba(201,168,76,0.1);
}

.start-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 2s ease 1.5s both;
}

.btn-icon {
  background: none;
  border: 1px solid var(--vn-border);
  color: var(--vn-gold);
  width: 40px; height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: rgba(201,168,76,0.15);
  border-color: var(--vn-gold);
}

.start-footer {
  position: absolute;
  bottom: 2rem;
  animation: fadeIn 2s ease 2s both;
}

/* ===== GAME SCREEN ===== */
.game-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  z-index: 10;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
}
.stats-bar {
  display: flex;
  gap: 1rem;
}
.stat {
  font-size: 0.8rem;
  color: var(--vn-gold);
  background: rgba(0,0,0,0.5);
  padding: 0.3rem 0.8rem;
  border-radius: 3px;
  border: 1px solid var(--vn-border);
}
.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Scene Image */
.scene-image-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0a0a0f;
}
.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.scene-image.loaded { opacity: 1; }
.scene-title {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  text-align: center;
  padding: 2rem 1rem 1rem;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--vn-gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  background: linear-gradient(transparent, rgba(10,10,15,0.9));
  letter-spacing: 0.2em;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.scene-title.show { opacity: 1; }

/* Dialog Box */
.dialog-box {
  background: var(--vn-dialog-bg);
  border-top: 1px solid var(--vn-border);
  padding: 1.5rem 2rem;
  min-height: 180px;
  max-height: 40vh;
  position: relative;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}
.dialog-text {
  flex: 1;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-y: auto;
  padding-right: 0.5rem;
}
.dialog-text::-webkit-scrollbar { width: 4px; }
.dialog-text::-webkit-scrollbar-thumb { background: var(--vn-gold-dark); border-radius: 2px; }

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  animation: fadeIn 0.5s ease;
}
.choice-btn {
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.1), transparent);
  border: 1px solid var(--vn-border);
  color: var(--vn-gold-light);
  padding: 0.7rem 1.5rem;
  font-family: inherit;
  font-size: clamp(0.85rem, 2vw, 1rem);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  border-radius: 2px;
}
.choice-btn:hover {
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.25), transparent);
  border-color: var(--vn-gold);
  padding-left: 2rem;
  box-shadow: 0 0 15px rgba(201,168,76,0.2);
}
.choice-btn .stat-change {
  float: right;
  font-size: 0.75rem;
  opacity: 0.6;
}

.dialog-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 0.75rem;
  color: var(--vn-text-dim);
  animation: pulse 1.5s ease infinite;
  cursor: pointer;
}
.dialog-hint.hidden { display: none; }

/* ===== ENDING SCREEN ===== */
.ending-image-container {
  flex: 1;
  overflow: hidden;
  background: #0a0a0f;
}
.ending-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ending-content {
  background: linear-gradient(0deg, var(--vn-bg) 0%, rgba(10,10,15,0.95) 100%);
  padding: 2rem;
  text-align: center;
}
.ending-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--vn-gold);
  margin-bottom: 1.5rem;
  letter-spacing: 0.2em;
  text-shadow: 0 0 20px rgba(201,168,76,0.3);
}
.ending-text {
  max-width: 600px;
  margin: 0 auto 2rem;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  line-height: 2;
  white-space: pre-wrap;
  opacity: 0;
  animation: fadeIn 2s ease 1s both;
}
.ending-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  animation: fadeIn 1s ease 2s both;
}

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(201,168,76,0.9);
  color: #0a0a0f;
  padding: 0.6rem 1.5rem;
  border-radius: 3px;
  font-size: 0.9rem;
  z-index: 100;
  transition: transform 0.3s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* Responsive */
@media (max-width: 768px) {
  .stats-bar { gap: 0.3rem; }
  .stat { font-size: 0.65rem; padding: 0.2rem 0.5rem; }
  .dialog-box { padding: 1rem; min-height: 150px; }
  .btn-icon { width: 35px; height: 35px; font-size: 1rem; }
}
@media (max-width: 480px) {
  .stats-bar { flex-wrap: wrap; gap: 0.2rem; }
  .dialog-box { padding: 0.8rem; min-height: 130px; max-height: 45vh; }
}
