*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
}

body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.8rem;
  color: #555;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Full-page gradient background layers ── */
.bg-layer {
  position: fixed;
  inset: 0;
  transition: opacity 2s ease;
  will-change: opacity, background-position, background-size;
}

/* ── Scrim ── */
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.08);
  mix-blend-mode: multiply;
}

/* ── Gradient morph animation ── */
@keyframes morph {
  0%   { background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 50% 50%; }
  25%  { background-position: 100% 0%, 100% 100%, 0% 100%, 0% 0%, 30% 70%; }
  50%  { background-position: 100% 100%, 0% 100%, 0% 0%, 100% 0%, 70% 30%; }
  75%  { background-position: 0% 100%, 0% 0%, 100% 0%, 100% 100%, 60% 60%; }
  100% { background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 50% 50%; }
}

/* ── Page content ── */
.page {
  position: relative;
  height: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 16px;
  gap: 12px;
}

@media (min-width: 640px) {
  .page {
    padding: 20px 24px;
    gap: 16px;
  }
}

/* ── Top bar ── */
.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .top-bar {
    gap: 12px;
    flex-wrap: nowrap;
  }
}

.top-bar .title {
  flex: 1;

  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 2s ease;
}
.top-bar .title:hover {
  color: var(--font-color, #f0f0f0) !important;
}

.top-bar .nav {
  flex: 2;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.top-bar .nav a, .top-bar .nav span {
  font-size: 0.6rem;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  transition: opacity 0.2s ease, border-color 2s ease, background 2s ease;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
  color: var(--font-color, #f0f0f0);
}

@media (min-width: 640px) {
  .top-bar .nav a, .top-bar .nav span {
    font-size: 0.65rem;
    padding: 6px 14px;
  }
}

.top-bar .nav span.disabled {
  opacity: 0.2;
  pointer-events: none;
}

.top-bar .nav .latest {
  padding: 4px 8px;
}

@media (min-width: 640px) {
  .top-bar .nav .latest {
    padding: 6px 10px;
  }
}

.top-bar .counter {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  transition: color 2s ease;
}

@media (min-width: 640px) {
  .top-bar .counter {
    font-size: 0.6rem;
  }
}

.top-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.top-right .nav-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  border-radius: 6px;
  padding: 4px 8px;
  text-decoration: none;
  width: 1.75rem;
  margin-left: .5rem;
}

@media (min-width: 640px) {
  .top-right .nav-sound {
    padding: 6px 10px;
  }
}

/* ── Stage ── */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 12px;
  overflow: hidden;
}

@media (min-width: 640px) {
  .stage {
    padding: 0 48px;
  }
}

.haiku-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.haiku-stage .word {
  display: inline-block;
  font-size: clamp(1.2rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
  animation-delay: 0.2s;
  transition: color 1.2s ease;
  border-bottom: .5px solid transparent;
  transition: letter-spacing 2s ease, color 2s ease;
}
.haiku-stage .word:hover {
  letter-spacing: 0.1em;
}

@media (min-width: 640px) {
  .haiku-stage .word {
    font-size: clamp(1.6rem, 4.5vw, 3rem);
  }
}

.haiku-stage .phonetic {
  font-size: clamp(.5rem, 1vw, 1rem);
  text-wrap-style: balance;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.5s;
  transition: color 2s ease;
}

@media (min-width: 640px) {
  .haiku-stage .phonetic {
    font-size: clamp(.5rem, 0.75vw, .75rem);
    margin-bottom: 8px;
  }
}

.haiku-stage .definition {
  font-size: clamp(.5rem, 1vw, 1rem);
  text-wrap-style: balance;
  line-height: 1.5;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
  animation-delay: 0.8s;
  transition: color 2s ease;
}

@media (min-width: 640px) {
  .haiku-stage .definition {
    font-size: clamp(.5rem, 0.75vw, .75rem);
    line-height: 1.6;
    margin-bottom: 36px;
  }
}

.haiku-stage .lines {
  line-height: 1.8;
  transition: color 2s ease, text-shadow 2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
}

@media (min-width: 640px) {
  .haiku-stage .lines {
    line-height: 2;
  }
}

.haiku-stage .line {
  display: block;
  font-size: clamp(1.1rem, 5vw, 2.8rem);
  opacity: 0;
  transform: translateY(12px);
  text-wrap-style: balance;
}

@media (min-width: 640px) {
  .haiku-stage .line {
    white-space: nowrap;
    font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  }
}

.haiku-stage .line.l1 { animation: fadeUp 0.7s 0.5s ease forwards; }
.haiku-stage .line.l2 { animation: fadeUp 0.7s 1.2s ease forwards; }
.haiku-stage .line.l3 { animation: fadeUp 0.7s 1.9s ease forwards; }

.haiku-stage .sep {
  display: block;
  font-size: 0.4em;
  margin: 2px 0;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
}

@media (min-width: 640px) {
  .haiku-stage .sep {
    margin: 4px 0;
  }
}
.haiku-stage .sep:nth-of-type(1) { animation-delay: 0.9s; }
.haiku-stage .sep:nth-of-type(2) { animation-delay: 1.6s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Bottom ── */
.bottom-bar {
  flex-shrink: 0;
  padding: 0 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

@media (min-width: 640px) {
  .bottom-bar {
    gap: 10px;
  }
}

.bottom-bar .signature {
  font-size: clamp(0.45rem, 3vw, .55rem);
  line-height: 1.5;
  font-style: italic;
  margin-top: 20px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
  animation-delay: 2.8s;
  transition: color 2s ease;
}

@media (min-width: 640px) {
  .bottom-bar .signature {
    font-size: clamp(0.55rem, 3vw, .75rem);
    line-height: 1.6;
    margin-top: 32px;
  }
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-link {
  font-size: 0.5rem;
  text-decoration: none;
  letter-spacing: 0.06em;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
  animation-delay: 3.8s;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 2s ease;
}

@media (min-width: 640px) {
  .font-link {
    font-size: 0.55rem;
  }
}

.font-link:hover {
  border-bottom-color: currentColor;
}



.swatches {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .swatches {
    gap: 6px;
    flex-wrap: nowrap;
  }
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

@media (min-width: 640px) {
  .swatch {
    gap: 4px;
  }
}

.swatch-color {
  width: 32px;
  height: 6px;
  border-radius: 3px;
  opacity: 0;
  animation: scaleIn 0.5s ease forwards;
}

@media (min-width: 640px) {
  .swatch-color {
    width: 48px;
    height: 8px;
    border-radius: 4px;
  }
}

.swatch:nth-child(1) .swatch-color { animation-delay: 3.0s; }
.swatch:nth-child(2) .swatch-color { animation-delay: 3.15s; }
.swatch:nth-child(3) .swatch-color { animation-delay: 3.3s; }
.swatch:nth-child(4) .swatch-color { animation-delay: 3.45s; }
.swatch:nth-child(5) .swatch-color { animation-delay: 3.6s; }

.swatch-hex {
  font-size: 0.45rem;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
  transition: color 2s ease;
}

@media (min-width: 640px) {
  .swatch-hex {
    font-size: 0.5rem;
    letter-spacing: 0.06em;
  }
}

.swatch:nth-child(1) .swatch-hex { animation-delay: 3.1s; }
.swatch:nth-child(2) .swatch-hex { animation-delay: 3.25s; }
.swatch:nth-child(3) .swatch-hex { animation-delay: 3.4s; }
.swatch:nth-child(4) .swatch-hex { animation-delay: 3.55s; }
.swatch:nth-child(5) .swatch-hex { animation-delay: 3.7s; }

@keyframes scaleIn {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

/* ── Meta link ── */
.meta-link {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  font-size: 0.55rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
  animation-delay: 4s;
}

@media (min-width: 640px) {
  .meta-link {
    bottom: 20px;
    right: 24px;
    font-size: 0.6rem;
  }
}

.meta-link:hover {
  border-color: currentColor;
}
