/* 光湖 · 内测站 · 极简深色主题 */
/* 不使用任何模板/CSS框架 */

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121e;
  --bg-tertiary: #1a1a2e;
  --bg-hover: #242442;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #58587a;
  --accent: #6c5ce7;
  --accent-dim: #4a3db8;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --border: #2a2a44;
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius: 10px;
  --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
}
.screen.active { display: flex; }

/* ─── Login ─── */
#loginScreen {
  align-items: center;
  justify-content: center;
}

.login-container {
  text-align: center;
  max-width: 400px;
  width: 90%;
  padding: 40px 30px;
}

.login-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 0 30px var(--accent-glow);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-status {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.login-status.error { background: rgba(231,76,60,0.1); color: var(--danger); border: 1px solid rgba(231,76,60,0.2); }
.login-status.success { background: rgba(46,204,113,0.1); color: var(--success); border: 1px solid rgba(46,204,113,0.2); }
.login-status.info { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(108,92,231,0.2); }

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { color: var(--text-muted); }

.code-group { animation: fadeSlide 0.3s ease; }

.login-btn {
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.login-btn:hover { opacity: 0.85; }
.login-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.slot-info {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Chat ─── */
#chatScreen {
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-header-right { display: flex; align-items: center; gap: 8px; }

.header-icon { color: var(--accent); font-size: 18px; }
.header-title { font-weight: 600; font-size: 15px; }

.model-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(108,92,231,0.3);
}

.user-email {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

.message {
  margin-bottom: 20px;
  animation: fadeSlide 0.3s ease;
}

.message.user { text-align: right; }
.message.assistant { text-align: left; }

.message-content {
  display: inline-block;
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.user .message-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message.system-note .message-content {
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  padding: 4px 8px;
}

.message-content p { margin: 0 0 8px; }
.message-content p:last-child { margin: 0; }
.message-content code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 3px;
}
.message-content pre {
  background: rgba(0,0,0,0.3);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}
.message-content pre code {
  background: none;
  padding: 0;
}

/* Blinking cursor */
.cursor-blink::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
}
.typing-indicator span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 42px; height: 42px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.send-btn:hover { opacity: 0.85; }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Animations ─── */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ─── Scrollbar ─── */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .message-content { max-width: 90%; }
  .chat-header { padding: 10px 14px; }
  .chat-messages { padding: 14px; }
  .chat-input-area { padding: 10px 14px; }
  .user-email { display: none; }
}