/*
  答案之書 — 視覺系統沿用「一色到底」規格（design-tokens/rose-blush-restrained.css）。
  --accent2 是唯一要換的值，目前是 preview 用的暫定色，使用者確認後再定案。
*/

@font-face {
  font-family: "GenSenMaruGothicTW";
  src: url("/fonts/GenSenMaruGothicTW-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --accent2: #4A3B6B; /* preview 暫定色：墨紫，等使用者確認 */
  --accent2-text: #FFFFFF;

  --page-bg2: #05050C;
  --card: rgba(255, 255, 255, 0.06);

  --ink: #FFFFFF;
  --ink-title: #FFFFFF;
  --ink-soft: #FFFFFF;

  --radius2: 32px;
  --shadow2: 0px 8px 24px rgba(0, 0, 0, 0.45);
  --hairline: rgba(255, 255, 255, 0.14);

  --font-main: "GenSenMaruGothicTW", -apple-system, BlinkMacSystemFont,
               "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg2);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

.bg-photo {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.bg-photo.active { opacity: 1; }

.bg-scrim {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, rgba(5, 5, 12, 0.55), rgba(5, 5, 12, 0.72) 55%, rgba(5, 5, 12, 0.88));
  pointer-events: none;
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: var(--o, .8); }
  50% { opacity: calc(var(--o, .8) * .25); }
}

/* 中英對照：中文為主，英文永遠是次一行、字級縮小，顏色仍是純白（不靠變暗做層次） */
.en {
  display: block;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .01em;
  margin-top: 3px;
  color: var(--ink-title);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

.app-shell {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.screen {
  display: none;
  background: var(--card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius2);
  box-shadow: var(--shadow2);
  padding: 36px 28px;
  text-align: center;
  animation: fadeIn .4s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent2);
  color: var(--accent2-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
}

.page-title {
  font-family: var(--font-main);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-title);
  margin: 0 0 8px;
}
.page-title .en { font-size: 13px; margin-top: 4px; }

.sub-text {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 28px;
}
.sub-text .en { font-size: 11px; margin-top: 2px; }

/* 類別選擇：一色到底的 choice-chip 模式 */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.category-grid .choice-card:last-child {
  grid-column: 1 / -1;
}

.choice-card {
  background: var(--card);
  box-shadow: var(--shadow2);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-title);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.choice-card i { font-size: 20px; }
.choice-card .en { font-size: 10px; margin-top: 1px; }

/* 每個領域用各自的圖示色，跟「一色到底」的按鈕/選中填色是兩件事——
   這裡是使用者明確要求的裝飾性圖示配色，只影響 icon，不影響文字/按鈕 */
.choice-card[data-category="love"] i { color: #FF4D6D; font-size: 27px; }
.choice-card[data-category="wealth"] i { color: #F0B93D; }
.choice-card[data-category="health"] i { color: #4FD18B; }
.choice-card[data-category="career"] i { color: #57A6E8; }
.choice-card[data-category="general"] i { color: #B98CF0; }
.choice-card:active { transform: scale(0.97); }
.choice-card.on {
  background: var(--accent2);
  color: var(--accent2-text);
  border-color: var(--accent2);
}

/* 提問畫面 */
.instruction-text {
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 24px;
  text-align: left;
}
.instruction-text .en {
  display: block;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.6;
}

.number-field {
  border: 1.5px solid var(--hairline);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 24px;
  text-align: left;
  transition: border-color .15s;
}
.number-field:focus-within { border-color: var(--accent2); }

.number-field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.number-field-label i { color: var(--accent2); font-size: 12px; align-self: center; }
.number-field-label .en { font-size: 10px; font-weight: 500; margin: 0; flex-basis: 100%; }

.number-input {
  width: 100%;
  font-size: 26px;
  font-weight: 700;
  text-align: left;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.number-input:focus { outline: none; }
.number-input::placeholder { color: var(--ink-soft); font-weight: 400; opacity: .5; }

.btn-cta {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 20px;
  background: var(--accent2);
  color: var(--accent2-text);
  border: none;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}
.btn-cta .en { font-size: 10.5px; font-weight: 500; margin-top: 2px; }
.btn-cta:disabled { opacity: .4; cursor: not-allowed; }
.btn-cta:active:not(:disabled) { transform: scale(0.98); }

.btn-text {
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--ink-title);
  font-size: 13px;
  cursor: pointer;
}
.btn-text .en { font-size: 10px; margin-top: 2px; }

/* 翻書動畫畫面 */
.book-scene {
  perspective: 1000px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.book {
  position: relative;
  width: 150px;
  height: 190px;
}
.book-spine {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #FBF8F2, #FFFFFF);
  border-radius: 6px;
  box-shadow: 0 0 55px color-mix(in srgb, var(--accent2) 60%, transparent), var(--shadow2);
}
.book-spine i {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent2);
  font-size: 26px;
  opacity: 0;
  animation: sparkleIn .5s ease 1s forwards;
}
.cover-half {
  position: absolute;
  top: 0;
  width: 75px;
  height: 190px;
  background: var(--accent2);
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent2) 50%, transparent);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.cover-left {
  left: 0;
  transform-origin: right center;
  border-radius: 6px 0 0 6px;
  animation: openLeft 1s cubic-bezier(.4, 0, .2, 1) forwards;
}
.cover-right {
  right: 0;
  transform-origin: left center;
  border-radius: 0 6px 6px 0;
  animation: openRight 1s cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes openLeft {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-150deg); }
}
@keyframes openRight {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(150deg); }
}
@keyframes sparkleIn {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}

.book-loading-text {
  font-size: 14px;
  color: var(--ink-soft);
}
.book-loading-text .en { font-size: 11px; margin-top: 4px; }

/* 答案畫面 */
.answer-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-title);
  margin-bottom: 14px;
}
.answer-label .en { font-size: 10px; letter-spacing: .04em; margin-top: 2px; }

.answer-text {
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-title);
  line-height: 1.6;
  margin: 0 0 20px;
}
.answer-text .en {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  margin-top: 8px;
  line-height: 1.5;
}

.answer-guide {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 20px;
}
.answer-guide .en { font-size: 11px; margin-top: 6px; line-height: 1.6; }

.answer-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.answer-meta .en { font-size: 10px; margin-top: 2px; }

/* 音樂開關 */
.music-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent2);
  color: var(--accent2-text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow2);
  cursor: pointer;
}
