* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0a0a0b;
  color: #f5f7fb;
}

body {
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 30%),
    radial-gradient(circle at bottom right, rgba(96,165,250,0.12), transparent 28%),
    #0a0a0b;
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff, #60a5fa);
  box-shadow: 0 0 20px rgba(96,165,250,0.45);
}

.brand-title {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: #9aa4b2;
  font-size: 14px;
}

.topbar-right {
  display: flex;
  gap: 10px;
}

.ghost-button,
.secondary-button,
.primary-button,
.send-button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  transition: 0.2s ease;
}

.ghost-button {
  background: rgba(255,255,255,0.07);
  color: #edf2f7;
}

.ghost-button:hover {
  background: rgba(255,255,255,0.12);
}

.chat-layout {
  flex: 1;
  display: flex;
}

.chat-panel {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  background: rgba(17,17,20,0.92);
  box-shadow: 0 20px 60px rgba(0,0,0,0.38);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 100px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  display: flex;
}

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

.message-bubble {
  max-width: min(760px, 88%);
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.6;
  font-size: 15px;
  white-space: pre-wrap;
}

.message.assistant .message-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.message.user .message-bubble {
  background: #eef2ff;
  color: #111827;
}

.composer-wrap {
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,8,10,0.85);
  padding: 18px 20px 20px;
}

.composer-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.account-badge--guest {
  background: rgba(250,204,21,0.14);
  color: #fde68a;
  border: 1px solid rgba(250,204,21,0.22);
}

.account-badge--user {
  background: rgba(96,165,250,0.14);
  color: #bfdbfe;
  border: 1px solid rgba(96,165,250,0.22);
}

.budget-summary {
  color: #b8c0cc;
  font-size: 14px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.message-input {
  width: 100%;
  resize: none;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #f9fafb;
  border-radius: 22px;
  padding: 16px 18px;
  min-height: 58px;
  max-height: 220px;
  outline: none;
}

.message-input:focus,
.model-select:focus {
  border-color: rgba(96,165,250,0.55);
  box-shadow: 0 0 0 4px rgba(96,165,250,0.12);
}

.send-button {
  background: #ffffff;
  color: #0f172a;
  min-width: 88px;
  font-weight: 700;
}

.send-button:hover {
  background: #e5e7eb;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 14px;
}

.footer-note {
  color: #9aa4b2;
  font-size: 13px;
}

.model-picker-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.model-label {
  color: #9aa4b2;
  font-size: 12px;
}

.model-select {
  min-width: 230px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #f9fafb;
  padding: 12px 14px;
  outline: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,4,8,0.68);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 100;
}

.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 760px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(15,15,18,0.96);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  padding: 30px;
}

.modal-card--small {
  max-width: 620px;
}

.modal-title {
  margin: 0;
  font-size: 30px;
}

.modal-copy {
  margin: 10px 0 0;
  color: #aeb6c2;
  line-height: 1.6;
}

.modal-section {
  margin-top: 22px;
  color: #ebf0f7;
  line-height: 1.7;
}

.modal-section h3,
.model-group h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal-section p {
  margin: 10px 0;
}

.simple-list {
  margin: 12px 0 0;
  padding-left: 20px;
}

.budget-box {
  margin-top: 16px;
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.budget-box p {
  margin: 6px 0;
}

.budget-used-label {
  margin-top: 14px !important;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.modal-actions--single {
  justify-content: flex-end;
}

.primary-button {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
}

.primary-button:hover {
  background: #e5e7eb;
}

.secondary-button {
  background: rgba(255,255,255,0.07);
  color: #f3f4f6;
  font-weight: 700;
}

.secondary-button:hover {
  background: rgba(255,255,255,0.12);
}

.model-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.model-group {
  border-radius: 20px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
}

.free-group {
  background: rgba(16,185,129,0.08);
}

.paid-group {
  background: rgba(245,158,11,0.08);
}

.model-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.model-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.model-list li:last-child {
  border-bottom: 0;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
}

.tier-pill.free {
  background: rgba(16,185,129,0.14);
  color: #86efac;
}

.tier-pill.paid {
  background: rgba(245,158,11,0.14);
  color: #fcd34d;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-panel {
    min-height: calc(100vh - 70px);
    border-radius: 22px;
  }

  .chat-messages {
    padding: 18px;
  }

  .composer-wrap {
    padding: 14px;
  }

  .composer-row,
  .composer-footer,
  .composer-topline,
  .model-groups,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .model-groups {
    grid-template-columns: 1fr;
  }

  .model-picker-wrap {
    align-items: stretch;
  }

  .model-select {
    min-width: 0;
    width: 100%;
  }

  .message-bubble {
    max-width: 94%;
  }

  .modal-card {
    padding: 22px;
  }
}
