/* C.T. GALLERY — CONSOLIDATED UI EXTENSION */

:root {
  --ct-ice: #d9efff;
  --ct-deep: #172c45;
  --ct-accent: #3fa9ff;
  --ct-ease: cubic-bezier(.16,1,.3,1);
}

/* ========================================
   01. HEADER / SOUND CONTROL
======================================== */

.header { gap: clamp(.5rem,2vw,1.5rem); }
.header-nav { margin-left: auto; }
.logo { flex: none; }

.nav-btn,
.mobile-nav-btn {
  position: relative;
  transition: background .2s,color .2s,box-shadow .2s;
}

.nav-btn:not(.active):hover,
.mobile-nav-btn:not(.active):hover {
  color: #185e8d;
}

.header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 3px;
  transform: scaleX(var(--ct-progress,0));
  transform-origin: left;
  background: #123e65;
  pointer-events: none;
}

.ct-sound {
  flex: none;
  border: 1px solid #a9cbe4;
  background: #f4faff;
  color: #275e87;
  border-radius: 4px;
  min-height: 2.55rem;
  padding: .35rem .65rem;
  font: 700 .82rem/1.2 var(--body);
  white-space: nowrap;
  transition: background .2s,color .2s;
}

.ct-sound[aria-pressed="true"] {
  background: #e2f3ff;
  color: #164b74;
}

.ct-sound[aria-pressed="false"] {
  background: #fff;
  color: #586575;
}

.ct-sound:active { transform: scale(.94); }

/* ========================================
   02. HOME / SKY GRADIENT
======================================== */

.hero {
  grid-template-columns: minmax(0,1fr) minmax(0,.75fr);

  background: linear-gradient(
    180deg,
    #8bd5ff 0%,
    #58addf 25%,
    #326a99 49%,
    #162a43 73%,
    #070b13 91%,
    #000 100%
  );
}

.hero-art {
  inset: -22px 0;

  transform:
    translate3d(0,var(--ct-parallax,0px),0)
    scale(1.03);
}

.hero .hero-shade {
  background:
    linear-gradient(90deg,rgba(5,15,30,.24),transparent 65%),
    linear-gradient(0deg,rgba(0,0,0,.25),transparent 45%);
}

.hero-left { width: min(100%,23rem); }
.hero-right { width: min(100%,14rem); }
.hero .tag { letter-spacing: .16em; }
.logo-big { margin: .95rem 0 1.2rem; }
.logo-big b { letter-spacing: -.045em; }
.logo-big em { color: #e1f4ff; }

.hero-left .hb {
  position: relative;
  overflow: hidden;
  min-height: 3.2rem;
}

.hb i {
  border-radius: 2px;
  box-shadow: 0 0 12px #65c4ff30;
}

.hb b { font-variant-numeric: tabular-nums; }

.stk-b {
  border-color: #c7ebff;
  box-shadow: 0 7px 24px #10243e4d;
}

/* ========================================
   03. STARFIELD / SHOOTING STARS
======================================== */

.hero .ct-meteors {
  position: absolute;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  overflow: hidden;

  background-image:
    radial-gradient(circle at 5% 8%,#ffffffaa 0 1px,transparent 2px),
    radial-gradient(circle at 17% 14%,#ffffff66 0 .7px,transparent 1.8px),
    radial-gradient(circle at 29% 5%,#d8efffaa 0 1px,transparent 2px),
    radial-gradient(circle at 42% 19%,#ffffff55 0 .8px,transparent 2px),
    radial-gradient(circle at 57% 9%,#ffffff99 0 1px,transparent 2px),
    radial-gradient(circle at 72% 16%,#c8e7ff99 0 1px,transparent 2px),
    radial-gradient(circle at 88% 6%,#ffffffbb 0 1px,transparent 2.5px),
    radial-gradient(circle at 94% 27%,#ffffff77 0 .8px,transparent 2px),
    radial-gradient(circle at 8% 34%,#ffffff77 0 1px,transparent 2px),
    radial-gradient(circle at 21% 41%,#c8e7ff88 0 .8px,transparent 2px),
    radial-gradient(circle at 35% 29%,#ffffff55 0 .7px,transparent 1.7px),
    radial-gradient(circle at 49% 39%,#ffffff99 0 1px,transparent 2px),
    radial-gradient(circle at 64% 31%,#ffffff88 0 .8px,transparent 2px),
    radial-gradient(circle at 81% 43%,#d8efffaa 0 1px,transparent 2px),
    radial-gradient(circle at 91% 53%,#ffffff66 0 .8px,transparent 2px),
    radial-gradient(circle at 12% 61%,#ffffff55 0 .8px,transparent 2px),
    radial-gradient(circle at 28% 72%,#c8e7ff88 0 1px,transparent 2px),
    radial-gradient(circle at 43% 58%,#ffffff77 0 .8px,transparent 2px),
    radial-gradient(circle at 59% 69%,#ffffff55 0 .7px,transparent 2px),
    radial-gradient(circle at 76% 61%,#d8efff88 0 1px,transparent 2px),
    radial-gradient(circle at 86% 79%,#ffffff55 0 .7px,transparent 2px);

  background-repeat: no-repeat;
}

.hero .ct-meteor {
  position: absolute;
  left: -5%;
  right: auto;
  bottom: auto;
  width: clamp(10rem,36vw,28rem);
  height: 3px;
  opacity: 0;
  border-radius: 100px;

  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(110,200,255,.15) 20%,
    #85d4ff 58%,
    #d9f5ff 85%,
    #fff 100%
  );

  box-shadow: 0 0 8px #b0e5ff60;
  filter: drop-shadow(0 0 6px rgba(170,220,255,.85));
  transform-origin: right center;
  animation: ctMeteorLeftFlight 5s linear infinite;
  animation-play-state: paused;
}

.hero.ct-hero-ready .ct-meteor {
  animation-play-state: running;
}

.ct-meteor::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translate(50%,-50%);
  background: #fff;

  box-shadow:
    0 0 9px 3px #c8f2ffb0,
    0 0 18px 5px #8cdfff65;
}

.hero .ct-meteor:nth-child(1) {
  top: 7%;
  left: -7%;
  animation-delay: .1s;
}

.hero .ct-meteor:nth-child(2) {
  top: 17%;
  left: 2%;
  animation-delay: .45s;
}

.hero .ct-meteor:nth-child(3) {
  top: 28%;
  left: -4%;
  animation-delay: .8s;
}

@keyframes ctMeteorLeftFlight {
  0% {
    opacity: 0;
    transform: translate3d(-12vw,-7vw,0) rotate(30deg);
  }
  4% { opacity: 1; }
  16% {
    opacity: 1;
    transform: translate3d(15vw,8.6vw,0) rotate(30deg);
  }
  24%,100% {
    opacity: 0;
    transform: translate3d(29vw,16.5vw,0) rotate(30deg);
  }
}

/* ========================================
   04. CHARACTER SPOTLIGHT
======================================== */

.ct-spotlight {
  grid-area: 1/2;
  place-self: start end;
  position: relative;
  width: min(100%,15rem);
  min-width: 0;
  z-index: 2;
  padding: .75rem;
  border: 1px solid #c5eaffad;
  background: #122b45d9;
  color: white;
  border-radius: 5px;
  box-shadow: 0 6px 25px #10243e29;
}

.ct-spotlight[hidden],
.ct-dialogue[hidden] {
  display: none !important;
}

.ct-feature-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  white-space: nowrap;
  font: 700 .68rem/1.5 var(--latin);
  color: #aedfff;
  letter-spacing: .12em;
}

.ct-feature-top::before {
  content: "";
  width: .44rem;
  height: .44rem;
  flex: none;
  background: #7ce1ff;
  box-shadow: 0 0 10px #7ce1ff;
}

.ct-feature-top span:first-child { flex: 1; }

.ct-spot-name {
  width: 100%;
  min-height: 2.5rem;
  margin: .4rem 0;
  padding: .4rem .2rem;
  text-align: left;
  border: 0;
  background: none;
  color: #fff;
  font: 700 clamp(.9rem,2vw,1.15rem)/1.45 var(--serif);
  overflow-wrap: anywhere;
  word-break: keep-all;
  border-bottom: 1px solid #c3e6ff48;
}

.ct-feature-controls {
  display: flex;
  gap: .35rem;
  align-items: center;
}

.ct-feature-controls button {
  border: 1px solid #b8e5ff66;
  border-radius: 3px;
  background: #ffffff0d;
  color: #d2efff;
  min-height: 2rem;
  min-width: 2rem;
  padding: .15rem .4rem;
  font: 700 .85rem/1.2 var(--latin);
}

.ct-feature-controls button:last-child {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

.ct-feature-controls button:disabled { opacity: .35; }

.ct-feature-controls button:not(:disabled):hover {
  background: #377fb1;
}

/* ========================================
   05. SCROLL GUIDE
======================================== */

#m-head {
  scroll-margin-top: calc(var(--header-h) + .75rem);
}

.ct-scroll-hint {
  position: absolute;
  bottom: 1.3rem;
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  background: none;
  border: 0;
  color: white;
  text-shadow: 0 2px 8px #10243e;
  font: 700 .68rem/1.35 var(--latin);
  letter-spacing: .14em;
  display: grid;
  justify-items: center;
  gap: .15rem;
  padding: .4rem .75rem;
}

.ct-scroll-hint span {
  font-size: 1.15rem;
  animation: ct-nudge 1.6s ease-in-out infinite;
}

@keyframes ct-nudge {
  50% { transform: translateY(5px); }
}

/* ========================================
   06. HOME CHARACTER / LOWER BODY FADE
======================================== */

.hero.ct-dialogue-ready {
  grid-template-columns:
    minmax(0,1.05fr)
    minmax(0,1.35fr)
    minmax(0,.95fr);

  grid-template-rows:
    auto
    minmax(max-content,1fr)
    auto;
}

.hero.ct-dialogue-ready .hero-art {
  inset: 5% 25% 0 19%;
  transform: translate3d(0,var(--ct-parallax,0px),0);
}

.hero.ct-dialogue-ready .hero-art img {
  object-fit: contain;
  object-position: center bottom;

  --ct-art-mask: linear-gradient(
    to bottom,
    #000 0%,
    #000 58%,
    rgba(0,0,0,.95) 67%,
    rgba(0,0,0,.65) 80%,
    rgba(0,0,0,.25) 92%,
    transparent 100%
  );

  -webkit-mask-image: var(--ct-art-mask);
  mask-image: var(--ct-art-mask);
}

.hero.ct-dialogue-ready .hero-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  z-index: 2;
  pointer-events: none;
  background: rgba(0,0,0,.005);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);

  --ct-blur-mask: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0,0,0,.3) 30%,
    #000 85%
  );

  -webkit-mask-image: var(--ct-blur-mask);
  mask-image: var(--ct-blur-mask);
}

.hero.ct-dialogue-ready .vtag { grid-area: 1/1/3/2; }
.hero.ct-dialogue-ready .hero-left { grid-area: 3/1; }
.hero.ct-dialogue-ready .hero-right { grid-area: 3/3; }
.hero.ct-dialogue-ready .ct-spotlight { grid-area: 1/3; }

/* ========================================
   07. CHARACTER VOICE / CALENDAR FLIP
======================================== */

.ct-dialogue {
  position: relative;
  grid-area: 2/3;
  place-self: center end;
  width: min(100%,18rem);
  min-width: 0;
  z-index: 2;
  perspective: 900px;
}

.ct-voice-paper {
  position: relative;
  padding: 1rem;
  background: #f4faff;
  color: #233044;
  border: 1px solid #b9ddf5;
  border-top: 4px solid #3fa9ff;
  border-radius: 4px;

  box-shadow:
    0 6px 0 #d4e6f4,
    0 12px 24px #172c4538;

  transform-origin: center top;
  backface-visibility: hidden;
}

.ct-voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid #ccdcea;
  color: #377ba9;
  font: 700 .7rem/1.4 var(--latin);
  letter-spacing: .12em;
}

.ct-voice-text {
  padding: .9rem 0;
  font: 700 clamp(.95rem,1.4vw,1.15rem)/1.85 var(--copy);
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ct-voice-name {
  text-align: right;
  color: #52748e;
  font-size: .8rem;
  overflow-wrap: anywhere;
}

.ct-voice-paper.ct-page-out {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  animation: ct-calendar-out .5s ease-in both;
}

.ct-voice-paper.ct-page-in {
  animation: ct-calendar-in .65s var(--ct-ease) both;
}

@keyframes ct-calendar-out {
  from { transform: rotateX(0); opacity: 1; }
  to { transform: rotateX(-95deg); opacity: 0; }
}

@keyframes ct-calendar-in {
  from { transform: rotateX(85deg); opacity: .25; }
  to { transform: rotateX(0); opacity: 1; }
}

/* ========================================
   08. ARCHIVE CARDS
======================================== */

.page-header .hazard {
  background: linear-gradient(
    90deg,
    #3fa9ff 0 17%,
    #a5d6f8 17% 32%,
    #d4dfe9 32%
  );
  height: 3px;
  position: relative;
}

.page-header .hazard::after {
  content: "";
  position: absolute;
  inset: -1px auto -1px 0;
  width: 12%;
  background: #1d5f94;
  transform-origin: left;
}

.section-title h2 {
  position: relative;
  padding-right: 1.6rem;
}

.section-title h2::after {
  content: "";
  position: absolute;
  right: .5rem;
  top: .5rem;
  width: .28rem;
  height: .28rem;
  background: #8dd9ff;
}

.archive-card { transition: transform .32s var(--ct-ease); }

.card-in {
  position: relative;
  overflow: hidden;
  min-height: 9rem;
}

.archive-image {
  position: relative;
  overflow: hidden;
}

.archive-image img {
  transition: transform .65s var(--ct-ease);
}

.archive-type,
.archive-view { color: #276d9f; }

.archive-view {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.archive-view::before {
  content: "";
  width: 1rem;
  height: 2px;
  background: var(--c);
}

.archive-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* ========================================
   09. SAFE SPIN EFFECT
======================================== */

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

.fx-spin {
  min-width: 0;
  overflow: hidden;
  overflow: clip;
}

.fx-spin .archive-card {
  overflow: hidden;
  isolation: isolate;
  contain: paint;
}

.fx-spin .archive-card::before {
  content: "";
  position: absolute;
  inset: 0 !important;
  width: auto;
  height: auto;
  z-index: -1;
  transform: none !important;

  background: conic-gradient(
    from var(--ct-spin-angle),
    transparent 0%,
    transparent 40%,
    var(--c) 65%,
    #fff 80%,
    var(--c) 95%,
    transparent 100%
  );

  animation: ctBorderLightRotation 4s linear infinite;
  pointer-events: none;
}

@keyframes ctBorderLightRotation {
  from { --ct-spin-angle: 0deg; }
  to { --ct-spin-angle: 360deg; }
}

/* ========================================
   10. CHARACTER / WORLD VIEWER
======================================== */

.viewer {
  background-color: #eff3f7;

  background-image:
    radial-gradient(ellipse at 90% 12%,#d1eaff 0,transparent 50%),
    linear-gradient(#75869c0e 1px,transparent 1px),
    linear-gradient(90deg,#75869c0e 1px,transparent 1px);

  background-size: auto,24px 24px,24px 24px;
}

@supports (color: color-mix(in srgb,white,blue)) {
  .viewer {
    background-image:
      radial-gradient(
        ellipse at 90% 12%,
        color-mix(in srgb,var(--c) 23%,white) 0,
        transparent 50%
      ),
      linear-gradient(#75869c0e 1px,transparent 1px),
      linear-gradient(90deg,#75869c0e 1px,transparent 1px);
  }
}

.v-head {
  align-items: center;
  padding-bottom: .75rem;
  border-bottom: 1px solid #bdcbd9;
}

.ct-view-meta {
  margin-right: auto;
  text-align: left;
  min-width: 0;
}

.ct-view-meta small {
  display: block;
  color: #507089;
  font: 700 .68rem/1.5 var(--latin);
  letter-spacing: .15em;
}

.ct-view-meta strong {
  display: block;
  color: var(--ct-deep);
  font: 700 clamp(1.15rem,2.7vw,1.9rem)/1.15 var(--latin);
}

.ct-view-meta strong::before {
  content: "";
  display: inline-block;
  width: .42em;
  height: .42em;
  margin-right: .4em;
  vertical-align: middle;
  background: var(--c);
}

.v-name { box-shadow: 0 7px 20px #172c4525; }

.v-big {
  color: #334d6533;
  pointer-events: none;
}

.v-scene::before {
  inset: .3rem 0 .25rem 24%;
  clip-path: none;
  background: linear-gradient(145deg,#eff5fa,#cbd8e6);
  border: 1px solid #b6c8da;
}

.v-stand { isolation: isolate; }

.v-stand::after {
  content: "";
  position: absolute;
  inset: .7rem;
  z-index: -1;
  pointer-events: none;
  border: 1px solid #ffffffb8;
  box-shadow: inset 0 0 0 1px #2d6c9e16;
}

.v-info { gap: .8rem; }
.v-sub { background: #23374c; }

.v-desc {
  background: #fffffff2;
  border-left: 3px solid var(--c);
  padding: 1.05rem 1.15rem;
  box-shadow: 0 6px 18px #2d476b0d;
}

.v-desc::before {
  content: "ARCHIVE NOTES";
  display: block;
  margin-bottom: .65rem;
  color: #41718f;
  font: 700 .69rem/1.5 var(--latin);
  letter-spacing: .19em;
}

.v-web { transition: background .2s; }
.v-web:hover { background: #315b7d; }
.v-strip { border-color: #b8c9d9; }

.v-th {
  background: #e6edf5;
  border: 2px solid #acb8c6;
  padding: 0;
  transition: filter .3s,opacity .3s,transform .3s;
}

.v-th.on {
  background: #e6edf5;
  border-color: var(--c);
  box-shadow: 0 0 0 1px var(--c);
}

.viewer[data-kind="worldview"] .v-scene::before { inset: 0; }
.viewer[data-kind="worldview"] .v-id { max-width: 100%; }
.viewer[data-kind="worldview"] .v-stand img { object-position: center; }

/* ========================================
   11. SAFE SPIN VIEWER
======================================== */

#viewer[data-fx="spin"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

#viewer[data-fx="spin"] .v-stage,
#viewer[data-fx="spin"] .v-head,
#viewer[data-fx="spin"] .v-scene,
#viewer[data-fx="spin"] .v-info,
#viewer[data-fx="spin"] .v-strip {
  min-width: 0;
  max-width: 100%;
}

#viewer[data-fx="spin"] .v-stand {
  overflow: hidden;
  contain: paint;
}

.viewer[data-fx="spin"] .v-stand::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(75%,36svh,24rem);
  height: auto;
  aspect-ratio: 1;
  border: 2px dashed var(--c);
  border-radius: 50%;

  box-shadow:
    0 0 14px var(--c),
    inset 0 0 8px var(--c);

  pointer-events: none;
  transform-origin: center;
  animation: ctSafeOrbit 12s linear infinite;
}

@keyframes ctSafeOrbit {
  from { transform: translate(-50%,-50%) rotate(0deg); }
  to { transform: translate(-50%,-50%) rotate(360deg); }
}

.viewer[data-fx="spin"] .v-stand img {
  position: relative;
  z-index: 1;
}

/* ========================================
   12. ADMIN EDIT BUTTON / FORM
======================================== */

.ct-edit-btn { display: none; }

body.admin .ct-edit-btn {
  position: absolute;
  top: .5rem;
  right: 2.85rem;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #acdfff;
  border-radius: 3px;
  background: linear-gradient(135deg,#285e88,#19354f);
  color: #fff;
  font-family: var(--body);
  font-size: .8rem;
  font-weight: 700;

  box-shadow:
    inset 0 -2px 0 #63caff,
    0 2px 8px #00000020;

  transition: background .2s,transform .2s,box-shadow .2s;
}

@media (hover:hover) and (pointer:fine) {
  body.admin .ct-edit-btn:hover {
    background: #3d92c9;
    transform: translateY(-2px);

    box-shadow:
      inset 0 -2px 0 #c1efff,
      0 0 12px #69bfff88;
  }
}

body.admin .ct-edit-btn:active { transform: scale(.93); }
body.admin .fxw .card-in { padding-top: 2.7rem; }
body.admin .nt-head { padding-right: 6.2rem; }

#ct-edit-form small,
#ct-cover-form small,
#ct-illustration-form small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  font-size: .8rem;
}

.modal-box .ct-edit-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem;
  background: #edf4fa;
  border: 1px solid #ccd6e2;
}

.modal-box .ct-edit-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: #298bd3;
}

/* ========================================
   13. DYNAMIC SCROLL / INTERACTIONS
======================================== */

@media (prefers-reduced-motion:no-preference) {

  .reveal {
    transition:
      opacity .58s var(--ct-ease),
      transform .8s var(--ct-ease);
  }

  .archive-grid .reveal {
    transform: translate3d(-20px,24px,0) scale(.975);
  }

  .archive-grid .reveal:nth-child(even) {
    transform: translate3d(20px,24px,0) scale(.975);
  }

  .gallery .reveal {
    transform: translate3d(0,32px,0) scale(.96);
  }

  .nts .reveal { transform: translate3d(0,18px,0); }

  .reveal.in,
  .archive-grid .reveal.in,
  .gallery .reveal.in,
  .nts .reveal.in { transform: none; }

  .ct-reveal {
    opacity: 0;
    transform: translate3d(0,24px,0);
    transition:
      opacity .55s var(--ct-ease),
      transform .8s var(--ct-ease);
  }

  .ct-reveal.ct-in {
    opacity: 1;
    transform: none;
  }

  .ct-reveal .hazard::after {
    transform: scaleX(0);
    transition: transform .8s .15s var(--ct-ease);
  }

  .ct-reveal.ct-in .hazard::after { transform: scaleX(1); }

  .ct-hero-ready .vtag {
    animation: ct-hero-mask .95s var(--ct-ease) both;
  }

  .ct-hero-ready .hero-left {
    animation: ct-hero-rise .95s .08s var(--ct-ease) both;
  }

  .ct-hero-ready .hero-right {
    animation: ct-hero-rise .95s .2s var(--ct-ease) both;
  }

  .ct-hero-ready .ct-spotlight {
    animation: ct-hero-rise .9s .28s var(--ct-ease) both;
  }

  .ct-reveal.ct-in .page-main-title {
    animation: ct-title-wipe .85s var(--ct-ease) both;
  }

  .ct-feature-changed .ct-spot-name {
    animation: ct-label .46s var(--ct-ease) both;
  }

  .ct-pressed { animation: ct-click .36s var(--ct-ease); }

  .hb::after,
  .card-in::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg,transparent,#ffffff3d,transparent);
    transform: translateX(-120%);
  }

  @media (hover:hover) and (pointer:fine) {

    .hb:hover::after,
    .archive-card:hover .card-in::after {
      animation: ct-sweep .65s var(--ct-ease);
    }

    .archive-card:hover { transform: translateY(-3px); }
    .archive-card:hover img { transform: scale(1.055); }

    .v-th:hover {
      opacity: 1;
      filter: none;
      transform: translateY(-2px);
    }
  }
}

@keyframes ct-hero-mask {
  from { clip-path: inset(0 0 100% 0); opacity: 0; }
  to { clip-path: inset(0); opacity: 1; }
}

@keyframes ct-hero-rise {
  from { opacity: 0; transform: translate3d(0,28px,0); }
  to { opacity: 1; transform: none; }
}

@keyframes ct-title-wipe {
  from { clip-path: inset(0 100% 0 0); transform: translateX(-10px); }
  to { clip-path: inset(0); transform: none; }
}

@keyframes ct-label {
  from { opacity: .4; transform: translateX(7px); }
  to { opacity: 1; transform: none; }
}

@keyframes ct-click {
  0%,100% { filter: brightness(1); }
  32% { filter: brightness(1.24); }
}

@keyframes ct-sweep {
  to { transform: translateX(120%); }
}

/* ========================================
   14. RESPONSIVE — PC VIEWER
======================================== */

@media (min-width:850px) {

  .viewer[data-kind="character"] .v-stage {
    grid-template-columns: minmax(0,43fr) minmax(0,57fr);

    grid-template-rows:
      auto
      minmax(12rem,auto)
      minmax(0,1fr)
      auto;
  }

  .viewer[data-kind="character"] .v-stand {
    position: sticky;
    top: 1rem;
    height: clamp(28rem,72svh,62rem);
    border: 1px solid #aec5d9;
    background: radial-gradient(
      ellipse at 45% 38%,
      #fff,
      #d3e0ec 72%,
      #c2d1df
    );
  }

  .viewer[data-kind="character"] .v-stand img { padding: .35rem; }
  .viewer[data-kind="character"] .v-id { padding-top: 6.5rem; }
  .viewer[data-kind="character"] .v-info { margin-top: 1rem; }

  .viewer[data-kind="worldview"] .v-scene {
    grid-template-columns: minmax(0,34fr) minmax(0,66fr);
    grid-template-rows: minmax(26rem,auto);
    align-content: stretch;
    min-height: clamp(28rem,69svh,58rem);
    gap: 1rem;
  }

  .viewer[data-kind="worldview"] .v-stand {
    position: relative;
    inset: auto;
    grid-area: 1/2;
    min-width: 0;
    min-height: 0;
    height: clamp(26rem,69svh,58rem);
  }

  .viewer[data-kind="worldview"] .v-id {
    grid-area: 1/1;
    padding: 1.5rem;
  }

  .viewer[data-kind="worldview"] .v-big {
    top: 12%;
    opacity: .6;
  }
}

@media (max-width:849px) {

  #viewer[data-fx="spin"] .v-stage {
    width: 100%;
    max-width: 100%;
  }
}

/* ========================================
   15. RESPONSIVE — SMALL SCREEN
======================================== */

@media (max-width:760px) {

  .header { gap: .5rem; }

  .ct-sound {
    margin-left: auto;
    padding: .35rem .48rem;
    min-height: 2.4rem;
    font-size: .76rem;
  }

  .hero:not(.ct-dialogue-ready) {
    grid-template-columns: minmax(0,1fr) minmax(0,.7fr);
  }

  .hero-right { width: min(100%,9.5rem); }

  .ct-spotlight {
    width: min(100%,10rem);
    padding: .5rem;
  }

  .ct-feature-top {
    font-size: .58rem;
    letter-spacing: .055em;
    gap: .22rem;
  }

  .ct-feature-controls { gap: .2rem; }

  .ct-feature-controls button {
    min-width: 1.8rem;
    padding: .2rem;
  }

  .ct-feature-controls button:last-child { font-size: .69rem; }
  .hero-left .tag { letter-spacing: .05em; }

  .ct-view-meta small {
    font-size: .58rem;
    letter-spacing: .06em;
  }

  .v-head { gap: .4rem; }
  .v-head h2 { font-size: 1.25rem; }

  #v-back {
    padding: .3rem .45rem;
    font-size: .76rem;
  }

  .v-close {
    width: 2.45rem;
    height: 2.45rem;
  }

  .v-scene::before {
    inset: .3rem 0 .25rem 19%;
  }

  .viewer[data-kind="worldview"] .v-scene {
    grid-template-rows: minmax(14rem,39svh) auto;
    align-content: start;
    gap: .4rem;
  }

  .viewer[data-kind="worldview"] .v-stand {
    position: relative;
    inset: auto;
    grid-area: 1/1;
    min-height: 0;
  }

  .viewer[data-kind="worldview"] .v-id {
    grid-area: 2/1;
    padding: .3rem .55rem .55rem;
  }

  .viewer[data-kind="worldview"] .v-scene::before {
    inset: 0 0 auto;
    height: 39svh;
  }

  .viewer[data-kind="worldview"] .v-big { top: 6%; }
  .card-in { min-height: 0; }
}

@media (max-width:360px) {

  .header .logo small { font-size: 1rem; }
  .ct-sound { font-size: .69rem; }
  .ct-spotlight { padding: .35rem; }
  .ct-feature-top { letter-spacing: 0; }
  .ct-feature-controls button { min-width: 1.55rem; }
  .ct-feature-controls button:last-child { display: none; }
}

/* ========================================
   16. RESPONSIVE — PORTRAIT HOME
======================================== */

@media (max-aspect-ratio:1/1) {

  .hero.ct-dialogue-ready {
    min-height: 0;
    height: auto;
    grid-template-columns: minmax(0,1fr) minmax(0,.78fr);
    grid-template-rows: auto auto auto auto;
    gap: clamp(.65rem,2.1vw,1.4rem);
    padding: clamp(.85rem,3.5vw,2rem) 5vw .75rem;
  }

  .hero.ct-dialogue-ready .vtag {
    grid-area: 1/1;
    align-self: start;
    justify-self: start;
    font-size: clamp(.78rem,3vw,1.28rem);
    line-height: 1.08;
  }

  .hero.ct-dialogue-ready .vtag span:last-child {
    margin-top: .35em;
  }

  .hero.ct-dialogue-ready .ct-spotlight {
    grid-area: 1/2;
    width: min(100%,clamp(9rem,37vw,20rem));
    z-index: 3;
  }

  .hero.ct-dialogue-ready .hero-art {
    position: relative;
    grid-area: 2/1/3/3;
    inset: auto;
    width: 77%;
    height: clamp(16.5rem,86vw,52rem);
    justify-self: end;
    align-self: center;
    transform: none;
  }

  .hero.ct-dialogue-ready .hero-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
  }

  .hero.ct-dialogue-ready .hero-art::after {
    height: 40%;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .hero.ct-dialogue-ready .ct-dialogue {
    grid-area: 2/1;
    width: min(100%,clamp(7.8rem,37vw,22rem));
    justify-self: start;
    align-self: center;
    z-index: 2;
  }

  .hero.ct-dialogue-ready .ct-voice-paper {
    padding: clamp(.55rem,1.4vw,1rem);
  }

  .ct-dialogue .ct-voice-head {
    font-size: clamp(.58rem,1.5vw,.95rem);
    letter-spacing: .04em;
    gap: .2rem;
  }

  .ct-dialogue .ct-voice-text {
    writing-mode: horizontal-tb;
    direction: ltr;
    text-align: left;
    inline-size: auto;
    max-block-size: none;
    margin: .65rem 0;
    padding: 0;
    font-size: clamp(.85rem,2.9vw,1.35rem);
    line-height: 1.8;
    letter-spacing: normal;
    white-space: pre-wrap;
  }

  .ct-dialogue .ct-long-voice .ct-voice-text {
    font-size: clamp(.8rem,2.55vw,1.2rem);
  }

  .ct-dialogue .ct-voice-name {
    font-size: clamp(.68rem,1.9vw,1.05rem);
  }

  .hero.ct-dialogue-ready .hero-left {
    grid-area: 3/1;
    width: min(100%,28rem);
  }

  .hero.ct-dialogue-ready .hero-right {
    grid-area: 3/2;
    width: min(100%,20rem);
  }

  .hero.ct-dialogue-ready .hero-left .hb {
    min-height: clamp(3rem,6.5vw,4.2rem);
  }

  .hero.ct-dialogue-ready .ct-scroll-hint {
    grid-area: 4/1/5/3;
    position: relative;
    left: auto;
    bottom: auto;
    translate: none;
    justify-self: center;
    align-self: center;
    display: grid;
    margin: .1rem 0 0;
    font-size: clamp(.68rem,1.5vw,1rem);
  }

  .hero:not(.ct-dialogue-ready) .ct-scroll-hint {
    grid-area: 3/1/4/-1;
    position: relative;
    left: auto;
    bottom: auto;
    translate: none;
    justify-self: center;
    display: grid;
  }

  .hero .ct-meteor { width: clamp(9rem,43vw,20rem); }

  .hero .ct-meteor:nth-child(1) {
    top: 5%;
    left: -9%;
  }

  .hero .ct-meteor:nth-child(2) {
    top: 14%;
    left: -1%;
  }

  .hero .ct-meteor:nth-child(3) {
    top: 24%;
    left: -5%;
  }
}

/* ========================================
   17. MOTION ACCESSIBILITY
======================================== */

@media (prefers-reduced-motion:reduce) {

  .hero-art,
  .hero.ct-dialogue-ready .hero-art {
    transform: none;
  }

  .ct-reveal {
    opacity: 1;
    transform: none;
  }

  .ct-scroll-hint span,
  .ct-voice-paper,
  .fx-spin .archive-card::before {
    animation: none !important;
  }

  .hero .ct-meteors { display: block; }

  .hero .ct-meteor {
    display: none;
    animation: none !important;
  }
}

/* ========================================
   18. CINEMATIC HOME DISPLAY
======================================== */

.ct-ambient {
  position: absolute;
  inset: 0;
  z-index: -5;
  overflow: hidden;
  pointer-events: none;

  -webkit-mask-image:
    linear-gradient(to bottom,#000 0%,#000 55%,transparent 100%);

  mask-image:
    linear-gradient(to bottom,#000 0%,#000 55%,transparent 100%);
}

.ct-ambient img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: blur(32px) saturate(.85);
  transform: scale(1.15);
  transition: opacity 1.3s ease;
}

.ct-ambient img.on { opacity: .22; }

.hero.ct-dialogue-ready .hero-art {
  inset: 3% 19% 0 16%;
}

.hero.ct-dialogue-ready .hero-art img {
  position: absolute;
  inset: auto auto 0 50%;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  translate: -50% 0;
  transform: scale(1.045);
  transform-origin: center bottom;

  transition:
    opacity 1.3s ease,
    transform 1.5s var(--ct-ease);

  --ct-art-mask: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0,0,0,.7) 4%,
    #000 10%,
    #000 58%,
    rgba(0,0,0,.95) 67%,
    rgba(0,0,0,.65) 80%,
    rgba(0,0,0,.25) 92%,
    transparent 100%
  );

  --ct-side-mask: linear-gradient(
    to right,
    transparent 0%,
    rgba(0,0,0,.7) 7%,
    #000 15%,
    #000 87%,
    rgba(0,0,0,.8) 94%,
    transparent 100%
  );

  -webkit-mask-image: var(--ct-art-mask),var(--ct-side-mask);
  -webkit-mask-composite: source-in;

  mask-image: var(--ct-art-mask),var(--ct-side-mask);
  mask-composite: intersect;
}

.hero.ct-dialogue-ready .hero-art img.on {
  opacity: 1;
  transform: scale(1);
}

@media (max-aspect-ratio:1/1) {

  .hero.ct-dialogue-ready .hero-art {
    inset: auto;
    width: 92%;
    height: clamp(17rem,96vw,54rem);
  }

  .hero.ct-dialogue-ready .hero-art img {
    inset: auto 0 0 auto;
    translate: none;
    object-position: right bottom;
  }

  .ct-ambient img {
    filter: blur(24px) saturate(.85);
  }
}

/* ========================================
   19. WEBTOON ILLUSTRATION / PLAY BUTTON
======================================== */

#viewer.ct-webtoon-ready #v-web {
  display: none !important;
}

.ct-cover-zone {
  width: min(100%,44rem);
  min-width: 0;
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid #b8c9d9;
}

.ct-cover-heading {
  color: #52748e;
  font: 700 .8rem/1.5 var(--latin);
  letter-spacing: .2em;
  margin-bottom: .75rem;
}

.ct-cover-link {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--c);
  border-radius: 5px;
  background: #e4edf5;
  cursor: pointer;
  box-shadow: 0 6px 20px #172c4520;

  transition:
    transform .3s var(--ct-ease),
    box-shadow .3s;
}

.ct-cover-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  object-position: center;

  transition:
    transform .6s var(--ct-ease),
    filter .3s;
}

.ct-cover-link::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;

  background: linear-gradient(
    110deg,
    transparent 25%,
    #ffffff55 50%,
    transparent 75%
  );

  transform: translateX(-130%);
}

@media (hover:hover) and (pointer:fine) {

  .ct-cover-link:hover {
    box-shadow: 0 0 20px var(--c);
  }

  .ct-cover-link:hover img {
    transform: scale(1.045);
    filter: brightness(1.08);
  }

  .ct-cover-link:hover::after {
    animation: ctCoverSweep .85s ease;
  }
}

@keyframes ctCoverSweep {
  to { transform: translateX(130%); }
}

.ct-cover-link:active { transform: scale(.98); }

.ct-play-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  width: 100%;
  min-height: 3.3rem;
  margin-top: .65rem;
  padding: .85rem 1rem;
  border: 1px solid #719ebf;
  border-radius: 4px;
  background: linear-gradient(120deg,#172c45,#285f87);
  color: #fff;
  text-decoration: none;
  font: 700 1rem/1.5 var(--body);

  box-shadow:
    inset 0 -3px var(--c),
    0 5px 14px #172c4525;

  transition: background .25s,transform .25s,box-shadow .25s;
}

.ct-play-link b {
  color: #caedff;
  font-size: .8rem;
  transition: transform .25s;
}

@media (hover:hover) and (pointer:fine) {

  .ct-play-link:hover {
    background: #327fac;
    box-shadow: 0 0 18px #69bfff70;
  }

  .ct-play-link:hover b { transform: translateX(5px); }
}

.ct-play-link:active { transform: scale(.97); }

.ct-cover-admin { display: none; }

body.admin .ct-cover-admin {
  display: block;
  width: 100%;
  margin-top: .75rem;
  padding: .65rem;
  border: 1px dashed #8bb9dc;
  border-radius: 4px;
  background: #fff;
  color: #285e88;
  font-weight: 700;
}

.ct-cover-admin:hover { background: #e5f4ff; }

.ct-cover-zone[hidden],
.ct-cover-link[hidden],
.ct-play-link[hidden],
.ct-cover-admin[hidden] {
  display: none !important;
}

@media (min-width:850px) {

  .viewer[data-kind="character"] .ct-cover-zone {
    grid-area: 5/1/6/-1;
    align-self: start;
  }
}

@media (max-width:760px) {

  .ct-cover-zone { margin-top: 1.2rem; }

  .ct-play-link {
    min-height: 3rem;
    font-size: .95rem;
  }
}

/* ========================================
   20. IMMERSIVE WEBTOON READER
======================================== */

#viewer.ct-webtoon-reading {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #000;
  background-image: none;
}

#viewer.ct-webtoon-reading .v-stage {
  display: none !important;
}

.ct-webtoon-reader {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 0;
  background: #000;
  animation: ctReaderOpen .35s ease both;
}

.ct-reader-head {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ct-reader-content {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  overflow: hidden;
}

.ct-reader-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: contain;
}

.ct-reader-image[hidden] { display: none !important; }

.ct-reader-status {
  padding: 3rem 1rem;
  color: #dbeeff;
  background: #000;
  text-align: center;
}

.ct-reader-status[hidden] { display: none !important; }

.ct-reader-end {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 1.2rem 1rem;
  padding-bottom: max(1.2rem,env(safe-area-inset-bottom));
  margin: 0;
  background: #000;
  text-align: center;
}

.ct-reader-end > span,
.ct-reader-external {
  display: none !important;
}

.ct-reader-back {
  width: min(100%,44rem);
  min-height: 3.2rem;
  padding: .85rem 1rem;
  border: 1px solid #385b78;
  border-radius: 4px;
  background: linear-gradient(135deg,#172c45,#275e87);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 -3px var(--c);
  transition: transform .2s,background .2s;
}

.ct-reader-back:hover { background: #357ca9; }
.ct-reader-back:active { transform: scale(.97); }

@keyframes ctReaderOpen {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   21. CHARACTER ILLUSTRATION CAROUSEL
======================================== */

#viewer.ct-illustrations-on #v-img {
  visibility: hidden !important;
}

.ct-art-carousel {
  position: absolute;
  inset: 0;
  z-index: 2;
  isolation: isolate;
  pointer-events: auto;
}

.ct-art-carousel[hidden] {
  display: none !important;
}

.ct-art-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

#viewer .ct-art-carousel img.ct-art-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  will-change: transform,opacity;
}

/* 일러스트 좌우 전환 컨트롤 */

.ct-art-controls {
  position: absolute;
  left: 50%;
  bottom: .8rem;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  width: max-content;
  max-width: calc(100% - 1rem);
  padding: .4rem;
  z-index: 5;
  border: 1px solid #ffffff65;
  border-radius: 6px;
  background: #172c45df;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 20px #14283d30;
}

.ct-art-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #ffffff55;
  border-radius: 3px;
  background: #ffffff12;
  color: #fff;
  font: 700 1.4rem/1 var(--latin);
  transition: background .2s,transform .2s;
}

.ct-art-arrow:hover { background: #367fae; }
.ct-art-arrow:active { transform: scale(.9); }
.ct-art-arrow:disabled { opacity: .35; }

.ct-art-indicator {
  display: grid;
  justify-items: center;
  gap: .2rem;
  min-width: 4.5rem;
  min-width: 0;
}

.ct-art-count {
  color: #fff;
  font: 700 .75rem/1.2 var(--latin);
  letter-spacing: .12em;
  white-space: nowrap;
}

.ct-art-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .1rem;
}

.ct-art-dot {
  display: grid;
  place-items: center;
  width: 14px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ct-art-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff55;
  transition: background .2s,transform .2s;
}

.ct-art-dot.on::before {
  background: #9cddff;
  transform: scale(1.15);
  box-shadow: 0 0 8px #78cfff;
}

/* 추가 일러스트 관리자 버튼 */

.ct-illustration-admin {
  display: none;
}

body.admin .ct-illustration-admin {
  position: absolute;
  top: .8rem;
  right: .8rem;
  z-index: 10;
  display: block;
  padding: .45rem .7rem;
  border: 1px solid #b7ddf6;
  border-radius: 4px;
  background: #193751ed;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  pointer-events: auto;

  box-shadow: 0 3px 12px #172c4530;
}

.ct-illustration-admin[hidden] {
  display: none !important;
}

.ct-illustration-admin:hover {
  background: #327fab;
}

.ct-extra-list {
  display: grid;
  gap: .55rem;
  margin: 1rem 0;
}

.ct-extra-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem;
  border: 1px solid #c8d8e5;
  background: #f2f7fb;
}

.ct-extra-row img {
  flex: none;
  width: 3.5rem;
  height: 4.5rem;
  object-fit: cover;
}

.ct-extra-row span {
  flex: 1;
  color: #294a66;
  font-size: .85rem;
  font-weight: 700;
}

.ct-extra-delete {
  padding: .35rem .55rem;
  border: 0;
  border-radius: 3px;
  background: #c6404b;
  color: #fff;
  font-size: .75rem;
}

.ct-extra-delete:disabled {
  opacity: .4;
}

@media (max-width:760px) {

  .ct-art-controls {
    bottom: .4rem;
    gap: .25rem;
    padding: .3rem;
  }

  .ct-art-arrow {
    width: 1.75rem;
    height: 1.75rem;
  }

  .ct-art-count {
    font-size: .65rem;
  }

  body.admin .ct-illustration-admin {
    top: .4rem;
    right: .4rem;
    padding: .35rem .45rem;
    font-size: .68rem;
  }
}

/* ========================================
   22. REDUCED MOTION
======================================== */

@media (prefers-reduced-motion:reduce) {

  .ct-ambient img,
  .hero.ct-dialogue-ready .hero-art img,
  .ct-cover-link,
  .ct-cover-img,
  .ct-play-link,
  .ct-art-slide,
  .ct-art-dot::before {
    transition: none !important;
  }

  .hero.ct-dialogue-ready .hero-art img {
    transform: none !important;
  }

  .ct-cover-link::after,
  .ct-webtoon-reader {
    animation: none !important;
  }
     }
