/* The original glyph retains its advance and baseline in every meaning state. */
.glyph { position: relative; isolation: isolate; }
.glyph-face { position: relative; display: block; transition: opacity .12s ease, color .16s ease; }
.glyph-baseline { display: inline-block; width: 0; height: 0; font-size: 0; line-height: 0; vertical-align: baseline; }
.glyph-chunks, .glyph-minecraft, .glyph-object { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; }
.glyph-chunks { color: #d7d5dd; mix-blend-mode: normal; perspective: 620px; perspective-origin: 50% 50%; transform-style: preserve-3d; }
.glyph-block { position: absolute; display: block; background: currentColor; border-radius: 0; opacity: 0; transform-origin: center; backface-visibility: hidden; }
.glyph-minecraft { color: #e5e3ea; transition: opacity .12s ease, color .16s ease; }
.glyph-minecraft text { font-family: 'Community Minecraft'; font-weight: 400; font-style: normal; font-kerning: none; fill: currentColor; text-rendering: geometricPrecision; }
/* Keep the same neutral composited transform before, during and after a reveal.
   Removing the animation must not switch a fractional bitmap back to none. */
.glyph-object { transform: translate3d(0,0,0) scale(1); transition: opacity .18s ease; }
.glyph-icon { position: absolute; display: block; object-fit: contain; opacity: 0; pointer-events: none; user-select: none; -webkit-user-drag: none; transform-origin: 50% 58%; transform: rotate(var(--icon-tilt, 0deg)) scaleX(var(--icon-flip, 1)); transition: opacity .18s ease, filter .18s ease; }
.glyph-placeholder { position: absolute; display: grid; place-items: center; box-sizing: border-box; width: clamp(28px,.33em,60px); aspect-ratio: 1; border: 1px solid #ffffff28; border-radius: 25%; background: #ffffff08; color: #a4a3ad; transform: translate(-50%,-50%); opacity: 1; transition: opacity .18s ease; }
.glyph-placeholder svg { width: 48%; height: 48%; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.glyph.icon-ready .glyph-icon { opacity: 1; }
.glyph.icon-ready .glyph-placeholder { opacity: 0; }
#hero[data-hero-boot='pending'] .glyph-object { opacity: 0; }

/* Locked means an image, never a letter. The static face is only the no-JS fallback. */
.glyph.is-locked .glyph-face, .glyph.is-transforming .glyph-face, .glyph.is-encrypting .glyph-face { opacity: 0; }
.glyph.is-locked .glyph-object { opacity: 1; }
/* Hover belongs to the inner bitmap, so it still responds during the entrance. */
.glyph.is-locked.icon-ready.is-image-active .glyph-icon,
.glyph.is-locked.is-image-active .glyph-placeholder { opacity: .86; }
/* The extra five percent affects only the loaded bitmap's colour channels. */
.glyph.is-locked.icon-ready.is-image-active .glyph-icon { filter: brightness(.95); }
.glyph.is-locked.icon-ready.is-image-active .glyph-placeholder { opacity: 0; }
.glyph.is-unlocked .glyph-face { opacity: 1; }
.glyph.minecraft-ready.is-unlocked.is-active .glyph-face { opacity: 0; }
.glyph.minecraft-ready.is-unlocked.is-active .glyph-minecraft { opacity: 1; }
.glyph.is-unlocked.is-active .glyph-face,
.glyph.is-unlocked.is-active .glyph-minecraft { color: var(--violet, #b7a0eb); }
.glyph:focus-visible { outline: none; }
.glyph:focus-visible::after { content: ''; position: absolute; left: 17%; right: 17%; bottom: .01em; height: 3px; border-radius: 2px; background: #d9c9f5; }

/* One finite acknowledgement, only after all nine letters have settled.
   The measured face and baseline never transform. A decorative duplicate
   carries the tiny hop and samples a single gradient in word coordinates. */
.glyph-completion { position: absolute; inset: 0; display: none; pointer-events: none; }
.glyph-completion-ink { display: block; width: 100%; height: 100%; font: inherit; letter-spacing: inherit; color: var(--ink, #f5f5f7); }
.hero.is-word-celebrating .glyph-completion { display: block; }
.hero.is-word-celebrating .glyph-face,
.hero.is-word-celebrating .glyph-minecraft { visibility: hidden; }
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .glyph-completion-ink {
    background-color: var(--ink, #f5f5f7);
    /* A broad pastel reflection with long milk-white shoulders. The feather is
       in the colour field, so the ordinary glyph edges remain perfectly crisp. */
    background-image: linear-gradient(90deg,
      var(--ink, #f5f5f7) 0%, var(--ink, #f5f5f7) 6%,
      #f3edf5 18%, #edc8e6 34%, #dec9ef 48%,
      #f1d0e4 62%, #cad7f3 76%, #eff1f7 88%,
      var(--ink, #f5f5f7) 96%, var(--ink, #f5f5f7) 100%);
    background-size: var(--word-sweep-width, 0px) 100%;
    background-repeat: no-repeat;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* Entry is a quiet left-to-right sequence; loading changes only its inner image. */
.glyph.is-entering.is-locked .glyph-object { animation: hero-image-intro var(--image-intro-duration,550ms) var(--start-delay) cubic-bezier(.22,.61,.36,1) both; }
.glyph.is-entering.is-unlocked .glyph-face { animation: hero-letter-intro var(--image-intro-duration,550ms) var(--start-delay) cubic-bezier(.42,0,.58,1) both; }
/* Ordinary intro ink fades at its own slot's time without transforming the
   measured face/baseline. Initial letters cannot move the optical key anchor. */
@keyframes hero-letter-intro { from { opacity: 0; } to { opacity: 1; } }
@keyframes hero-image-intro {
  0% { opacity: 0; transform: translateY(.04em) scale(.9); }
  76% { opacity: 1; transform: translateY(-.003em) scale(1.008); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.glyph.is-denying .glyph-object { animation: hero-image-deny var(--deny-duration,440ms) cubic-bezier(.32,.08,.33,1) both; }
@keyframes hero-image-deny {
  0%, 100% { transform: translateX(0) rotate(0); }
  19% { transform: translateX(clamp(-5px,-.025em,-2px)) rotate(-2deg); }
  42% { transform: translateX(clamp(2px,.023em,4.5px)) rotate(1.8deg); }
  65% { transform: translateX(clamp(-3px,-.014em,-1px)) rotate(-.9deg); }
  83% { transform: translateX(1px) rotate(.35deg); }
}

/* The original three to seven filled macro-pixels — no cut glyphs or cloud. */
.glyph.is-transforming, .glyph.is-encrypting { z-index: 3; }
.glyph.is-transforming .glyph-object { animation: hero-unlock-object var(--unlock-duration) cubic-bezier(.24,.75,.25,1) both; }
.glyph.is-transforming .glyph-face { animation: hero-unlock-face var(--unlock-duration) linear both; }
.glyph.is-transforming .glyph-minecraft, .glyph.is-encrypting .glyph-minecraft { opacity: 0; transition: none; animation: none; }
.glyph.is-transforming .glyph-chunks { opacity: 1; animation: hero-unlock-ink var(--unlock-duration) linear both, hero-unlock-composite var(--unlock-duration) linear both; }
.glyph.is-transforming .glyph-block { animation: hero-unlock-stroke var(--unlock-duration) cubic-bezier(.24,.66,.24,1) both; }
@keyframes hero-unlock-object {
  0%, 8% { opacity: 1; transform: translateY(0) scale(1); }
  29%, 100% { opacity: 0; transform: translateY(.01em) scale(.76); }
}
@keyframes hero-unlock-stroke {
  0%, 14% { opacity: 0; transform: translate3d(0,0,0) scale(.78); }
  30%, 40% { opacity: 1; transform: translate3d(var(--split-x),var(--split-y),var(--split-z)) rotate(var(--split-rotate)); }
  56% { opacity: 1; transform: translate3d(calc(var(--split-x) * .32),calc(var(--split-y) * .32),0) rotate(0); }
  66% { opacity: 1; transform: translate3d(0,0,0) rotate(0); animation-timing-function: cubic-bezier(.42,0,.58,1); }
  96%, 100% { opacity: 0; transform: translate3d(0,0,0) rotate(0); }
}
/* Settle first, then hand off to normal ink with one complementary 288ms curve.
   The isolated additive crossfade is used ONLY after every block is stationary.
   Switching at face=0 / pixels=1 with matching colour is visually neutral;
   moving perspective layers never run through additive blending. Browsers
   without plus-lighter retain the same stationary crossfade. */
@keyframes hero-unlock-face {
  0%, 66% { opacity: 0; animation-timing-function: cubic-bezier(.42,0,.58,1); }
  96%, 100% { opacity: 1; }
}
@keyframes hero-unlock-ink {
  0%, 40% { color: #d7d5dd; }
  66%, 100% { color: var(--ink, #f5f5f7); }
}
@keyframes hero-unlock-composite {
  0% { mix-blend-mode: normal; animation-timing-function: steps(1, end); }
  66%, 100% { mix-blend-mode: plus-lighter; }
}

/* A letter can be encoded by the key or by a direct click. Only the key decodes. */
.glyph.is-encrypting .glyph-face { animation: hero-encrypt-face var(--encrypt-duration) linear both; }
.glyph.is-encrypting.is-pixel-origin { --encode-start-opacity: 1; --encode-start-color: var(--violet, #b7a0eb); }
.glyph.is-encrypting.is-pixel-origin .glyph-face { opacity: 0; transition: none; animation: none; }
.glyph.is-encrypting .glyph-chunks { opacity: 1; animation: hero-encrypt-ink var(--encrypt-duration) linear both; }
.glyph.is-encrypting .glyph-block { animation: hero-encrypt-stroke var(--encrypt-duration) cubic-bezier(.24,.66,.24,1) both; }
.glyph.is-encrypting .glyph-object { animation: hero-encrypt-object var(--encrypt-duration) cubic-bezier(.2,.8,.22,1) both; }
@keyframes hero-encrypt-face { 0% { opacity: 1; } 20%, 100% { opacity: 0; } }
@keyframes hero-encrypt-stroke {
  0% { opacity: var(--encode-start-opacity,0); transform: translate3d(0,0,0) rotate(0); }
  12% { opacity: 1; transform: translate3d(0,0,0) rotate(0); }
  37%, 49% { opacity: 1; transform: translate3d(var(--split-x),var(--split-y),var(--split-z)) rotate(var(--split-rotate)); }
  63% { opacity: .7; transform: translate3d(0,0,0) rotate(0); }
  79%, 100% { opacity: 0; transform: translate3d(0,0,0) scale(.82); }
}
@keyframes hero-encrypt-object {
  0%, 56% { opacity: 0; transform: translate3d(0,.02em,0) scale(.82); }
  88%, 100% { opacity: 1; transform: translate3d(0,0,0) scale(1); }
}
/* The returned bitmap is already still for the last 96ms. No late overshoot
   or resize remains for the timer/class cleanup to cut off. A lavender hover source
   also begins its coarse pixels in the same ink, then rejoins the neutral set. */
@keyframes hero-encrypt-ink {
  0% { color: var(--encode-start-color, #d7d5dd); }
  37%, 100% { color: #d7d5dd; }
}

/* One quiet, light message bubble. The lock is a small inset, not a second card. */
#letter-menu[hidden], #letter-menu-lock[hidden] { display: none !important; }
#letter-menu {
  position: fixed; z-index: 100; box-sizing: border-box;
  display: flex; align-items: center; gap: 11px;
  width: 310px; max-width: calc(100vw - 32px); padding: 13px;
  border: 1px solid #ffffffc7; border-radius: 22px;
  background: linear-gradient(145deg,#fffffff7,#f1f1f7f0); color: #25252b;
  box-shadow: 0 12px 34px #00000024, inset 0 1px 0 #ffffffa6;
  backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  font-family: var(--font, 'Raleway', Arial, sans-serif); line-height: 1.4; color-scheme: light;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
#letter-menu-lock { flex: 0 0 40px; height: 42px; display: grid; place-items: center; border: 1px solid #d3d0dd80; border-radius: 13px; color: #73717e; background: #e7e5edb3; box-shadow: inset 0 1px 0 #ffffffa6; }
#letter-menu-lock svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
#letter-menu-body { flex: 1; min-width: 0; padding: 0; overflow-wrap: anywhere; }
#letter-menu-title { margin: 0; color: #25252b; font-size: 16px; font-weight: 650; line-height: 1.35; letter-spacing: -.025em; }
#letter-menu[data-state='locked'] #letter-menu-title { white-space: normal; }
#letter-menu-caption { margin: 4px 0 0; color: #62626c; font-size: 14px; font-weight: 450; line-height: 1.4; letter-spacing: 0; }
/* JS anchors this actual corner to the object's ink centre. No extra tail and
   no translateX(-50%) can turn the placement back into a centred popover. */
#letter-menu[data-corner='bottom-right'] { border-bottom-right-radius: 7px; }
#letter-menu[data-corner='top-right'] { border-top-right-radius: 7px; }
#letter-menu[data-corner='bottom-left'] { border-bottom-left-radius: 7px; }
#letter-menu[data-corner='top-left'] { border-top-left-radius: 7px; }
@media (max-width: 600px) {
  #letter-menu { width: 300px; gap: 10px; padding: 12px; }
  #letter-menu-lock { flex-basis: 38px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero.is-word-celebrating .glyph-completion { display: none; }
  .hero.is-word-celebrating .glyph-face { visibility: visible; }
  .glyph-face, .glyph-minecraft, .glyph-object, .glyph-icon, .glyph-placeholder, .glyph-chunks, .glyph-block, #letter-menu { animation: none !important; transition: none !important; }
  .glyph.is-entering .glyph-object, .glyph.is-denying .glyph-object { transform: none; }
  .glyph.is-transforming .glyph-face { opacity: 1 !important; }
  .glyph.is-transforming .glyph-object, .glyph.is-encrypting .glyph-face,
  .glyph.is-transforming .glyph-minecraft, .glyph.is-encrypting .glyph-minecraft,
  .glyph.is-transforming .glyph-chunks, .glyph.is-encrypting .glyph-chunks { opacity: 0 !important; }
  .glyph.is-encrypting .glyph-object { opacity: 1 !important; }
}
