:root {
  --bg: #09090b;
  --panel: #111118;
  --panel2: #171722;
  --text: #f5f5f7;
  --muted: #9ca3af;
  --red: #ef233c;
  --blue: #2563eb;
  --border: #272735;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  overflow: auto;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(239, 35, 60, 0.20), transparent 35%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.16), transparent 30%),
    var(--bg);
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 460px;
}

.login-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.login-brand {
  margin-bottom: 22px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.login-form {
  margin-top: 22px;
}

.login-form label {
  display: block;
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b0b10;
  color: var(--text);
  outline: none;
  font-size: 16px;
}

.login-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 35, 60, 0.18);
}

.login-form button {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: white;
  font-weight: 800;
  cursor: pointer;
  font-size: 16px;
}

.login-form button:hover {
  filter: brightness(1.1);
}

.login-form button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.error-text {
  min-height: 22px;
  color: #ff7b7b;
  font-size: 14px;
}

/* CHAT */

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 290px;
  background: #0d0d13;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--blue));
  box-shadow: 0 0 24px rgba(239, 35, 60, 0.25);
}

.brand h1 {
  margin: 0;
  font-size: 24px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.new-chat {
  width: 100%;
  background: var(--red);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  font-weight: 700;
}

.logout-btn {
  width: 100%;
  margin-top: 18px;
  background: #252532;
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  font-weight: 700;
}

.panel {
  margin-top: 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.panel h3 {
  margin: 0 0 10px;
}

.panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  min-height: 76px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar h2 {
  margin: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  background: rgba(239, 35, 60, 0.14);
  border: 1px solid rgba(239, 35, 60, 0.5);
  color: #ff9aa7;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.chatbox {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  max-width: 900px;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--panel2);
  border: 1px solid var(--border);
  flex: 0 0 34px;
}

.user .avatar {
  background: var(--blue);
}

.ai .avatar {
  background: var(--red);
}

.bubble {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.user .bubble {
  background: #13223d;
}

.bubble p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* SUPERDEEP */

.superdeep-btn {
  padding: 0 16px;
  border: 1px solid rgba(239, 35, 60, 0.55);
  border-radius: 12px;
  background: rgba(239, 35, 60, 0.10);
  color: #ff9aa7;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.superdeep-btn:hover {
  background: rgba(239, 35, 60, 0.20);
}

.superdeep-btn.active {
  background: var(--red);
  color: white;
  box-shadow: 0 0 18px rgba(239, 35, 60, 0.30);
}

.thinking-box {
  margin-top: 10px;
  margin-bottom: 10px;
  background: rgba(239, 35, 60, 0.08);
  border: 1px solid rgba(239, 35, 60, 0.28);
  border-radius: 12px;
  padding: 10px;
}

.thinking-title {
  font-size: 12px;
  font-weight: 800;
  color: #ff9aa7;
  margin-bottom: 8px;
}

.thinking-box pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Arial, Helvetica, sans-serif;
  color: #d8d8e6;
  font-size: 13px;
  line-height: 1.45;
}

/* IMAGE + DOWNLOAD BUTTON */

.image-wrap {
  position: relative;
  display: inline-block;
  margin-top: 12px;
  max-width: 360px;
  width: 100%;
}

.image-download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: white;
  text-decoration: none;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 900;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.image-download-btn:hover {
  background: var(--red);
  filter: brightness(1.08);
}

.generated-image {
  display: block;
  margin-top: 12px;
  max-width: 360px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.image-wrap .generated-image {
  margin-top: 0;
}

/* INPUT */

.input-area {
  display: flex;
  gap: 12px;
  padding: 18px 24px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#message {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b0b10;
  color: var(--text);
  outline: none;
  font-size: 16px;
}

#message:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 35, 60, 0.14);
}

.input-area button {
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.input-area button:hover,
.new-chat:hover,
.logout-btn:hover {
  filter: brightness(1.1);
}

.input-area button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* MOBILE */

@media (max-width: 800px) {
  body {
    overflow: auto;
  }

  .app-shell {
    flex-direction: column;
    height: 100vh;
  }

  .sidebar {
    width: 100%;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar {
    height: auto;
    padding: 16px;
    gap: 12px;
  }

  .panel {
    display: none;
  }

  .main {
    height: calc(100vh - 210px);
  }

  .input-area {
    padding: 12px;
    gap: 8px;
  }

  .superdeep-btn {
    padding: 0 10px;
    font-size: 12px;
  }

  .input-area button {
    padding: 0 14px;
  }
}