:root {
  --bg-1: #020b18;
  --bg-2: #071a34;
  --panel-border: rgba(105, 170, 255, 0.18);
  --text: #f2f7ff;
  --muted: rgba(226, 236, 255, 0.72);
  --cyan: #1ec8ff;
  --blue: #3e8fff;
  --violet: #7758ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1), #07132a 42%, #092349);
  overflow: hidden;
}

body {
  position: relative;
}

.hidden {
  display: none !important;
}

.page-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.52;
  animation: floatOrb 11s ease-in-out infinite alternate;
}

.orb-1 {
  width: 460px;
  height: 460px;
  left: -70px;
  top: 70px;
  background: radial-gradient(circle, rgba(30, 200, 255, 0.38), transparent 70%);
}

.orb-2 {
  width: 390px;
  height: 390px;
  right: 60px;
  top: 80px;
  background: radial-gradient(circle, rgba(62, 143, 255, 0.32), transparent 72%);
}

.orb-3 {
  width: 430px;
  height: 430px;
  left: 34%;
  bottom: -120px;
  background: radial-gradient(circle, rgba(119, 88, 255, 0.28), transparent 72%);
}

.grid-glow {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

@keyframes floatOrb {
  from { transform: translateY(0px) scale(1); }
  to { transform: translateY(20px) scale(1.04); }
}

.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.screen-center {
  display: grid;
  place-items: center;
  padding: 24px;
}

.glass-card {
  background: linear-gradient(180deg, rgba(10, 24, 48, 0.9), rgba(8, 20, 42, 0.78));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  margin-bottom: 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #dff6ff;
  background: linear-gradient(135deg, rgba(30, 200, 255, 0.18), rgba(119, 88, 255, 0.18));
  border: 1px solid rgba(130, 180, 255, 0.18);
}

.auth-card {
  width: min(500px, 92vw);
  padding: 32px;
  border-radius: 30px;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: 58px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 17px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: rgba(230, 240, 255, 0.78);
  font-weight: 600;
}

.field input,
.composer textarea {
  width: 100%;
  border: 1px solid rgba(140, 180, 255, 0.08);
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 16px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input::placeholder,
.composer textarea::placeholder {
  color: rgba(230, 240, 255, 0.38);
}

.field input:focus,
.composer textarea:focus {
  border-color: rgba(30, 200, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(30, 200, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.btn {
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  color: white;
  transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue) 48%, var(--violet));
  box-shadow: 0 12px 28px rgba(62, 143, 255, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #edf4ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-full {
  width: 100%;
  margin-top: 6px;
}

.btn-small {
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 14px;
}

.auth-error {
  min-height: 20px;
  margin-top: 16px;
  color: #ffb8c0;
  font-size: 14px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, 96vw);
  height: 92vh;
  margin: 4vh auto;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
}

.sidebar {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top h2 {
  margin: 0 0 10px;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.user-info {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
  word-break: break-word;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-divider {
  height: 1px;
  margin: 22px 0 16px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.18), rgba(255,255,255,0.02));
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(227, 237, 255, 0.68);
  margin-bottom: 12px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.conversation-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(140, 180, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.conversation-item:hover,
.conversation-item.active {
  background: linear-gradient(135deg, rgba(30, 200, 255, 0.12), rgba(119, 88, 255, 0.12));
  border-color: rgba(30, 200, 255, 0.2);
  transform: translateY(-1px);
}

.conversation-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #f6f9ff;
}

.conversation-date {
  font-size: 12px;
  color: rgba(227, 237, 255, 0.56);
}

.chat-panel {
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 26px 26px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chat-kicker {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 6px;
}

.chat-header h1 {
  margin: 0;
  font-size: 54px;
  line-height: 1;
  letter-spacing: -0.035em;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: min(76%, 820px);
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid rgba(140, 180, 255, 0.08);
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(30, 200, 255, 0.18), rgba(62, 143, 255, 0.16));
  border-color: rgba(30, 200, 255, 0.22);
}

.msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.composer textarea {
  resize: none;
  min-height: 60px;
  max-height: 180px;
}

.empty-state {
  color: rgba(227, 237, 255, 0.58);
  padding: 8px 4px;
}

@media (max-width: 860px) {
  .app-shell {
    width: 96vw;
    height: 94vh;
    margin: 3vh auto;
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .chat-header h1 {
    font-size: 40px;
  }

  .auth-card h1 {
    font-size: 44px;
  }
}