* {
  box-sizing: border-box;
}

:root {
  --text-main: #f8f4e9;
  --text-muted: rgba(248, 244, 233, 0.88);
  --gold: #d9b86c;

  --border-soft: rgba(255, 255, 255, 0.16);
  --card-bg: rgba(8, 12, 28, 0.28);
  --card-bg-soft: rgba(8, 12, 28, 0.20);
  --chat-bg: rgba(8, 12, 28, 0.22);
  --message-bg: rgba(255, 255, 255, 0.05);

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text-main);
  background: #050816;
  overflow-x: hidden;
  position: relative;
}

/* Fundalul cosmic real */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("/cosmic-bg.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: -2;
  transform: translateZ(0);
}

/* Strat discret de întunecare pentru lizibilitate */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    rgba(5, 8, 20, 0.18),
    rgba(5, 8, 20, 0.30)
  );
  z-index: -1;
}

.app-shell {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 18px;
  display: grid;
  gap: 18px;
  align-content: center;
  position: relative;
  z-index: 1;
}

.hero-card,
.response-card {
  position: relative;
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035),
      rgba(255, 255, 255, 0.008)
    ),
    var(--card-bg);
  border-radius: 30px;
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hero-card {
  text-align: center;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -80px;
  top: -90px;
  background: radial-gradient(circle, rgba(217, 184, 108, 0.12), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.star-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 184, 108, 0.28);
  border-radius: 50%;
  background: rgba(217, 184, 108, 0.06);
  color: var(--gold);
  font-size: 26px;
}

.small-label {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 10px 0 8px;
  font-size: clamp(36px, 6.5vw, 68px);
  line-height: 1;
  font-weight: 500;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
}

.welcome-text {
  max-width: 700px;
  margin: 24px auto 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.65;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.response-label {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-size: 12px;
}

button {
  border: 1px solid rgba(217, 184, 108, 0.26);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 20%, rgba(140, 80, 255, 0.06), transparent 35%),
    radial-gradient(circle at 80% 25%, rgba(0, 180, 255, 0.06), transparent 35%),
    rgba(255, 255, 255, 0.03);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

button:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 184, 108, 0.46);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

button:active {
  transform: translateY(0);
}

.small-clear-button {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-history {
  height: 280px;
  overflow-y: auto;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025),
      rgba(255, 255, 255, 0.006)
    ),
    var(--chat-bg);
  border: 1px solid rgba(255, 255, 255, 0.10);
  scroll-behavior: smooth;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-history::-webkit-scrollbar {
  width: 8px;
}

.chat-history::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.chat-history::-webkit-scrollbar-thumb {
  background: rgba(217, 184, 108, 0.42);
  border-radius: 999px;
}

.message {
  max-width: 86%;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.55;
  white-space: pre-line;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.message-author {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-text {
  color: var(--text-main);
  font-size: 17px;
}

.assistant-message {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.user-message {
  margin-left: auto;
  background:
    linear-gradient(
      180deg,
      rgba(217, 184, 108, 0.07),
      rgba(255, 255, 255, 0.02)
    );
  border: 1px solid rgba(217, 184, 108, 0.18);
}

.user-message .message-author {
  color: #f0d792;
}

.chat-box {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--text-main);
  background: rgba(8, 12, 32, 0.18);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

input::placeholder {
  color: rgba(248, 244, 233, 0.70);
}

input:focus {
  border-color: rgba(217, 184, 108, 0.48);
}

#sendButton {
  min-width: 105px;
}

@media (max-width: 720px) {
  body::before {
    background-image: url("/cosmic-bg.png");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
  }

  body::after {
    background: linear-gradient(
      rgba(5, 8, 20, 0.12),
      rgba(5, 8, 20, 0.22)
    );
  }

  .app-shell {
    padding: 18px 12px;
    align-content: start;
  }

  .hero-card,
  .response-card {
    padding: 22px;
    border-radius: 24px;
    background:
      linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.025),
        rgba(255, 255, 255, 0.006)
      ),
      rgba(8, 12, 28, 0.24);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .small-clear-button {
    width: 100%;
  }

  .chat-history {
    height: 240px;
    padding: 12px;
    background:
      linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.005)
      ),
      rgba(8, 12, 28, 0.18);
  }

  .message {
    max-width: 100%;
  }

  .chat-box {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  .welcome-text {
    font-size: 16px;
    line-height: 1.6;
  }

  .message-text {
    font-size: 16px;
  }
}