:root {
  --bg: #07070f;
  --bg-deep: #07070f;
  --bg-violet: #0d0820;
  --text: rgba(245, 241, 255, 0.94);
  --muted: rgba(188, 181, 212, 0.68);
  --label: #a78bfa;
  --line: rgba(255, 255, 255, 0.07);
  --glow: rgba(167, 139, 250, 0.35);
  --sand: rgba(200, 185, 160, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Cormorant Garamond", serif;
}

body {
  overflow-x: hidden;
}

.starfield,
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.starfield {
  z-index: 0;
}

.noise {
  z-index: 1;
  opacity: 0.045;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.8) 0 0.5px, transparent 0.7px),
    radial-gradient(circle at 70% 40%, rgba(255, 255, 255, 0.7) 0 0.5px, transparent 0.7px),
    radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.55) 0 0.5px, transparent 0.7px);
  background-size: 180px 180px, 220px 220px, 260px 260px;
  mix-blend-mode: screen;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 1180px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 1.25rem;
}

.screen {
  min-height: 100vh;
}

.entry-screen,
.scan-screen {
  display: grid;
  place-items: center;
}

.entry-screen {
  gap: 2rem;
  align-content: center;
  position: relative;
  isolation: isolate;
}

.entry-lockup {
  display: grid;
  gap: 0.8rem;
  text-align: center;
}

.wordmark {
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f0ece4;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}

.entry-subtitle,
.block-label,
.sheet-meta,
.footer-mark,
.status-line,
.entry-hint {
  font-family: "Space Mono", monospace;
}

.entry-subtitle {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: rgba(200, 190, 175, 0.55);
  letter-spacing: 0.04em;
  margin-bottom: 2.8rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.5s;
}

.entry-form {
  width: min(640px, 100%);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}

.input-wrap {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
  padding: 1rem 2.8rem 1rem 0;
  border: 0;
  border-bottom: 1px solid rgba(200, 185, 160, 0.18);
  background: transparent;
  color: #e8e2d8;
  font: 300 1.15rem/1.8 "Cormorant Garamond", serif;
  outline: none;
  caret-color: rgba(200, 185, 160, 0.5);
  transition: border-color 0.25s ease;
}

textarea::placeholder {
  color: rgba(200, 185, 160, 0.3);
}

textarea:focus {
  border-bottom-color: rgba(200, 185, 160, 0.42);
}

.mic-button {
  position: absolute;
  right: 0.15rem;
  bottom: 1rem;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(200, 185, 160, 0.35);
  cursor: pointer;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.mic-button svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mic-button:hover {
  color: rgba(200, 185, 160, 0.7);
}

.mic-button.recording {
  color: rgba(200, 185, 160, 1);
  animation: micPulse 1.5s ease-in-out infinite;
}

.entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1s;
}

.entry-hint {
  min-height: 0.9rem;
  flex: 1;
  text-align: right;
  font-size: 0.58rem;
  color: rgba(200, 185, 160, 0.3);
}

.ghost-button {
  font-family: "Space Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240, 236, 228, 0.8);
  background: none;
  border: 1px solid rgba(200, 185, 160, 0.18);
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
  border-radius: 1px;
}

.ghost-button:hover {
  border-color: rgba(200, 185, 160, 0.45);
  color: #f0ece4;
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.status-line {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  max-width: 18rem;
  text-align: right;
  color: rgba(200, 185, 160, 0.45);
  font-size: 0.58rem;
  line-height: 1.45;
 }

.status-line.error {
  color: #d8b7bb;
}

.entry-footer-note {
  margin: 2.5rem 0 0;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(200, 185, 160, 0.28);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1.3s;
}

.pulse-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(54vw, 30rem);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(200, 185, 160, 0.12);
  transform: translate(-50%, -50%);
  animation: pulse 4.4s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
  box-shadow: 0 0 40px rgba(200, 185, 160, 0.04);
}

.ring-two {
  animation-delay: 2.2s;
}

.scan-screen {
  gap: 1.6rem;
  text-align: center;
  align-content: center;
}

.scan-orb {
  width: min(28vw, 12rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.32), transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(76, 110, 255, 0.88), rgba(140, 92, 255, 0.7) 54%, rgba(40, 24, 88, 0.08));
  box-shadow: 0 0 80px rgba(100, 76, 255, 0.28), 0 0 160px rgba(80, 102, 255, 0.12);
  animation: breathe 3.8s ease-in-out infinite;
}

.scan-copy {
  margin: 0;
  font: 0.95rem/1.6 "Space Mono", monospace;
  color: rgba(228, 220, 247, 0.82);
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.result-screen {
  display: grid;
  align-content: center;
  padding: 3rem 0;
}

.signal-sheet {
  position: relative;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1rem, 2vw, 2rem);
  background: linear-gradient(180deg, rgba(7, 7, 15, 0.62), rgba(13, 8, 32, 0.3));
  text-align: center;
}

.sheet-meta {
  color: rgba(196, 190, 222, 0.56);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sheet-title {
  margin: 0.9rem 0 1.6rem;
  font: 500 clamp(2.35rem, 4.2vw, 4.4rem)/0.97 "Cormorant Garamond", serif;
  letter-spacing: -0.03em;
  color: #f8f5ff;
  max-width: 20ch;
  text-wrap: balance;
  overflow-wrap: anywhere;
  margin-left: auto;
  margin-right: auto;
}

.sheet-block {
  padding: 1.45rem 0 1.55rem;
  border-top: 1px solid var(--line);
}

.block-label {
  color: var(--label);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.block-copy {
  margin: 0.95rem 0 0;
  font: 500 clamp(1.24rem, 2.1vw, 1.72rem)/1.48 "Cormorant Garamond", serif;
  color: rgba(248, 245, 255, 0.92);
  max-width: 48ch;
  text-wrap: pretty;
  margin-left: auto;
  margin-right: auto;
}

.inner-voice {
  font-style: italic;
}

.message-copy {
  max-width: 50ch;
}

.sheet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.footer-mark {
  color: rgba(205, 199, 228, 0.58);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
}

.footer-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hidden {
  display: none;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.84;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

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

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.15);
    opacity: 0;
  }
}

@keyframes micPulse {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0 1rem;
  }

  .wordmark {
    font-size: clamp(2.4rem, 11vw, 4rem);
    letter-spacing: 0.12em;
  }

  .sheet-title,
  .block-copy {
    max-width: none;
  }

  textarea {
    min-height: 8rem;
    padding-right: 2.3rem;
    font-size: 1.08rem;
    line-height: 1.7;
  }

  .mic-button {
    right: 0.05rem;
    bottom: 0.95rem;
  }

  .entry-actions {
    align-items: flex-end;
  }

  .entry-hint {
    max-width: 8rem;
    text-align: left;
    margin-right: auto;
  }

  .result-screen {
    padding: 1.5rem 0 2rem;
  }

  .signal-sheet {
    width: 100%;
    padding: 1rem 0 1.5rem;
  }

  .sheet-meta {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
  }

  .sheet-title {
    font-size: clamp(2.1rem, 11vw, 3.2rem);
    line-height: 0.98;
    max-width: 14ch;
    margin-bottom: 1.25rem;
  }

  .sheet-block {
    padding: 1.1rem 0 1.2rem;
  }

  .block-label {
    font-size: 0.68rem;
    letter-spacing: 0.24em;
  }

  .block-copy {
    margin-top: 0.75rem;
    font-size: clamp(1.12rem, 5.2vw, 1.42rem);
    line-height: 1.42;
    max-width: 100%;
  }

  .sheet-footer {
    align-items: stretch;
    padding-top: 1.2rem;
    margin-top: 0.8rem;
  }

  .footer-actions {
    width: 100%;
    flex-direction: column;
  }

  .footer-actions .ghost-button {
    width: 100%;
  }

  .status-line {
    position: static;
    margin-top: 0.7rem;
    max-width: none;
    text-align: left;
  }
}
