﻿:root {
  color-scheme: dark;
  --bg: #181716;
  --bg-soft: #1f1e1c;
  --panel: #242321;
  --panel-2: #2c2a27;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #efebe3;
  --muted: #a8a097;
  --muted-2: #756f68;
  --accent: #d97745;
  --accent-hot: #ff8b4a;
  --danger: #ff7c7c;
  --success: #a7e3bc;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-sans: Inter, Aptos, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 16% 8%, rgba(217, 119, 69, 0.26), transparent 32vw),
    radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.08), transparent 24vw),
    linear-gradient(135deg, #151412 0%, #1d1b19 48%, #141311 100%);
  color: var(--text);
  overflow: hidden;
}

@supports (height: 100dvh) {
  html,
  body {
    height: 100dvh;
  }
}

button,
textarea,
input {
  font: inherit;
}

button,
.attach-button,
.round-button {
  -webkit-tap-highlight-color: transparent;
}

.surface-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 76%);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

@supports (height: 100dvh) {
  .app-shell {
    min-height: 100dvh;
    height: 100dvh;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  gap: 14px;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-logo {
  width: 126px;
  height: 44px;
  object-fit: cover;
  object-position: left center;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
}

.brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-button {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.ghost-button:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.workspace {
  min-height: 0;
  position: relative;
  display: grid;
  overflow: hidden;
}

.empty-state,
.chat {
  grid-area: 1 / 1;
}

.empty-state {
  align-self: center;
  justify-self: center;
  width: min(680px, calc(100vw - 32px));
  padding: 24px 18px 80px;
  text-align: center;
  animation: rise-in 520ms ease both;
}

.empty-state.hidden {
  display: none;
}

.empty-logo,
.login-logo {
  width: min(520px, 88vw);
  height: auto;
  object-fit: contain;
  border-radius: 24px;
  opacity: 0.94;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.empty-state .eyebrow,
.login-copy .eyebrow {
  margin: 26px 0 8px;
}

.eyebrow {
  color: var(--accent-hot);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.empty-state h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 400;
  letter-spacing: -0.05em;
}

.empty-state p {
  width: min(520px, 100%);
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.chat {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 28px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.chat::-webkit-scrollbar {
  width: 10px;
}

.chat::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.message {
  width: min(760px, 100%);
  margin: 0 auto 24px;
  animation: message-in 240ms ease both;
}

.message.assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.message.user .message-head {
  justify-content: flex-end;
  padding-right: 8px;
}

.role-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 0;
  background: transparent url("/static/agent-mark.png?v=20260416-7") center / contain no-repeat;
  box-shadow: none;
  filter: none;
}

.message.user .role-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3eee6, #a79f95);
  box-shadow: none;
}

.usage {
  color: var(--muted-2);
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.bubble {
  position: relative;
  width: fit-content;
  max-width: min(720px, 100%);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(36, 35, 33, 0.78), rgba(28, 27, 25, 0.72));
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.2);
}

.message.assistant .bubble {
  background: linear-gradient(145deg, rgba(24, 23, 22, 0.58), rgba(31, 29, 27, 0.42));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.12);
}

.message.user .bubble {
  max-width: min(620px, 92vw);
  background: linear-gradient(145deg, rgba(56, 52, 48, 0.92), rgba(36, 34, 32, 0.92));
  border-color: rgba(255, 255, 255, 0.14);
}

.content {
  color: var(--text);
  font-size: 15px;
  line-height: 1.58;
  word-break: break-word;
}

.message.user .content {
  white-space: pre-wrap;
}

.content mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

.content mjx-container[display="true"] {
  margin: 12px 0;
}

.content a {
  color: #ffb384;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 179, 132, 0.36);
}

.content a:hover {
  border-color: #ffb384;
}

.content code {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.26);
  color: #ffe0c7;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.content pre {
  overflow-x: auto;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: #11100f;
}

.content pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f5eee7;
}

.content blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: rgba(217, 119, 69, 0.08);
  color: #f2dfd1;
}

.content .list-line {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 4px;
  margin: 3px 0;
}

.content .list-dot {
  color: var(--accent-hot);
}

.content .spoiler {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  color: transparent;
  transition: color 140ms ease;
}

.content .spoiler:hover {
  color: var(--text);
}

.copy-button {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 23, 22, 0.86);
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.message:hover .copy-button,
.copy-button.copied {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.copy-button:hover,
.copy-button.copied {
  color: var(--text);
  background: rgba(36, 35, 33, 0.96);
}

.file-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

.message-file img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 10px;
}

.file-icon,
.attachment-icon {
  min-width: 34px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(217, 119, 69, 0.16);
  color: #ffb384;
  font-size: 10px;
  font-weight: 800;
}

.thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: 34px;
  color: var(--muted);
  font-size: 15px;
}

.thinking-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-hot);
  box-shadow: 0 0 0 rgba(255, 139, 74, 0.5);
  animation: pulse-dot 1.05s ease infinite;
}

.composer {
  padding: 0 18px calc(18px + env(safe-area-inset-bottom));
}

.composer-inner {
  width: min(760px, 100%);
  margin: 0 auto;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(36, 35, 33, 0.86);
  color: var(--muted);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  font-size: 12px;
}

.attachment-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 11px;
}

.attachment-chip button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
}

.attachment-chip button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.13);
}

.composer-card {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: rgba(36, 35, 33, 0.86);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.composer-card:focus-within,
.composer-card.drag-over {
  border-color: rgba(255, 139, 74, 0.7);
  box-shadow: 0 22px 90px rgba(217, 119, 69, 0.18), var(--shadow);
}

.composer-card.busy {
  transform: translateY(-1px);
}

textarea {
  display: block;
  width: 100%;
  min-height: 58px;
  max-height: 220px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 18px 18px 8px;
  line-height: 1.5;
}

textarea::placeholder {
  color: var(--muted-2);
}

textarea:disabled {
  opacity: 0.72;
  cursor: wait;
}

.composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 10px;
}

.left-tools,
.right-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.round-button,
.send-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  font-size: 0;
  line-height: 0;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.round-button svg,
.send-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.round-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.round-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.send-button {
  border: 0;
  background: var(--text);
  color: #181716;
  font-weight: 800;
}

.send-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff7ed;
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.hint,
.status,
.model-pill {
  color: var(--muted-2);
  font-size: 12px;
}

.model-pill {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  text-transform: capitalize;
}

.status {
  min-height: 18px;
  padding: 8px 4px 0;
}

.status.error,
.error {
  color: var(--danger);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 18%, rgba(217, 119, 69, 0.22), transparent 40%),
    rgba(16, 15, 14, 0.78);
  backdrop-filter: blur(26px);
}

.login-overlay.hidden {
  display: none;
}

.login-box {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(36, 35, 33, 0.8);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: rise-in 420ms ease both;
}

.login-logo {
  display: block;
  width: min(360px, 100%);
  margin: 0 auto 18px;
}

.login-copy {
  text-align: center;
}

.login-copy h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.05em;
}

.login-copy p:not(.eyebrow) {
  margin: 10px auto 22px;
  color: var(--muted);
  line-height: 1.55;
}

.login-control {
  display: grid;
  grid-template-columns: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.16);
}

.login-control input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 15px 16px;
}

.login-control button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--text);
  color: #181716;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
}

.login-control button:hover {
  background: #fff7ed;
}

.error {
  min-height: 18px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 139, 74, 0.45);
    opacity: 0.55;
  }
  70% {
    box-shadow: 0 0 0 11px rgba(255, 139, 74, 0);
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 139, 74, 0);
    opacity: 0.55;
  }
}

@media (max-width: 720px) {
  body {
    overflow: hidden;
  }

  .topbar {
    padding: 10px 12px 6px;
    gap: 8px;
  }

  .brand-block {
    min-width: 0;
    gap: 8px;
    justify-content: flex-start;
  }

  .brand-logo {
    width: 92px;
    height: 32px;
    border-radius: 10px;
  }

  .brand {
    font-size: 14px;
  }

  .sub {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 6px;
  }

  .ghost-button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .chat {
    padding: 8px 10px 14px;
  }

  .message {
    margin-bottom: 20px;
  }

  .message.user .bubble {
    max-width: 94vw;
  }

  .message.assistant .bubble {
    padding-left: 12px;
  }

  .composer {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  }

  .hint {
    display: none;
  }

  .model-pill {
    display: none;
  }

  .empty-logo {
    width: min(360px, 92vw);
    border-radius: 18px;
  }

  .empty-state {
    width: 100%;
    padding: 0 14px 32px;
  }

  .empty-state .eyebrow {
    margin-top: 18px;
  }

  .empty-state h2 {
    font-size: clamp(32px, 11vw, 46px);
  }

  .empty-state p {
    font-size: 14px;
    margin-top: 10px;
  }

  .login-box {
    padding: 18px;
    border-radius: 26px;
  }

  .login-logo {
    width: 100%;
    border-radius: 18px;
    margin-bottom: 12px;
  }

  .login-copy .eyebrow {
    margin-top: 14px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .login-copy p:not(.eyebrow) {
    margin-bottom: 16px;
    font-size: 14px;
  }

  .composer-card {
    border-radius: 22px;
  }

  textarea {
    min-height: 52px;
    padding: 14px 14px 6px;
    font-size: 16px;
  }

  .composer-toolbar {
    padding: 7px 8px 8px;
  }

  .round-button,
  .send-button {
    width: 38px;
    height: 38px;
  }
}
