:root {
  color-scheme: light;
  --ink: #17394a;
  --muted: #5e7b89;
  --sky: #dff4ff;
  --sky-deep: #b9e5f7;
  --mint: #dff4e8;
  --peach: #ffdcca;
  --butter: #fff1bb;
  --lilac: #e9e1f8;
  --rose: #f6c8d4;
  --paper: rgba(255, 255, 255, 0.93);
  --shadow: 0 20px 46px rgba(43, 97, 121, 0.14);
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  height: 100%;
  min-width: 320px;
  overflow: hidden;
  overscroll-behavior: none;
  background: #f8fcff;
}

body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 220, 202, 0.58), transparent 30rem),
    radial-gradient(circle at 88% 21%, rgba(233, 225, 248, 0.72), transparent 28rem),
    radial-gradient(circle at 48% 84%, rgba(223, 244, 232, 0.58), transparent 32rem),
    linear-gradient(165deg, #fafdff 0%, var(--sky) 51%, #f7fcff 100%);
}

a { color: inherit; }

.recommendations {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

.orbit-stage {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: visible;
  isolation: isolate;
  contain: layout size;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.orbit-stage.is-spinning,
.orbit-stage.is-card-dragging {
  cursor: grabbing;
}

.book-orbit {
  position: absolute;
  z-index: 3;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.book-node {
  position: absolute;
  -webkit-tap-highlight-color: transparent;
  top: 0;
  left: 0;
  width: var(--card-width, min(39vw, 148px));
  pointer-events: auto;
  will-change: transform, opacity;
  transition: opacity 150ms ease;
  transform: translate3d(-200vw, -200vh, 0) translate(-50%, -50%);
}

.book-shell {
  --card-scale: 1;
  --card-tilt: 0deg;
  width: 100%;
  transform: rotate(var(--card-tilt)) scale(var(--card-scale));
  transform-origin: center;
  transition:
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 220ms ease;
  will-change: transform;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.book-node.is-inspecting .book-shell {
  --card-scale: 1.2;
}

.book-node.is-dragging .book-shell {
  --card-scale: 1.055;
  transition-duration: 120ms;
}

.book-card {
  position: relative;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  height: calc(var(--card-width, min(39vw, 148px)) * 1.4 + 4.1rem);
  margin: 0;
  outline: none;
  perspective: 1200px;
  cursor: grab;
}

.book-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.18, 0.76, 0.2, 1);
  will-change: transform;
}

.book-node.is-inspecting .book-card-inner {
  transform: rotateY(180deg);
}

.book-node.is-dragging .book-card-inner {
  transform: rotateY(0deg) !important;
}

.book-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(55, 116, 145, 0.15);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
}

.book-face--front {
  display: flex;
  flex-direction: column;
  padding: 0.52rem;
  transform: rotateY(0deg) translateZ(0.5px);
  pointer-events: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.book-face--back {
  --sun-light-x: -35%;
  --sun-light-y: -25%;
  --sun-light-width: 150%;
  --sun-light-height: 115%;
  --sun-light-alpha: 0.72;
  --sun-light-alpha-mid: 0.5;
  --sun-light-alpha-edge: 0.18;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 0.95rem 0.9rem;
  transform: rotateY(180deg) translateZ(0.5px);
  pointer-events: none;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
  cursor: grab;
  background:
    radial-gradient(
      ellipse var(--sun-light-width) var(--sun-light-height)
      at var(--sun-light-x) var(--sun-light-y),
      rgb(255 241 187 / var(--sun-light-alpha)) 0%,
      rgb(255 241 187 / var(--sun-light-alpha-mid)) 48%,
      rgb(255 241 187 / var(--sun-light-alpha-edge)) 62%,
      transparent 74%
    ),
    radial-gradient(circle at 88% 88%, rgba(233, 225, 248, 0.9), transparent 50%),
    rgba(250, 254, 255, 0.98);
}

@media (hover: hover) and (pointer: fine) {
  .book-card:focus-visible .book-face {
    outline: 3px solid rgba(39, 113, 149, 0.38);
    outline-offset: 5px;
  }
}

.book-cover {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 16px;
  background: var(--sky-deep);
}

.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.book-meta {
  display: grid;
  gap: 0.24rem;
  padding: 0.68rem 0.28rem 0.22rem;
}

.book-title {
  font-size: clamp(0.88rem, 3.5vw, 0.98rem);
  font-weight: 690;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.book-author {
  color: var(--muted);
  font-size: clamp(0.72rem, 2.8vw, 0.82rem);
  line-height: 1.3;
}

.review-kicker {
  display: inline-flex;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
  cursor: text;
  width: fit-content;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.54rem;
  border-radius: 999px;
  background: rgba(185, 229, 247, 0.62);
  color: #426979;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.review-kicker::before {
  content: "✦";
  color: #d68070;
  font-size: 0.62rem;
}

.book-review {
  margin: 0.7rem 0;
  color: #244a5a;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
  cursor: text;
  font-size: clamp(0.74rem, 3vw, 0.84rem);
  line-height: 1.72;
}

.open-cue {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  overflow: hidden;
  padding: 0.52rem 0.7rem;
  border: 1px solid rgba(55, 116, 145, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #315d6f;
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.02em;
  text-decoration: none;
  pointer-events: none;
  transition: transform 160ms ease, background 160ms ease;
}

.book-node.is-inspecting .book-face--back {
  pointer-events: auto;
}

.book-node.is-inspecting .open-cue {
  pointer-events: auto;
  cursor: pointer;
}

.open-cue:hover,
.open-cue:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.98);
}

.open-cue::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -70%;
  width: 48%;
  transform: skewX(-16deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.84), transparent);
  animation: cue-shimmer 3.5s ease-in-out infinite;
}

.card-orbit-line,
.orbit-center {
  position: absolute;
  top: 50%;
  left: 50%;
}

.card-orbit-line {
  pointer-events: none;
}

.card-orbit-line {
  z-index: 1;
  width: var(--orbit-width, 60%);
  height: var(--orbit-height, 46%);
  border: 1.25px solid rgba(63, 126, 154, 0.26);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(var(--orbit-tilt, 0deg));
  transform-origin: center;
  opacity: 0.82;
  will-change: transform, width, height;
}

.card-orbit-line--one {
  border-style: dashed;
}

.card-orbit-line--two {
  border-color: rgba(82, 143, 170, 0.22);
  border-style: solid;
}

.card-orbit-line--three {
  border-color: rgba(76, 136, 161, 0.24);
  border-style: dotted;
}

.orbit-center {
  z-index: 2;
  display: grid;
  padding: 0;
  border: 1px solid rgba(172, 142, 77, 0.18);
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  width: 3.7rem;
  height: 3.7rem;
  place-items: center;
  border: 1px solid rgba(172, 142, 77, 0.18);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 31%, #fffdf1 0%, #fff2ae 38%, #f5cf72 72%, #e8b85d 100%);
  box-shadow:
    0 0 0 8px rgba(255, 241, 187, 0.13),
    0 0 36px rgba(245, 207, 114, 0.34),
    0 12px 35px rgba(74, 114, 131, 0.12);
  transform: translate(-50%, -50%);
  animation: sun-pulse 4.3s ease-in-out infinite;
}

.orbit-center::before,
.orbit-center::after {
  content: "";
  position: absolute;
  inset: -17px;
  border: 1px solid rgba(246, 200, 116, 0.2);
  border-radius: 50%;
  animation: sun-halo 5.2s ease-in-out infinite;
}

.orbit-center::after {
  inset: -29px;
  border-color: rgba(255, 255, 255, 0.34);
  animation-delay: -2.4s;
}

.orbit-center span {
  position: relative;
  z-index: 1;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ambient-shape {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.55;
  filter: blur(2px);
  will-change: transform, opacity;
  transform: translateZ(0);
}

.ambient-shape--one {
  top: 7%;
  left: -5rem;
  width: 11rem;
  height: 11rem;
  background: var(--mint);
  animation: ambient-one 48s ease-in-out infinite alternate;
}

.ambient-shape--two {
  right: -5.3rem;
  bottom: 5%;
  width: 12.5rem;
  height: 12.5rem;
  background: #f3dfd4;
  opacity: 0.28;
  animation: ambient-two 56s ease-in-out infinite alternate;
}

.ambient-shape--three {
  top: 39%;
  right: 6%;
  width: 5.2rem;
  height: 5.2rem;
  background: var(--lilac);
  opacity: 0.38;
  filter: blur(6px);
  animation: ambient-three 42s ease-in-out infinite alternate;
}

.ambient-shape--four {
  bottom: 16%;
  left: 8%;
  width: 5.7rem;
  height: 5.7rem;
  background: var(--rose);
  opacity: 0.25;
  filter: blur(9px);
  animation: ambient-four 51s ease-in-out infinite alternate;
}

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

.no-js .recommendations { min-height: auto; }
.no-js .orbit-stage { height: auto; padding: 2rem 0; cursor: default; }
.no-js .orbit-ring,
.no-js .orbit-center { display: none; }
.no-js .book-orbit {
  position: static;
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  pointer-events: auto;
}
.no-js .book-node {
  position: static;
  width: min(78vw, 230px);
  transform: none !important;
}
.no-js .book-card { height: calc(min(78vw, 230px) * 1.4 + 4.1rem); }

@media (min-width: 720px) {
  .recommendations { padding-block: 0; }
  .book-card { height: calc(var(--card-width, 200px) * 1.4 + 4.5rem); }
  .book-title { font-size: 1.02rem; }
  .book-author { font-size: 0.82rem; }
  .book-review { font-size: 0.84rem; }
}

@keyframes cue-shimmer {
  0%, 45% { left: -70%; }
  78%, 100% { left: 135%; }
}


@keyframes sun-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.97);
    box-shadow: 0 0 0 8px rgba(255, 241, 187, 0.11), 0 0 30px rgba(245, 207, 114, 0.28), 0 12px 35px rgba(74, 114, 131, 0.12);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.07);
    box-shadow: 0 0 0 14px rgba(255, 241, 187, 0.16), 0 0 50px rgba(245, 207, 114, 0.42), 0 14px 38px rgba(74, 114, 131, 0.13);
  }
}

@keyframes sun-halo {
  0%, 100% { transform: scale(0.92); opacity: 0.36; }
  50% { transform: scale(1.11); opacity: 0.84; }
}

@keyframes ambient-one {
  0% { transform: translate3d(0, 0, 0) scale(0.86); border-radius: 50%; opacity: 0.48; }
  45% { transform: translate3d(5.8rem, 6.6rem, 0) scale(1.18); border-radius: 49% 51% 50% 50%; opacity: 0.6; }
  100% { transform: translate3d(2.2rem, 13rem, 0) scale(0.94); border-radius: 51% 49% 50% 50%; opacity: 0.5; }
}

@keyframes ambient-two {
  0% { transform: translate3d(0, 0, 0) scale(0.92); border-radius: 50%; opacity: 0.22; }
  50% { transform: translate3d(-7rem, -6.3rem, 0) scale(1.16); border-radius: 50% 50% 49% 51%; opacity: 0.31; }
  100% { transform: translate3d(-2.7rem, -12rem, 0) scale(0.9); border-radius: 51% 49% 51% 49%; opacity: 0.24; }
}

@keyframes ambient-three {
  from { transform: translate3d(1rem, -2rem, 0) scale(0.8); opacity: 0.28; }
  to { transform: translate3d(-7rem, 6.2rem, 0) scale(1.22); opacity: 0.42; }
}

@keyframes ambient-four {
  from { transform: translate3d(-2rem, 1rem, 0) scale(0.82); opacity: 0.18; }
  to { transform: translate3d(7rem, -6.6rem, 0) scale(1.2); opacity: 0.29; }
}

@keyframes sun-pulse-reduced {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.992);
    box-shadow: 0 0 0 8px rgba(255, 241, 187, 0.11), 0 0 30px rgba(245, 207, 114, 0.28), 0 12px 35px rgba(74, 114, 131, 0.12);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.018);
    box-shadow: 0 0 0 10px rgba(255, 241, 187, 0.13), 0 0 36px rgba(245, 207, 114, 0.33), 0 13px 36px rgba(74, 114, 131, 0.12);
  }
}

@keyframes sun-halo-reduced {
  0%, 100% { transform: scale(0.97); opacity: 0.42; }
  50% { transform: scale(1.035); opacity: 0.62; }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
  }

  /* Card inspection is a core state transition rather than ambient motion.
     Keep it visibly animated under reduced-motion, but make it much shorter
     and less sweeping than the normal 620 ms flip. */
  .book-card-inner {
    transition-duration: 340ms !important;
    transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1) !important;
  }

  .book-shell {
    transition-duration: 180ms !important;
  }

  .ambient-shape,
  .open-cue::after {
    animation: none !important;
  }

  .orbit-center {
    animation: sun-pulse-reduced 8.6s ease-in-out infinite !important;
  }

  .orbit-center::before,
  .orbit-center::after {
    animation: sun-halo-reduced 10.4s ease-in-out infinite !important;
  }

  .orbit-center::after {
    animation-delay: -4.8s !important;
  }
}

@media (max-height: 640px) {
  .book-card { height: calc(var(--card-width, 126px) * 1.4 + 3.5rem); }
  .book-title { font-size: 0.82rem; }
  .book-author { font-size: 0.7rem; }
  .book-review { font-size: 0.7rem; line-height: 1.55; }
}

.book-face--back ::selection {
  background: rgba(255, 225, 139, 0.48);
  color: inherit;
}

.book-face--back ::-moz-selection {
  background: rgba(255, 225, 139, 0.48);
  color: inherit;
}

.book-node,
.book-shell,
.book-card,
.book-face,
.open-cue {
  -webkit-tap-highlight-color: transparent;
}

.book-node.is-dragging .book-card {
  cursor: grabbing;
}

.book-node.is-inspecting .book-face--back {
  cursor: grab;
}

.book-node.is-inspecting .book-review,
.book-node.is-inspecting .review-kicker {
  cursor: text;
}

.orbit-center:hover {
  filter: brightness(1.025);
}

.orbit-center:focus-visible {
  outline: 2px solid rgba(49, 93, 111, 0.42);
  outline-offset: 5px;
}

@media (max-width: 719px) {
  html[lang="en"] .book-card {
    height: calc(var(--card-width, 148px) * 1.4 + 5.2rem);
  }

  html[lang="en"] .book-face--back {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.42rem;
    padding: 0.72rem 0.72rem 0.68rem;
  }

  html[lang="en"] .review-kicker {
    padding: 0.22rem 0.42rem;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  html[lang="en"] .book-review {
    align-self: start;
    margin: 0;
    font-size: clamp(0.61rem, 2.55vw, 0.71rem);
    line-height: 1.42;
    overflow-wrap: anywhere;
  }

  html[lang="en"] .open-cue {
    padding: 0.4rem 0.56rem;
    font-size: 0.61rem;
  }
}

@media (max-width: 719px) {
  body {
    background:
      radial-gradient(circle at 8% 9%, rgba(255, 220, 202, 0.34), transparent 19rem),
      radial-gradient(circle at 91% 18%, rgba(233, 225, 248, 0.44), transparent 17rem),
      radial-gradient(circle at 43% 88%, rgba(223, 244, 232, 0.34), transparent 20rem),
      linear-gradient(165deg, #f5fbff 0%, #d7f1ff 34%, #c9ebfb 63%, #eef9ff 100%);
  }

  .ambient-shape--three {
    opacity: 0.26;
  }

  .ambient-shape--four {
    opacity: 0.18;
  }
}
