:root {
  color-scheme: dark;
  --night: #04152f;
  --night-deep: #010713;
  --sapphire: #0f52ba;
  --sapphire-bright: #3a83f6;
  --sapphire-pale: #d9e9ff;
  --white: #f8fbff;
  --muted: #aac1df;
  --metal: #c4ddff;
  --card-border: rgba(190, 220, 255, 0.72);
  --focus: #7fb4ff;
  --shadow: 0 1.75rem 5.25rem rgba(0, 10, 43, 0.62),
    0 0.45rem 1.3rem rgba(3, 18, 58, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--night-deep);
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 50% 20%, rgba(25, 100, 214, 0.3), transparent 31rem),
    radial-gradient(circle at 12% 75%, rgba(47, 126, 247, 0.12), transparent 26rem),
    linear-gradient(160deg, #010510 0%, var(--night) 48%, #020c21 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

.concert-background {
  position: fixed;
  inset: -1.5rem;
  z-index: -3;
  background:
    linear-gradient(
      180deg,
      rgba(1, 7, 19, 0.6) 0%,
      rgba(3, 18, 43, 0.54) 34%,
      rgba(2, 12, 33, 0.7) 68%,
      rgba(1, 7, 19, 0.9) 100%
    ),
    radial-gradient(circle at 50% 32%, rgba(25, 100, 214, 0.12), rgba(1, 7, 19, 0.32) 70%),
    url("assets/sapphire-lightstick-ocean.jpg") center center / cover no-repeat;
  filter: saturate(1.14) contrast(1.04);
  pointer-events: none;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(circle, rgba(248, 251, 255, 0.8) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(47, 126, 247, 0.72) 0 1px, transparent 1.3px);
  background-position: 0 0, 2rem 3rem;
  background-size: 7rem 7rem, 9rem 9rem;
  content: "";
  opacity: 0.18;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sky-decoration {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0.7rem rgba(127, 180, 255, 0.92);
  opacity: 0.75;
}

.star::before,
.star::after {
  position: absolute;
  top: 50%;
  left: 50%;
  background: linear-gradient(90deg, transparent, rgba(220, 234, 255, 0.8), transparent);
  content: "";
  transform: translate(-50%, -50%);
}

.star::before {
  width: 1.2rem;
  height: 1px;
}

.star::after {
  width: 1px;
  height: 1.2rem;
}

.star-one { top: 12%; left: 12%; }
.star-two { top: 23%; right: 14%; transform: scale(0.7); }
.star-three { top: 52%; left: 6%; transform: scale(0.55); }
.star-four { top: 64%; right: 7%; transform: scale(0.85); }
.star-five { top: 83%; left: 18%; transform: scale(0.65); }
.star-six { top: 87%; right: 22%; transform: scale(0.45); }

.page-shell {
  width: min(100% - 2rem, 43rem);
  margin-inline: auto;
  padding: clamp(3rem, 8vw, 5.5rem) 0 2.5rem;
}

.site-header {
  margin-bottom: clamp(2rem, 5vw, 2.75rem);
  text-align: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 0.7rem;
  color: #91bbfa;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.eyebrow::before,
.eyebrow::after {
  width: clamp(1.35rem, 5vw, 2.5rem);
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(126, 181, 255, 0.68));
}

.eyebrow::after {
  transform: rotate(180deg);
}

h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2.1rem, 8.4vw, 3.5rem);
  font-weight: 560;
  letter-spacing: 0.075em;
  line-height: 1.2;
  text-wrap: balance;
  text-shadow:
    0 0 2rem rgba(58, 131, 246, 0.46),
    0 0.12rem 0.35rem rgba(0, 8, 28, 0.7);
}

.intro {
  display: grid;
  gap: 0.08rem;
  max-width: 31rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: clamp(0.96rem, 3.5vw, 1.06rem);
  line-height: 1.75;
  text-wrap: pretty;
}

.answer-book {
  position: relative;
  isolation: isolate;
  width: min(100%, 34rem);
  margin-inline: auto;
}

.book-spine {
  position: absolute;
  top: 0.55rem;
  bottom: auto;
  left: -0.32rem;
  z-index: -1;
  width: 0.72rem;
  height: calc(clamp(23.5rem, 70vw, 28rem) - 1.1rem);
  border: 1px solid rgba(140, 186, 255, 0.22);
  border-radius: 0.48rem 0 0 0.48rem;
  background: linear-gradient(
    90deg,
    rgba(3, 19, 55, 0.28),
    rgba(18, 87, 186, 0.2) 58%,
    rgba(6, 35, 82, 0.3)
  );
  -webkit-backdrop-filter: blur(0.35rem);
  backdrop-filter: blur(0.35rem);
  box-shadow: -0.45rem 0 1.35rem rgba(1, 8, 26, 0.42);
}

.book-card {
  position: relative;
  z-index: 1;
  min-height: clamp(23.5rem, 70vw, 28rem);
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 0.9rem 1.3rem 1.3rem 0.9rem;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.08), transparent 24%),
    radial-gradient(circle at 50% 1%, rgba(126, 179, 255, 0.18), transparent 43%),
    linear-gradient(
      148deg,
      rgba(23, 100, 210, 0.2) 0%,
      rgba(11, 65, 157, 0.22) 46%,
      rgba(5, 25, 66, 0.28) 100%
    );
  -webkit-backdrop-filter: blur(0.65rem) saturate(1.12);
  backdrop-filter: blur(0.65rem) saturate(1.12);
  box-shadow:
    inset 0 0 0 0.16rem rgba(3, 26, 75, 0.68),
    inset 0 0 0 0.22rem rgba(182, 213, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(127, 180, 255, 0.08),
    var(--shadow);
  isolation: isolate;
  perspective: 900px;
}

.book-card::before {
  position: absolute;
  inset: 0.65rem;
  z-index: -1;
  border: 1px solid rgba(184, 215, 255, 0.22);
  border-radius: 0.5rem 0.92rem 0.92rem 0.5rem;
  background-image:
    linear-gradient(125deg, rgba(255, 255, 255, 0.05), transparent 35%),
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 25%, rgba(255, 255, 255, 0.28) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 76%, rgba(255, 255, 255, 0.22) 0 1px, transparent 1.5px);
  content: "";
}

.book-card::after {
  position: absolute;
  top: 0.8rem;
  right: 0.28rem;
  bottom: 0.8rem;
  z-index: 1;
  width: 0.34rem;
  border-radius: 0 0.75rem 0.75rem 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(231, 241, 255, 0.82) 0 2px,
    rgba(105, 137, 181, 0.55) 2px 3px
  );
  content: "";
  opacity: 0.42;
  pointer-events: none;
}

.book-surface {
  display: grid;
  min-height: inherit;
  padding: clamp(2.4rem, 7vw, 4.1rem) clamp(1.6rem, 8vw, 4.75rem);
  place-items: center;
  text-align: center;
  transform-origin: left center;
  transition:
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 280ms ease,
    filter 280ms ease;
}

.book-card.is-revealing .book-surface {
  filter: blur(1px);
  opacity: 0.18;
  transform: rotateY(-7deg) scale(0.992);
}

.book-card.has-answer .book-surface {
  background:
    linear-gradient(rgba(246, 250, 255, 0.26), rgba(222, 236, 255, 0.2)),
    repeating-linear-gradient(0deg, transparent 0 1.65rem, rgba(15, 82, 186, 0.045) 1.65rem 1.7rem);
  color: #f8fbff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 3.5rem rgba(75, 129, 205, 0.1);
}

.book-card.has-answer blockquote {
  color: #f8fbff;
  text-shadow: 0 0.15rem 0.9rem rgba(0, 7, 27, 0.82);
}

.book-card.has-answer .attribution {
  color: #dceaff;
  text-shadow: 0 0.1rem 0.6rem rgba(0, 7, 27, 0.78);
}

.book-card.has-answer .source {
  color: #c7dbf5;
  text-shadow: 0 0.1rem 0.55rem rgba(0, 7, 27, 0.78);
}

.book-card.has-answer .type-badge {
  background: rgba(230, 241, 255, 0.82);
}

.book-card.has-answer .sample-badge {
  background: rgba(255, 239, 201, 0.84);
}

.corner {
  position: absolute;
  z-index: 2;
  width: 1.5rem;
  height: 1.5rem;
  border-color: rgba(203, 224, 255, 0.68);
  pointer-events: none;
}

.corner-top-left { top: 1.05rem; left: 1.05rem; border-top: 1px solid; border-left: 1px solid; }
.corner-top-right { top: 1.05rem; right: 1.05rem; border-top: 1px solid; border-right: 1px solid; }
.corner-bottom-left { bottom: 1.05rem; left: 1.05rem; border-bottom: 1px solid; border-left: 1px solid; }
.corner-bottom-right { right: 1.05rem; bottom: 1.05rem; border-right: 1px solid; border-bottom: 1px solid; }

.initial-view,
.answer-view,
.empty-message {
  width: 100%;
}

.book-mark {
  display: grid;
  width: 3.35rem;
  height: 3.35rem;
  margin: 0 auto 1.45rem;
  border: 1px solid rgba(220, 234, 255, 0.52);
  border-radius: 50%;
  place-items: center;
  color: var(--metal);
  font-size: 1.2rem;
  background: rgba(5, 39, 101, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 2rem rgba(47, 126, 247, 0.38);
}

.book-kicker {
  margin: 0 0 0.55rem;
  color: #c8dbfa;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.initial-view h3 {
  max-width: 22rem;
  margin: 0 auto 0.95rem;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 500;
  line-height: 1.45;
  text-wrap: balance;
}

.initial-view > p:last-child {
  margin: 0;
  color: #c5d6f0;
  font-size: 0.96rem;
}

.answer-view {
  outline: none;
  animation: answer-in 520ms ease both;
}

.answer-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.35rem;
}

.type-badge,
.sample-badge {
  display: inline-flex;
  min-height: 1.65rem;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.72rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.type-badge {
  border: 1px solid rgba(15, 82, 186, 0.3);
  color: #0b4cad;
  background: rgba(15, 82, 186, 0.09);
}

.sample-badge {
  border: 1px solid rgba(126, 77, 8, 0.24);
  color: #76500e;
  background: rgba(220, 171, 70, 0.16);
}

blockquote {
  position: relative;
  margin: 0;
  color: #061f50;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  font-weight: 600;
  line-height: 1.68;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.answer-details {
  margin-top: clamp(1.4rem, 5vw, 1.9rem);
}

.attribution {
  margin: 0;
  color: #0c459c;
  font-size: 1rem;
  font-weight: 700;
}

.source {
  margin: 0.45rem 0 0;
  color: #45638e;
  font-size: 0.84rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.source a {
  border-radius: 0.2rem;
  color: inherit;
  text-decoration-color: rgba(69, 99, 142, 0.48);
  text-underline-offset: 0.2em;
}

.source a:hover {
  color: #0c459c;
  text-decoration-color: currentColor;
}

.source a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.empty-message {
  max-width: 25rem;
  margin: 0;
  color: var(--sapphire-pale);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.2rem, 4vw, 1.55rem);
}

.answer-controls {
  position: relative;
  z-index: 3;
  width: min(100% - 1rem, 36rem);
  margin: 2.4rem auto 0;
}

.source-picker {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0 0 1.2rem;
}

.source-picker legend {
  width: 100%;
  margin-bottom: 0.75rem;
  color: #d3e3f8;
  font-size: 0.88rem;
  font-weight: 650;
  text-align: center;
}

.segment-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.3rem;
  border: 1px solid rgba(151, 195, 255, 0.3);
  border-radius: 1rem;
  background: rgba(1, 12, 36, 0.64);
  backdrop-filter: blur(0.65rem);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0.9rem 2.3rem rgba(0, 7, 27, 0.22);
}

.segment-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.segment-group label {
  display: grid;
  min-width: 0;
  min-height: 2.8rem;
  border-radius: 0.72rem;
  place-items: center;
  color: #b8cae2;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: center;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.segment-group input:checked + label {
  color: var(--white);
  background: linear-gradient(135deg, #2f7ef1, #0d4eaf);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0.4rem 1.2rem rgba(10, 70, 165, 0.36);
}

.segment-group input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.primary-button,
.secondary-button {
  min-height: 3.25rem;
  border-radius: 0.95rem;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0.02em;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border: 1px solid rgba(185, 215, 255, 0.5);
  color: var(--white);
  background: linear-gradient(125deg, #4a92fb, var(--sapphire) 60%, #093d8e);
  box-shadow:
    0 0.85rem 2.1rem rgba(9, 65, 158, 0.46),
    inset 0 1px rgba(255, 255, 255, 0.22);
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.secondary-button {
  border: 1px solid rgba(157, 200, 255, 0.4);
  color: #e8f2ff;
  background: linear-gradient(145deg, rgba(10, 43, 94, 0.82), rgba(4, 24, 61, 0.8));
  backdrop-filter: blur(0.5rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (hover: hover) {
  .primary-button:hover:not(:disabled),
  .secondary-button:hover:not(:disabled) {
    transform: translateY(-2px);
  }

  .primary-button:hover:not(:disabled) {
    box-shadow:
      0 1rem 2.5rem rgba(9, 65, 158, 0.56),
      inset 0 1px rgba(255, 255, 255, 0.22);
  }

  .secondary-button:hover:not(:disabled) {
    border-color: rgba(184, 216, 255, 0.7);
    background: linear-gradient(145deg, rgba(13, 58, 128, 0.86), rgba(5, 32, 76, 0.84));
  }
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.interaction-status {
  min-height: 1.6rem;
  margin: 0.8rem 0 0;
  color: #bcd4f6;
  font-size: 0.86rem;
  text-align: center;
}

.site-footer {
  width: min(100% - 2rem, 43rem);
  padding: 1.5rem 0 max(2.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(127, 180, 255, 0.18);
  margin-inline: auto;
  color: #b7c8df;
  font-size: 0.7rem;
  line-height: 1.65;
  text-align: center;
}

.site-footer p {
  margin: 0;
  opacity: 0.6;
}

@keyframes answer-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 32rem) {
  .concert-background {
    background:
      linear-gradient(
        180deg,
        rgba(1, 7, 19, 0.34) 0%,
        rgba(3, 18, 43, 0.24) 34%,
        rgba(2, 12, 33, 0.4) 68%,
        rgba(1, 7, 19, 0.68) 100%
      ),
      radial-gradient(circle at 50% 38%, rgba(25, 100, 214, 0.04), rgba(1, 7, 19, 0.16) 72%),
      url("assets/sapphire-lightstick-ocean.jpg");
    background-position: center, center, center;
    background-size: auto, auto, cover;
    background-repeat: no-repeat;
    filter: saturate(1.22) contrast(1.04) brightness(1.1);
  }

  .page-shell {
    width: min(100% - 1.25rem, 43rem);
    padding-top: 2.4rem;
  }

  .site-header {
    margin-bottom: 1.9rem;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.75rem);
    letter-spacing: 0.05em;
  }

  .intro {
    margin-top: 0.85rem;
    line-height: 1.7;
  }

  .book-card {
    /* 为较长语录、双行出处和“出处待补”标识留出安全空间。 */
    min-height: 23.5rem;
    border-radius: 0.75rem 1.05rem 1.05rem 0.75rem;
    -webkit-backdrop-filter: blur(0.2rem) saturate(1.08);
    backdrop-filter: blur(0.2rem) saturate(1.08);
  }

  .book-surface {
    padding: 2.55rem 1.55rem;
  }

  .book-spine {
    left: -0.15rem;
    width: 0.52rem;
  }

  .corner-top-left,
  .corner-bottom-left { left: 1rem; }
  .corner-top-right,
  .corner-bottom-right { right: 1rem; }

  .answer-controls {
    width: calc(100% - 0.5rem);
    margin-top: 1.85rem;
  }

  .answer-label-row {
    margin-bottom: 1.15rem;
  }

  blockquote {
    font-size: clamp(1.3rem, 5.8vw, 1.55rem);
    line-height: 1.7;
  }

  .answer-details {
    margin-top: 1.35rem;
  }

  .segment-group label {
    min-height: 2.9rem;
    padding-inline: 0.25rem;
    font-size: 0.84rem;
  }

  .primary-button,
  .secondary-button {
    min-height: 3.35rem;
  }
}

@media (max-width: 22rem) {
  .result-actions {
    grid-template-columns: 1fr;
  }

  .segment-group label {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
