:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #17191f;
  --panel-2: #20232b;
  --text: #f4f1ec;
  --muted: #a8adb8;
  --line: #30343d;
  --accent: #54b6a8;
  --accent-2: #f2c46d;
  --danger: #ff8f8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(84, 182, 168, 0.16), transparent 30%),
    linear-gradient(135deg, #101114 0%, #151821 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.chat {
  width: min(980px, 100%);
  height: min(820px, calc(100vh - 48px));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(32, 35, 43, 0.78);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.status {
  padding: 7px 10px;
  border: 1px solid rgba(84, 182, 168, 0.35);
  border-radius: 999px;
  color: #c7fff6;
  font-size: 13px;
  background: rgba(84, 182, 168, 0.1);
}

.status.error {
  color: var(--danger);
  border-color: rgba(255, 143, 143, 0.45);
  background: rgba(255, 143, 143, 0.08);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(84, 182, 168, 0.16);
  color: #bff5ed;
  font-size: 12px;
  font-weight: 800;
}

.bubble {
  max-width: min(720px, 86%);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: #eceff4;
  line-height: 1.48;
}

.user .bubble {
  border-color: rgba(242, 196, 109, 0.36);
  background: rgba(242, 196, 109, 0.12);
}

.photo-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.photo-card {
  display: grid;
  gap: 7px;
}

.photo-card span {
  color: var(--muted);
  font-size: 12px;
}

.photo-card img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0d10;
}

.photo-card a {
  color: var(--accent);
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(32, 35, 43, 0.9);
}

.upload input {
  display: none;
}

.upload span,
.composer input,
.composer button {
  height: 44px;
  border-radius: 8px;
  font: inherit;
}

.upload span {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer input {
  min-width: 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  outline: none;
  color: var(--text);
  background: var(--panel);
}

.composer input:focus {
  border-color: rgba(84, 182, 168, 0.7);
}

.composer button {
  padding: 0 18px;
  border: 0;
  color: #07110f;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.composer button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 720px) {
  .app {
    padding: 0;
  }

  .chat {
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

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

  .upload span {
    width: 100%;
    max-width: none;
    justify-content: center;
  }

  .photo-pair {
    grid-template-columns: 1fr;
  }
}
