/* ==== RESET / BASE ==== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #000;
  color: #fff;
  min-height: 100svh;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==== STARFIELD ==== */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ==== NAV ==== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  padding-top: max(20px, env(safe-area-inset-top));
}
.nav-logo {
  height: 28px;
  width: auto;
  opacity: 0.9;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-link svg { width: 14px; height: 14px; }

.btn-pill {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-solid {
  background: #fff;
  color: #000;
}
.btn-solid:hover { background: rgba(255, 255, 255, 0.9); transform: translateY(-1px); }

/* ==== HERO ==== */
.hero {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 140px;
  transition: padding 0.5s ease;
}
.hero-inner {
  width: 100%;
  max-width: 760px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  transition: gap 0.5s ease;
}

/* Chat mode: logo small, prompt at bottom, chat fills space */
body.chatting .hero {
  align-items: flex-start;
  padding: 32px 24px 120px;
}
body.chatting .hero-inner {
  gap: 18px;
  min-height: calc(100svh - 160px);
  min-height: calc(100vh - 160px);
}
body.chatting .hero-logo {
  width: min(180px, 42vw);
  transition: width 0.5s ease;
}
body.chatting .ca-block { display: none; }

/* Hero logo — full transparent lockup */
.hero-logo {
  display: block;
  width: min(62vw, 520px);
  height: auto;
  filter: drop-shadow(0 0 60px rgba(255, 255, 255, 0.08));
}
@media (max-width: 700px) {
  .hero-logo { width: min(78vw, 420px); }
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo { animation: none; }
}

/* ==== PROMPT ==== */
.prompt {
  width: min(92vw, 720px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 10px 8px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prompt:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}
.prompt-attach, .prompt-mic, .prompt-send {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.prompt-attach:hover, .prompt-mic:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.prompt-attach svg, .prompt-mic svg, .prompt-send svg { width: 18px; height: 18px; }
.prompt-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  padding: 10px 0;
  font-weight: 400;
}
.prompt-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.prompt-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mode-wrap { position: relative; }
.prompt-mode {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px 6px 4px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.prompt-mode:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.prompt-mode svg { width: 14px; height: 14px; opacity: 0.7; }

.mode-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 20;
  animation: menuIn 0.15s ease-out;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mode-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
  transition: background 0.12s;
}
.mode-opt:hover { background: rgba(255, 255, 255, 0.06); }
.mode-opt.active { background: rgba(255, 255, 255, 0.08); }
.mode-opt-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.mode-opt-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}
.prompt-send {
  background: #fff;
  color: #000;
}
.prompt-send:hover { background: rgba(255, 255, 255, 0.9); }
.prompt-send svg { width: 16px; height: 16px; }

.sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
}
.sub-pill svg { color: #7bd389; opacity: 0.85; }

/* ==== CHAT LOG ==== */
.chat-log {
  width: min(92vw, 720px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}
.chat-log:empty { display: none; }
.msg {
  animation: answerIn 0.35s ease-out;
  text-align: left;
  width: 100%;
}
.msg-user {
  align-self: flex-end;
  max-width: 88%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 6px 20px;
  padding: 12px 18px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.95);
}
.msg-assistant {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 20px 22px;
}
@keyframes answerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.answer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.answer-avatar {
  width: 34px; height: 34px;
  border-radius: 999px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.answer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.answer-avatar {
  background: transparent;
}
.answer-name {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.answer-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}
.answer-status.done { color: #7bd389; }
.answer-body {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  white-space: pre-wrap;
  min-height: 1.55em;
}
.answer-body .caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  background: currentColor;
  vertical-align: -2px;
  margin-left: 1px;
  animation: blink 0.8s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* CA block */
.ca-block {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 90vw;
  overflow: hidden;
}
#ca {
  font-family: 'Inter', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  letter-spacing: 0.02em;
}
.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border: none;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

/* ==== FOOTER ==== */
.foot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 20px 32px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
}
.foot span { pointer-events: auto; }

/* ==== MOBILE ==== */
@media (max-width: 700px) {
  .nav { padding: 14px 18px; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .btn-pill { padding: 7px 14px; font-size: 13px; }
  .hero { padding: 100px 20px 160px; }
  .brand { gap: 10px; }
  .ca-block { flex-wrap: wrap; justify-content: center; text-align: center; }
  #ca { max-width: 240px; font-size: 12px; }
  .foot {
    flex-direction: column;
    gap: 4px;
    text-align: center;
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .brand-logo { height: 52px; }
  .brand-name { font-size: 52px; }
  .tagline { letter-spacing: 0.3em; }
}
