:root {
  --bg: #060b14;
  --bg-card: #0a1220;
  --bg-input: #0d1626;
  --border: rgba(157, 196, 255, 0.12);
  --cyan: #4de8e0;
  --violet: #9d7cff;
  --text: #c9d6e3;
  --text-dim: #51607a;
  --text-bright: #eef5fb;
  --danger: #ff5c7a;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

.app-container {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* HEADER / HUD */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.core {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.core-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.core-ring {
  position: absolute;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  opacity: 0.4;
}

.core-ring.r1 { width: 28px; height: 28px; }
.core-ring.r2 { width: 40px; height: 40px; opacity: 0.2; }

.core.thinking .core-ring {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--text-bright);
}

.highlight {
  color: var(--cyan);
}

.status {
  font-size: 0.75rem;
  color: var(--cyan);
  margin-top: 2px;
}

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

.hud-right {
  display: flex;
  gap: 8px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* SETTINGS PANEL */
.settings-panel {
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-panel label {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.settings-panel input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-bright);
  font-family: inherit;
}

/* TABS */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.tab {
  flex: 1;
  padding: 14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.tab-content.active {
  display: flex;
}

/* CHAT LOG */
.log {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.message .time {
  color: var(--text-dim);
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.badge.sys { background: rgba(157,196,255,0.15); color: var(--text-dim); }
.badge.user { background: rgba(157,124,255,0.15); color: var(--violet); }
.badge.ai { background: rgba(77,232,224,0.15); color: var(--cyan); }
.badge.error { background: rgba(255,92,122,0.15); color: var(--danger); }

.message.user .content { color: var(--text-bright); }
.message.ai .content { color: var(--text); }
.message.error .content { color: var(--danger); }

/* INPUT AREA */
.input-area {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.input-area input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.9rem;
}

.input-area input:focus {
  outline: none;
  border-color: var(--cyan);
}

.input-area button {
  background: var(--cyan);
  border: none;
  border-radius: var(--radius);
  width: 44px;
  color: var(--bg);
  font-size: 1.1rem;
  cursor: pointer;
}

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

/* FACE TAB */
.face-area {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.image-preview, .face-area .image-preview {
  min-height: 220px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  overflow: hidden;
}

.image-preview img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
}

.image-preview .placeholder {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.upload-area {
  display: flex;
  gap: 10px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--violet);
  color: var(--text-bright);
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.analysis-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  min-height: 60px;
  white-space: pre-wrap;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .image-preview { min-height: 150px; }
}
