* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: #f8fbff;
  background: url(../Assets/bg2.png) no-repeat center 0 fixed;
  background-size: cover;
  font-family: "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;

  width: min(100% - 40px, 1800px);
  margin: 0 auto;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  font-size: 1.35rem;
  font-weight: 700;
}

.brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 20px;

  font-weight: 600;
}

.nav-menu a {
  transition: color 0.2s ease;
}

.nav-menu a:hover {
  color: #00d0e8;
}

.chat-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;

  width: min(100% - 40px, 1500px);
  height: calc(100vh - 118px);
  min-height: 620px;

  margin: 0 auto 24px;
}

.sidebar,
.chat-panel {
  background: rgba(7, 15, 27, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);

  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);

  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;

  padding: 18px;
  border-radius: 8px;
}

.new-chat-button,
.composer button {
  border: 0;
  border-radius: 8px;

  cursor: pointer;
  font-weight: 800;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

.new-chat-button {
  width: 100%;
  padding: 13px 16px;

  color: #07101d;
  background: #ffffff;

  text-align: left;
}

.new-chat-button:hover,
.composer button:hover {
  transform: translateY(-1px);
  background: #f19408;
}

.model-card {
  padding: 16px;

  color: #fff;
  background: rgba(255, 255, 255, 0.1);

  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

.model-label {
  display: block;
  margin-bottom: 6px;

  color: rgba(255, 255, 255, 0.7);
  font-size: 0.84rem;
}

.model-card p,
.privacy-note {
  margin-top: 8px;

  color: rgba(255, 255, 255, 0.72);
  font-size: 0.94rem;
  line-height: 1.45;
}

.privacy-note {
  margin-top: auto;
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;

  overflow: hidden;
  border-radius: 8px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;

  overflow-y: auto;

  padding: 26px;

  scroll-behavior: smooth;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;

  max-width: 980px;
}

.message.user {
  align-self: end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.avatar {
  display: grid;
  place-items: center;

  width: 38px;
  height: 38px;

  border-radius: 50%;

  color: #06121f;
  background: #fff;

  font-weight: 900;
}

.message.user .avatar {
  grid-column: 2;
  background: #00d0e8;
}

.bubble {
  min-width: 0;
  padding: 14px 16px;

  color: #f8fbff;
  background: rgba(0, 0, 0, 0.38);

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;

  line-height: 1.62;
  overflow-wrap: anywhere;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;

  background: rgba(0, 208, 232, 0.18);
  white-space: pre-wrap;
}

.message.assistant .bubble > * + * {
  margin-top: 12px;
}

.message.assistant .bubble h1,
.message.assistant .bubble h2,
.message.assistant .bubble h3,
.message.assistant .bubble h4,
.message.assistant .bubble h5,
.message.assistant .bubble h6 {
  color: #ffffff;
  font-weight: 800;
  line-height: 1.25;
}

.message.assistant .bubble h1 {
  font-size: 1.5rem;
}

.message.assistant .bubble h2 {
  font-size: 1.3rem;
}

.message.assistant .bubble h3 {
  font-size: 1.12rem;
}

.message.assistant .bubble ul,
.message.assistant .bubble ol {
  padding-left: 24px;
}

.message.assistant .bubble li + li {
  margin-top: 6px;
}

.message.assistant .bubble blockquote {
  padding: 10px 14px;

  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);

  border-left: 4px solid #00d0e8;
  border-radius: 8px;
}

.message.assistant .bubble code {
  padding: 2px 6px;

  color: #d8fbff;
  background: rgba(0, 0, 0, 0.35);

  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.message.assistant .bubble pre {
  overflow-x: auto;
  padding: 14px;

  background: rgba(0, 0, 0, 0.48);

  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.message.assistant .bubble pre code {
  display: block;
  padding: 0;

  color: #f8fbff;
  background: transparent;

  white-space: pre;
}

.message.assistant .bubble a {
  color: #6ff1ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-table {
  overflow-x: auto;
}

.message.assistant .bubble table {
  width: 100%;
  min-width: 420px;

  border-collapse: collapse;
  overflow: hidden;

  font-size: 0.94rem;
}

.message.assistant .bubble th,
.message.assistant .bubble td {
  padding: 10px 12px;

  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
  vertical-align: top;
}

.message.assistant .bubble th {
  color: #07101d;
  background: rgba(255, 255, 255, 0.9);
}

.message.assistant .bubble td {
  background: rgba(255, 255, 255, 0.06);
}

.message.is-loading .bubble {
  color: rgba(255, 255, 255, 0.7);
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;

  padding: 16px;

  background: rgba(0, 0, 0, 0.22);

  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.composer textarea {
  width: 100%;
  max-height: 180px;
  min-height: 48px;

  resize: none;

  padding: 12px 14px;

  color: #fff;
  background: rgba(0, 0, 0, 0.42);

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;

  outline: none;
}

.composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.composer textarea:focus {
  border-color: #00d0e8;
  box-shadow: 0 0 0 3px rgba(0, 208, 232, 0.16);
}

.composer button {
  min-height: 48px;

  color: #07101d;
  background: #ffffff;
}

.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.status {
  min-height: 24px;
  padding: 0 18px 12px;

  color: #b8f7ff;
  font-size: 0.92rem;
}

.status.is-error {
  color: #ffd1d1;
}

@media (max-width: 900px) {

  .app-header {
    flex-direction: column;
    width: min(100% - 28px, 680px);
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
  }

  .chat-shell {
    grid-template-columns: 1fr;

    width: min(100% - 28px, 680px);
    height: auto;
    min-height: 0;
  }

  .sidebar {
    display: none;
  }

  .chat-panel {
    height: calc(100vh - 168px);
    min-height: 560px;
  }

  .messages {
    padding: 18px;
  }

  .composer {
    grid-template-columns: 1fr;
  }
}
