.app[data-scene="lantern-grid"] .visual-shell,
.app[data-scene="lantern-grid"] .energy-control {
  display: none;
}

.lantern-grid-shell {
  position: relative;
  min-height: clamp(500px, 62vw, 720px);
  margin-top: 18px;
  border: 1px solid rgba(255, 192, 93, 0.4);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--lantern-scan-x, 50%) 46%, rgba(255, 224, 138, 0.2), transparent 28%),
    linear-gradient(180deg, #080706 0%, #11100f 48%, #08090b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 0 46px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

.lantern-grid-shell[hidden] {
  display: none;
}

.lantern-grid {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: #f7efe2;
  user-select: none;
}

.lantern-grid:focus-visible {
  outline: 3px solid rgba(255, 224, 138, 0.34);
  outline-offset: -6px;
}

.lantern-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 224, 138, 0.06) 0 1px, transparent 1px 6.25%),
    linear-gradient(90deg, transparent, rgba(255, 224, 138, 0.1), transparent);
  background-position: 0 0, var(--lantern-scan-x, 50%) 0;
  background-size: auto, 18% 100%;
  opacity: 0.66;
  mix-blend-mode: screen;
}

.lantern-grid-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

.lantern-grid-hud {
  position: absolute;
  inset: 16px 18px auto;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  color: rgba(247, 239, 226, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.lantern-grid-title {
  color: #ffe08a;
}

.lantern-grid-status {
  color: #7be3ff;
}

.lantern-grid-tempo {
  color: #ffb657;
}

.lantern-grid-phrase {
  position: absolute;
  left: 50%;
  bottom: 88px;
  z-index: 4;
  width: min(92%, 940px);
  transform: translateX(-50%);
  color: rgba(255, 239, 191, 0.92);
  font-size: clamp(1.45rem, 5vw, 5rem);
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 28px rgba(255, 192, 93, 0.32);
  animation: lantern-word 420ms cubic-bezier(0.18, 0.8, 0.22, 1) both;
  animation-delay: calc(var(--lantern-pulse, 0) * 1ms);
  pointer-events: none;
}

.lantern-grid-wrap {
  position: absolute;
  inset: 82px 5.5% 160px;
  z-index: 3;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: stretch;
}

.lantern-grid-pitches {
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 5px;
  color: rgba(247, 239, 226, 0.5);
  font-size: clamp(0.62rem, 1.2vw, 0.78rem);
  font-weight: 900;
  letter-spacing: 0.05em;
}

.lantern-grid-pitches span {
  display: grid;
  align-items: center;
  min-width: 0;
}

.lantern-grid-board {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(3px, 0.55vw, 8px);
  min-width: 0;
  min-height: 0;
}

.lantern-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 238, 196, 0.13);
  border-radius: 6px;
  padding: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.lantern-cell::after {
  content: "";
  position: absolute;
  inset: 22% 28%;
  border-radius: 999px;
  background: var(--lantern-color);
  opacity: 0;
  box-shadow: 0 0 0 transparent;
  transition: opacity 120ms ease, inset 120ms ease, box-shadow 120ms ease;
}

.lantern-cell:hover {
  border-color: rgba(255, 224, 138, 0.46);
  transform: translateY(-1px);
}

.lantern-cell:focus-visible {
  outline: 2px solid var(--lantern-color);
  outline-offset: 2px;
}

.lantern-cell.is-active {
  border-color: color-mix(in srgb, var(--lantern-color), transparent 34%);
  background:
    radial-gradient(circle at 50% 36%, color-mix(in srgb, var(--lantern-color), transparent 56%), transparent 48%),
    rgba(255, 255, 255, 0.06);
}

.lantern-cell.is-active::after {
  inset: 16% 24%;
  opacity: 0.75;
  box-shadow: 0 0 18px var(--lantern-color);
}

.lantern-cell.is-current {
  border-color: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 18px rgba(255, 224, 138, 0.14);
}

.lantern-cell.is-hit {
  transform: translateY(-3px) scale(1.04);
  background: color-mix(in srgb, var(--lantern-color), #fff 12%);
  box-shadow: 0 0 30px var(--lantern-color);
}

.lantern-cell.is-hit::after {
  opacity: 1;
  box-shadow: 0 0 28px var(--lantern-color), 0 0 54px var(--lantern-color);
}

.lantern-grid-actions {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.lantern-grid-actions button {
  min-height: 38px;
  border-color: rgba(255, 224, 138, 0.28);
  background: rgba(10, 10, 10, 0.72);
  color: rgba(247, 239, 226, 0.86);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.lantern-grid-actions button:hover {
  border-color: rgba(255, 224, 138, 0.7);
}

@keyframes lantern-word {
  0% {
    opacity: 0.62;
    transform: translateX(-50%) scale(0.97);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 720px) {
  .lantern-grid-shell {
    min-height: 620px;
  }

  .lantern-grid-hud {
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 0.7rem;
  }

  .lantern-grid-wrap {
    inset: 112px 12px 168px;
    grid-template-columns: 34px 1fr;
    gap: 7px;
  }

  .lantern-grid-board {
    gap: 3px;
  }

  .lantern-cell {
    border-radius: 4px;
  }

  .lantern-grid-phrase {
    bottom: 84px;
    font-size: clamp(1.35rem, 10vw, 3.6rem);
  }

  .lantern-grid-actions {
    left: 12px;
    right: 12px;
  }

  .lantern-grid-actions button {
    flex: 1;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lantern-grid-phrase,
  .lantern-cell {
    animation: none;
    transition: none;
  }
}
