:root {
  --bg: #F2EDE4;
  --bg-card: #FAF8F4;
  --text: #1A1A1A;
  --text-light: #8A8279;
  --accent: #E8384F;
  --accent-hover: #C72E42;
  --teal: #1A8C7E;
  --green: #3A7D5C;
  --quiz-accent: #69B9F7;
  --quiz-accent-strong: #3FA7F2;
  --quiz-accent-soft: rgba(105, 185, 247, 0.12);
  --border: #D4CBC0;
  --border-dark: #1A1A1A;
  --font-serif: "Noto Serif TC", Georgia, serif;
  --font-sans: "Noto Sans TC", "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

body.image-preview-open,
body.lang-gate-open {
  overflow: hidden;
}

body[data-script="latin"] .home-tag,
body[data-script="latin"] .home-date,
body[data-script="latin"] .home-feature-tag,
body[data-script="latin"] .home-footer span,
body[data-script="latin"] .result-card-pub,
body[data-script="latin"] .result-card-vol,
body[data-script="latin"] .result-footer,
body[data-script="latin"] .btn-start,
body[data-script="latin"] .btn-secondary,
body[data-script="latin"] .btn-action,
body[data-script="latin"] .btn-action-link,
body[data-script="latin"] .quiz-progress-text,
body[data-script="latin"] .quiz-prev,
body[data-script="latin"] .result-section-label {
  letter-spacing: 1px;
}

body[data-script="latin"] .home-subtitle,
body[data-script="latin"] .quiz-question,
body[data-script="latin"] .quiz-option,
body[data-script="latin"] .result-description,
body[data-script="latin"] .result-section-item-why,
body[data-script="latin"] .repo-link-value {
  letter-spacing: 0.2px;
}

body[data-script="latin"] .home-title h1,
body[data-script="latin"] .result-anime-name,
body[data-script="latin"] .result-anime-romaji,
body[data-script="latin"] .result-type-badge,
body[data-script="latin"] .home-footer-jp {
  letter-spacing: 1px !important;
}

body[data-script="latin"] .home-title h1,
body[data-script="latin"] .result-anime-name {
  line-height: 1.35;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page {
  position: relative;
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
}

.page.active {
  display: flex;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rule {
  height: 1px;
  margin: 20px 0;
  background: var(--border-dark);
}

.rule-dashed {
  margin: 20px 0;
  border: none;
  border-top: 1px dashed var(--border);
}

.rule-double {
  height: 0;
  margin: 12px 0;
  border-top: 3px double var(--border-dark);
}

.stripe {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent),
    var(--accent) 4px,
    transparent 4px,
    transparent 8px
  );
  animation: stripe-scroll 0.92s linear infinite;
}

@keyframes stripe-scroll {
  to {
    background-position: 11.31px 0;
  }
}

.anim {
  opacity: 0;
  transform: translateY(18px);
}

.anim.anim-in {
  animation: fade-in-up 1.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-left.anim-in {
  animation-name: fade-in-left;
}

.anim-right.anim-in {
  animation-name: fade-in-right;
}

.anim-right-soft.anim-in {
  animation-name: fade-in-right-soft;
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translate3d(-34px, 14px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translate3d(34px, 14px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fade-in-right-soft {
  from {
    opacity: 0;
    transform: translate3d(22px, 0, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Rule lines insert from left edge */
.rule.anim {
  opacity: 1;
  transform: scaleX(0);
  transform-origin: left center;
}

.rule.anim.anim-in {
  animation: rule-from-left 1.06s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

@keyframes rule-from-left {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Rule-double inserts from right edge */
.rule-double.anim {
  opacity: 1;
  transform: scaleX(0);
  transform-origin: right center;
}

.rule-double.anim.anim-in {
  animation: rule-from-right 1.06s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

@keyframes rule-from-right {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Stripe wipes in from left edge */
.stripe.anim {
  opacity: 1;
  transform: none;
  clip-path: inset(0 100% 0 0);
}

.stripe.anim.anim-in {
  animation: stripe-from-left 1.06s ease-out forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

@keyframes stripe-from-left {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

/* Character-by-character text animation */
.char {
  display: inline-block;
  opacity: 0;
  animation: char-in 0.52s ease forwards;
  animation-delay: calc(var(--ci, 0) * 92ms + var(--char-base, 560ms));
}

@keyframes char-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Page transition animations */
.page.page-leaving {
  display: flex;
  animation: page-out 0.66s ease forwards;
  pointer-events: none;
}

.page.page-entering {
  animation: page-in 1.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes page-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-18px); }
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Repeat visits keep the page's visual identity without replaying the full sequence. */
.page.anim-quick .anim.anim-in:not(.btn-start),
.page.anim-quick .rule.anim.anim-in,
.page.anim-quick .rule-double.anim.anim-in,
.page.anim-quick .stripe.anim.anim-in {
  animation-duration: 0.54s;
  animation-delay: 0s;
}

.page.anim-quick .char {
  animation-duration: 0.36s;
  animation-delay: calc(var(--ci, 0) * 20ms);
}

/* Button two-pass wipe entrance
   Pass 1 (::before): thin scan line sweeps L→R over page-bg cover
   Pass 2 (::after wipes left): cover slides out LEFT, revealing filled button R→L
*/
.btn-start.anim {
  opacity: 1;
  transform: none;
  background: var(--border-dark);
  color: var(--bg);
}

/* Restart pulse once entrance completes */
.btn-start.anim.anim-in {
  animation: btn-pulse 4.6s ease-in-out calc(var(--d, 0) * 0.22s + 2.36s) infinite;
}

@keyframes btn-scan {
  0%   { left: -4px; opacity: 1; }
  90%  { left: calc(100% + 4px); opacity: 1; }
  100% { left: calc(100% + 4px); opacity: 0; }
}

@keyframes btn-cover-wipe {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

.glitch-text {
  position: relative;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glitch-text::before {
  color: var(--accent);
  clip-path: inset(0 0 58% 0);
  animation: glitch-top 4.8s ease-in-out infinite;
}

.glitch-text::after {
  color: var(--teal);
  clip-path: inset(58% 0 0 0);
  animation: glitch-bottom 4.8s ease-in-out infinite 0.24s;
}

@keyframes glitch-top {
  0%, 84%, 100% { transform: translate(0); opacity: 0.78; }
  86% { transform: translate(-4px, -2px); opacity: 1; }
  88% { transform: translate(4px, 1px); opacity: 0.62; }
  91% { transform: translate(-2px, 0); opacity: 1; }
  94% { transform: translate(0); opacity: 0.78; }
}

@keyframes glitch-bottom {
  0%, 84%, 100% { transform: translate(0); opacity: 0.78; }
  87% { transform: translate(3px, 2px); opacity: 0.66; }
  89% { transform: translate(-5px, -1px); opacity: 1; }
  92% { transform: translate(2px, 0); opacity: 0.74; }
  95% { transform: translate(0); opacity: 0.78; }
}

.y2k-mixed,
.y2k-sparkle {
  color: var(--border);
  text-align: center;
  user-select: none;
}

.y2k-mixed {
  padding-top: 8px;
  font-family: var(--font-serif);
  font-size: 10px;
  letter-spacing: 4px;
}

.y2k-sparkle {
  padding-top: 4px;
  font-size: 10px;
  letter-spacing: 6px;
  animation: breathe 4.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.36; }
  50% { opacity: 0.84; }
}

.lang-control {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
}

.lang-select {
  min-width: 88px;
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1.5px solid var(--border-dark);
  border-radius: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%231A1A1A' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 10px 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 1px;
  appearance: none;
  cursor: pointer;
}

.lang-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lang-control.is-guided .lang-select {
  animation: lang-control-pulse 2s ease;
}

.lang-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 84px 20px 28px;
  background: rgba(242, 237, 228, 0.94);
  backdrop-filter: blur(8px);
  transition: opacity 1.28s ease, visibility 1.28s ease;
}

.lang-gate.is-dismissing,
.lang-gate.is-hidden {
  opacity: 0;
}

.lang-gate.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.lang-gate-panel {
  width: min(100%, 620px);
  padding: 26px 24px 22px;
  text-align: center;
}

.lang-gate-kicker,
.lang-gate-note {
  color: var(--text-light);
  text-transform: uppercase;
}

.lang-gate-kicker {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: 6px;
}

.lang-gate-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.2;
  letter-spacing: 2px;
}

.lang-gate-subtitle,
.lang-gate-note {
  max-width: 460px;
  margin: 12px auto 0;
  line-height: 1.9;
}

.lang-gate-subtitle {
  font-size: 14px;
  letter-spacing: 0.5px;
}

.lang-gate-note {
  font-size: 10px;
  letter-spacing: 2px;
}

.lang-gate-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px auto 0;
}

.lang-gate-button {
  min-height: 54px;
  border: 2px solid var(--border-dark);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.28s ease, background 0.36s ease, color 0.36s ease;
}

.lang-gate-button:hover,
.lang-gate-button:focus-visible,
.lang-gate-button.is-current {
  background: var(--border-dark);
  color: var(--bg);
  transform: translateY(-1px);
}

.lang-guide-toast,
.lang-fly-chip {
  position: fixed;
  z-index: 45;
}

.lang-guide-toast {
  top: 62px;
  right: 16px;
  max-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border-dark);
  background: var(--bg-card);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.62s ease, transform 0.62s ease;
}

.lang-guide-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.lang-fly-chip {
  left: 0;
  top: 0;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--border-dark);
  background: var(--border-dark);
  color: var(--bg);
  font-size: 11px;
  letter-spacing: 2px;
  transform: translate(-50%, -50%);
  transition: transform 1.76s cubic-bezier(0.22, 1, 0.36, 1), opacity 1.76s ease;
  pointer-events: none;
}

@keyframes lang-control-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(232, 56, 79, 0);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(232, 56, 79, 0.15);
  }
}

#page-home,
#page-quiz,
#page-result {
  justify-content: flex-start;
  align-items: center;
  padding: 24px 0 32px;
  background: #080808;
}

.editorial-page {
  width: 100%;
}

.editorial-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(calc(100vw - 48px), 1380px);
  min-height: calc(100vh - 56px);
  border: 1.5px solid var(--border-dark);
  background: var(--bg-card);
  box-shadow: 0 24px 88px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  isolation: isolate;
}

.editorial-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(26, 26, 26, 0.1);
  pointer-events: none;
  z-index: 3;
}

.paper-masthead {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 120px 1fr 108px;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  background: var(--border-dark);
  color: var(--bg-card);
  text-transform: uppercase;
  line-height: 1;
}

.brand-lockup {
  display: inline-grid;
  gap: 2px;
  justify-items: start;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2.2px;
}

.masthead-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}

.masthead-home-link {
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid currentColor;
}

.masthead-home-link:hover {
  opacity: 0.72;
}

.masthead-home-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.masthead-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 18px;
  min-width: 0;
}

.masthead-volume,
.masthead-route,
.masthead-date {
  font-size: 11px;
  letter-spacing: 1.9px;
  white-space: nowrap;
}

.masthead-center span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.masthead-date {
  justify-self: end;
}

.editorial-surface {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-card);
}

.editorial-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 34px,
    rgba(0, 0, 0, 0.018) 34px 35px
  );
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.editorial-band,
.home-layout,
.quiz-layout,
.result-layout,
.poster-band,
.paper-footer {
  position: relative;
  z-index: 1;
}

.editorial-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 68px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0;
  color: #fff;
}

.editorial-band span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2.4px;
}

.editorial-band-home {
  background: var(--accent);
}

.editorial-band-quiz {
  background: var(--border-dark);
}

.editorial-band-result {
  background: var(--teal);
}

.paper-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 36px;
  padding: 0 18px 0 86px;
  border-top: 1.5px solid var(--border-dark);
  color: var(--text-light);
  font-size: 12px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.paper-footer-dot {
  color: var(--border-dark);
  font-size: 12px;
}

.paper-footer-title {
  overflow-wrap: anywhere;
  text-align: center;
}

.corner-strokes {
  position: absolute;
  top: 16px;
  left: 96px;
  width: 186px;
  height: 58px;
  pointer-events: none;
}

.corner-strokes::before,
.corner-strokes::after {
  content: "";
  position: absolute;
  left: 0;
  width: 176px;
  border-top: 4px solid rgba(26, 26, 26, 0.94);
  transform: scaleX(0) rotate(-18deg);
  transform-origin: left center;
}

.corner-strokes::after {
  top: 16px;
  left: 22px;
  width: 138px;
  border-top-width: 2px;
  border-top-color: rgba(26, 26, 26, 0.22);
  transform-origin: right center;
}

.corner-strokes.anim-in::before {
  animation: stroke-left 1.24s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 140ms) forwards;
}

.corner-strokes.anim-in::after {
  animation: stroke-right 1.24s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 320ms) forwards;
}

@keyframes stroke-left {
  from {
    transform: scaleX(0) rotate(-18deg);
  }

  to {
    transform: scaleX(1) rotate(-18deg);
  }
}

@keyframes stroke-right {
  from {
    transform: scaleX(0) rotate(-18deg);
  }

  to {
    transform: scaleX(1) rotate(-18deg);
  }
}

.editorial-band {
  overflow: hidden;
  isolation: isolate;
}

.band-wipe::before,
.band-wipe::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.band-wipe::before {
  background: var(--bg-card);
  z-index: 1;
}

.band-wipe::after {
  inset: 0 auto 0 -6px;
  width: 6px;
  background: rgba(26, 26, 26, 0.44);
  opacity: 0;
  z-index: 2;
}

.band-wipe span {
  position: relative;
  z-index: 3;
}

.band-wipe.anim.anim-in::after {
  animation: btn-scan 1.02s ease-in-out calc(var(--d, 0) * 0.22s + 0.18s) forwards;
}

.band-wipe.anim.anim-in::before {
  animation: button-cover-wipe 1.28s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 1.14s) forwards;
}

.editorial-badge {
  position: absolute;
  top: 42px;
  right: 42px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--border-dark);
  color: var(--bg-card);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.4px;
  line-height: 1;
  text-transform: uppercase;
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
  transform: rotate(-7deg) skewX(-11deg);
}

.editorial-badge span {
  position: relative;
  z-index: 3;
  display: inline-block;
  padding: 9px 20px 8px;
  transform: skewX(11deg);
}

.wipe-badge::before,
.wipe-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wipe-badge::before {
  background: var(--bg-card);
  z-index: 1;
}

.wipe-badge::after {
  inset: 0 auto 0 -5px;
  width: 5px;
  background: rgba(26, 26, 26, 0.48);
  opacity: 0;
  z-index: 2;
}

.wipe-badge.anim.anim-in {
  animation: badge-settle 1.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

.wipe-badge.anim.anim-in::after {
  animation: btn-scan 1.02s ease-in-out calc(var(--d, 0) * 0.22s + 0.2s) forwards;
}

.wipe-badge.anim.anim-in::before {
  animation: button-cover-wipe 1.28s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 1.18s) forwards;
}

@keyframes badge-settle {
  from {
    opacity: 0;
    transform: translate3d(26px, 12px, 0) rotate(-11deg) skewX(-13deg);
  }

  to {
    opacity: 1;
    transform: rotate(-7deg) skewX(-11deg);
  }
}

.home-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(280px, 1fr) 62px;
  grid-template-rows: 1fr auto;
  column-gap: clamp(24px, 2.8vw, 40px);
  row-gap: 26px;
  min-height: clamp(620px, 74vh, 860px);
  padding: clamp(46px, 4vw, 66px) clamp(34px, 3.6vw, 54px) 0 108px;
}

.home-display-block {
  position: relative;
  grid-column: 1 / 3;
  min-height: clamp(360px, 54vh, 520px);
}

.home-display-primary {
  position: relative;
  z-index: 2;
  max-width: 2.4em;
  font-family: var(--font-serif);
  font-size: clamp(5.4rem, 15vw, 11.2rem);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: translateX(-10px) rotate(-8deg);
  transform-origin: left top;
}

.home-display-primary.anim.anim-in {
  animation: home-title-primary-in 1.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s + 0.24s);
}

@keyframes home-title-primary-in {
  from {
    opacity: 0;
    transform: translate3d(-42px, 32px, 0) rotate(-15deg);
  }

  to {
    opacity: 1;
    transform: translateX(-10px) rotate(-8deg);
  }
}

.home-display-secondary {
  position: absolute;
  left: clamp(124px, 16vw, 236px);
  bottom: clamp(-4px, 0.7vw, 10px);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: clamp(3.6rem, 8.8vw, 6.6rem);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: 0;
  transform: translateX(-8px) rotate(-9deg) skewX(-10deg);
  transform-origin: left bottom;
}

.home-display-secondary::before {
  content: "";
  position: absolute;
  left: -16px;
  right: -18px;
  bottom: 0.14em;
  height: 0.34em;
  background: rgba(232, 56, 79, 0.08);
  clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
  z-index: -1;
}

.home-display-secondary.anim.anim-in {
  animation: home-title-secondary-in 1.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s + 0.42s);
}

@keyframes home-title-secondary-in {
  from {
    opacity: 0;
    transform: translate3d(42px, 24px, 0) rotate(-16deg) skewX(-16deg);
  }

  to {
    opacity: 1;
    transform: translateX(-8px) rotate(-9deg) skewX(-10deg);
  }
}

body[data-script="latin"] .home-display-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
  max-width: 620px;
}

body[data-script="latin"] .home-display-primary {
  max-width: none;
  writing-mode: horizontal-tb;
  font-size: clamp(4.2rem, 7vw, 7rem);
  line-height: 0.94;
  transform: none;
}

body[data-script="latin"] .home-display-secondary {
  position: static;
  font-size: clamp(2.2rem, 4.2vw, 4rem);
  line-height: 0.96;
  transform: none;
}

body[data-script="latin"] .home-display-primary.anim.anim-in {
  animation: fade-in-left 1.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s + 0.18s);
}

body[data-script="latin"] .home-display-secondary.anim.anim-in {
  animation: fade-in-right 1.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s + 0.36s);
}

body[data-script="latin"] .home-display-secondary::before {
  left: -8px;
  right: -10px;
}

.home-watermark {
  position: absolute;
  right: 28px;
  top: 132px;
  color: rgba(26, 26, 26, 0.055);
  font-size: clamp(9rem, 22vw, 20rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 4px;
  pointer-events: none;
  user-select: none;
}

.home-side-rail,
.quiz-side-rail {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 28px;
  color: var(--teal);
  font-size: 14px;
  letter-spacing: 2px;
}

.rail-rise-right {
  position: relative;
  padding-right: 18px;
}

.rail-rise-right::before {
  content: "";
  position: absolute;
  top: -44px;
  right: 10px;
  bottom: 0;
  width: 3px;
  background: currentColor;
  transform: scaleY(0);
  transform-origin: top center;
  opacity: 0.9;
}

.rail-rise-right.anim-in::before {
  animation: rail-grow 1.46s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 0.26s) forwards;
}

@keyframes rail-grow {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

.home-side-rail span,
.quiz-side-rail span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: skewY(-10deg);
}

.panel-divider-left,
.panel-divider-right {
  position: relative;
  border-top: none;
}

.panel-divider-left::before,
.panel-divider-left::after,
.panel-divider-right::before,
.panel-divider-right::after {
  content: "";
  position: absolute;
  top: 0;
  height: 0;
  border-top: 2px solid var(--border-dark);
  pointer-events: none;
}

.panel-divider-left::before,
.panel-divider-right::before {
  left: 0;
  right: 0;
}

.panel-divider-left::after,
.panel-divider-right::after {
  top: 8px;
  left: 0;
  right: 0;
  border-top-width: 1px;
  border-top-color: rgba(26, 26, 26, 0.14);
}

.panel-divider-left::before,
.panel-divider-left::after {
  transform: scaleX(0);
  transform-origin: left center;
}

.panel-divider-right::before,
.panel-divider-right::after {
  transform: scaleX(0);
  transform-origin: right center;
}

.panel-divider-left.anim-in::before {
  animation: rule-from-left 1.22s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 0.24s) forwards;
}

.panel-divider-left.anim-in::after {
  animation: rule-from-right 1.22s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 0.42s) forwards;
}

.panel-divider-right.anim-in::before {
  animation: rule-from-right 1.22s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 0.24s) forwards;
}

.panel-divider-right.anim-in::after {
  animation: rule-from-left 1.22s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 0.42s) forwards;
}

.home-summary-panel,
.home-cta-panel {
  padding-top: 20px;
  border-top: 2px solid var(--border-dark);
}

.home-summary-panel {
  grid-column: 1 / 3;
  display: grid;
  gap: 10px;
  align-content: end;
  max-width: min(780px, 100%);
  padding-bottom: 24px;
}

.home-feature-tag,
.quiz-progress-caption {
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 3.2px;
  text-transform: uppercase;
}

.home-subtitle {
  color: rgba(26, 26, 26, 0.78);
  font-size: clamp(1rem, 1.4vw, 1.14rem);
  line-height: 1.92;
  letter-spacing: 0.24px;
}

.home-meta-url,
.repo-link-inline-value,
.result-anime-romaji,
.result-qr-url {
  overflow-wrap: anywhere;
}

.home-meta-url {
  color: rgba(26, 26, 26, 0.38);
  font-size: 13px;
  letter-spacing: 0.7px;
}

.repo-link-inline {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  width: fit-content;
  padding-top: 8px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, color 0.2s ease;
}

.repo-link-inline:hover {
  color: var(--accent);
  transform: translateX(3px);
}

.repo-link-inline-label,
.result-qr-label {
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.repo-link-inline-value {
  font-size: 13px;
  line-height: 1.7;
}

.home-cta-panel {
  grid-column: 3;
  display: grid;
  gap: 12px;
  align-content: end;
  justify-self: end;
  min-width: 230px;
  padding-bottom: 24px;
}

.btn-start,
.btn-secondary,
.btn-action,
.btn-action-link,
.quiz-prev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 20px;
  border: 1.5px solid var(--border-dark);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.28s ease,
    box-shadow 0.34s ease,
    color 0.34s ease,
    background 0.34s ease,
    border-color 0.34s ease;
}

.btn-start,
.btn-share {
  --button-fill: var(--border-dark);
  --button-text: var(--bg-card);
  background: var(--button-fill);
  color: var(--button-text);
}

.btn-share {
  --button-fill: var(--accent);
  border-color: var(--accent);
}

.btn-secondary,
.btn-action,
.btn-action-link,
.quiz-prev {
  background: rgba(26, 26, 26, 0.035);
  color: var(--text);
}

.btn-start:hover,
.btn-secondary:hover,
.btn-action:hover,
.btn-action-link:hover,
.quiz-prev:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.btn-secondary:hover,
.btn-action:hover,
.btn-action-link:hover,
.quiz-prev:hover:not(:disabled) {
  background: var(--border-dark);
  color: var(--bg-card);
}

.btn-share:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-start:active,
.btn-secondary:active,
.btn-action:active,
.btn-action-link:active,
.quiz-prev:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
  box-shadow: none;
}

.quiz-prev {
  min-height: 46px;
  padding-inline: 16px;
}

.quiz-prev:disabled {
  opacity: 0.34;
  cursor: default;
  box-shadow: none;
}

.wipe-fill {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --wipe-cover: var(--bg-card);
  --wipe-scan: rgba(26, 26, 26, 0.42);
}

.wipe-fill::before,
.wipe-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wipe-fill::before {
  background: var(--wipe-cover);
  transform: translateX(0);
  z-index: 0;
}

.wipe-fill::after {
  inset: 0 auto 0 -4px;
  width: 4px;
  background: var(--wipe-scan);
  opacity: 0;
  z-index: 1;
}

.btn-start,
.btn-share,
.wipe-fill-ghost {
  animation: none;
}

.wipe-fill.anim::before,
.wipe-fill.anim::after {
  display: block;
}

.wipe-fill-ghost {
  --wipe-cover: rgba(242, 237, 228, 0.96);
  --wipe-scan: rgba(26, 26, 26, 0.24);
}

.wipe-fill.anim.anim-in {
  animation: fade-in-up 1.12s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 0.22s);
}

.wipe-fill.anim.anim-in::after {
  animation: btn-scan 1.02s ease-in-out calc(var(--d, 0) * 0.22s + 0.18s) forwards;
}

.wipe-fill.anim.anim-in::before {
  animation: button-cover-wipe 1.26s cubic-bezier(0.22, 1, 0.36, 1)
    calc(var(--d, 0) * 0.22s + 1.18s) forwards;
}

.btn-start.anim.anim-in {
  animation:
    fade-in-up 1.12s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    btn-pulse 4.6s ease-in-out calc(var(--d, 0) * 0.22s + 2.36s) infinite;
}

.btn-start > *,
.btn-share > *,
.wipe-fill {
  position: relative;
  z-index: 2;
}

@keyframes button-cover-wipe {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100%);
  }
}

@keyframes btn-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(26, 26, 26, 0);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(26, 26, 26, 0.08);
  }
}

.poster-band {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1.5px solid var(--border-dark);
  background: #efe7d9;
  overflow: hidden;
}

.poster-marquee {
  overflow: hidden;
}

.marquee-track {
  display: flex;
  gap: 12px;
  width: max-content;
  will-change: transform;
  --loop-shift: 0px;
  animation: poster-scroll-left 54s linear infinite;
}

.marquee-track[data-direction="right"] {
  animation-name: poster-scroll-right;
}

.marquee-item {
  position: relative;
  width: clamp(74px, 6vw, 94px);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1.5px solid var(--border-dark);
  background: var(--border-dark);
  flex-shrink: 0;
}

.marquee-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.marquee-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.04);
}

.home-scroll-hint {
  display: none;
  opacity: 0;
  visibility: hidden;
}

.home-scroll-hint-label {
  max-width: 100%;
  font-size: 10px;
  letter-spacing: 2px;
  line-height: 1.5;
  text-align: center;
}

@keyframes poster-scroll-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-1 * var(--loop-shift)));
  }
}

@keyframes poster-scroll-right {
  from {
    transform: translateX(calc(-1 * var(--loop-shift)));
  }

  to {
    transform: translateX(0);
  }
}

.quiz-layout {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 62px;
  min-height: clamp(620px, 74vh, 860px);
  padding: clamp(44px, 4vw, 62px) clamp(30px, 3.2vw, 48px) 0 108px;
}

.quiz-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 10px 24px 30px 0;
  border-right: 1px solid rgba(26, 26, 26, 0.14);
}

.quiz-q-label {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 5vw, 4.8rem);
  font-weight: 900;
  line-height: 0.88;
}

.quiz-progress-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-progress-text {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.quiz-progress-bar {
  position: relative;
  margin-top: 6px;
  height: 12px;
  border: 1.5px solid var(--border-dark);
  background: transparent;
  overflow: hidden;
}

.quiz-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--quiz-accent);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: width 0.62s ease;
}

.quiz-stage {
  display: flex;
  align-items: center;
  padding: 0 clamp(24px, 3.8vw, 58px) 34px;
}

.quiz-body {
  width: min(100%, 780px);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.quiz-body.exiting {
  opacity: 0;
  transform: translateY(-14px);
}

.quiz-body.entering {
  opacity: 0;
  transform: translateY(16px);
}

.quiz-question {
  margin-bottom: 34px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3vw, 3.4rem);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre-line;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-option {
  position: relative;
  z-index: 0;
  width: 100%;
  min-height: 72px;
  padding: 18px 22px;
  overflow: hidden;
  border: 1.5px solid var(--border-dark);
  background: #fcfbf8;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  text-align: left;
  letter-spacing: 0.12px;
  cursor: pointer;
  opacity: 0;
  animation: option-in 0.46s ease forwards;
  animation-delay: calc(var(--i, 0) * 0.075s);
  transition: border-color 0.32s ease, transform 0.28s ease, color 0.32s ease;
}

.quiz-option::before {
  content: "";
  position: absolute;
  inset: 0 100% 0 0;
  background: var(--quiz-accent-soft);
  z-index: -1;
  transition: inset 0.38s ease;
}

.quiz-option:hover {
  transform: translateX(4px);
  border-color: var(--quiz-accent);
}

.quiz-option:hover::before,
.quiz-option.selected::before {
  inset: 0 0 0 0;
}

.quiz-option.selected {
  border-color: var(--quiz-accent-strong);
  background: rgba(234, 246, 255, 0.86);
}

.quiz-option:disabled {
  pointer-events: none;
}

@keyframes option-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.result-container {
  width: min(100%, 1380px);
  padding: 0 0 32px;
}

.result-card {
  overflow: hidden;
  background: var(--bg-card);
  text-align: left;
  animation: card-in 0.78s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-card.is-exporting {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  box-shadow: none !important;
  background: var(--bg-card);
}

.result-card.is-exporting * {
  transition: none !important;
}

.result-card.is-exporting .anim,
.result-card.is-exporting .char,
.result-card.is-exporting .result-img-wrap img,
.result-card.is-exporting .result-headline,
.result-card.is-exporting .result-main,
.result-card.is-exporting .result-copy,
.result-card.is-exporting .result-cover-panel,
.result-card.is-exporting .result-title-grid,
.result-card.is-exporting .corner-strokes::before,
.result-card.is-exporting .corner-strokes::after {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.result-card.is-exporting .char {
  display: inline-block;
}

.result-card.is-exporting .trait-bar-fill {
  clip-path: inset(0 0 0 0) !important;
  animation: none !important;
}

.result-card.is-exporting .rail-rise-right::before {
  transform: scaleY(1) !important;
  animation: none !important;
}

.result-card.is-exporting .panel-divider-left::before,
.result-card.is-exporting .panel-divider-left::after,
.result-card.is-exporting .panel-divider-right::before,
.result-card.is-exporting .panel-divider-right::after {
  transform: scaleX(1) !important;
  animation: none !important;
}

.result-card.is-exporting [data-export-hidden="true"] {
  display: none !important;
}

.result-card.is-exporting .result-main {
  padding-bottom: 20px;
}

.result-card.is-exporting .editorial-surface::after {
  opacity: 0 !important;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-card-body {
  flex: 1;
  padding: 0;
}

.result-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr) 56px;
  min-height: clamp(650px, 78vh, 920px);
  padding: clamp(42px, 4vw, 62px) 0 0 108px;
}

.result-main {
  display: flex;
  flex-direction: column;
  padding: 0 clamp(24px, 3vw, 42px) 34px 0;
}

.result-headline {
  min-height: 18px;
  margin-bottom: 18px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  transform: skewX(-10deg);
  transform-origin: left center;
}

.result-title-grid {
  display: block;
}

.result-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.result-anime-name {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 4.8vw, 5rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

body[data-script="latin"] .result-anime-name {
  font-size: clamp(2.4rem, 4vw, 4.1rem);
  line-height: 1.1;
}

.result-anime-romaji {
  margin: 0 0 12px;
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 1.8px;
  line-height: 1.6;
  text-transform: uppercase;
}

.result-type-badge {
  display: inline-block;
  margin: 16px 0 14px;
  padding: 0;
  background: transparent;
  color: var(--teal);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}

.result-description {
  max-width: 54ch;
  color: rgba(26, 26, 26, 0.78);
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: 0.16px;
}

.result-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 22px;
}

.result-keywords span {
  padding: 7px 12px 6px;
  border: 1.5px solid rgba(26, 26, 26, 0.16);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.result-cover-panel {
  width: min(100%, clamp(228px, 26vw, 340px));
  margin: 0 0 26px;
}

.result-img-wrap {
  --cover-ratio: 0.72;
  position: relative;
  width: 100%;
  aspect-ratio: var(--cover-ratio);
  overflow: hidden;
  border: 1.5px solid var(--border-dark);
  background: #f2e7d9;
  display: grid;
  place-items: center;
  padding: clamp(8px, 1vw, 12px);
}

.result-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center center;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.result-img-wrap[data-cover-mode="landscape"] {
  --cover-ratio: 1.22;
}

.result-img-wrap[data-cover-mode="square"] {
  --cover-ratio: 1;
}

.result-img-wrap[data-cover-mode="portrait"] {
  --cover-ratio: 0.72;
}

.result-img-wrap img.loaded {
  opacity: 1;
}

.result-img-wrap img.loaded + .result-img-placeholder {
  opacity: 0;
}

.result-img-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(26, 26, 26, 0.28);
  font-size: 12px;
  letter-spacing: 4px;
  user-select: none;
  transition: opacity 0.24s ease;
}

.result-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: auto;
  padding-top: 26px;
}

.result-action-stack {
  display: grid;
  gap: 10px;
}

.result-action-stack .btn-action {
  min-height: 52px;
}

.result-action-grid .btn-action,
.result-action-grid .btn-action-link {
  width: 100%;
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: blur(8px);
}

.image-preview-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  width: min(92vw, 860px);
  max-height: min(90vh, 1100px);
  margin: min(4vh, 32px) auto;
  padding: 18px;
  border: 1.5px solid rgba(250, 248, 244, 0.26);
  background: rgba(12, 12, 12, 0.94);
  color: #faf8f4;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.image-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.image-preview-title-block {
  min-width: 0;
}

.image-preview-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.image-preview-note {
  margin-top: 8px;
  color: rgba(250, 248, 244, 0.72);
  font-size: 12px;
  line-height: 1.75;
  letter-spacing: 0.24px;
}

.image-preview-close {
  min-width: 84px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(250, 248, 244, 0.32);
  background: transparent;
  color: #faf8f4;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.24s ease, border-color 0.24s ease, transform 0.24s ease;
}

.image-preview-close:hover {
  background: rgba(250, 248, 244, 0.08);
  border-color: rgba(250, 248, 244, 0.56);
  transform: translateY(-1px);
}

.image-preview-body {
  overflow: auto;
  display: grid;
  place-items: center;
}

@media (max-width: 640px) {
}

.image-preview-body img {
  display: block;
  width: min(100%, 760px);
  height: auto;
  background: #faf8f4;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.result-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 10px clamp(22px, 2.5vw, 34px) 34px;
  border-left: 1px solid rgba(26, 26, 26, 0.14);
}

.result-side-heading {
  display: inline-flex;
  align-self: flex-start;
  color: var(--text-light);
  font-size: 12px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  transform: skewX(-10deg);
}

.result-traits {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trait-row {
  display: grid;
  grid-template-columns: minmax(94px, 126px) minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
}

.trait-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.18px;
  text-align: left;
  white-space: normal;
}

.trait-bar-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: rgba(26, 26, 26, 0.08);
}

.trait-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--bar-color, var(--border-dark));
  clip-path: inset(0 100% 0 0);
}

.trait-bar-fill.bar-in {
  animation: trait-bar-reveal 0.82s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: var(--bar-d, 0s);
}

.trait-value {
  color: var(--bar-color, var(--border-dark));
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@keyframes trait-bar-reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

.result-columns {
  display: grid;
  gap: 16px;
}

.result-section-label {
  margin-bottom: 10px;
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 2px;
  text-align: left;
  text-transform: uppercase;
}

.result-section-label::before,
.result-section-label::after {
  content: none;
}

.result-section-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-section-item {
  padding: 12px 14px;
  border: 1.5px solid rgba(26, 26, 26, 0.14);
  background: rgba(255, 255, 255, 0.32);
}

.result-section-item-name {
  margin-bottom: 4px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

.result-section-item-why {
  color: rgba(26, 26, 26, 0.58);
  font-size: 12px;
  line-height: 1.68;
  letter-spacing: 0.1px;
}

.result-qr-block {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid rgba(26, 26, 26, 0.14);
}

.result-qr-code {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-dark);
  background: #fffdf8;
}

.result-qr-code img,
.result-qr-code canvas,
.result-qr-code table {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.result-qr-meta {
  min-width: 0;
}

.result-qr-url {
  color: rgba(26, 26, 26, 0.58);
  font-size: 10px;
  line-height: 1.8;
  letter-spacing: 1px;
}

.repo-link-inline-side {
  width: 100%;
  margin-top: 2px;
}

.result-side-marker {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-right: 18px;
  padding-bottom: 28px;
  border-left: none;
  color: var(--accent);
}

.result-side-marker span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  transform: skewY(-10deg);
}

@media (max-width: 1180px) {
  .editorial-frame {
    width: min(calc(100vw - 32px), 1120px);
  }

  .home-layout {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr);
  }

  .home-side-rail {
    display: none;
  }

  .home-summary-panel {
    grid-column: 1 / 2;
  }

  .home-cta-panel {
    grid-column: 2;
  }

  .quiz-layout {
    grid-template-columns: 164px minmax(0, 1fr);
  }

  .quiz-side-rail {
    display: none;
  }

  .result-layout {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  }

  .result-side-marker {
    display: none;
  }
}

@media (max-width: 860px) {
  #page-home,
  #page-quiz,
  #page-result {
    padding: 0;
  }

  .lang-control {
    top: 12px;
    right: 12px;
  }

  .lang-select {
    min-width: 82px;
    height: 34px;
    font-size: 11px;
  }

  .lang-gate {
    padding-top: 94px;
  }

  .lang-gate-panel {
    padding: 20px 12px 18px;
  }

  .lang-gate-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lang-guide-toast {
    top: 54px;
    right: 12px;
    max-width: 156px;
  }

  .editorial-frame {
    width: 100vw;
    min-height: 100dvh;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .paper-masthead {
    grid-template-columns: 84px 1fr 88px;
    min-height: 42px;
    padding: 0 12px;
  }

  .brand-lockup {
    font-size: 14px;
    letter-spacing: 1.8px;
  }

  .masthead-volume,
  .masthead-route,
  .masthead-date {
    font-size: 9px;
    letter-spacing: 1.2px;
  }

  .masthead-home-link {
    font-size: 8px;
    letter-spacing: 0.9px;
  }

  .editorial-band {
    width: 52px;
  }

  .editorial-band span {
    font-size: 13px;
  }

  .editorial-badge {
    top: 30px;
    right: 14px;
    font-size: 10px;
    letter-spacing: 1.6px;
    transform: rotate(-5deg) skewX(-8deg) scale(0.86);
    transform-origin: right top;
  }

  .editorial-badge span {
    padding: 7px 12px 6px;
    transform: skewX(8deg);
  }

  .home-layout,
  .quiz-layout,
  .result-layout {
    padding-left: 68px;
    padding-right: 18px;
  }

  .home-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    min-height: auto;
    row-gap: 14px;
    padding-top: 24px;
  }

  .corner-strokes {
    left: 62px;
    width: 144px;
  }

  .corner-strokes::before {
    width: 132px;
    border-top-width: 3px;
  }

  .corner-strokes::after {
    top: 14px;
    left: 18px;
    width: 102px;
  }

  .home-display-block {
    grid-column: 1;
    min-height: 218px;
  }

  .home-display-primary {
    font-size: clamp(3.1rem, 19vw, 5.9rem);
    transform: translateX(-4px) rotate(-5deg);
  }

  .home-display-secondary {
    left: clamp(94px, 31vw, 176px);
    font-size: clamp(2.35rem, 12.8vw, 4rem);
    transform: translateX(-4px) rotate(-6deg) skewX(-8deg);
  }

  body[data-script="latin"] .home-display-primary {
    font-size: clamp(3rem, 12vw, 4.9rem);
  }

  body[data-script="latin"] .home-display-secondary {
    font-size: clamp(1.9rem, 8vw, 3rem);
  }

  .home-watermark {
    top: auto;
    right: 8px;
    bottom: 104px;
    font-size: clamp(5rem, 28vw, 9rem);
  }

  .rail-rise-right {
    padding-right: 12px;
  }

  .rail-rise-right::before {
    right: 6px;
  }

  .home-summary-panel,
  .home-cta-panel {
    grid-column: 1;
    padding-top: 14px;
    padding-bottom: 0;
  }

  .home-cta-panel {
    min-width: 0;
    justify-self: stretch;
    gap: 10px;
  }

  .home-subtitle {
    font-size: 0.96rem;
    line-height: 1.76;
  }

  .home-meta-url {
    font-size: 12px;
    line-height: 1.55;
  }

  .repo-link-inline-value {
    font-size: 12px;
    line-height: 1.55;
  }

  .btn-start,
  .btn-secondary,
  .btn-action,
  .btn-action-link {
    min-height: 52px;
    font-size: 12px;
    letter-spacing: 1.7px;
  }

  .home-scroll-hint {
    position: fixed;
    left: 50%;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: min(188px, calc(100vw - 28px));
    padding: 10px 14px 11px;
    border: 1px solid rgba(26, 26, 26, 0.14);
    background: rgba(250, 248, 244, 0.96);
    box-shadow: 0 10px 24px rgba(26, 26, 26, 0.08);
    color: rgba(26, 26, 26, 0.72);
    justify-self: center;
    pointer-events: none;
    z-index: 18;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 18px);
    transition:
      opacity 0.88s cubic-bezier(0.22, 1, 0.36, 1),
      transform 1.04s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 1.04s;
  }

  .home-scroll-hint.is-mobile-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition:
      opacity 0.88s cubic-bezier(0.22, 1, 0.36, 1),
      transform 1.04s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0s;
  }

  .home-scroll-hint-line {
    width: 1px;
    height: 18px;
    background: rgba(26, 26, 26, 0.24);
  }

  .home-scroll-hint-label {
    letter-spacing: 1.8px;
  }

  .home-scroll-hint-dots {
    font-size: 9px;
    letter-spacing: 2.4px;
  }

  .home-scroll-hint-arrow {
    width: 12px;
    height: 12px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    animation: scroll-cue-bob 1.9s ease-in-out infinite;
  }

  .poster-band {
    padding: 8px 0 10px;
  }

  .poster-band .marquee-track {
    animation-duration: 48s;
  }

  .poster-band .marquee-item {
    width: 72px;
  }

  .paper-footer {
    padding-left: 58px;
    gap: 10px;
    font-size: 10px;
  }

  .quiz-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 24px;
  }

  .quiz-aside {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: 12px;
    padding: 0 0 18px;
    border-right: none;
    border-bottom: 1px solid rgba(26, 26, 26, 0.14);
  }

  .quiz-progress-stack {
    gap: 4px;
  }

  .quiz-progress-bar {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .quiz-prev {
    margin-top: 0;
  }

  .quiz-stage {
    padding: 24px 0 32px;
  }

  .quiz-question {
    margin-bottom: 24px;
    font-size: clamp(1.7rem, 7.6vw, 2.4rem);
  }

  .quiz-option {
    min-height: 62px;
    padding: 14px 16px;
    font-size: 14px;
  }

  .result-container {
    width: 100%;
    padding-bottom: 0;
  }

  .result-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 24px;
  }

  .result-main {
    padding: 0 0 24px;
  }

  .result-headline,
  .result-side-heading {
    transform: skewX(-7deg);
  }

  .result-title-grid {
    display: block;
  }

  .result-cover-panel {
    width: min(100%, 280px);
  }

  .result-description {
    font-size: 14px;
    line-height: 1.9;
  }

  .result-action-grid {
    grid-template-columns: 1fr;
  }

  .result-action-stack {
    gap: 12px;
  }

  .result-side {
    padding: 20px 0 28px;
    border-left: none;
    border-top: 1px solid rgba(26, 26, 26, 0.14);
  }

  .result-qr-block {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .image-preview-panel {
    width: min(94vw, 720px);
    max-height: min(92vh, 960px);
    margin: 18px auto;
    padding: 14px;
  }

  .image-preview-head {
    flex-direction: column;
    align-items: stretch;
  }

  .image-preview-close {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .paper-masthead {
    grid-template-columns: 70px 1fr 74px;
  }

  .editorial-band {
    width: 46px;
  }

  .home-layout,
  .quiz-layout,
  .result-layout {
    padding-left: 56px;
    padding-right: 14px;
  }

  .home-display-block {
    min-height: 194px;
  }

  .home-display-primary {
    font-size: clamp(2.86rem, 22vw, 4.9rem);
    transform: translateX(-2px) rotate(-4deg);
  }

  .home-display-secondary {
    left: clamp(68px, 28vw, 126px);
    font-size: clamp(1.95rem, 13vw, 3.2rem);
    transform: translateX(-2px) rotate(-5deg) skewX(-6deg);
  }

  .home-watermark {
    bottom: 94px;
    font-size: clamp(4.4rem, 25vw, 7.8rem);
  }

  .editorial-badge {
    top: 28px;
    right: 10px;
    font-size: 9px;
    letter-spacing: 1.2px;
    transform: rotate(-5deg) skewX(-7deg) scale(0.74);
  }

  .home-scroll-hint {
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 10px));
    width: min(172px, calc(100vw - 24px));
    padding: 9px 12px 10px;
  }

  .home-scroll-hint-line {
    height: 16px;
  }

  .home-scroll-hint-label {
    font-size: 9px;
    letter-spacing: 1.5px;
  }

  .result-anime-name {
    font-size: clamp(2.35rem, 11vw, 3.4rem);
  }

  .result-headline,
  .result-side-heading,
  .result-section-label,
  .repo-link-inline-label,
  .result-qr-label {
    letter-spacing: 1.6px;
  }

  .trait-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .trait-value {
    text-align: left;
  }

}

@media (prefers-reduced-motion: reduce) {
  .marquee-track,
  .glitch-text::before,
  .glitch-text::after,
  .btn-start,
  .corner-strokes::before,
  .corner-strokes::after,
  .rail-rise-right::before,
  .panel-divider-left::before,
  .panel-divider-left::after,
  .panel-divider-right::before,
  .panel-divider-right::after,
  .home-scroll-hint-arrow {
    animation: none !important;
  }

  .band-wipe::before,
  .band-wipe::after,
  .wipe-badge::before,
  .wipe-badge::after,
  .wipe-fill::before,
  .wipe-fill::after,
  .home-scroll-hint,
  .lang-gate,
  .lang-guide-toast,
  .lang-fly-chip,
  .lang-gate-button {
    transition: none !important;
  }

  /* Entrance/page system: jump straight to final state */
  .anim,
  .anim.anim-in,
  .char,
  .quiz-option {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }

  .page.page-entering,
  .page.page-leaving {
    animation: none !important;
  }

  .quiz-body {
    transition: none !important;
  }
}

body.lang-gate-open .home-scroll-hint {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate(-50%, 18px) !important;
}

@keyframes scroll-cue-bob {
  0%,
  100% {
    transform: rotate(45deg) translate(0, 0);
    opacity: 0.55;
  }

  50% {
    transform: rotate(45deg) translate(4px, 4px);
    opacity: 1;
  }
}
