:root {
  --void: #080302;
  --surface: #120806;
  --panel: #1d100b;
  --parchment: #d8c3a3;
  --aged: #a88f6b;
  --bone: #f0dfc1;
  --blood: #7e1712;
  --blood-bright: #b3291e;
  --candle: #d39a42;
  --mold: #58614a;
  --line: rgba(216, 195, 163, 0.2);
  --shadow: 0 38px 110px rgba(0, 0, 0, 0.68);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--void);
}

html::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 18%, transparent 0 24%, rgba(0, 0, 0, 0.56) 68%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025), transparent 9%, rgba(0, 0, 0, 0.16) 10% 11%, transparent 12%),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(0, 0, 0, 0.18) 20px);
  mix-blend-mode: multiply;
  z-index: 4;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--bone);
  font-family: "IM Fell English", Georgia, serif;
  background:
    radial-gradient(circle at 22% 16%, rgba(179, 41, 30, 0.22), transparent 19rem),
    radial-gradient(circle at 78% 4%, rgba(211, 154, 66, 0.18), transparent 16rem),
    linear-gradient(180deg, #1c0c07 0%, var(--void) 55%, #020101 100%);
}

button {
  font: inherit;
}

.shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid rgba(216, 195, 163, 0.2);
  background:
    radial-gradient(circle at 50% -8%, rgba(211, 154, 66, 0.14), transparent 16rem),
    linear-gradient(rgba(216, 195, 163, 0.03) 1px, transparent 1px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 7px),
    var(--surface);
  background-size: auto, 100% 7px, auto, auto;
  box-shadow: var(--shadow);
}

.shell::before,
.shell::after {
  position: absolute;
  pointer-events: none;
  content: "";
  z-index: 2;
}

.shell::before {
  inset: 13px;
  border: 1px solid rgba(216, 195, 163, 0.18);
  box-shadow: inset 0 0 0 1px rgba(126, 23, 18, 0.26);
}

.shell::after {
  inset: 22px;
  border: 1px solid rgba(211, 154, 66, 0.11);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 30px 24px;
  animation: reveal 520ms ease both;
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

.screen--disclaimer {
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    repeating-radial-gradient(circle at 17% 31%, rgba(216, 195, 163, 0.32) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(0, 0, 0, 0.28) 13px);
  mix-blend-mode: soft-light;
}

.status-line,
.topbar,
.hero-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-line,
.hero-card__meta,
.mono {
  color: var(--aged);
  font-family: "Special Elite", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-stack {
  position: relative;
  z-index: 1;
  margin-block: auto;
  padding-block: 72px 34px;
}

.intro-stack--compact {
  margin-block: 36px 10px;
  padding-block: 24px 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--candle);
  font-family: "Special Elite", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.065em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 28px rgba(126, 23, 18, 0.34);
}

h1 {
  max-width: 10ch;
  margin-bottom: 18px;
  font-size: clamp(3.55rem, 15vw, 5.8rem);
  line-height: 0.86;
}

h2 {
  margin-bottom: 0;
  font-size: 2.45rem;
  line-height: 0.94;
}

h3 {
  margin-bottom: 14px;
  font-size: 2rem;
  line-height: 1;
}

.lead,
.hero-card p,
.transcript-card p,
.history-list p,
.notice p {
  color: var(--parchment);
  font-size: 1.12rem;
  line-height: 1.55;
}

.notice {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(126, 23, 18, 0.7);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(126, 23, 18, 0.22), transparent),
    rgba(10, 4, 3, 0.54);
}

.notice p {
  margin: 0;
}

.notice__mark {
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--blood-bright);
  box-shadow: 0 0 22px rgba(179, 41, 30, 0.9);
}

.primary-action,
.record-action,
.ghost-action,
.small-action {
  border: 0;
  cursor: pointer;
}

.primary-action {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(216, 195, 163, 0.42);
  border-radius: 4px;
  color: var(--bone);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    linear-gradient(135deg, #8d1b14, #3c0705);
  box-shadow: 0 18px 48px rgba(126, 23, 18, 0.32);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.screen--home,
.screen--history {
  gap: 22px;
}

.topbar {
  padding-top: 4px;
}

.orb {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(211, 154, 66, 0.55);
  border-radius: 4px 18px;
  background:
    radial-gradient(circle, rgba(211, 154, 66, 0.45), transparent 42%),
    radial-gradient(circle at 60% 45%, var(--blood), transparent 24%),
    #100603;
  box-shadow: 0 0 38px rgba(211, 154, 66, 0.18);
  transform: rotate(45deg);
}

.hero-card,
.transcript-card,
.history-list article,
.permission-list article {
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    linear-gradient(145deg, rgba(216, 195, 163, 0.08), transparent 48%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.11) 0 1px, transparent 1px 4px),
    var(--panel);
}

.hero-card {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  background:
    linear-gradient(180deg, transparent 0%, rgba(8, 3, 2, 0.84) 100%),
    radial-gradient(circle at 50% 16%, rgba(211, 154, 66, 0.2), transparent 36%),
    linear-gradient(135deg, rgba(126, 23, 18, 0.23), transparent 38%),
    var(--panel);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.36);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-grid div {
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(216, 195, 163, 0.045);
}

.quick-grid span {
  display: block;
  color: var(--aged);
  font-family: "Special Elite", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.quick-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
}

.record-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  border: 1px solid rgba(216, 195, 163, 0.36);
  border-radius: 4px;
  color: var(--bone);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent),
    linear-gradient(135deg, var(--blood), #2f0503);
  box-shadow: 0 20px 60px rgba(126, 23, 18, 0.36);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.record-action span,
.mic-action span {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--candle);
  box-shadow: 0 0 22px rgba(211, 154, 66, 0.9);
}

.ghost-action,
.small-action {
  color: var(--aged);
  background: transparent;
}

.ghost-action {
  align-self: center;
  padding: 10px;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.ghost-action--compact {
  align-self: auto;
}

.screen--investigation {
  gap: 22px;
}

.screen--permission {
  gap: 22px;
}

.permission-list {
  display: grid;
  gap: 12px;
  margin-bottom: auto;
}

.permission-list article {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 16px;
}

.permission-list span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(211, 154, 66, 0.3);
  color: var(--candle);
  font-family: "Special Elite", monospace;
  font-size: 0.76rem;
}

.permission-list h3 {
  margin-bottom: 4px;
  font-size: 1.45rem;
}

.permission-list p {
  margin-bottom: 0;
  color: var(--parchment);
  font-size: 1rem;
  line-height: 1.45;
}

.investigation-title {
  margin-top: 36px;
}

.signal-panel {
  display: grid;
  place-items: center;
  gap: 24px;
  min-height: 330px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    radial-gradient(circle, rgba(211, 154, 66, 0.14), transparent 48%),
    linear-gradient(180deg, rgba(216, 195, 163, 0.05), transparent),
    repeating-radial-gradient(circle at 50% 40%, transparent 0 18px, rgba(126, 23, 18, 0.1) 19px 20px),
    #100604;
}

.signal-ring {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(211, 154, 66, 0.32);
  border-radius: 999px;
  background:
    radial-gradient(circle, transparent 43%, rgba(211, 154, 66, 0.12) 44% 45%, transparent 46%),
    conic-gradient(from 20deg, transparent, rgba(179, 41, 30, 0.62), rgba(211, 154, 66, 0.38), transparent 30%, transparent);
  animation: drift 7s linear infinite;
}

.signal-core {
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--candle), var(--blood) 45%, transparent 70%);
  filter: blur(0.5px);
  opacity: 0.72;
  animation: pulse 2.8s ease-in-out infinite;
}

.meter {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  height: 72px;
}

.meter i {
  display: block;
  width: 7px;
  height: var(--h);
  min-height: 10px;
  border-radius: 999px;
  background: linear-gradient(var(--candle), rgba(211, 154, 66, 0.18));
  animation: meter 1.6s ease-in-out infinite alternate;
}

.meter i:nth-child(even) {
  animation-delay: 300ms;
}

.transcript-card {
  padding: 18px;
}

.transcript-card p:last-child {
  margin-bottom: 0;
}

.transcript-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.transcript-card__head .mono {
  margin-bottom: 0;
}

.session-state {
  color: var(--candle);
  font-family: "Special Elite", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.session-state[data-state="responding"] {
  color: var(--blood-bright);
}

.session-state[data-state="listening"] {
  color: var(--candle);
}

.transcript-log {
  display: grid;
  max-height: 158px;
  overflow: auto;
  gap: 10px;
  padding-right: 4px;
}

.transcript-log p {
  margin: 0;
}

.transcript-log .user-line {
  color: var(--bone);
}

.transcript-log .engine-line {
  color: var(--parchment);
  font-style: italic;
}

.transcript-log .mark-line {
  color: var(--candle);
  font-family: "Special Elite", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question-form {
  display: grid;
  gap: 8px;
}

.question-form label {
  color: var(--aged);
  font-family: "Special Elite", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.question-form div {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
}

.question-form input,
.question-form button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.question-form input {
  min-width: 0;
  padding: 0 12px;
  color: var(--bone);
  background: rgba(8, 3, 2, 0.58);
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1rem;
}

.question-form input::placeholder {
  color: rgba(168, 143, 107, 0.8);
}

.question-form button {
  color: var(--bone);
  background: linear-gradient(135deg, var(--blood), #2f0503);
  font-family: "Special Elite", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bottom-controls {
  display: grid;
  grid-template-columns: 1fr 92px 1fr;
  align-items: center;
  gap: 14px;
  margin-top: auto;
}

.mic-action {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(211, 154, 66, 0.32);
  border-radius: 999px;
  background: #0b0403;
  box-shadow: inset 0 0 0 12px rgba(216, 195, 163, 0.04), 0 16px 48px rgba(0, 0, 0, 0.45);
}

.mic-action.is-listening {
  animation: pulse 2.3s ease-in-out infinite;
}

.small-action {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(216, 195, 163, 0.035);
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-list article {
  padding: 18px;
}

.history-list span {
  display: block;
  margin-bottom: 10px;
  color: var(--candle);
  font-family: "Special Elite", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.history-list h3 {
  margin-bottom: 8px;
  font-size: 1.7rem;
}

.history-list p {
  margin-bottom: 0;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes drift {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes meter {
  to {
    transform: scaleY(0.72);
    opacity: 0.62;
  }
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
    padding: 28px;
  }

  .shell {
    min-height: 860px;
    border-radius: 3px;
    overflow: hidden;
  }

  .screen {
    min-height: 860px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
