@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Noto+Serif+JP:wght@400;500;600;700&display=swap");

@property --frame-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --card-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  --bg: #03101f;
  --bg-deep: #020914;
  --panel: #071426;
  --panel-raised: #0a192d;
  --gold: #d7b45c;
  --gold-bright: #f2d78b;
  --gold-dark: #886522;
  --ivory: #f4efe5;
  --muted: #aaa69e;
  --line: rgba(215, 180, 92, 0.48);
  --line-soft: rgba(215, 180, 92, 0.2);
  --focus: #ffe59b;
  --serif: "Noto Serif JP", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
  --latin: "Cinzel", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg-deep);
  color: var(--ivory);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
summary {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
.result-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.app {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  overflow: clip;
  background:
    radial-gradient(ellipse 52% 22% at 50% 13%, rgba(201, 159, 69, 0.09), transparent 72%),
    linear-gradient(180deg, #020b17 0%, #041326 31%, #03101f 68%, #020b17 100%);
}

.app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 28%, rgba(32, 71, 105, 0.11), transparent 25rem),
    radial-gradient(circle at 90% 46%, rgba(24, 63, 96, 0.1), transparent 26rem),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.003) 0 1px, transparent 1px 5px);
  transform-origin: 50% 12%;
  transition: transform 520ms ease, filter 520ms ease;
}

.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent 19%, transparent 81%, rgba(0, 0, 0, 0.28));
  transition: opacity 420ms ease;
}

.cathedral-scene {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
  width: min(100%, 1160px);
  height: 430px;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 0.66;
  mask-image: linear-gradient(black 0%, black 70%, transparent 100%);
  transform-origin: 50% 12%;
  transition: opacity 520ms ease, transform 720ms ease, filter 520ms ease;
}

.cathedral-scene::before {
  content: "";
  position: absolute;
  inset: 72px 11% 0;
  background:
    linear-gradient(90deg, rgba(4, 10, 20, 0.93), transparent 13%, transparent 87%, rgba(4, 10, 20, 0.93)),
    radial-gradient(ellipse at 50% 85%, rgba(26, 47, 65, 0.22), transparent 68%);
  filter: blur(1px);
}

.cathedral-scene::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 38px;
  left: 0;
  height: 95px;
  background: linear-gradient(180deg, transparent, rgba(151, 119, 48, 0.035) 48%, rgba(0, 0, 0, 0.22));
  filter: blur(7px);
}

.light-beam {
  position: absolute;
  top: -34px;
  left: 50%;
  width: 140px;
  height: 450px;
  background: linear-gradient(180deg, rgba(242, 215, 139, 0.43), rgba(215, 180, 92, 0.09) 55%, transparent 96%);
  clip-path: polygon(43% 0, 57% 0, 88% 100%, 12% 100%);
  filter: blur(16px);
  transform: translateX(-50%);
  opacity: 0.38;
  animation: ambient-beam-drift 8s ease-in-out infinite;
  transform-origin: 50% 0;
}

.cathedral-mist {
  position: absolute;
  right: -18%;
  bottom: 29px;
  left: -18%;
  height: 118px;
  pointer-events: none;
  opacity: 0.24;
  background:
    radial-gradient(ellipse at 22% 58%, rgba(177, 194, 205, 0.13), transparent 28%),
    radial-gradient(ellipse at 56% 47%, rgba(215, 180, 92, 0.065), transparent 29%),
    radial-gradient(ellipse at 83% 66%, rgba(155, 176, 194, 0.1), transparent 24%);
  filter: blur(12px);
  animation: cathedral-mist-drift 16s ease-in-out infinite alternate;
}

.cathedral-arch {
  position: absolute;
  left: 50%;
  border-style: solid;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform: translateX(-50%);
}

.arch-outer {
  top: 42px;
  width: 520px;
  height: 470px;
  border-width: 20px;
  border-color: rgba(105, 83, 42, 0.065);
  box-shadow:
    inset 0 0 0 2px rgba(215, 180, 92, 0.035),
    0 0 0 2px rgba(0, 0, 0, 0.28);
  animation: architecture-arch-glint 13s ease-in-out 1.8s infinite;
}

.arch-inner {
  top: 65px;
  width: 430px;
  height: 450px;
  border-width: 4px;
  border-color: rgba(215, 180, 92, 0.055);
  box-shadow:
    0 0 0 18px rgba(4, 11, 22, 0.42),
    0 0 0 20px rgba(215, 180, 92, 0.02);
  animation: architecture-arch-glint 15.5s ease-in-out 6.2s infinite reverse;
}

.cathedral-column {
  position: absolute;
  top: 110px;
  bottom: 44px;
  width: 64px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(143, 112, 54, 0.08) 30%, rgba(215, 180, 92, 0.065) 50%, rgba(0, 0, 0, 0.5)),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(215, 180, 92, 0.025) 10px 12px);
  border-right: 1px solid rgba(215, 180, 92, 0.045);
  border-left: 1px solid rgba(215, 180, 92, 0.045);
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.46);
  background-size: 100% 100%, 130px 100%;
  animation: architecture-column-glint 17s ease-in-out infinite;
}

.cathedral-column::before {
  content: "";
  position: absolute;
  top: -23px;
  right: -17px;
  left: -17px;
  height: 25px;
  border-top: 1px solid rgba(215, 180, 92, 0.08);
  border-bottom: 1px solid rgba(215, 180, 92, 0.055);
  background: linear-gradient(180deg, rgba(111, 85, 39, 0.08), rgba(1, 6, 14, 0.8));
}

.cathedral-column::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -18px;
  left: -22px;
  height: 25px;
  border-top: 1px solid rgba(215, 180, 92, 0.07);
  background: rgba(1, 6, 14, 0.72);
}

.column-left {
  left: 17%;
}

.column-right {
  right: 17%;
  animation-delay: -8.5s;
}

.ambient-stars,
.screen-show-effects {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-stars {
  z-index: 1;
}

.ambient-star {
  --idle-opacity: 0.48;
  --star-duration: 12s;
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 239, 190, 0.92);
  box-shadow: 0 0 7px rgba(242, 215, 139, 0.46);
  opacity: var(--idle-opacity);
  animation: ambient-star-float var(--star-duration) ease-in-out infinite;
  transition: filter 320ms ease;
}

.ambient-star:nth-child(1) { top: 18%; left: 8%; --star-duration: 13s; }
.ambient-star:nth-child(2) { top: 31%; right: 11%; --star-duration: 15s; animation-delay: -5s; }
.ambient-star:nth-child(3) { top: 54%; left: 14%; --star-duration: 11s; animation-delay: -8s; }
.ambient-star:nth-child(4) { top: 69%; right: 9%; --star-duration: 16s; animation-delay: -3s; }
.ambient-star:nth-child(5) { top: 42%; right: 24%; --idle-opacity: 0.03; --star-duration: 12.5s; animation-delay: -7s; }
.ambient-star:nth-child(6) { top: 78%; left: 27%; --idle-opacity: 0.03; --star-duration: 14.5s; animation-delay: -10s; }

.screen-show-effects {
  z-index: 6;
}

.screen-focus-vignette,
.screen-ring,
.screen-cross-light,
.converging-ray,
.cta-slot-light-path {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.screen-focus-vignette {
  inset: 0;
  background:
    radial-gradient(circle at 50% 56%, rgba(215, 180, 92, 0.08) 0 12%, transparent 34%),
    radial-gradient(circle at 50% 56%, transparent 0 24%, rgba(1, 5, 13, 0.16) 58%, rgba(1, 4, 11, 0.48) 100%);
  transition: opacity 380ms ease;
}

.screen-ring {
  top: 50%;
  left: 50%;
  width: 18vmin;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 234, 169, 0.78);
  border-radius: 50%;
  box-shadow: 0 0 32px rgba(242, 215, 139, 0.22), inset 0 0 22px rgba(242, 215, 139, 0.12);
  transform: translate(-50%, -50%) scale(0.35);
}

.screen-cross-light {
  top: 50%;
  left: 50%;
  width: min(72vw, 760px);
  height: min(82vh, 780px);
  background:
    linear-gradient(90deg, transparent 49.86%, rgba(255, 239, 190, 0.72) 50%, transparent 50.14%),
    linear-gradient(0deg, transparent 49.78%, rgba(255, 239, 190, 0.58) 50%, transparent 50.22%);
  filter: drop-shadow(0 0 12px rgba(242, 215, 139, 0.54));
  transform: translate(-50%, -50%) scale(0.42);
}

.converging-ray {
  top: 50%;
  width: 43vw;
  max-width: 620px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 232, 158, 0.84));
  box-shadow: 0 0 8px rgba(242, 215, 139, 0.46);
  transform-origin: center;
}

.ray-left {
  left: 0;
  transform: translateX(-104%) rotate(2deg);
}

.ray-right {
  right: 0;
  background: linear-gradient(90deg, rgba(255, 232, 158, 0.84), transparent);
  transform: translateX(104%) rotate(-2deg);
}

.cta-slot-light-path {
  top: 20%;
  left: 50%;
  width: 2px;
  height: 62%;
  background: linear-gradient(180deg, transparent, rgba(255, 244, 205, 0.9) 32%, rgba(215, 180, 92, 0.34) 75%, transparent);
  filter: drop-shadow(0 0 6px rgba(242, 215, 139, 0.7));
  transform: translateX(-50%) scaleY(0);
  transform-origin: 50% 0;
}

.app.spinning .screen-focus-vignette,
.app.is-anticipating .screen-focus-vignette,
.app.is-accelerating .screen-focus-vignette,
.app.is-spinning-fast .screen-focus-vignette,
.app.is-finalizing .screen-focus-vignette,
.app.is-final-reveal .screen-focus-vignette {
  opacity: 1;
}

.app.spinning::before {
  filter: brightness(0.78) saturate(0.86);
  transform: scale(1.01);
}

.app.spinning .cathedral-scene {
  opacity: 0.77;
  filter: brightness(1.08);
  transform: translateX(-50%) scale(1.01);
}

.app.spinning .hero,
.app.spinning .theme-section {
  opacity: 0.66;
  filter: brightness(0.72) saturate(0.82);
}

.app.spinning .slot-section {
  position: relative;
  z-index: 7;
  filter: brightness(1.12);
  transform: scale(1.008);
}

.app.spinning .ambient-star,
.app.is-anticipating .ambient-star,
.app.is-accelerating .ambient-star,
.app.is-spinning-fast .ambient-star,
.app.is-finalizing .ambient-star,
.app.is-final-reveal .ambient-star {
  --idle-opacity: 0.82;
  filter: brightness(1.38) drop-shadow(0 0 5px rgba(242, 215, 139, 0.7));
}

.app.is-anticipating .screen-ring {
  animation: screen-ring-once 720ms cubic-bezier(0.16, 0.72, 0.24, 1) both;
}

.app.is-anticipating .cta-slot-light-path {
  animation: cta-slot-light-run 520ms 80ms ease-out both;
}

.app.is-spinning-fast .converging-ray {
  animation: screen-ray-scan 1.6s ease-in-out infinite;
}

.app.is-spinning-fast .ray-right {
  animation-name: screen-ray-scan-right;
  animation-delay: -800ms;
}

.app.is-finalizing .converging-ray,
.app.is-final-reveal .converging-ray {
  animation: final-ray-converge 620ms cubic-bezier(0.16, 0.72, 0.24, 1) both;
}

.app.is-finalizing .ray-right,
.app.is-final-reveal .ray-right {
  animation-name: final-ray-converge-right;
}

.app.is-final-reveal .screen-ring {
  animation: final-screen-ring 680ms ease-out both;
}

.app.is-final-reveal .screen-cross-light {
  animation: final-cross-light 620ms ease-out both;
}

.app.spinning .hero,
.app.spinning .theme-section,
.app.spinning .slot-section {
  transform-origin: 50% 50%;
  transition: opacity 420ms ease, filter 420ms ease, transform 520ms ease;
}

.app.is-page-hidden,
.app.is-page-hidden *,
.app.is-page-hidden::before,
.app.is-page-hidden::after,
.app.is-page-hidden *::before,
.app.is-page-hidden *::after {
  animation-play-state: paused !important;
}

.site-header {
  position: relative;
  z-index: 10;
  width: min(100%, 1280px);
  min-height: 74px;
  margin: 0 auto;
  padding: 16px clamp(18px, 3vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  color: var(--gold-bright);
  font-size: clamp(0.9rem, 1.5vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-shadow: 0 2px 14px rgba(215, 180, 92, 0.15);
}

.brand-symbol {
  width: 36px;
  height: 36px;
  fill: rgba(215, 180, 92, 0.16);
  stroke: var(--gold-bright);
  stroke-width: 0.8;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(9px, 1.5vw, 20px);
}

.header-nav button {
  min-height: 40px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: rgba(244, 239, 229, 0.78);
  font-size: clamp(0.63rem, 0.9vw, 0.75rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.header-nav button[aria-disabled="true"] {
  cursor: default;
  opacity: 0.82;
}

.nav-divider {
  width: 1px;
  height: 16px;
  background: rgba(215, 180, 92, 0.42);
}

.nav-search {
  display: grid;
  place-items: center;
  width: 36px;
  padding: 0 !important;
}

.nav-search svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--gold-bright);
  stroke-linecap: round;
  stroke-width: 1.45;
}

.login-button {
  min-width: 80px;
  min-height: 38px !important;
  padding: 7px 15px !important;
  border: 1px solid rgba(215, 180, 92, 0.58) !important;
  border-radius: 999px;
  color: var(--gold-bright) !important;
}

main {
  position: relative;
  z-index: 2;
  padding-bottom: clamp(56px, 8vw, 92px);
}

.hero {
  min-height: 300px;
  padding: 71px 16px 28px;
  display: grid;
  place-items: start center;
  scroll-margin-top: 12px;
}

.hero-content {
  width: min(100%, 560px);
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--gold-bright);
  font-size: clamp(3rem, 6vw, 3.35rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.11em;
  text-shadow:
    0 4px 24px rgba(215, 180, 92, 0.19),
    0 1px rgba(255, 255, 255, 0.1);
}

.hero-rule {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 360px);
  margin: 23px auto 28px;
}

.hero-rule::before,
.hero-rule::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 180, 92, 0.6));
}

.hero-rule::after {
  background: linear-gradient(90deg, rgba(215, 180, 92, 0.6), transparent);
}

.hero-rule span {
  width: 5px;
  height: 5px;
  margin: auto;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(215, 180, 92, 0.45);
  transform: rotate(45deg);
}

.gold-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 54px;
  border: 1px solid #efd47f;
  border-radius: 999px;
  background: linear-gradient(100deg, #ae8437 0%, #e6c977 47%, #f0d889 62%, #b78d3e 100%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(215, 180, 92, 0.24);
  color: #10131b;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-shadow: 0 1px rgba(255, 255, 255, 0.3);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.gold-cta::before {
  content: "";
  position: absolute;
  inset: -35% -55%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(108deg, transparent 39%, rgba(255, 250, 225, 0.68) 49%, transparent 59%);
  transform: translateX(-58%) skewX(-10deg);
}

.gold-cta > * {
  position: relative;
  z-index: 1;
}

.gold-cta svg {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  transform: translateY(-50%);
  transition: transform 180ms ease;
}

.hero-cta {
  width: min(100%, 262px);
  min-height: 60px;
  padding: 14px 46px 14px 26px;
  font-size: 1rem;
}

.hero-cta:not(:disabled) {
  animation: cta-breathe 3s ease-in-out infinite;
}

.hero-cta:not(:disabled)::before {
  animation: cta-idle-shine 3.15s 520ms ease-in-out infinite;
}

.gold-cta:disabled {
  cursor: wait;
  filter: saturate(0.55);
  opacity: 0.7;
}

.section-heading {
  width: min(100%, 640px);
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  align-items: center;
  gap: 16px;
  color: var(--gold-bright);
  text-align: center;
}

.section-heading > span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 180, 92, 0.46));
}

.section-heading > span:last-child {
  background: linear-gradient(90deg, rgba(215, 180, 92, 0.46), transparent);
}

.section-heading h2 {
  position: relative;
  margin: 0;
  padding: 0 13px;
  font-size: clamp(1rem, 2.2vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.19em;
  line-height: 1.5;
}

.section-heading h2::before,
.section-heading h2::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  background: var(--gold);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.84;
}

.section-heading h2::before {
  left: -3px;
}

.section-heading h2::after {
  right: -3px;
}

.theme-section {
  position: relative;
  width: min(calc(100% - 32px), 780px);
  margin: 0 auto;
  padding-top: 4px;
}

.theme-section .section-heading {
  margin-bottom: 16px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 17px;
}

.mode-button {
  --theme-color: 105, 127, 164;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  min-height: 164px;
  padding: 21px 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 17px;
  border: 1px solid rgba(var(--theme-color), 0.62);
  border-radius: 10px;
  background:
    linear-gradient(150deg, rgba(var(--theme-color), 0.15), rgba(5, 13, 26, 0.87) 58%),
    var(--panel);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.018),
    inset 0 0 28px rgba(var(--theme-color), 0.04);
  color: rgba(244, 239, 229, 0.9);
  cursor: pointer;
  font-size: clamp(0.78rem, 1.8vw, 1rem);
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: 0.04em;
  text-align: center;
  text-wrap: balance;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
  animation: theme-card-float 5.2s ease-in-out infinite;
}

.mode-button:nth-child(2) { animation-duration: 6.1s; animation-delay: -1.4s; }
.mode-button:nth-child(3) { animation-duration: 4.7s; animation-delay: -3.2s; }
.mode-button:nth-child(4) { animation-duration: 6.8s; animation-delay: -2.1s; }
.mode-button:nth-child(5) { animation-duration: 5.7s; animation-delay: -4.4s; }

.mode-button > * {
  position: relative;
  z-index: 2;
}

.mode-button::before {
  content: "";
  position: absolute;
  inset: -45% -75%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 232, 158, 0.32), transparent 36%),
    linear-gradient(110deg, transparent 38%, rgba(255, 239, 190, 0.3) 49%, transparent 60%);
  transform: translateX(-62%) rotate(8deg);
}

.mode-button[data-mode="beginner"] {
  --theme-color: 162, 130, 74;
}

.mode-button[data-mode="anxiety"] {
  --theme-color: 126, 105, 157;
}

.mode-button[data-mode="sadness"] {
  --theme-color: 152, 87, 78;
}

.mode-button[data-mode="lowEnergy"] {
  --theme-color: 76, 128, 101;
}

.mode-button[aria-pressed="true"] {
  border-color: var(--gold-bright);
  background:
    linear-gradient(150deg, rgba(215, 180, 92, 0.19), rgba(8, 16, 28, 0.91) 60%),
    var(--panel);
  box-shadow:
    inset 0 0 28px rgba(215, 180, 92, 0.08),
    0 0 17px rgba(215, 180, 92, 0.2);
  color: var(--gold-bright);
  animation: theme-selected-breathe 3.25s ease-in-out infinite;
}

.mode-button[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--gold-bright);
  font: 700 0.68rem/1 sans-serif;
}

.mode-button.is-selecting {
  animation: theme-card-select 420ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.mode-button.is-selecting::before {
  animation: theme-card-sheen 420ms ease-out;
}

.mode-button.is-selecting::after {
  animation: theme-check-in 360ms 70ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.mode-button.is-selecting .theme-icon {
  animation: theme-icon-pop 390ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.theme-icon {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: rgba(var(--theme-color), 0.95);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
  filter: drop-shadow(0 0 7px rgba(var(--theme-color), 0.18));
  transition: transform 180ms ease, filter 180ms ease, stroke 180ms ease;
}

.mode-button[aria-pressed="true"] .theme-icon {
  stroke: var(--gold-bright);
}

.settings-row {
  position: static;
  min-height: 42px;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.toggle-button {
  min-width: 88px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid rgba(215, 180, 92, 0.27);
  border-radius: 999px;
  background: rgba(5, 13, 26, 0.68);
  color: rgba(170, 166, 158, 0.88);
  cursor: pointer;
  font: 600 0.67rem/1.2 var(--serif);
  letter-spacing: 0.1em;
}

.toggle-button[aria-pressed="true"] {
  border-color: rgba(215, 180, 92, 0.55);
  background: rgba(215, 180, 92, 0.075);
  color: var(--gold-bright);
}

.slot-section {
  width: min(calc(100% - 32px), 640px);
  margin: 39px auto 0;
}

.slot-section .section-heading {
  margin-bottom: 14px;
}

.machine-wrap {
  width: min(100%, 578px);
  margin: 0 auto;
}

.machine {
  position: relative;
  isolation: isolate;
  height: 430px;
  padding: 2px;
  border: 1px solid rgba(215, 180, 92, 0.72);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(242, 215, 139, 0.24), rgba(105, 76, 23, 0.09) 44%, rgba(242, 215, 139, 0.16)),
    #071426;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(215, 180, 92, 0.07),
    inset 0 0 0 1px rgba(255, 240, 192, 0.05);
  transition: transform 260ms cubic-bezier(0.18, 0.82, 0.24, 1), box-shadow 260ms ease, border-color 260ms ease;
}

.machine-frame-effect,
.machine-reveal-effect {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.machine-frame-effect {
  inset: -3px;
  border: 1px solid rgba(242, 215, 139, 0.22);
  box-shadow:
    inset 0 0 0 3px rgba(2, 9, 20, 0.76),
    inset 0 0 0 4px rgba(215, 180, 92, 0.17);
}

.machine-frame-effect::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  opacity: 0;
  background: conic-gradient(
    from var(--frame-angle),
    transparent 0 40%,
    rgba(255, 244, 205, 0.08) 45%,
    rgba(255, 225, 137, 0.95) 49%,
    rgba(255, 244, 205, 0.12) 53%,
    transparent 58% 100%
  );
  filter: blur(1px);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.machine-frame-effect::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(215, 180, 92, 0.12);
  border-radius: 12px;
  background:
    linear-gradient(135deg, var(--gold-bright), transparent 11px) top left,
    linear-gradient(225deg, var(--gold-bright), transparent 11px) top right,
    linear-gradient(45deg, var(--gold-bright), transparent 11px) bottom left,
    linear-gradient(315deg, var(--gold-bright), transparent 11px) bottom right;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  opacity: 0.42;
}

.machine-reveal-effect {
  z-index: 6;
  display: grid;
  place-items: center;
  opacity: 0;
}

.machine-reveal-effect::before,
.machine-reveal-effect::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.machine-reveal-effect::before {
  width: 92px;
  height: 92px;
  border: 1px solid rgba(255, 232, 158, 0.9);
  border-radius: 50%;
  box-shadow:
    0 0 24px rgba(242, 215, 139, 0.55),
    inset 0 0 22px rgba(242, 215, 139, 0.22);
}

.machine-reveal-effect::after {
  width: min(76%, 390px);
  height: 88%;
  background:
    linear-gradient(90deg, transparent 49.65%, rgba(255, 239, 187, 0.86) 50%, transparent 50.35%),
    linear-gradient(0deg, transparent 49.55%, rgba(255, 239, 187, 0.72) 50%, transparent 50.45%);
  filter: blur(0.4px) drop-shadow(0 0 11px rgba(242, 215, 139, 0.62));
}

.machine-inner {
  position: relative;
  z-index: 1;
  overflow: hidden;
  height: 100%;
  padding: 19px 27px 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 47%, rgba(215, 180, 92, 0.075), transparent 44%),
    radial-gradient(circle at 50% 108%, rgba(215, 180, 92, 0.07), transparent 42%),
    linear-gradient(155deg, #09172a, #041020 63%, #071426);
}

.machine-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background: linear-gradient(105deg, transparent 0%, rgba(242, 215, 139, 0.12) 49%, transparent 68%);
  transform: translateX(-120%);
}

.machine-inner::after {
  content: "";
  position: absolute;
  inset: -35%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(242, 215, 139, 0.08) 0 3deg, transparent 3deg 15deg);
  mask-image: radial-gradient(circle, black 0 14%, transparent 58%);
  transform: scale(0.35);
}

.app.is-anticipating .cathedral-scene {
  animation: cathedral-anticipation 1.35s ease-in-out infinite alternate;
}

.app.is-anticipating .light-beam {
  animation: light-beam-charge 900ms ease-in-out infinite alternate;
}

.machine.is-charging {
  border-color: rgba(255, 225, 139, 0.95);
  box-shadow:
    0 20px 58px rgba(0, 0, 0, 0.38),
    0 0 38px rgba(215, 180, 92, 0.27),
    inset 0 0 24px rgba(242, 215, 139, 0.08);
  transform: scale(0.985);
}

.machine.is-charging .machine-inner::after,
.machine-inner.is-radiating::after {
  animation: radial-charge 300ms ease-out both;
}

.machine.is-accelerating .machine-inner::before {
  animation: shine-sweep 450ms ease-in 1;
}

.machine.is-spinning-fast {
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.35),
    0 0 34px rgba(215, 180, 92, 0.16),
    inset 0 0 0 1px rgba(255, 240, 192, 0.05);
  animation: machine-breathe 2.7s ease-in-out infinite;
}

.machine.is-spinning-fast .machine-frame-effect::before {
  opacity: 0.88;
  animation: frame-light-orbit 1.65s linear infinite;
}

.machine.is-spinning-fast .machine-inner::before {
  animation: reel-gloss-sweep 1.05s linear infinite;
}

.app.is-final-reveal .cathedral-scene {
  animation: cathedral-final-glow 520ms ease-out;
}

.machine.is-final-impact {
  border-color: var(--gold-bright);
  animation: machine-final-impact 520ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.machine.is-final-impact .machine-frame-effect::before {
  opacity: 1;
  animation: frame-light-orbit-final 420ms linear 1;
}

.machine.is-final-impact .machine-reveal-effect {
  animation: machine-reveal-wave 520ms ease-out both;
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.reel-wrap {
  position: relative;
  min-width: 0;
}

.reel-label {
  min-height: 57px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.17em;
}

.reel-label svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  transition: filter 180ms ease, stroke 180ms ease, transform 180ms ease;
}

.reel-wrap.is-primed .reel-label svg {
  stroke: var(--gold-bright);
  filter: drop-shadow(0 0 9px rgba(242, 215, 139, 0.58));
  animation: reel-icon-prime 300ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.reel-wrap.is-impact .reel-label svg,
.reel-wrap.is-stopped .reel-label svg {
  stroke: var(--gold-bright);
  filter: drop-shadow(0 0 10px rgba(242, 215, 139, 0.72));
}

.reel-wrap.is-impact .reel-label svg {
  animation: reel-icon-impact 240ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.reel {
  --row-height: 79px;
  --spin-from: -79px;
  --spin-to: -474px;
  --spin-cycle: 0.32s;
  --spin-phase: -0.05s;
  position: relative;
  width: 100%;
  height: 237px;
  overflow: hidden;
  border: 1px solid rgba(215, 180, 92, 0.56);
  border-radius: 5px;
  background:
    linear-gradient(110deg, transparent 0 34%, rgba(255, 255, 255, 0.035) 48%, transparent 62%),
    linear-gradient(180deg, #020914, #09192d 49%, #020914);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.52),
    0 7px 16px rgba(0, 0, 0, 0.2);
  transform-origin: center;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

#chapterReel {
  --spin-cycle: 0.24s;
  --spin-phase: -0.1s;
}

#verseReel {
  --spin-cycle: 0.18s;
  --spin-phase: -0.14s;
}

.reel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(1, 6, 15, 0.92), transparent 34%, transparent 66%, rgba(1, 6, 15, 0.92)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018), transparent 15%, transparent 85%, rgba(255, 255, 255, 0.018));
}

.reel::after {
  content: "";
  position: absolute;
  top: 79px;
  right: 0;
  left: 0;
  z-index: 2;
  height: 79px;
  pointer-events: none;
  border-top: 1px solid rgba(215, 180, 92, 0.35);
  border-bottom: 1px solid rgba(215, 180, 92, 0.35);
  background:
    linear-gradient(115deg, transparent 15%, rgba(255, 255, 255, 0.045) 38%, rgba(255, 244, 205, 0.12) 49%, transparent 64%),
    linear-gradient(90deg, rgba(215, 180, 92, 0.1), rgba(215, 180, 92, 0.2), rgba(215, 180, 92, 0.1));
  background-size: 220% 100%, 100% 100%;
  box-shadow: inset 0 0 14px rgba(242, 215, 139, 0.045);
}

.reel-strip {
  position: relative;
  z-index: 1;
  transform: translateY(var(--spin-from));
}

.reel.accelerating .reel-strip,
.reel.spinning .reel-strip,
.reel.spinning-fast .reel-strip,
.reel.decelerating .reel-strip,
.reel.impact .reel-strip {
  will-change: transform;
}

.reel.accelerating .reel-strip,
.reel.spinning .reel-strip,
.reel.spinning-fast .reel-strip {
  animation: reel-scroll var(--spin-cycle) linear infinite;
  animation-delay: var(--spin-phase);
}

.reel.spinning-fast .reel-value {
  filter: blur(0.42px);
  opacity: 0.84;
}

.reel.spinning-fast::after {
  animation: selection-line-scan 720ms ease-in-out infinite alternate;
}

.reel.decelerating {
  border-color: rgba(242, 215, 139, 0.76);
  box-shadow:
    inset 0 0 22px rgba(0, 0, 0, 0.5),
    0 0 17px rgba(215, 180, 92, 0.2);
}

.reel.decelerating .reel-value {
  filter: blur(0.12px);
  opacity: 0.94;
}

.reel.impact {
  border-color: var(--gold-bright);
  animation: reel-impact-frame 240ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.reel.impact .reel-strip {
  animation: reel-value-settle 220ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.reel.stopped {
  border-color: rgba(242, 215, 139, 0.82);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.52),
    0 0 18px rgba(215, 180, 92, 0.2);
  transform: scale(1.012);
}

.reel.impact .reel-cell.center,
.reel.stopped .reel-cell.center {
  background: radial-gradient(ellipse at center, rgba(242, 215, 139, 0.16), transparent 74%);
}

.reel-cell {
  min-width: 0;
  height: 79px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-value {
  display: block;
  max-width: 100%;
  color: rgba(215, 180, 92, 0.31);
  font-size: clamp(0.65rem, 1.35vw, 0.78rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: center;
  text-wrap: balance;
  transition: color 180ms ease, filter 180ms ease, opacity 180ms ease, text-shadow 180ms ease;
}

.reel-cell.center .reel-value {
  color: var(--gold-bright);
  font-size: clamp(0.82rem, 1.75vw, 1rem);
  font-weight: 600;
  text-shadow: 0 0 11px rgba(215, 180, 92, 0.28);
}

.selection-marker {
  position: absolute;
  top: 176px;
  z-index: 5;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  filter: drop-shadow(0 0 5px rgba(215, 180, 92, 0.34));
  pointer-events: none;
}

.marker-left {
  --marker-kick: -5px;
  left: -11px;
  border-left: 0;
  border-right: 10px solid var(--gold-bright);
}

.marker-right {
  --marker-kick: 5px;
  right: -11px;
  border-right: 0;
  border-left: 10px solid var(--gold-bright);
}

.machine.is-accelerating .selection-marker,
.machine.is-spinning-fast .selection-marker {
  animation: marker-pulse 620ms ease-in-out infinite alternate;
}

.reel-wrap.is-impact .selection-marker {
  animation: marker-impact 240ms cubic-bezier(0.18, 0.82, 0.24, 1);
}

.stop-lights {
  height: 18px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stop-light {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(215, 180, 92, 0.4);
  background: transparent;
  transform: rotate(45deg);
  transition: background-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.machine.is-accelerating .stop-light:not(.on),
.machine.is-spinning-fast .stop-light:not(.on),
.stop-lights.is-sequencing .stop-light:not(.on) {
  animation: stop-light-chase 720ms ease-in-out infinite;
}

.machine.is-accelerating .stop-light:not(.on):nth-child(2),
.machine.is-spinning-fast .stop-light:not(.on):nth-child(2),
.stop-lights.is-sequencing .stop-light:not(.on):nth-child(2) {
  animation-delay: 120ms;
}

.machine.is-accelerating .stop-light:not(.on):nth-child(3),
.machine.is-spinning-fast .stop-light:not(.on):nth-child(3),
.stop-lights.is-sequencing .stop-light:not(.on):nth-child(3) {
  animation-delay: 240ms;
}

.stop-light.on {
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(242, 215, 139, 0.7);
}

.machine.is-final-impact .stop-light.on {
  animation: stop-light-final 520ms ease-out;
}

.machine-cta {
  width: min(100%, 320px);
  min-height: 50px;
  margin: 6px auto 0;
  padding: 11px 46px 11px 28px;
  display: block;
  font-size: 0.9rem;
}

.machine-cta:not(:disabled) {
  animation: cta-breathe 2.8s ease-in-out infinite;
}

.gold-cta.is-committing {
  animation: cta-commit 260ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.status {
  position: absolute;
  right: 16px;
  bottom: 1px;
  left: 16px;
  min-height: 22px;
  margin: 0 auto;
  color: rgba(242, 215, 139, 0.74);
  font-size: 0.72rem;
  line-height: 1.55;
  letter-spacing: 0.04em;
  text-align: center;
}

.result-card {
  position: relative;
  isolation: isolate;
  width: min(calc(100% - 32px), 680px);
  margin: 21px auto 0;
  scroll-margin-top: 20px;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 8% -12% 3%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(215, 180, 92, 0.17), rgba(62, 105, 145, 0.055) 45%, transparent 72%);
  transform: scale(0.74);
}

.result-card:not(.visible) {
  display: none;
}

.result-card:focus {
  outline: none;
}

.result-card.is-revealing,
.app.is-revealing .result-card.visible {
  animation: result-card-rise 720ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.result-card.is-revealing::before,
.app.is-revealing .result-card.visible::before {
  animation: result-halo-rise 920ms 40ms ease-out both;
}

.result-heading {
  width: min(100%, 460px);
  margin-bottom: 14px;
}

.card-border {
  position: relative;
  isolation: isolate;
  padding: 1px;
  border: 1px solid rgba(242, 215, 139, 0.8);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(215, 180, 92, 0.12), rgba(215, 180, 92, 0.015));
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(215, 180, 92, 0.12);
}

.result-card.is-revealing .card-border,
.app.is-revealing .result-card.visible .card-border {
  animation: result-border-enter 480ms ease-out both;
}

.card-border::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 5;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: conic-gradient(from var(--card-angle), transparent 0 34%, rgba(255, 240, 190, 0.95) 48%, transparent 60% 100%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.result-card.is-revealing .card-border::before,
.app.is-revealing .result-card.visible .card-border::before {
  animation: card-border-orbit 900ms ease-out both;
}

.card-inner {
  position: relative;
  z-index: 1;
  min-height: 402px;
  padding: 23px clamp(34px, 6vw, 46px) 30px;
  overflow: hidden;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 0, rgba(215, 180, 92, 0.065), transparent 220px),
    linear-gradient(155deg, #0a192d, #061326 62%, #08172a);
  text-align: center;
}

.botanical-corner {
  position: absolute;
  z-index: 3;
  width: 64px;
  height: 64px;
  pointer-events: none;
  opacity: 0.61;
}

.botanical-corner svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 0.95;
}

.result-card.is-revealing .botanical-corner,
.app.is-revealing .result-card.visible .botanical-corner {
  animation: result-corner-in 460ms 80ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.result-card.is-revealing .botanical-corner svg,
.app.is-revealing .result-card.visible .botanical-corner svg {
  animation: botanical-light-flow 720ms 80ms ease-out both;
}

.corner-top-left {
  top: 7px;
  left: 7px;
  transform: rotate(90deg);
}

.corner-top-right {
  top: 7px;
  right: 7px;
  transform: rotate(180deg);
}

.corner-bottom-left {
  bottom: 7px;
  left: 7px;
}

.corner-bottom-right {
  right: 7px;
  bottom: 7px;
  transform: rotate(-90deg);
}

.seal {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 180, 92, 0.5);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(215, 180, 92, 0.06);
}

.seal::before,
.seal::after {
  content: "";
  position: absolute;
  left: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(215, 180, 92, 0.34);
  transform: translateX(-50%);
}

.seal::before {
  top: 13px;
  width: 1px;
  height: 30px;
}

.seal::after {
  top: 22px;
  width: 17px;
  height: 1px;
}

.seal span {
  width: 27px;
  height: 27px;
  background: radial-gradient(circle, rgba(215, 180, 92, 0.19), transparent 68%);
}

.result-card.is-revealing .seal,
.app.is-revealing .result-card.visible .seal {
  animation: result-piece-in 500ms 150ms cubic-bezier(0.18, 0.82, 0.24, 1) both, seal-reveal-glow 650ms 150ms ease-out both;
}

.reference {
  margin: 0;
  color: var(--gold-bright);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
  text-shadow: 0 3px 17px rgba(215, 180, 92, 0.14);
}

.result-card.is-revealing .reference,
.app.is-revealing .result-card.visible .reference {
  animation: result-piece-in 500ms 220ms cubic-bezier(0.18, 0.82, 0.24, 1) both, reference-reveal-glow 720ms 220ms ease-out both;
}

.context-block,
.book-intro {
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(215, 180, 92, 0.16);
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(17, 38, 62, 0.68), rgba(7, 24, 43, 0.54));
  box-shadow: inset 0 1px rgba(255, 246, 213, 0.025);
  text-align: left;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.supplemental-heading {
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(242, 215, 139, 0.84);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.13em;
  list-style: none;
  transition: background-color 160ms ease;
}

.supplemental-heading::-webkit-details-marker {
  display: none;
}

.supplemental-heading:hover {
  background: rgba(215, 180, 92, 0.035);
}

.supplemental-heading:focus-visible {
  outline-offset: -4px;
}

.supplemental-heading > :first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
}

.supplemental-heading > :first-child::after {
  content: "";
  min-width: 18px;
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(215, 180, 92, 0.24), transparent);
}

.disclosure-state {
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1px solid rgba(215, 180, 92, 0.28);
  border-radius: 50%;
}

.disclosure-state::before,
.disclosure-state::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.disclosure-state::after {
  transform: translate(-50%, -50%) rotate(90deg);
  transition: opacity 160ms ease, transform 160ms ease;
}

.context-block[open] .disclosure-state::after,
.book-intro[open] .disclosure-state::after {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
}

.context-block[open] .supplemental-heading,
.book-intro[open] .supplemental-heading {
  border-bottom: 1px solid rgba(215, 180, 92, 0.12);
}

.disclosure-body {
  padding: 13px 16px 16px;
}

.context-title {
  margin: 0;
  color: rgba(244, 239, 229, 0.93);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: 0.035em;
}

.context-range {
  margin: 5px 0 0;
  color: rgba(170, 166, 158, 0.68);
  font-size: 0.63rem;
  line-height: 1.6;
  letter-spacing: 0.035em;
}

.verse-ornament {
  width: min(100%, 470px);
  margin: 17px auto 13px;
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  align-items: center;
  gap: 9px;
}

.result-card.is-revealing .verse-ornament:not(.ornament-bottom),
.app.is-revealing .result-card.visible .verse-ornament:not(.ornament-bottom) {
  animation: result-piece-in 470ms 290ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.verse-ornament::before,
.verse-ornament::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 180, 92, 0.34));
}

.verse-ornament::after {
  background: linear-gradient(90deg, rgba(215, 180, 92, 0.34), transparent);
}

.verse-ornament span {
  height: 6px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 2px, transparent 2.5px),
    linear-gradient(45deg, transparent 44%, var(--gold) 46% 54%, transparent 56%) center / 7px 7px no-repeat;
  opacity: 0.7;
}

.verse-text {
  width: min(100%, 500px);
  margin: 0 auto;
  color: rgba(244, 239, 229, 0.96);
  font-size: clamp(0.98rem, 2.15vw, 1.14rem);
  font-style: normal;
  line-height: 1.92;
  letter-spacing: 0.035em;
  overflow-wrap: anywhere;
  text-align: center;
}

.result-card.is-revealing .verse-text,
.app.is-revealing .result-card.visible .verse-text {
  animation: result-piece-in 500ms 360ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.ornament-bottom {
  margin-top: 13px;
  margin-bottom: 12px;
}

.result-card.is-revealing .ornament-bottom,
.app.is-revealing .result-card.visible .ornament-bottom {
  animation: result-piece-in 470ms 430ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.api-note {
  width: min(100%, 480px);
  margin: 0 auto;
  color: rgba(170, 166, 158, 0.68);
  font-size: 0.64rem;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.result-card.is-revealing .api-note,
.app.is-revealing .result-card.visible .api-note {
  animation: result-piece-in 460ms 500ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.result-card.is-revealing .supplemental-row,
.app.is-revealing .result-card.visible .supplemental-row {
  animation: result-piece-in 460ms 570ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.supplemental-row {
  width: min(calc(100% - 28px), 590px);
  margin: 22px auto 6px;
  padding-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  border-top: 1px solid rgba(215, 180, 92, 0.19);
}

.supplemental-row[data-layout="both"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.supplemental-row[data-layout="section"] .context-block {
  width: min(100%, 440px);
  justify-self: center;
}

.supplemental-row[data-layout="intro"] .book-intro {
  width: min(100%, 560px);
  justify-self: center;
}

.intro-text {
  margin: 0;
  color: rgba(244, 239, 229, 0.84);
  font-size: 0.78rem;
  line-height: 1.9;
  letter-spacing: 0.025em;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.intro-body {
  padding: 13px 16px 16px;
}

.intro-copyright {
  margin: 12px 0 0;
  color: rgba(170, 166, 158, 0.66);
  font-size: 0.61rem;
  line-height: 1.68;
  letter-spacing: 0.015em;
  overflow-wrap: anywhere;
}

.card-actions {
  margin-top: 32px;
}

.result-card.is-revealing .card-actions,
.app.is-revealing .result-card.visible .card-actions {
  animation: result-piece-in 440ms 640ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.small-button {
  min-width: 0;
  min-height: 48px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(215, 180, 92, 0.47);
  border-radius: 7px;
  background: rgba(6, 16, 31, 0.8);
  color: rgba(242, 215, 139, 0.92);
  cursor: pointer;
  font-size: clamp(0.63rem, 1.35vw, 0.75rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 140ms ease;
}

.small-button:disabled,
.small-button[aria-disabled="true"] {
  cursor: default;
  opacity: 0.48;
  pointer-events: none;
}

.action-icon {
  flex: 0 0 auto;
  color: var(--gold);
  font-family: sans-serif;
  font-size: 0.95rem;
}

.source-link {
  width: min(100%, 350px);
  min-height: 50px;
  margin: 19px auto 0;
  letter-spacing: 0.08em;
}

/* The entering class is added briefly by JavaScript; without it every element is visible. */
.app.is-page-entering .cathedral-scene {
  animation: page-cathedral-reveal 720ms ease-out both;
}

.app.is-page-entering .light-beam {
  animation: page-light-beam 800ms 120ms ease-out both;
}

.app.is-page-entering .site-brand {
  animation: page-enter-from-left 540ms 260ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .settings-row {
  animation: page-enter-from-top 540ms 350ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .hero h1 {
  animation: page-title-enter 660ms 480ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .hero-rule {
  animation: page-rule-grow 500ms 620ms ease-out both;
}

.app.is-page-entering .hero-cta {
  animation: page-enter-from-bottom 580ms 720ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .theme-section .section-heading {
  animation: page-enter-from-bottom 500ms 880ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .mode-button {
  animation: page-card-enter 420ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .mode-button:nth-child(1) { animation-delay: 960ms; }
.app.is-page-entering .mode-button:nth-child(2) { animation-delay: 1040ms; }
.app.is-page-entering .mode-button:nth-child(3) { animation-delay: 1120ms; }
.app.is-page-entering .mode-button:nth-child(4) { animation-delay: 1200ms; }
.app.is-page-entering .mode-button:nth-child(5) { animation-delay: 1280ms; }

.app.is-page-entering .slot-section .section-heading {
  animation: page-enter-from-bottom 420ms 1400ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.app.is-page-entering .machine-wrap {
  animation: page-machine-enter 420ms 1480ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
}

.particle,
.effect-particle,
[data-effect-particle] {
  position: fixed;
  top: var(--y);
  left: var(--x);
  width: var(--s, 3px);
  height: var(--s, 3px);
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  background: var(--c, var(--gold-bright));
  box-shadow: 0 0 8px var(--c, var(--gold-bright));
  will-change: transform, opacity;
  animation: effect-particle-fly var(--d, 900ms) var(--delay, 0ms) cubic-bezier(0.12, 0.7, 0.24, 1) forwards;
}

.effect-particle.is-diamond,
[data-effect-particle][data-shape="diamond"] {
  border-radius: 1px;
  transform: rotate(45deg);
}

.effect-particle.is-star,
[data-effect-particle][data-shape="star"] {
  border-radius: 0;
  background:
    linear-gradient(transparent 44%, var(--c) 45% 55%, transparent 56%),
    linear-gradient(90deg, transparent 44%, var(--c) 45% 55%, transparent 56%);
  box-shadow: 0 0 9px var(--c);
}

.effect-particle.is-ray,
[data-effect-particle][data-shape="ray"] {
  width: var(--ray-width, 28px);
  height: 1px;
  border-radius: 999px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--c), transparent);
  box-shadow: 0 0 7px var(--c);
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 248, 220, 0.58), rgba(242, 215, 139, 0.15) 38%, transparent 72%);
}

.flash.show {
  animation: flash-fade 0.46s ease-out forwards;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 80;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border: 1px solid rgba(215, 180, 92, 0.48);
  border-radius: 7px;
  background: rgba(5, 14, 28, 0.96);
  color: var(--gold-bright);
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .gold-cta:not(:disabled):hover {
    animation: none;
    filter: brightness(1.08);
    box-shadow:
      inset 0 1px rgba(255, 255, 255, 0.4),
      0 10px 28px rgba(215, 180, 92, 0.32);
    transform: translateY(-2px);
  }

  .gold-cta:not(:disabled):hover svg {
    transform: translate3d(4px, -50%, 0);
  }

  .mode-button:hover {
    animation: none;
    border-color: rgba(var(--theme-color), 0.86);
    box-shadow:
      inset 0 0 28px rgba(var(--theme-color), 0.07),
      0 9px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-5px);
  }

  .mode-button:hover::before {
    animation: theme-hover-sheen 620ms ease-out both;
  }

  .mode-button:hover .theme-icon {
    transform: scale(1.06);
    filter: drop-shadow(0 0 10px rgba(var(--theme-color), 0.38));
  }

  .mode-button[aria-pressed="true"]:hover {
    border-color: var(--gold-bright);
  }

  .toggle-button:hover,
  .small-button:not(:disabled):not([aria-disabled="true"]):hover {
    border-color: rgba(242, 215, 139, 0.72);
    background-color: rgba(215, 180, 92, 0.1);
    color: var(--gold-bright);
  }
}

.gold-cta:not(:disabled):active,
.toggle-button:active,
.small-button:not(:disabled):not([aria-disabled="true"]):active {
  transform: scale(0.97);
}

.mode-button:active {
  animation: none;
  transform: scale(0.98);
}

@keyframes ambient-beam-drift {
  0%, 100% { opacity: 0.35; transform: translateX(-50%) rotate(-0.7deg) scaleX(0.97); }
  50% { opacity: 0.43; transform: translateX(-50%) rotate(0.7deg) scaleX(1.03); }
}

@keyframes cathedral-mist-drift {
  from { transform: translate3d(-3.5%, 0, 0); opacity: 0.19; }
  to { transform: translate3d(3.5%, -4px, 0); opacity: 0.27; }
}

@keyframes architecture-arch-glint {
  0%, 70%, 100% { filter: brightness(1); }
  78% { filter: brightness(1.32) drop-shadow(0 0 4px rgba(215, 180, 92, 0.18)); }
  86% { filter: brightness(1.08); }
}

@keyframes architecture-column-glint {
  0%, 68% { background-position: 0 0, -130px 0; filter: brightness(1); }
  80% { filter: brightness(1.2); }
  92%, 100% { background-position: 0 0, calc(100% + 130px) 0; filter: brightness(1); }
}

@keyframes ambient-star-float {
  0%, 100% { opacity: var(--idle-opacity); transform: translate3d(0, 4px, 0) scale(0.82); }
  45% { opacity: var(--idle-opacity); transform: translate3d(5px, -7px, 0) scale(1.08); }
  72% { transform: translate3d(-3px, -2px, 0) scale(0.94); }
}

@keyframes screen-ring-once {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
  24% { opacity: 0.55; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(5.4); }
}

@keyframes cta-slot-light-run {
  0% { opacity: 0; transform: translateX(-50%) scaleY(0); }
  32% { opacity: 0.88; }
  72% { opacity: 0.42; transform: translateX(-50%) scaleY(1); }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1); }
}

@keyframes screen-ray-scan {
  0%, 100% { opacity: 0; transform: translateX(-104%) rotate(2deg); }
  35% { opacity: 0.32; }
  70% { opacity: 0.06; transform: translateX(-10%) rotate(0); }
}

@keyframes screen-ray-scan-right {
  0%, 100% { opacity: 0; transform: translateX(104%) rotate(-2deg); }
  35% { opacity: 0.32; }
  70% { opacity: 0.06; transform: translateX(10%) rotate(0); }
}

@keyframes final-ray-converge {
  0% { opacity: 0; transform: translateX(-104%) rotate(2deg); }
  34% { opacity: 0.82; }
  72% { opacity: 0.94; transform: translateX(16%) rotate(0); }
  100% { opacity: 0; transform: translateX(23%) rotate(0); }
}

@keyframes final-ray-converge-right {
  0% { opacity: 0; transform: translateX(104%) rotate(-2deg); }
  34% { opacity: 0.82; }
  72% { opacity: 0.94; transform: translateX(-16%) rotate(0); }
  100% { opacity: 0; transform: translateX(-23%) rotate(0); }
}

@keyframes final-screen-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.42); }
  22% { opacity: 0.92; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(7.2); }
}

@keyframes final-cross-light {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.42); }
  30% { opacity: 0.82; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18); }
}

@keyframes page-cathedral-reveal {
  from { opacity: 0; filter: brightness(0.45); transform: translateX(-50%) scale(0.985); }
  to { opacity: 0.66; filter: brightness(1); transform: translateX(-50%) scale(1); }
}

@keyframes page-light-beam {
  from { opacity: 0; transform: translateX(-50%) scaleY(0.25); }
  to { opacity: 0.38; transform: translateX(-50%) scaleY(1); }
}

@keyframes page-enter-from-left {
  from { opacity: 0; transform: translate3d(-24px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes page-enter-from-top {
  from { opacity: 0; transform: translate3d(0, -18px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes page-title-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.94); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes page-rule-grow {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes page-enter-from-bottom {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes page-card-enter {
  from { opacity: 0; transform: translate3d(-12px, 18px, 0) scale(0.97); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes page-machine-enter {
  from { opacity: 0; transform: translateY(22px) scale(0.97); filter: brightness(0.72); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes cta-idle-shine {
  0%, 54% { opacity: 0; transform: translateX(-58%) skewX(-10deg); }
  66% { opacity: 0.72; }
  82%, 100% { opacity: 0; transform: translateX(58%) skewX(-10deg); }
}

@keyframes theme-card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

@keyframes theme-selected-breathe {
  0%, 100% { transform: translateY(0); box-shadow: inset 0 0 28px rgba(215, 180, 92, 0.08), 0 0 15px rgba(215, 180, 92, 0.16); }
  50% { transform: translateY(-2px); box-shadow: inset 0 0 31px rgba(215, 180, 92, 0.11), 0 0 21px rgba(215, 180, 92, 0.25); }
}

@keyframes theme-hover-sheen {
  0% { opacity: 0; transform: translateX(-62%) rotate(8deg); }
  30% { opacity: 0.82; }
  100% { opacity: 0; transform: translateX(62%) rotate(8deg); }
}

@keyframes result-halo-rise {
  from { opacity: 0; transform: scale(0.74); }
  46% { opacity: 0.82; }
  to { opacity: 0.42; transform: scale(1); }
}

@keyframes result-border-enter {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shine-sweep {
  from {
    transform: translateX(-120%);
  }

  to {
    transform: translateX(120%);
  }
}

@keyframes theme-card-select {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-7px) scale(1.018); border-color: var(--gold-bright); box-shadow: 0 0 24px rgba(215, 180, 92, 0.34); }
}

@keyframes theme-card-sheen {
  0% { opacity: 0; transform: translateX(-62%) rotate(8deg); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translateX(62%) rotate(8deg); }
}

@keyframes theme-check-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.5); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes theme-icon-pop {
  0%, 100% { transform: scale(1); }
  52% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(242, 215, 139, 0.6)); }
}

@keyframes cathedral-anticipation {
  from { opacity: 0.66; filter: brightness(1); }
  to { opacity: 0.82; filter: brightness(1.2); }
}

@keyframes cathedral-final-glow {
  0%, 100% { filter: brightness(1); }
  38% { filter: brightness(1.55); }
}

@keyframes light-beam-charge {
  from { opacity: 0.38; filter: blur(16px) brightness(1); }
  to { opacity: 0.62; filter: blur(13px) brightness(1.32); }
}

@keyframes radial-charge {
  from { opacity: 0; transform: scale(0.35) rotate(0); }
  60% { opacity: 0.8; }
  to { opacity: 0.14; transform: scale(1.12) rotate(18deg); }
}

@keyframes frame-light-orbit {
  to { --frame-angle: 360deg; }
}

@keyframes frame-light-orbit-final {
  from { --frame-angle: 0deg; }
  to { --frame-angle: 360deg; }
}

@keyframes reel-gloss-sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

@keyframes machine-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.006); }
}

@keyframes machine-final-impact {
  0% { transform: scale(1); box-shadow: 0 0 25px rgba(215, 180, 92, 0.18); }
  35% { transform: scale(1.014); box-shadow: 0 0 62px rgba(242, 215, 139, 0.62), inset 0 0 32px rgba(242, 215, 139, 0.12); }
  68% { transform: scale(0.997); }
  100% { transform: scale(1); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35), 0 0 30px rgba(215, 180, 92, 0.16); }
}

@keyframes machine-reveal-wave {
  0% { opacity: 0; transform: scale(0.25); }
  28% { opacity: 0.88; }
  100% { opacity: 0; transform: scale(2.2); }
}

@keyframes reel-icon-prime {
  0% { opacity: 0.55; transform: scale(0.86); }
  62% { opacity: 1; transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes reel-icon-impact {
  0%, 100% { transform: scale(1); }
  42% { transform: scale(1.16); }
}

@keyframes reel-scroll {
  from {
    transform: translateY(var(--spin-from));
  }

  to {
    transform: translateY(var(--spin-to));
  }
}

@keyframes selection-line-scan {
  from { background-position: 120% 0, 0 0; filter: brightness(0.92); }
  to { background-position: -120% 0, 0 0; filter: brightness(1.36); }
}

@keyframes reel-impact-frame {
  0% { transform: translateY(0) scale(1); }
  34% { transform: translateY(5px) scale(1.022); box-shadow: 0 0 32px rgba(242, 215, 139, 0.56), inset 0 0 24px rgba(242, 215, 139, 0.12); }
  66% { transform: translateY(-2px) scale(1.01); }
  100% { transform: translateY(0) scale(1.012); }
}

@keyframes reel-value-settle {
  0% { transform: translateY(calc(var(--spin-from) - 8px)); }
  38% { transform: translateY(calc(var(--spin-from) + 5px)); }
  68% { transform: translateY(calc(var(--spin-from) - 2px)); }
  100% { transform: translateY(var(--spin-from)); }
}

@keyframes marker-pulse {
  from { opacity: 0.7; filter: drop-shadow(0 0 4px rgba(215, 180, 92, 0.38)); transform: scale(0.9); }
  to { opacity: 1; filter: drop-shadow(0 0 10px rgba(242, 215, 139, 0.78)); transform: scale(1.08); }
}

@keyframes marker-impact {
  0%, 100% { transform: translateX(0) scale(1); }
  40% { transform: translateX(var(--marker-kick, 0)) scale(1.28); filter: drop-shadow(0 0 13px rgba(242, 215, 139, 0.95)); }
}

@keyframes stop-light-chase {
  0%, 60%, 100% { opacity: 0.3; background: transparent; box-shadow: none; }
  22% { opacity: 1; background: var(--gold-bright); box-shadow: 0 0 9px rgba(242, 215, 139, 0.7); }
}

@keyframes stop-light-final {
  0%, 100% { transform: rotate(45deg) scale(1); }
  36% { transform: rotate(45deg) scale(1.75); box-shadow: 0 0 18px rgba(255, 238, 180, 1); }
}

@keyframes cta-breathe {
  0%, 100% { transform: scale(1); box-shadow: inset 0 1px rgba(255, 255, 255, 0.35), 0 8px 22px rgba(215, 180, 92, 0.24); }
  50% { transform: scale(1.012); box-shadow: inset 0 1px rgba(255, 255, 255, 0.42), 0 9px 28px rgba(215, 180, 92, 0.34); }
}

@keyframes cta-commit {
  0% { transform: scale(1); }
  44% { transform: scale(0.965); box-shadow: inset 0 0 24px rgba(255, 246, 209, 0.64), 0 4px 14px rgba(215, 180, 92, 0.24); }
  100% { transform: scale(0.99); }
}

@keyframes result-card-rise {
  from { opacity: 0; transform: translateY(36px) scale(0.94); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes result-piece-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes result-corner-in {
  from { opacity: 0; translate: 0 12px; scale: 0.98; }
  to { opacity: 0.61; translate: 0 0; scale: 1; }
}

@keyframes card-border-orbit {
  0% { opacity: 0; --card-angle: 0deg; }
  22% { opacity: 1; }
  100% { opacity: 0; --card-angle: 360deg; }
}

@keyframes botanical-light-flow {
  0% { stroke: rgba(215, 180, 92, 0.3); filter: drop-shadow(0 0 0 transparent); }
  48% { stroke: var(--gold-bright); filter: drop-shadow(0 0 7px rgba(242, 215, 139, 0.7)); }
  100% { stroke: var(--gold); filter: drop-shadow(0 0 0 transparent); }
}

@keyframes seal-reveal-glow {
  0%, 100% { box-shadow: inset 0 0 18px rgba(215, 180, 92, 0.06); }
  42% { box-shadow: inset 0 0 28px rgba(242, 215, 139, 0.22), 0 0 24px rgba(242, 215, 139, 0.5); }
}

@keyframes reference-reveal-glow {
  0%, 100% { text-shadow: 0 3px 17px rgba(215, 180, 92, 0.14); }
  48% { text-shadow: 0 0 22px rgba(242, 215, 139, 0.62); }
}

@keyframes effect-particle-fly {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(var(--rotation, 0deg)) scale(0.35); }
  16% { opacity: 0.95; }
  100% { opacity: 0; transform: translate3d(var(--tx), var(--ty), 0) rotate(var(--turn, 120deg)) scale(0.08); }
}

@keyframes flash-fade {
  0% {
    opacity: 0;
  }

  24% {
    opacity: 0.5;
  }

  100% {
    opacity: 0;
  }
}

@media (min-width: 1100px) {
  .theme-section {
    width: min(calc(100% - 48px), 900px);
  }

  .slot-section {
    width: min(calc(100% - 48px), 700px);
  }

  .mode-options {
    gap: 20px;
  }

  .mode-button {
    min-height: 172px;
  }
}

@media (max-width: 800px) {
  .site-header {
    min-height: 64px;
  }

  .header-nav {
    display: none;
  }

  .hero {
    min-height: 270px;
    padding-top: 51px;
  }

  .mode-options {
    gap: 12px;
  }

  .machine-inner {
    padding-right: 22px;
    padding-left: 22px;
  }

  .reels {
    gap: 14px;
  }
}

@media (max-width: 767px) {
  .cathedral-scene {
    height: 430px;
    opacity: 0.52;
  }

  .light-beam {
    width: 130px;
  }

  .arch-outer {
    width: 520px;
  }

  .arch-inner {
    width: 390px;
  }

  .column-left {
    left: 2%;
  }

  .column-right {
    right: 2%;
  }

  .site-header {
    padding: 13px 16px;
  }

  .site-brand {
    font-size: 0.9rem;
  }

  .brand-symbol {
    width: 34px;
    height: 34px;
  }

  .hero {
    min-height: 250px;
    padding: 45px 16px 24px;
  }

  h1 {
    font-size: clamp(2.5rem, 12vw, 3.45rem);
    letter-spacing: 0.08em;
  }

  .hero-rule {
    margin-top: 19px;
    margin-bottom: 24px;
  }

  .section-heading {
    gap: 9px;
    margin-bottom: 18px;
  }

  .section-heading h2 {
    padding: 0 9px;
    font-size: clamp(0.9rem, 4.5vw, 1.08rem);
    letter-spacing: 0.12em;
  }

  .theme-section {
    width: min(calc(100% - 28px), 520px);
  }

  .mode-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mode-button {
    min-height: 124px;
    padding: 15px 8px 13px;
    gap: 9px;
    font-size: clamp(0.72rem, 3.3vw, 0.84rem);
  }

  .mode-button:last-child {
    grid-column: 1 / -1;
    width: calc(50% - 5px);
    justify-self: center;
  }

  .theme-icon {
    width: 34px;
    height: 34px;
  }

  .settings-row {
    position: static;
    margin-top: 0;
  }

  .toggle-button {
    min-width: 70px;
    min-height: 44px;
  }

  .slot-section {
    width: min(calc(100% - 28px), 560px);
    margin-top: 23px;
  }

  .machine {
    height: auto;
    border-radius: 15px;
  }

  .machine-frame-effect::after {
    inset: 7px;
    border-radius: 9px;
  }

  .machine-inner {
    padding: 19px 11px 14px;
    border-radius: 13px;
  }

  .reels {
    gap: 7px;
  }

  .reel-label {
    min-height: 50px;
    margin-bottom: 7px;
    font-size: 0.62rem;
  }

  .reel-label svg {
    width: 25px;
    height: 25px;
  }

  .reel {
    --row-height: 58px;
    --spin-from: -58px;
    --spin-to: -348px;
    height: 174px;
  }

  .reel::after {
    top: 58px;
    height: 58px;
  }

  .reel-strip {
    transform: translateY(-58px);
  }

  .reel-cell {
    height: 58px;
    padding: 0 3px;
  }

  .reel-value {
    font-size: clamp(0.58rem, 2.55vw, 0.72rem);
  }

  .reel-cell.center .reel-value {
    font-size: clamp(0.68rem, 3vw, 0.84rem);
  }

  .selection-marker {
    top: 135px;
    border-top-width: 8px;
    border-bottom-width: 8px;
  }

  .marker-left {
    left: -9px;
    border-right-width: 8px;
  }

  .marker-right {
    right: -9px;
    border-left-width: 8px;
  }

  .machine-cta {
    min-height: 50px;
  }

  .status {
    position: static;
    min-height: 22px;
    margin-top: 3px;
  }

  .result-card {
    width: min(calc(100% - 28px), 560px);
    margin-top: 24px;
  }

  .card-inner {
    min-height: 0;
    padding: 25px 20px 24px;
  }

  .botanical-corner {
    width: 52px;
    height: 52px;
  }

  .seal {
    width: 52px;
    height: 52px;
  }

  .reference {
    font-size: clamp(1.3rem, 6.8vw, 1.72rem);
  }

  .verse-text {
    min-width: 0;
    font-size: clamp(1rem, 4.2vw, 1.08rem);
    line-height: 1.86;
  }

  .supplemental-row,
  .supplemental-row[data-layout="both"] {
    width: calc(100% - 40px);
    margin-top: 20px;
    padding-top: 18px;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .context-block,
  .book-intro {
    padding: 0;
  }

  .supplemental-heading {
    min-height: 50px;
    padding: 12px 14px;
    font-size: 0.68rem;
  }

  .intro-text {
    font-size: 0.77rem;
    line-height: 1.88;
  }

  .disclosure-body,
  .intro-body {
    padding: 13px 14px 15px;
  }

  .card-actions {
    margin-top: 28px;
  }

  .primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .small-button {
    min-height: 48px;
    font-size: clamp(0.68rem, 3vw, 0.78rem);
  }

  .source-link {
    width: 100%;
    margin-top: 9px;
  }

}

@media (max-width: 390px) {
  .site-header {
    padding-right: 10px;
    padding-left: 10px;
    gap: 6px;
  }

  .site-brand {
    gap: 6px;
    font-size: 0.78rem;
  }

  .brand-symbol {
    width: 30px;
    height: 30px;
  }

  .settings-row {
    gap: 5px;
  }

  .toggle-button {
    min-width: 62px;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0.6rem;
  }

  .hero {
    min-height: 236px;
    padding-top: 38px;
  }

  .hero-cta {
    width: min(100%, 244px);
  }

  .mode-button {
    min-height: 116px;
  }

  .slot-section,
  .result-card,
  .theme-section {
    width: calc(100% - 24px);
  }

  .machine-inner {
    padding-right: 8px;
    padding-left: 8px;
  }

  .reels {
    gap: 5px;
  }

  .reel-label {
    font-size: 0.58rem;
    letter-spacing: 0.09em;
  }

  .reel-value {
    font-size: clamp(0.55rem, 2.5vw, 0.66rem);
  }

  .reel-cell.center .reel-value {
    font-size: clamp(0.64rem, 2.9vw, 0.78rem);
  }

  .machine-cta {
    width: min(100%, 270px);
  }

  .card-inner {
    padding-right: 18px;
    padding-left: 18px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reel.accelerating .reel-strip,
  .reel.spinning .reel-strip,
  .reel.spinning-fast .reel-strip,
  .reel.impact,
  .reel.impact .reel-strip,
  .app.is-anticipating .cathedral-scene,
  .app.is-anticipating .light-beam,
  .app.is-final-reveal .cathedral-scene,
  .machine.is-charging,
  .machine.is-spinning-fast,
  .machine.is-final-impact,
  .machine.is-final-impact .machine-reveal-effect,
  .machine-frame-effect::before,
  .machine-inner::before,
  .machine-inner::after,
  .selection-marker,
  .stop-light,
  .mode-button.is-selecting,
  .mode-button.is-selecting::before,
  .mode-button.is-selecting .theme-icon,
  .mode-button,
  .mode-button[aria-pressed="true"],
  .hero-cta:not(:disabled),
  .hero-cta:not(:disabled)::before,
  .cathedral-scene,
  .light-beam,
  .cathedral-mist,
  .cathedral-arch,
  .cathedral-column,
  .ambient-star,
  .app.is-page-entering .site-brand,
  .app.is-page-entering .settings-row,
  .app.is-page-entering .hero h1,
  .app.is-page-entering .hero-rule,
  .app.is-page-entering .hero-cta,
  .app.is-page-entering .theme-section .section-heading,
  .app.is-page-entering .mode-button,
  .app.is-page-entering .slot-section .section-heading,
  .app.is-page-entering .machine-wrap,
  .result-card.is-revealing,
  .result-card.is-revealing *,
  .app.is-revealing .result-card.visible,
  .app.is-revealing .result-card.visible *,
  .flash.show {
    animation: none !important;
  }

  .machine.is-charging,
  .machine.is-spinning-fast,
  .machine.is-final-impact {
    transform: none;
  }

  .app.spinning::before,
  .app.spinning .slot-section {
    filter: none;
    transform: none;
  }

  .app.spinning .cathedral-scene {
    filter: none;
    transform: translateX(-50%);
  }

  .app.spinning .hero,
  .app.spinning .theme-section {
    opacity: 1;
    filter: none;
  }

  .result-card.is-revealing,
  .app.is-revealing .result-card.visible {
    opacity: 1;
    filter: none;
    transform: none;
  }

  .reel-strip {
    will-change: auto !important;
  }

  .effect-particle,
  [data-effect-particle],
  .ambient-stars,
  .cathedral-mist,
  .screen-show-effects,
  .machine-frame-effect::before,
  .machine-reveal-effect,
  .flash {
    display: none !important;
  }
}

/* ================================================================
   Library, guidance, account and mobile navigation surfaces
   ================================================================ */

body.dialog-open {
  overflow: hidden;
  overscroll-behavior: none;
}

#mobileMenuButton,
.mobile-menu-button,
.mobile-menu-toggle {
  display: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 10px;
  place-items: center;
  border: 1px solid rgba(215, 180, 92, 0.42);
  border-radius: 50%;
  background: rgba(5, 14, 28, 0.74);
  color: var(--gold-bright);
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

#mobileMenuButton svg,
.mobile-menu-button svg,
.mobile-menu-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.header-nav button:not(:disabled),
.login-button:not(:disabled) {
  cursor: pointer;
}

.header-nav button:disabled,
.login-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: min(1120px, calc(100% - 40px));
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(215, 180, 92, 0.52);
  border-radius: 18px;
  background: #061326;
  color: var(--ivory);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(242, 215, 139, 0.05),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

dialog.app-dialog:not([open]) {
  display: none;
}

.app-dialog[aria-hidden="false"]:not(dialog) {
  display: grid;
}

.app-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 22%, rgba(22, 54, 84, 0.26), transparent 55%),
    rgba(0, 5, 13, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.app-dialog[open] {
  animation: app-dialog-in 220ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.app-dialog[open]::backdrop {
  animation: app-backdrop-in 180ms ease-out both;
}

.dialog-surface {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  max-height: calc(100dvh - 42px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 0, rgba(215, 180, 92, 0.075), transparent 25rem),
    linear-gradient(160deg, rgba(10, 27, 48, 0.99), rgba(4, 15, 30, 0.995));
}

.dialog-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, rgba(242, 215, 139, 0.025), transparent),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(255, 255, 255, 0.004) 4px 5px);
}

.dialog-header {
  position: relative;
  z-index: 3;
  min-width: 0;
  min-height: 70px;
  padding: 17px 74px 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(215, 180, 92, 0.22);
  background: rgba(4, 14, 28, 0.82);
}

.dialog-header > div,
.dialog-title-group {
  min-width: 0;
}

.dialog-header h2,
.dialog-title {
  margin: 0;
  color: var(--gold-bright);
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.09em;
  overflow-wrap: anywhere;
}

.dialog-eyebrow,
.dialog-kicker {
  margin: 0 0 3px;
  color: rgba(170, 166, 158, 0.76);
  font: 600 0.62rem/1.4 var(--latin);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 15px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 180, 92, 0.3);
  border-radius: 50%;
  background: rgba(6, 19, 37, 0.82);
  color: rgba(244, 239, 229, 0.82);
  cursor: pointer;
  font: 400 1.35rem/1 sans-serif;
}

.dialog-close svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.dialog-body {
  min-width: 0;
  min-height: 0;
  padding: clamp(18px, 3vw, 30px);
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(215, 180, 92, 0.45) rgba(5, 16, 31, 0.4);
  scrollbar-width: thin;
}

.dialog-body > :first-child {
  margin-top: 0;
}

.dialog-body > :last-child {
  margin-bottom: 0;
}

.dialog-body p,
.dialog-body li,
.dialog-body dd,
.dialog-body dt {
  overflow-wrap: anywhere;
}

.dialog-body a {
  color: var(--gold-bright);
  text-underline-offset: 0.18em;
}

.dialog-status,
.collection-status,
.sync-status,
.empty-state,
.loading-state,
.error-state {
  width: 100%;
  min-width: 0;
  margin: 14px 0;
  padding: 13px 15px;
  border: 1px solid rgba(215, 180, 92, 0.18);
  border-radius: 10px;
  background: rgba(3, 14, 28, 0.62);
  color: rgba(244, 239, 229, 0.76);
  font-size: 0.76rem;
  line-height: 1.75;
}

.dialog-status:empty,
.collection-status:empty,
.sync-status:empty {
  display: none;
}

.error-state,
.dialog-status.is-error,
.sync-status.is-error {
  border-color: rgba(215, 111, 92, 0.36);
  color: #f2c1b9;
}

.dialog-status.is-success,
.sync-status.is-success {
  border-color: rgba(124, 188, 146, 0.34);
  color: #c8e7d2;
}

.empty-state {
  padding-block: 30px;
  text-align: center;
}

.collection-dialog,
#collectionDialog {
  width: min(1180px, calc(100% - 40px));
}

.collection-dialog-surface {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(215, 180, 92, 0.45) rgba(5, 16, 31, 0.4);
  scrollbar-width: thin;
}

.collection-dialog-surface > .dialog-header,
.account-dialog-surface > .dialog-header {
  position: sticky;
  top: 0;
}

.collection-summary,
.collection-summary-grid,
.summary-cards,
.collection-stats {
  min-width: 0;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.collection-dialog-surface > .collection-summary {
  margin: clamp(16px, 2.5vw, 24px) clamp(18px, 3vw, 30px) 14px;
  flex: 0 0 auto;
}

.summary-card,
.collection-summary-card,
.stat-card {
  min-width: 0;
  min-height: 92px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(215, 180, 92, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(18, 42, 67, 0.72), rgba(6, 20, 38, 0.78));
  box-shadow: inset 0 1px rgba(255, 248, 219, 0.03);
}

.summary-value,
.stat-value,
.collection-summary-card strong {
  color: var(--gold-bright);
  font: 600 clamp(1.05rem, 2vw, 1.38rem)/1.2 var(--latin);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.summary-label,
.stat-label,
.collection-summary-card span {
  color: rgba(170, 166, 158, 0.88);
  font-size: 0.66rem;
  line-height: 1.55;
  letter-spacing: 0.07em;
}

.summary-card dt {
  margin: 0;
  color: rgba(170, 166, 158, 0.88);
  font-size: 0.65rem;
  line-height: 1.55;
  letter-spacing: 0.07em;
}

.summary-card dd {
  min-width: 0;
  margin: 0;
  color: var(--gold-bright);
  font: 600 clamp(1.02rem, 2vw, 1.35rem)/1.25 var(--latin);
  overflow-wrap: anywhere;
}

.summary-card dd.summary-text {
  font-family: var(--serif);
  font-size: 0.76rem;
  line-height: 1.55;
}

.summary-unit {
  margin-left: 0.18em;
  color: rgba(242, 215, 139, 0.68);
  font: 500 0.62rem/1.4 var(--serif);
}

.collection-toolbar,
.library-toolbar {
  min-width: 0;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.collection-dialog-surface > .collection-toolbar {
  margin: 0 clamp(18px, 3vw, 30px) 14px;
  flex: 0 0 auto;
}

.collection-search,
.search-field,
.collection-search-field,
.collection-sort,
.collection-sort-field,
.sort-field {
  min-width: 0;
}

.collection-search label,
.search-field label,
.collection-search-field label,
.collection-sort label,
.collection-sort-field label,
.sort-field label {
  display: block;
  margin: 0 0 6px;
  color: rgba(242, 215, 139, 0.77);
  font-size: 0.64rem;
  line-height: 1.45;
  letter-spacing: 0.1em;
}

.collection-search input,
.search-field input,
.collection-search-field input,
.collection-sort select,
.collection-sort-field select,
.sort-field select,
.dialog-body input[type="search"],
.dialog-body input[type="text"],
.dialog-body select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid rgba(215, 180, 92, 0.32);
  border-radius: 9px;
  outline: none;
  background: rgba(3, 14, 28, 0.82);
  color: var(--ivory);
  font: 500 0.78rem/1.5 var(--serif);
}

.collection-search-control {
  position: relative;
  min-width: 0;
}

.collection-search-control svg {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: rgba(242, 215, 139, 0.72);
  stroke-linecap: round;
  stroke-width: 1.45;
  pointer-events: none;
  transform: translateY(-50%);
}

.collection-search-control input {
  padding-left: 41px;
}

.collection-search input::placeholder,
.search-field input::placeholder,
.collection-search-field input::placeholder,
.dialog-body input::placeholder {
  color: rgba(170, 166, 158, 0.62);
}

.collection-sort select,
.collection-sort-field select,
.sort-field select,
.dialog-body select {
  cursor: pointer;
}

.collection-tabs,
.dialog-tabs,
[role="tablist"].collection-tabs {
  position: relative;
  min-width: 0;
  margin: 0 0 20px;
  padding: 3px;
  display: flex;
  align-items: stretch;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  border: 1px solid rgba(215, 180, 92, 0.18);
  border-radius: 11px;
  background: rgba(3, 13, 26, 0.68);
}

.collection-tab,
.dialog-tab,
.collection-tabs [role="tab"],
.dialog-tabs [role="tab"] {
  min-width: max-content;
  min-height: 44px;
  padding: 9px 18px;
  flex: 1 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(244, 239, 229, 0.68);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.collection-tab[aria-selected="true"],
.dialog-tab[aria-selected="true"],
.collection-tabs [role="tab"][aria-selected="true"],
.dialog-tabs [role="tab"][aria-selected="true"],
.collection-tab.is-active,
.dialog-tab.is-active {
  border-color: rgba(215, 180, 92, 0.4);
  background: rgba(215, 180, 92, 0.1);
  color: var(--gold-bright);
  box-shadow: inset 0 0 14px rgba(215, 180, 92, 0.04);
}

.collection-content,
.library-content,
.collection-panel,
.tab-panel,
[role="tabpanel"] {
  min-width: 0;
}

.collection-dialog-surface > .collection-tabs {
  margin: 0 clamp(18px, 3vw, 30px) 14px;
  flex: 0 0 auto;
}

.collection-dialog-surface > .collection-panel {
  min-height: 110px;
  padding: 0 clamp(18px, 3vw, 30px) clamp(18px, 3vw, 26px);
  flex: 0 0 auto;
}

.collection-dialog-surface > .dialog-status {
  margin: 0 clamp(18px, 3vw, 30px) clamp(16px, 2vw, 22px);
  width: auto;
  flex: 0 0 auto;
}

.collection-empty-state {
  width: 100%;
  margin: 0;
  padding: 30px 16px;
  border: 1px dashed rgba(215, 180, 92, 0.22);
  border-radius: 10px;
  background: rgba(3, 14, 28, 0.42);
  color: rgba(170, 166, 158, 0.82);
  font-size: 0.75rem;
  line-height: 1.75;
  text-align: center;
}

.collection-content-heading,
.panel-heading,
.tab-panel-heading {
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.collection-content-heading h3,
.panel-heading h3,
.tab-panel-heading h3 {
  margin: 0;
  color: rgba(242, 215, 139, 0.92);
  font-size: 0.9rem;
  line-height: 1.5;
  letter-spacing: 0.09em;
}

.collection-note,
.panel-note,
.history-note {
  margin: 0;
  color: rgba(170, 166, 158, 0.72);
  font-size: 0.66rem;
  line-height: 1.7;
}

.book-grid,
.bible-book-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.book-card,
.bible-book-card {
  position: relative;
  min-width: 0;
  min-height: 112px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(215, 180, 92, 0.24);
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(15, 37, 61, 0.72), rgba(5, 18, 35, 0.76));
  color: var(--ivory);
  text-align: left;
  box-shadow: inset 0 1px rgba(255, 248, 219, 0.025);
}

button.book-card,
button.bible-book-card {
  cursor: pointer;
}

.book-card.is-undiscovered,
.book-card.is-locked,
.book-card[data-discovered="false"],
.bible-book-card.is-locked {
  border-color: rgba(170, 166, 158, 0.14);
  background: rgba(4, 15, 29, 0.58);
  color: rgba(170, 166, 158, 0.52);
}

.book-card.is-undiscovered::after,
.book-card.is-locked::after,
.book-card[data-discovered="false"]::after,
.bible-book-card.is-locked::after {
  content: "\1F512";
  position: absolute;
  top: 13px;
  right: 13px;
  color: rgba(170, 166, 158, 0.38);
  font: 0.76rem/1 sans-serif;
}

.book-name,
.book-card-title {
  margin: 0;
  padding-right: 20px;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.book-count,
.book-meta,
.book-card-meta,
.book-card-count,
.book-card-date,
.book-card-lock {
  margin: 0;
  color: rgba(170, 166, 158, 0.76);
  font-size: 0.64rem;
  line-height: 1.7;
}

.book-card:not(.is-undiscovered) .book-count,
.book-card.is-discovered .book-card-count,
.book-card[data-discovered="true"] .book-count {
  color: rgba(242, 215, 139, 0.72);
}

.verse-list,
.discovered-list,
.favorite-list,
.history-list {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.verse-card,
.discovered-card,
.favorite-card,
.history-card,
.history-item {
  min-width: 0;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(215, 180, 92, 0.19);
  border-radius: 10px;
  background: rgba(5, 19, 37, 0.68);
}

.verse-card-main,
.verse-card-content,
.history-main,
.history-content {
  min-width: 0;
}

.verse-card {
  display: block;
}

.verse-card-header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.verse-card-id {
  margin-top: 3px;
  display: block;
  color: rgba(170, 166, 158, 0.62);
  font: 500 0.58rem/1.5 var(--latin);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.verse-card-meta {
  min-width: 0;
  margin-top: 11px;
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(215, 180, 92, 0.11);
}

.verse-card-meta-row {
  min-width: 0;
  margin: 0;
  padding-left: 9px;
  display: grid;
  gap: 3px;
  border-left: 1px solid rgba(215, 180, 92, 0.15);
}

.verse-card-meta-label {
  color: rgba(170, 166, 158, 0.65);
  font-size: 0.57rem;
  line-height: 1.45;
}

.verse-card-meta-value {
  color: rgba(244, 239, 229, 0.79);
  font-size: 0.65rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.verse-card > .verse-card-meta {
  margin-top: 11px;
}

.verse-reference,
.verse-card-reference,
.history-reference {
  margin: 0 0 5px;
  color: rgba(244, 239, 229, 0.95);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.035em;
  overflow-wrap: anywhere;
}

.verse-meta,
.verse-card-meta,
.history-meta,
.history-date,
.history-theme {
  margin: 0;
  color: rgba(170, 166, 158, 0.74);
  font-size: 0.64rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.verse-card-actions,
.collection-card-actions,
.account-actions,
.sync-actions,
.dialog-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.favorite-button,
.favorite-toggle,
[class~="collection-favorite-button"],
[data-favorite-button] {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(215, 180, 92, 0.3);
  border-radius: 999px;
  background: rgba(3, 14, 28, 0.7);
  color: rgba(242, 215, 139, 0.78);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: nowrap;
}

.favorite-button[aria-pressed="true"],
.favorite-toggle[aria-pressed="true"],
.collection-favorite-button[aria-pressed="true"],
[data-favorite-button][aria-pressed="true"],
.favorite-button.is-favorite {
  border-color: rgba(242, 215, 139, 0.62);
  background: rgba(215, 180, 92, 0.11);
  color: var(--gold-bright);
}

.small-button.favorite-button {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: rgba(6, 16, 31, 0.8);
  font-size: clamp(0.63rem, 1.35vw, 0.75rem);
  white-space: normal;
}

.small-button.favorite-button[aria-pressed="true"] {
  background: rgba(215, 180, 92, 0.1);
}

.theme-progress-list,
.theme-progress-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.theme-progress,
.theme-progress-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(215, 180, 92, 0.2);
  border-radius: 11px;
  background: rgba(5, 19, 37, 0.66);
}

.theme-progress-card > h3 {
  margin: 0 0 7px;
  color: rgba(244, 239, 229, 0.9);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.theme-progress-header {
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.theme-progress-name {
  min-width: 0;
  color: rgba(244, 239, 229, 0.9);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.theme-progress-value {
  margin: 0 0 10px;
  flex: 0 0 auto;
  color: var(--gold-bright);
  font: 600 0.72rem/1.4 var(--latin);
}

.progress-track,
.theme-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(170, 166, 158, 0.15);
}

.progress-bar,
.theme-progress-bar {
  width: var(--progress, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright));
  box-shadow: 0 0 10px rgba(215, 180, 92, 0.2);
}

progress.theme-progress-bar {
  width: 100%;
  max-width: 100%;
  height: 7px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(170, 166, 158, 0.15);
  color: var(--gold);
}

progress.theme-progress-bar::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(170, 166, 158, 0.15);
}

progress.theme-progress-bar::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright));
  box-shadow: 0 0 10px rgba(215, 180, 92, 0.2);
}

progress.theme-progress-bar::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright));
  box-shadow: 0 0 10px rgba(215, 180, 92, 0.2);
}

.history-local-note {
  margin: 0 0 11px;
  color: rgba(170, 166, 158, 0.68);
  font-size: 0.64rem;
  line-height: 1.7;
}

.history-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.history-item .history-reference,
.history-item .history-date,
.history-item .history-theme {
  margin: 0;
}

.history-item .history-theme {
  padding: 4px 8px;
  border: 1px solid rgba(215, 180, 92, 0.18);
  border-radius: 999px;
  color: rgba(242, 215, 139, 0.75);
  white-space: nowrap;
}

.info-dialog,
.guide-dialog,
.about-dialog,
.account-dialog,
#guideDialog,
#aboutDialog,
#accountDialog {
  width: min(660px, calc(100% - 40px));
}

.info-content,
.guide-content,
.about-content,
.account-content {
  color: rgba(244, 239, 229, 0.82);
  font-size: 0.82rem;
  line-height: 1.9;
}

.guide-steps,
.info-list {
  margin: 0;
  padding-left: 1.45em;
}

.guide-steps li,
.info-list li {
  margin: 0 0 8px;
  padding-left: 0.28em;
}

.account-summary,
.sync-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(215, 180, 92, 0.2);
  border-radius: 11px;
  background: rgba(4, 17, 34, 0.7);
}

.account-dialog-surface {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.account-dialog-surface > .account-summary,
.account-dialog-surface > .guest-import-prompt,
.account-dialog-surface > .sync-progress,
.account-dialog-surface > .account-actions,
.account-dialog-surface > .dialog-status {
  width: auto;
  margin-right: clamp(18px, 3vw, 28px);
  margin-left: clamp(18px, 3vw, 28px);
  flex: 0 0 auto;
}

.account-dialog-surface > .account-summary {
  margin-top: clamp(18px, 3vw, 26px);
}

.account-dialog-surface > .guest-import-prompt {
  margin-top: 14px;
}

.account-summary p {
  min-width: 0;
  margin: 0;
  padding: 8px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid rgba(215, 180, 92, 0.1);
}

.account-summary p:first-child {
  padding-top: 0;
}

.account-summary p:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.account-summary p > span {
  color: rgba(170, 166, 158, 0.76);
  font-size: 0.67rem;
  line-height: 1.55;
}

.account-summary p > strong {
  min-width: 0;
  color: rgba(244, 239, 229, 0.92);
  font-size: 0.72rem;
  line-height: 1.6;
  text-align: right;
  overflow-wrap: anywhere;
}

.guest-import-prompt {
  padding: 16px;
  border: 1px solid rgba(242, 215, 139, 0.34);
  border-radius: 11px;
  background: rgba(215, 180, 92, 0.07);
}

.guest-import-prompt h3 {
  margin: 0 0 7px;
  color: var(--gold-bright);
  font-size: 0.82rem;
  line-height: 1.5;
}

.guest-import-prompt p {
  margin: 0;
  color: rgba(244, 239, 229, 0.8);
  font-size: 0.72rem;
  line-height: 1.75;
}

.guest-import-actions {
  margin-top: 13px;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.guest-import-actions button,
.account-actions button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid rgba(215, 180, 92, 0.34);
  border-radius: 999px;
  background: rgba(5, 19, 37, 0.82);
  color: rgba(244, 239, 229, 0.84);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.45;
}

.account-actions .account-primary-action,
.guest-import-actions button:first-child {
  border-color: rgba(242, 215, 139, 0.7);
  background: linear-gradient(140deg, rgba(184, 139, 46, 0.94), rgba(112, 78, 18, 0.96));
  color: #fff8e6;
}

.account-actions .account-logout-button:not(:disabled) {
  border-color: rgba(215, 111, 92, 0.34);
  color: #edc0b9;
}

.account-actions button:disabled,
.guest-import-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.account-dialog-surface > .account-actions {
  margin-top: 16px;
}

.account-dialog-surface > .dialog-status {
  margin-bottom: clamp(18px, 3vw, 26px);
}

.info-dialog > .dialog-surface > .dialog-status {
  width: auto;
  margin: 0 clamp(18px, 3vw, 28px) clamp(18px, 3vw, 24px);
  flex: 0 0 auto;
}

.account-summary + .sync-panel,
.sync-panel + .account-actions {
  margin-top: 14px;
}

.account-state,
.account-meta,
.sync-meta {
  margin: 0;
  color: rgba(170, 166, 158, 0.82);
  font-size: 0.72rem;
  line-height: 1.75;
}

.account-state strong,
.sync-meta strong {
  color: rgba(244, 239, 229, 0.94);
}

.sync-progress,
.sync-steps {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.sync-step {
  min-width: 0;
  padding: 8px 10px;
  border-left: 2px solid rgba(170, 166, 158, 0.25);
  color: rgba(170, 166, 158, 0.78);
  font-size: 0.7rem;
  line-height: 1.55;
}

.sync-step.is-current {
  border-left-color: var(--gold-bright);
  color: var(--gold-bright);
}

.sync-step.is-complete {
  border-left-color: rgba(124, 188, 146, 0.7);
  color: #c8e7d2;
}

.dialog-button,
.account-button,
.sync-button,
.drawer-button {
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid rgba(215, 180, 92, 0.34);
  border-radius: 999px;
  background: rgba(6, 21, 40, 0.82);
  color: rgba(244, 239, 229, 0.85);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.05em;
}

.dialog-button.primary,
.account-button.primary,
.sync-button.primary,
.dialog-button[data-variant="primary"] {
  border-color: rgba(242, 215, 139, 0.72);
  background: linear-gradient(140deg, rgba(184, 139, 46, 0.94), rgba(112, 78, 18, 0.96));
  color: #fff8e6;
}

.dialog-button:disabled,
.account-button:disabled,
.sync-button:disabled,
.drawer-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.discovery-notice,
.result-discovery-notice {
  width: min(100%, 520px);
  margin: 13px auto 0;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(215, 180, 92, 0.24);
  border-radius: 999px;
  background: rgba(6, 21, 39, 0.68);
  color: rgba(244, 239, 229, 0.75);
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

.discovery-notice .discovery-message,
.result-discovery-notice .discovery-message {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  overflow-wrap: anywhere;
}

.discovery-badge,
.new-badge,
.badge-new {
  min-width: max-content;
  padding: 3px 7px;
  border: 1px solid rgba(242, 215, 139, 0.54);
  border-radius: 999px;
  background: rgba(215, 180, 92, 0.12);
  color: var(--gold-bright);
  font: 700 0.58rem/1.35 var(--latin);
  letter-spacing: 0.11em;
}

.mobile-drawer,
.mobile-menu-dialog,
#mobileMenuDialog {
  inset: 0 0 0 auto;
  width: min(390px, calc(100% - 42px));
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
  border-radius: 0;
  background: #061326;
}

.mobile-drawer[open],
.mobile-menu-dialog[open],
#mobileMenuDialog[open] {
  animation: mobile-drawer-in 220ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

.mobile-drawer .dialog-surface,
.mobile-menu-dialog .dialog-surface,
#mobileMenuDialog .dialog-surface,
.mobile-menu-surface,
.drawer-panel {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

.mobile-drawer .dialog-header,
.mobile-menu-dialog .dialog-header,
#mobileMenuDialog .dialog-header,
.drawer-header {
  min-height: 68px;
}

.mobile-drawer .dialog-body,
.mobile-menu-dialog .dialog-body,
#mobileMenuDialog .dialog-body,
.drawer-body {
  padding: 18px;
}

.mobile-menu-surface > .mobile-menu-nav {
  min-height: 0;
  padding: 18px 18px 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-menu-surface > .mobile-settings {
  margin: 16px 18px 0;
  flex: 0 0 auto;
}

.mobile-menu-surface > .dialog-status {
  width: auto;
  margin: 12px 18px 18px;
  flex: 0 0 auto;
}

.mobile-nav,
.drawer-nav,
.mobile-menu-nav {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.mobile-nav button,
.drawer-nav button,
.mobile-menu-nav button,
.mobile-nav a,
.drawer-nav a,
.mobile-menu-nav a {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(215, 180, 92, 0.18);
  border-radius: 9px;
  background: rgba(4, 17, 33, 0.68);
  color: rgba(244, 239, 229, 0.86);
  cursor: pointer;
  font-size: 0.76rem;
  line-height: 1.45;
  letter-spacing: 0.07em;
  text-align: left;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.mobile-nav button::after,
.drawer-nav button::after,
.mobile-menu-nav button::after {
  content: "›";
  flex: 0 0 auto;
  color: rgba(242, 215, 139, 0.52);
  font: 1.15rem/1 sans-serif;
}

.mobile-settings,
.drawer-settings {
  min-width: 0;
  margin-top: 18px;
  padding-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(215, 180, 92, 0.18);
}

.mobile-settings .toggle-button,
.drawer-settings .toggle-button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
}

.mobile-settings button,
.drawer-settings button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid rgba(215, 180, 92, 0.28);
  border-radius: 999px;
  background: rgba(5, 18, 35, 0.78);
  color: rgba(170, 166, 158, 0.9);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
}

.mobile-settings button[aria-pressed="true"],
.drawer-settings button[aria-pressed="true"] {
  border-color: rgba(242, 215, 139, 0.54);
  background: rgba(215, 180, 92, 0.09);
  color: var(--gold-bright);
}

.app-dialog button:focus-visible,
.app-dialog a:focus-visible,
.app-dialog input:focus-visible,
.app-dialog select:focus-visible,
.app-dialog summary:focus-visible,
#mobileMenuButton:focus-visible,
.mobile-menu-button:focus-visible,
.mobile-menu-toggle:focus-visible,
.favorite-button:focus-visible,
.favorite-toggle:focus-visible,
.collection-favorite-button:focus-visible,
[data-favorite-button]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.collection-search input:focus-visible,
.search-field input:focus-visible,
.collection-search-field input:focus-visible,
.collection-sort select:focus-visible,
.collection-sort-field select:focus-visible,
.sort-field select:focus-visible,
.dialog-body input:focus-visible,
.dialog-body select:focus-visible {
  border-color: rgba(242, 215, 139, 0.76);
  box-shadow: 0 0 0 3px rgba(215, 180, 92, 0.1);
}

@media (hover: hover) and (pointer: fine) {
  #mobileMenuButton:hover,
  .mobile-menu-button:hover,
  .mobile-menu-toggle:hover,
  .dialog-close:hover,
  .dialog-button:not(:disabled):hover,
  .account-button:not(:disabled):hover,
  .sync-button:not(:disabled):hover,
  .drawer-button:not(:disabled):hover,
  .favorite-button:hover,
  .favorite-toggle:hover,
  .collection-favorite-button:hover,
  [data-favorite-button]:hover,
  .mobile-nav button:hover,
  .drawer-nav button:hover,
  .mobile-menu-nav button:hover {
    border-color: rgba(242, 215, 139, 0.7);
    background-color: rgba(215, 180, 92, 0.1);
    color: var(--gold-bright);
  }

  button.book-card:hover,
  button.bible-book-card:hover {
    border-color: rgba(242, 215, 139, 0.5);
    background-color: rgba(215, 180, 92, 0.075);
  }

  .collection-tab:hover,
  .dialog-tab:hover,
  .collection-tabs [role="tab"]:hover,
  .dialog-tabs [role="tab"]:hover {
    color: var(--gold-bright);
  }
}

@keyframes app-dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes app-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mobile-drawer-in {
  from {
    opacity: 0.65;
    transform: translateX(28px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (min-width: 961px) {
  .site-header {
    width: min(100%, 1380px);
    gap: clamp(16px, 2vw, 28px);
  }

  .header-nav {
    min-width: 0;
    gap: clamp(6px, 0.9vw, 14px);
  }

  .header-nav button {
    font-size: clamp(0.61rem, 0.72vw, 0.73rem);
  }
}

@media (max-width: 960px) {
  .site-header {
    min-height: 64px;
  }

  .header-nav,
  .site-header > .settings-row,
  main > .settings-row,
  .theme-section > .settings-row,
  .app > .settings-row {
    display: none;
  }

  #mobileMenuButton,
  .mobile-menu-button,
  .mobile-menu-toggle {
    display: grid;
    flex: 0 0 44px;
  }

  .mobile-drawer .settings-row,
  .mobile-menu-dialog .settings-row,
  #mobileMenuDialog .settings-row,
  .mobile-settings,
  .drawer-settings {
    display: grid;
  }

  .collection-summary,
  .collection-summary-grid,
  .summary-cards,
  .collection-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .book-grid,
  .bible-book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .app-dialog,
  .collection-dialog,
  #collectionDialog,
  .info-dialog,
  .guide-dialog,
  .about-dialog,
  .account-dialog,
  #guideDialog,
  #aboutDialog,
  #accountDialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 14px;
  }

  .dialog-surface {
    max-height: calc(100dvh - 22px);
  }

  .mobile-drawer,
  .mobile-menu-dialog,
  #mobileMenuDialog {
    width: min(360px, calc(100% - 28px));
    max-height: 100dvh;
    border-radius: 0;
  }

  .mobile-drawer .dialog-surface,
  .mobile-menu-dialog .dialog-surface,
  #mobileMenuDialog .dialog-surface,
  .mobile-menu-surface,
  .drawer-panel {
    max-height: 100dvh;
  }

  .dialog-header {
    min-height: 64px;
    padding: 14px 66px 13px 18px;
  }

  .dialog-close {
    top: 10px;
    right: 11px;
  }

  .dialog-body {
    padding: 17px;
  }

  .collection-dialog-surface > .collection-summary {
    margin: 16px 17px 12px;
  }

  .collection-dialog-surface > .collection-toolbar,
  .collection-dialog-surface > .collection-tabs {
    margin-right: 17px;
    margin-left: 17px;
  }

  .collection-dialog-surface > .collection-panel {
    padding-right: 17px;
    padding-left: 17px;
  }

  .collection-dialog-surface > .dialog-status {
    margin-right: 17px;
    margin-left: 17px;
  }

  .collection-summary,
  .collection-summary-grid,
  .summary-cards,
  .collection-stats {
    margin-bottom: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-card,
  .collection-summary-card,
  .stat-card {
    min-height: 84px;
    padding: 12px;
  }

  .collection-toolbar,
  .library-toolbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .collection-tabs,
  .dialog-tabs,
  [role="tablist"].collection-tabs {
    margin-right: -17px;
    margin-left: -17px;
    padding-right: 17px;
    padding-left: 17px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .collection-dialog-surface > .collection-tabs {
    margin-right: 17px;
    margin-left: 17px;
    padding-right: 3px;
    padding-left: 3px;
    border-right: 1px solid rgba(215, 180, 92, 0.18);
    border-left: 1px solid rgba(215, 180, 92, 0.18);
    border-radius: 11px;
  }

  .collection-tab,
  .dialog-tab,
  .collection-tabs [role="tab"],
  .dialog-tabs [role="tab"] {
    flex: 0 0 auto;
    padding-inline: 15px;
  }

  .book-grid,
  .bible-book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .book-card,
  .bible-book-card {
    min-height: 104px;
    padding: 13px;
  }

  .verse-card,
  .discovered-card,
  .favorite-card,
  .history-card,
  .history-item {
    padding: 13px;
    align-items: start;
  }

  .verse-card-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-item .history-reference {
    grid-column: 1 / -1;
  }

  .theme-progress-list,
  .theme-progress-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-actions,
  .sync-actions,
  .dialog-actions {
    align-items: stretch;
  }

  .account-actions > *,
  .sync-actions > *,
  .dialog-actions > * {
    flex: 1 1 160px;
  }
}

@media (max-width: 390px) {
  .site-brand {
    min-width: 0;
  }

  .site-brand span,
  .brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-body {
    padding: 14px;
  }

  .collection-dialog-surface > .collection-summary {
    margin-right: 14px;
    margin-left: 14px;
  }

  .collection-dialog-surface > .collection-toolbar,
  .collection-dialog-surface > .collection-tabs,
  .collection-dialog-surface > .dialog-status {
    margin-right: 14px;
    margin-left: 14px;
  }

  .collection-dialog-surface > .collection-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .collection-tabs,
  .dialog-tabs,
  [role="tablist"].collection-tabs {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .summary-label,
  .stat-label,
  .collection-summary-card span {
    font-size: 0.61rem;
  }

  .verse-card,
  .discovered-card,
  .favorite-card,
  .history-card,
  .history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .verse-card-actions,
  .collection-card-actions {
    justify-content: flex-start;
  }

  .favorite-button,
  .favorite-toggle,
  .collection-favorite-button,
  [data-favorite-button] {
    white-space: normal;
  }

  .discovery-notice,
  .result-discovery-notice {
    border-radius: 10px;
  }
}

@media (max-width: 340px) {
  .site-header {
    padding-right: 8px;
    padding-left: 8px;
  }

  .site-brand {
    font-size: 0.72rem;
  }

  .brand-symbol {
    width: 29px;
    height: 29px;
  }

  .app-dialog,
  .collection-dialog,
  #collectionDialog,
  .info-dialog,
  .guide-dialog,
  .about-dialog,
  .account-dialog,
  #guideDialog,
  #aboutDialog,
  #accountDialog {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
  }

  .dialog-surface {
    max-height: calc(100dvh - 14px);
  }

  .mobile-drawer,
  .mobile-menu-dialog,
  #mobileMenuDialog {
    width: calc(100% - 18px);
    max-height: 100dvh;
  }

  .dialog-header {
    padding-left: 13px;
  }

  .dialog-body {
    padding: 12px;
  }

  .collection-dialog-surface > .collection-summary {
    margin-right: 12px;
    margin-left: 12px;
  }

  .collection-dialog-surface > .collection-toolbar,
  .collection-dialog-surface > .collection-tabs,
  .collection-dialog-surface > .dialog-status {
    margin-right: 12px;
    margin-left: 12px;
  }

  .collection-dialog-surface > .collection-panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .collection-summary,
  .collection-summary-grid,
  .summary-cards,
  .collection-stats,
  .book-grid,
  .bible-book-grid,
  .theme-progress-list,
  .theme-progress-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .verse-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .verse-card-header .collection-favorite-button {
    width: 100%;
  }

  .verse-card-meta,
  .history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-item .history-reference {
    grid-column: auto;
  }

  .collection-toolbar,
  .library-toolbar,
  .mobile-settings,
  .drawer-settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-card,
  .collection-summary-card,
  .stat-card {
    min-height: 72px;
  }

  .collection-tabs,
  .dialog-tabs,
  [role="tablist"].collection-tabs {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .verse-card-actions,
  .collection-card-actions,
  .guest-import-actions,
  .account-actions,
  .sync-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .verse-card-actions > *,
  .collection-card-actions > *,
  .guest-import-actions > *,
  .account-actions > *,
  .sync-actions > *,
  .dialog-actions > * {
    width: 100%;
  }

  .discovery-notice,
  .result-discovery-notice {
    align-items: flex-start;
    flex-direction: column;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-dialog[open],
  .app-dialog[open]::backdrop,
  .mobile-drawer[open],
  .mobile-menu-dialog[open],
  #mobileMenuDialog[open],
  .drawer-panel,
  .progress-bar,
  .theme-progress-bar {
    animation: none !important;
    transition: none !important;
  }
}
