:root {
  color-scheme: light;
  --bg-1: #f4f1ff;
  --bg-2: #eef5ff;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(142, 117, 214, 0.22);
  --text-main: #1f1636;
  --brand: #7b4dff;
  --brand-2: #5a2ee5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #e7dcff 0%, transparent 50%),
    radial-gradient(1000px 500px at 100% 0%, #dff0ff 0%, transparent 45%),
    linear-gradient(150deg, var(--bg-1), var(--bg-2));
  color: var(--text-main);
}

.app {
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  gap: 16px;
}

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, #9b7bff, #6e45f5);
  box-shadow: 0 0 0 6px rgba(123, 77, 255, 0.14);
}
.logo { font-weight: 800; font-size: 26px; letter-spacing: 0.2px; }
.status {
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #0b8f4d; border: 1px solid rgba(11, 143, 77, 0.25); background: rgba(11, 143, 77, 0.1);
}

.providers { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.provider {
  border: 1px solid #d2c6f4; background: rgba(255, 255, 255, 0.78); color: #4f3389;
  border-radius: 999px; padding: 10px 15px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all 0.22s ease; backdrop-filter: blur(8px);
}
.provider.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent; box-shadow: 0 8px 22px rgba(105, 62, 255, 0.32);
}
.provider:hover { transform: translateY(-1px); border-color: #b7a5ee; }

.chat {
  flex: 1; min-height: 360px; background: var(--panel); border-radius: 20px; padding: 18px;
  overflow-y: auto; border: 1px solid var(--panel-border); backdrop-filter: blur(10px);
  box-shadow: 0 18px 45px rgba(66, 36, 140, 0.12);
}
.msg { display: flex; margin-bottom: 12px; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 82%; padding: 12px 14px; border-radius: 14px; line-height: 1.5;
  white-space: pre-wrap; font-size: 15px; box-shadow: 0 8px 24px rgba(38, 24, 87, 0.08);
}
.msg.bot .bubble { background: #f2edff; border: 1px solid rgba(138, 107, 214, 0.16); border-bottom-left-radius: 8px; }
.msg.user .bubble { background: linear-gradient(135deg, #7b4dff, #6538ea); color: white; border-bottom-right-radius: 8px; }

.composer {
  display: flex; gap: 10px; padding: 8px; border: 1px solid var(--panel-border);
  border-radius: 18px; background: var(--panel); backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(53, 30, 105, 0.1);
}
#chat-input {
  flex: 1; border: 1px solid #d7caf9; border-radius: 12px; padding: 13px 14px; font-size: 15px;
  color: var(--text-main); background: rgba(255, 255, 255, 0.9); outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#chat-input:focus { border-color: #ac93f3; box-shadow: 0 0 0 4px rgba(123, 77, 255, 0.12); }
#send-btn {
  border: none; border-radius: 12px; padding: 0 18px; min-width: 108px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 8px 20px rgba(105, 62, 255, 0.3);
}
#send-btn:hover:enabled { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(105, 62, 255, 0.37); }
#send-btn:disabled { opacity: 0.6; cursor: default; box-shadow: none; }

@media (max-width: 680px) {
  .app { padding: 14px 10px; }
  .logo { font-size: 22px; }
  .status { padding: 5px 9px; }
  .chat { min-height: 62vh; padding: 14px; border-radius: 16px; }
  .bubble { max-width: 92%; font-size: 14px; }
  .composer { padding: 6px; border-radius: 14px; }
  #send-btn { min-width: 94px; font-size: 14px; }
}
