/* Base Styles */
:root {
  --primary: #1a1a2e;
  --secondary: #16213e;
  --accent: #e94560;
  --gold: #d4af37;
  --light: #f5f5f5;
}

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

body {
  font-family: 'Noto Sans SC', 'Playfair Display', sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, #0f0f23 100%);
  min-height: 100vh;
  color: var(--light);
  overflow: hidden;
}

/* Flying Answers */
.flying-answers {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

.flying-answer {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  animation: flyAway 4s ease-out forwards;
}

@keyframes flyAway {
  0% { opacity: 0; transform: translateY(100vh) scale(0.5); }
  10% { opacity: 1; transform: translateY(80vh) scale(1); }
  100% { opacity: 0; transform: translateY(-30vh) scale(0.3); }
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.2rem;
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header { text-align: center; padding: 0.15rem 0; }
.logo { font-size: 1.6rem; }
.title { font-size: 1.2rem; font-weight: 700; background: linear-gradient(45deg, var(--gold), #fff, var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { font-size: 0.7rem; opacity: 0.8; margin-bottom: 0.2rem; }

/* Language Switch */
.lang-switch {
  position: fixed;
  top: 0.3rem; right: 0.3rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--light);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.7rem;
  z-index: 100;
}

/* Question */
.question-section { text-align: center; padding: 0.1rem 0; }
.question-input-wrapper { max-width: 80%; margin: 0 auto; }
.question-input {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  outline: none;
}
.question-input:focus { border-color: var(--gold); }

/* Book Section */
.book-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 7.5rem;
}

.book-section .ask-again-btn {
  margin-top: 0.3rem;
  position: absolute;
  bottom: 12%;
}

/* Book Container */
.book {
  position: relative;
  width: 320px;
  height: 420px;
  perspective: 1000px;
  cursor: pointer;
}

/* Book Body */
.book-body {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* Back cover */
.book-back {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #5a0000, #3a0000);
  border-radius: 4px 14px 14px 4px;
  box-shadow: -4px 4px 12px rgba(0,0,0,0.4);
}

/* Pages */
.book-pages {
  position: absolute;
  top: 5px;
  left: 5px;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  background: #fffef8;
  border-radius: 2px 10px 10px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.book-pages::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: linear-gradient(180deg, transparent, #ddd, transparent);
}

.answer-text {
  font-size: 1.8rem;
  color: #222;
  text-align: center;
  line-height: 1.8;
}

.page-num {
  position: absolute;
  bottom: 15px;
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
}

/* Cover - flips to left */
.book-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #a00, #600);
  border-radius: 4px 14px 14px 4px;
  transform-origin: left center;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: -6px 6px 15px rgba(0,0,0,0.5);
  z-index: 10;
}

.book.opened .book-cover {
  transform: rotateY(-180deg);
}

.cover-spine {
  position: absolute;
  left: -10px;
  top: 0;
  width: 10px;
  height: 100%;
  background: linear-gradient(90deg, #400, #800);
  border-radius: 4px 0 0 4px;
}

.cover-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
}

.cover-hint {
  position: absolute;
  bottom: 20px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

/* Ask again */
.ask-again-btn {
  margin-top: 0.4rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.7rem;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  color: var(--light);
  cursor: pointer;
}

/* Footer */
.footer {
  text-align: center;
  padding: 0.15rem;
  opacity: 0.5;
  font-size: 0.55rem;
}

/* Loading */
.loading {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 600px) {
  .title { font-size: 1.1rem; }
  .book { width: 260px; height: 340px; }
  .cover-title { font-size: 1.6rem; }
  .answer-text { font-size: 1.5rem; }
}
