:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
  text-transform: lowercase;
  overflow: hidden;
  touch-action: none;
}

body,
body * {
  user-select: none;
  -webkit-user-select: none;
}

.layer,
.stack img {
  user-select: none;
  -webkit-user-drag: none;
}

.stack img {
  pointer-events: none;
}
.menu-container {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 10;
}

.menu-button {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  outline: none;
}

.menu-button:hover {
  transform: translateY(-2px);
}

.menu-button span {
  display: block;
  height: 2px;
  width: 60%;
  margin: 0 auto;
  background: #fff;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.menu-button.menu-open span {
  background: #67ff7a;
}

.menu-button.menu-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-button.menu-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-button.menu-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  width: 190px;
  padding: 0.75rem;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.5rem) scale(0.95);
  transition: opacity 0.2s ease, transform 0.25s ease;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
  outline: none;
  z-index: 10;
}

.menu-panel.menu-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.menu-panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.menu-panel a {
  display: block;
  width: 100%;
  text-align: right;
  color: #f4f4f4;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: none;
  text-transform: lowercase;
}

.menu-panel a:hover {
  color: #67ff7a;
}

.live-indicator {
  position: absolute;
  top: 1.2rem;
  left: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: #80ffad;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 20, 0, 0.45);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.live-indicator__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #4dff76;
  box-shadow: 0 0 12px rgba(77, 255, 118, 0.8);
  animation: livePulse 1.8s ease-in-out infinite;
}

.live-indicator__text {
  color: inherit;
}

@keyframes livePulse {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0.3;
    transform: scale(0.9);
  }
}

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

.stack {
  position: relative;
  width: min(80vw, 500px);
  aspect-ratio: 1 / 1;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.layer-color {
  --progress: 0%;
  --fade-end: 0%;
  opacity: 1;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) var(--progress),
    rgba(0, 0, 0, 0) var(--fade-end)
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) var(--progress),
    rgba(0, 0, 0, 0) var(--fade-end)
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.terminal {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  width: fit-content;
  max-width: min(340px, 80vw);
  background: #050505;
  color: #a9ffb5;
  border-radius: 0;
  border: 1px solid rgba(0, 255, 102, 0.35);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;
}

.terminal__top {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: #020202;
  border-bottom: 1px solid rgba(0, 255, 102, 0.1);
  font-size: 0.78rem;
  color: #54ff8c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.terminal__body {
  padding: 1rem 0.85rem 1.1rem;
}

.line {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: #cdebd4;
}

.line:last-child {
  margin-bottom: 0;
}

.prompt {
  color: #67ff7a;
  margin-right: 0.4rem;
}

.line-input {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.line-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e8fff0;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.1rem 0;
}

.line-input input::placeholder {
  color: rgba(233, 255, 240, 0.35);
}

.line-feedback {
  font-size: 0.72rem;
  color: rgba(205, 235, 212, 0.6);
  display: none;
  margin-top: 0.35rem;
}

.line-feedback.error {
  color: #ff6f61;
}

@media (max-width: 600px) {
  .line-input input {
    font-size: 0.85rem;
  }
  .live-indicator {
    top: 1rem;
    left: 1rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }

  .menu-container {
    top: 1rem;
    right: 1rem;
  }

  .menu-button {
    width: 3rem;
    height: 3rem;
  }

  .menu-panel {
    width: min(260px, calc(100vw - 2rem));
    padding: 0.65rem;
  }

  .stack {
    width: min(88vw, 420px);
  }

  .terminal {
    width: fit-content;
    max-width: min(280px, 90vw);
    left: 1rem;
    bottom: 1rem;
  }
}
.line-input input::placeholder::after {
  content: "|";
  margin-left: 0.2rem;
  animation: caretBlink 1s steps(2, jump-none) infinite;
}

@keyframes caretBlink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
