:root {
  --bg: #05080a;
  --card: rgba(8, 12, 15, 0.38);
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #f4fbff;
  --muted: rgba(244, 251, 255, 0.68);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #79eeff;
  --accent-soft: rgba(121, 238, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Sora", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(3, 5, 6, 0.26), rgba(3, 5, 6, 0.5)),
    url("/assets/grunc-bg.png") center center / cover no-repeat fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 72% 58%, rgba(120, 237, 255, 0.2), transparent 22%),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.12), transparent 22%);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat-card {
  width: min(100%, 470px);
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--card-border);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(26px) saturate(140%);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 48px rgba(121, 238, 255, 0.12);
}

.chat-card__header,
.chat-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-card__status,
input,
button {
  letter-spacing: 0.01em;
}

.chat-card__title {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.55rem);
  font-weight: 600;
  line-height: 1.15;
}

.chat-card__status {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.78rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(121, 238, 255, 0.85);
}

.message-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.message-feed::-webkit-scrollbar {
  width: 6px;
}

.message-feed::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.message {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 0.95rem;
  color: var(--text);
  border: 1px solid var(--line);
}

.message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
}

.message.user {
  align-self: flex-end;
  background: rgba(121, 238, 255, 0.14);
}

.message.typing {
  color: var(--muted);
}

.chat-form {
  padding-top: 4px;
}

input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
  outline: none;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

input::placeholder {
  color: rgba(244, 251, 255, 0.5);
}

input:focus {
  border-color: var(--accent-soft);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 4px rgba(121, 238, 255, 0.08);
}

button {
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #091012;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 140ms ease,
    opacity 140ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .stage {
    padding: 16px;
    align-items: end;
  }

  .chat-card {
    min-height: 68vh;
    padding: 18px;
    border-radius: 24px;
  }

  .chat-card__header,
  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-card__status {
    align-self: flex-start;
  }

  button {
    width: 100%;
  }
}
