/* ═══════════════════════════════════════════════════════════
   WORD TRAIL — Unlock Category
   15-second story mode · Film-grade visuals
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   ROOT OVERLAY
   ───────────────────────────────────────────── */
#uc-root {
  position: absolute;
  inset: 0;
  z-index: 500;
  overflow: hidden;
  pointer-events: none;
  display: none;
  font-family: 'Nunito', sans-serif;
}
#uc-root.uc-active {
  display: block;
  pointer-events: all;
}

/* ═══════════════════════════════════════════════
   PHASE 1 — STORY CINEMATIC
   ═══════════════════════════════════════════════ */
#uc-story {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.25, 0, 0.15, 1);
}
#uc-story.uc-story-visible { display: flex; }
#uc-story.uc-story-in      { opacity: 1; }
#uc-story.uc-story-out     { opacity: 0; transition-duration: 0.55s; }

#uc-story-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.uc-letterbox-top,
.uc-letterbox-bot {
  position: absolute;
  left: 0; right: 0;
  background: #000;
  z-index: 3;
  transition: height 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  height: 0;
}
.uc-letterbox-top { top: 0; }
.uc-letterbox-bot { bottom: 0; }
#uc-story.uc-story-in .uc-letterbox-top,
#uc-story.uc-story-in .uc-letterbox-bot { height: 58px; }
#uc-story.uc-story-out .uc-letterbox-top,
#uc-story.uc-story-out .uc-letterbox-bot { height: 0; }

.uc-grain-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  animation: ucGrainShift 0.08s steps(1) infinite;
}
@keyframes ucGrainShift {
  0%   { background-position: 0 0; }
  25%  { background-position: -30px -45px; }
  50%  { background-position: 22px 18px; }
  75%  { background-position: -14px 30px; }
  100% { background-position: 8px -22px; }
}

.uc-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 80% at 50% 50%,
    transparent 45%, rgba(0,0,0,0.72) 100%);
}

.uc-scanline-h {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  z-index: 4;
  background: linear-gradient(90deg,
    transparent 0%, rgba(255,255,255,0.055) 20%,
    rgba(255,255,255,0.16) 50%,
    rgba(255,255,255,0.055) 80%, transparent 100%);
  pointer-events: none;
  animation: ucScanH 12s linear infinite;
}
@keyframes ucScanH {
  from { top: 105%; opacity: 0.6; }
  to   { top: -2px; opacity: 0; }
}

.uc-chapter-label {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 8.5px;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.28);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  animation: ucFadeIn 0.8s ease 1.2s forwards;
  font-family: 'Cinzel', serif;
}

.uc-progress-track {
  position: absolute;
  bottom: 72px;
  left: 28px;
  right: 28px;
  height: 1.5px;
  background: rgba(255,255,255,0.07);
  z-index: 10;
  border-radius: 1px;
  overflow: hidden;
  opacity: 0;
  animation: ucFadeIn 0.5s ease 1.8s forwards;
}
.uc-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(255,255,255,0.6));
  border-radius: 1px;
  transition: width 0.15s linear;
}

.uc-progress-seg {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 5px;
  background: rgba(255,255,255,0.18);
}

#uc-story-text {
  position: absolute;
  bottom: 100px;
  left: 28px;
  right: 28px;
  z-index: 10;
  text-align: left;
}

.uc-beat-label {
  font-size: 8px;
  letter-spacing: 3.5px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
  margin-bottom: 10px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.uc-beat-label.visible { opacity: 1; transform: translateX(0); }

.uc-story-title {
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1.5px;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  text-shadow: 0 2px 40px rgba(255,255,255,0.2);
}
.uc-story-title.visible { opacity: 1; transform: translateY(0); }

.uc-story-divider {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.45), transparent);
  margin: 12px 0;
  opacity: 0;
  transition: opacity 0.4s ease 0.2s, width 0.6s ease 0.2s;
  width: 0;
}
.uc-story-divider.visible { opacity: 1; width: 32px; }

.uc-story-line {
  font-size: 12.5px;
  color: rgba(255,255,255,0.5);
  line-height: 1.85;
  font-weight: 300;
  letter-spacing: 0.3px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease 0.25s, transform 0.5s ease 0.25s;
}
.uc-story-line.visible { opacity: 1; transform: translateY(0); }

.uc-cat-reveal-name {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.88);
  z-index: 10;
  font-family: 'Cinzel', serif;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  text-shadow:
    0 0 60px rgba(255,255,255,0.25),
    0 0 120px rgba(255,255,255,0.08);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.uc-cat-reveal-name.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.uc-cat-reveal-name.hide {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.08);
  transition-duration: 0.5s;
}

.uc-story-skip {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 12;
  font-size: 9px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
  cursor: pointer;
  padding: 12px 16px;
  opacity: 0;
  animation: ucFadeIn 0.5s ease 3s forwards;
  transition: color 0.2s;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
}
.uc-story-skip:active { color: rgba(255,255,255,0.65); }

.uc-story-dots {
  position: absolute;
  bottom: 48px;
  left: 28px;
  display: flex;
  gap: 6px;
  z-index: 10;
  opacity: 0;
  animation: ucFadeIn 0.5s ease 2s forwards;
}
.uc-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transition: background 0.4s, transform 0.35s, width 0.35s;
}
.uc-dot.active {
  width: 14px;
  border-radius: 2px;
  background: rgba(255,255,255,0.8);
}

/* ═══════════════════════════════════════════════
   CANVAS PARTICLE LAYER
   ═══════════════════════════════════════════════ */

.uc-tap-hint {
  position: absolute;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: rgba(255,255,255,0.16);
  letter-spacing: 2.5px;
  z-index: 10;
  opacity: 0;
  animation: ucFadeIn 0.4s ease 4s forwards, ucTapPulse 2.2s ease-in-out 4s infinite;
  white-space: nowrap;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
}
@keyframes ucTapPulse {
  0%,100% { opacity: 0.16; }
  50%     { opacity: 0.4; }
}


/* ═══════════════════════════════════════════════
   PHASE 2 — UNLOCK PANEL
   ═══════════════════════════════════════════════ */
#uc-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--zen-bg, #131825);
  opacity: 1;
}
#uc-panel.uc-panel-visible { display: flex; }

.uc-panel-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 38%,
      rgba(var(--accent-rgb),0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 38%,
      rgba(var(--accent-rgb),0.04) 0%, transparent 60%);
  animation: ucGlowPulse 4s ease-in-out infinite;
}
@keyframes ucGlowPulse {
  0%,100% { opacity: 0.6; }
  50%     { opacity: 1; }
}

.uc-path-row {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 48px);
  left: 16px; right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.6s ease 2.2s;
}
#uc-panel.uc-panel-visible .uc-path-row { opacity: 1; }

.uc-path-node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.uc-path-node-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.uc-path-node-dot.done {
  background: var(--zen-jade, #5fa882);
  box-shadow: 0 0 6px rgba(var(--accent-rgb),0.6);
}
.uc-path-node-dot.new {
  background: var(--zen-gold, #c9a84c);
  box-shadow: 0 0 10px rgba(201,168,76,0.75);
  animation: ucDotPulse 1.2s ease-in-out infinite;
}
.uc-path-node-dot.locked {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}
@keyframes ucDotPulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.5); }
}
.uc-path-connector {
  width: 16px; height: 1px; margin-bottom: 12px; flex-shrink: 0;
  background: rgba(255,255,255,0.08);
}
.uc-path-connector.done   { background: linear-gradient(90deg, var(--zen-jade,#5fa882), rgba(255,255,255,0.1)); }
.uc-path-connector.active { background: linear-gradient(90deg, var(--zen-jade,#5fa882), var(--zen-gold,#c9a84c)); }
.uc-path-node-lbl {
  font-size: 7px; color: rgba(255,255,255,0.28);
  letter-spacing: 0.3px; max-width: 32px;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; text-align: center;
}

.uc-panel-nav {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 0; right: 0; text-align: center; z-index: 10;
  opacity: 0;
  transition: opacity 0.5s ease 1.4s;
}
#uc-panel.uc-panel-visible .uc-panel-nav { opacity: 1; }
.uc-panel-nav-title {
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: 4px;
  color: rgba(255,255,255,0.22);
  text-transform: uppercase;
}

.uc-track {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.uc-cat-card {
  position: absolute;
  width: calc(100% - 48px);
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.uc-cat-card.uc-card-out {
  animation: ucCardOut 0.65s cubic-bezier(0.4,0,0.6,1) forwards;
}
@keyframes ucCardOut {
  0%   { transform: translateX(0);     opacity: 1; }
  100% { transform: translateX(-120%); opacity: 0; }
}

.uc-cat-card.uc-card-in {
  transform: translateX(120%); opacity: 0;
  animation: ucCardIn 0.7s cubic-bezier(0.16,1,0.3,1) 0.45s forwards;
}
@keyframes ucCardIn {
  0%   { transform: translateX(120%); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: translateX(0);    opacity: 1; }
}

.uc-card-icon-wrap {
  width: 96px; height: 96px;
  border-radius: 28px;
  background: linear-gradient(145deg,
    rgba(var(--accent-rgb),0.14) 0%, rgba(var(--accent-rgb),0.04) 100%);
  border: 1.5px solid rgba(var(--accent-rgb),0.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: var(--zen-jade, #5fa882);
  margin-bottom: 22px;
  position: relative;
  box-shadow:
    0 0 0 0 rgba(95,168,130,0),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
.uc-card-in .uc-card-icon-wrap {
  animation: ucIconPulse 0.9s ease 1.1s both;
}
@keyframes ucIconPulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--accent-rgb),0.5); transform: scale(1); }
  35%  { box-shadow: 0 0 0 22px rgba(var(--accent-rgb),0); transform: scale(1.1); }
  60%  { transform: scale(0.95); }
  80%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes ucCatIconReveal {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.uc-lock-overlay {
  position: absolute; inset: 0; border-radius: 28px;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: rgba(255,255,255,0.5);
  animation: ucLockShatter 0.5s ease 1.25s forwards;
}
@keyframes ucLockShatter {
  0%   { opacity: 1; transform: scale(1)    rotate(0deg); filter: blur(0); }
  40%  { opacity: 1; transform: scale(1.22) rotate(-10deg); }
  65%  { opacity: 0.3; transform: scale(1.32) rotate(7deg); filter: blur(2px); }
  100% { opacity: 0; transform: scale(1.6)  rotate(-16deg); filter: blur(4px); }
}

.uc-unlock-burst {
  position: absolute; inset: -12px;
  border-radius: 50%;
  border: 1.5px solid var(--zen-jade, #5fa882);
  pointer-events: none; opacity: 0;
  animation: ucBurstRing 0.6s ease 1.3s forwards;
}
.uc-unlock-burst2 {
  border-color: var(--zen-gold, #c9a84c);
  animation-delay: 1.48s;
  inset: -6px;
}
.uc-unlock-burst3 {
  border-color: rgba(255,255,255,0.22);
  animation-delay: 1.62s;
  inset: -20px;
}
@keyframes ucBurstRing {
  0%   { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

.uc-card-new-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 8.5px; font-weight: 700; letter-spacing: 2.5px;
  color: var(--zen-gold, #c9a84c);
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0;
  animation: ucSlideUp 0.45s cubic-bezier(0.16,1,0.3,1) 1.6s both;
  font-family: 'Cinzel', serif;
}

.uc-card-name {
  font-family: 'Cinzel', serif;
  font-size: 28px; font-weight: 700;
  color: #fff; text-align: center;
  letter-spacing: 3px; margin-bottom: 10px;
  opacity: 0;
  animation: ucSlideUp 0.55s cubic-bezier(0.16,1,0.3,1) 1.72s both;
  text-shadow: 0 0 40px rgba(255,255,255,0.12);
}

.uc-card-desc {
  font-size: 12.5px; color: rgba(255,255,255,0.38);
  text-align: center; line-height: 1.7;
  max-width: 250px; margin-bottom: 12px;
  opacity: 0;
  animation: ucFadeIn 0.5s ease 1.9s both;
  font-weight: 300; letter-spacing: 0.2px;
}

.uc-card-words-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--icon-accent-color);
  margin-bottom: 32px;
  opacity: 0;
  animation: ucFadeIn 0.4s ease 2.0s both;
  letter-spacing: 0.3px;
}

.uc-play-btn {
  width: 100%; max-width: 240px; height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg,
    var(--zen-play-start, #5fa882) 0%,
    var(--zen-play-end,   #3d7a60) 100%);
  border: none; color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow:
    0 6px 28px var(--zen-play-shadow, rgba(95,168,130,0.35)),
    0 1px 0 rgba(255,255,255,0.1) inset;
  opacity: 0;
  animation: ucSlideUp 0.55s cubic-bezier(0.16,1,0.3,1) 2.15s both;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.uc-play-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: ucBtnSheen 3s ease 3s infinite;
}
@keyframes ucBtnSheen {
  from { left: -100%; }
  to   { left: 200%; }
}
.uc-play-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 12px var(--zen-play-shadow, rgba(95,168,130,0.25));
}


/* ═══════════════════════════════════════════════
   SHARED KEYFRAMES
   ═══════════════════════════════════════════════ */
@keyframes ucFadeIn  {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ucSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}