:root {
  --green: #00ff66;
  --green-dim: #0bb14b;
  --bg: #000000;
  --text: #d6ffd6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: Consolas, Monaco, "Courier New", monospace;
}

body {
  overflow: hidden;
}

.screen {
  position: fixed;
  inset: 0;
  background: #000;
}

.hidden {
  display: none !important;
}

.active {
  display: block;
}

#matrixCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.center-panel {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  width: min(90vw, 720px);
  text-align: center;
  z-index: 2;
}

.riddle-text {
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 24px;
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.25);
}

.prompt-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--green-dim);
  padding: 8px 0;
}

.prompt-row span {
  font-size: 22px;
}

.prompt-row input {
  width: min(70vw, 340px);
}

.feedback {
  min-height: 24px;
  margin-top: 16px;
  font-size: 15px;
  color: var(--green);
}

input,
button {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green-dim);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

input {
  border: none;
  border-bottom: 1px solid var(--green-dim);
}

button {
  cursor: pointer;
}

button:hover {
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.25);
}

.pill-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.pill-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 120px;
  margin-bottom: 36px;
}

.pill {
  width: 70px;
  height: 150px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.red-pill {
  background: linear-gradient(180deg, #ff7070 0 50%, #7c0000 50% 100%);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.blue-pill {
  background: linear-gradient(180deg, #7ec0ff 0 50%, #003c7a 50% 100%);
  box-shadow: 0 0 20px rgba(0, 136, 255, 0.45);
}

.pill:hover,
.pill:focus {
  transform: scale(1.12);
}

.pill-hint {
  text-align: center;
  min-height: 24px;
  color: var(--text);
  opacity: 0.9;
}

.rabbit-flash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 96px;
  color: #fff;
  opacity: 0;
  animation: rabbitFade 1.2s ease forwards;
}

@keyframes rabbitFade {
  0% { opacity: 0; transform: scale(0.9); }
  15% { opacity: 1; transform: scale(1); }
  85% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0; transform: scale(1.06); }
}

.auth-panel {
  width: min(90vw, 360px);
}

.auth-title {
  font-size: 24px;
  margin-bottom: 18px;
}

.auth-panel input {
  width: 100%;
  margin-bottom: 14px;
}

.auth-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.terminal-shell {
  position: absolute;
  top: 12px;
  left: 12px;
  width: min(560px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  padding: 10px 12px;
  overflow: hidden;
}

.terminal-log {
  height: calc(100% - 64px);
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  text-align: left;
  scrollbar-width: none;
}

.terminal-log::-webkit-scrollbar {
  display: none;
}

.terminal-line {
  margin-bottom: 6px;
}

.terminal-system {
  color: var(--green);
}

.terminal-user {
  color: var(--text);
}

.typing-indicator {
  height: 20px;
  font-size: 14px;
  opacity: 0.8;
  text-align: left;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.terminal-input-row input {
  flex: 1;
  min-width: 0;
}

.media-block img,
.media-block video {
  max-width: 220px;
  width: 100%;
  height: auto;
  border: 1px solid #0bb14b;
}

.glitch {
  animation: glitchFlash 0.22s ease;
}

@keyframes glitchFlash {
  0% { filter: none; }
  25% { filter: invert(1); }
  50% { filter: none; transform: translate(2px, -1px); }
  75% { transform: translate(-2px, 1px); }
  100% { filter: none; transform: none; }
}

@media (max-width: 768px) {
  .terminal-shell {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 10px;
  }

  .terminal-log {
    height: calc(100vh - 160px);
    font-size: 16px;
    padding-bottom: 10px;
  }

  .typing-indicator {
    font-size: 13px;
    margin-top: 6px;
  }

  .terminal-input-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 0);
    padding: 10px;
    background: black;
    border-top: 1px solid #0bb14b;
    z-index: 50;
  }

  .terminal-input-row input {
    font-size: 16px;
    width: 100%;
  }

  #chatInput {
    padding: 12px 10px;
  }
}

.media-block img,
.media-block video {
  max-width: 220px;
  width: 100%;
  height: auto;
  border: 1px solid #0bb14b;
}

html, body {
  height: 100%;
  overflow: hidden;
}

@supports (-webkit-touch-callout: none) {
  .terminal-shell {
    height: -webkit-fill-available;
  }
}

.pill {
  transition: transform 0.2s ease;
}

.pill:active {
  transform: scale(0.95);
}