:root {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --border: #e2e2e2;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #16a34a;
  --danger: #dc2626;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container.wide {
  max-width: 1100px;
}

/* Typography */
h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; color: #111; }
h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--accent); }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }

.brand {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}
.btn-danger:hover { opacity: 0.9; }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-name {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.05rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn-name:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow);
}

/* Landing */
.landing { max-width: 600px; }
.landing .intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.75;
}

.name-grid {
  margin-top: 1.5rem;
}

/* Chat */
.chat-view { display: none; }
.chat-view.active { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

.chat-header {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.chat-header .participant-name {
  font-weight: 600;
  color: var(--accent);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.message {
  max-width: 85%;
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 4px;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message.system {
  align-self: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  max-width: 90%;
}

.chat-input-area {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
}

.chat-input-area textarea {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font);
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
}

.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input-area button {
  padding: 0.75rem 1.25rem;
}

/* Summary overlay */
.summary-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  overflow-y: auto;
  padding: 2rem;
}

.summary-overlay.active { display: flex; justify-content: center; align-items: flex-start; }

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 700px;
  width: 100%;
  margin-top: 3rem;
  box-shadow: var(--shadow-md);
}

.summary-card h2 { margin-bottom: 1.5rem; }

.summary-field {
  margin-bottom: 1.25rem;
}

.summary-field label {
  display: block;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-field p {
  color: var(--text);
  margin-bottom: 0;
}

.summary-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Done state */
.done-view {
  display: none;
  text-align: center;
  padding-top: 15vh;
}

.done-view.active { display: block; }
.done-view .checkmark { font-size: 3rem; margin-bottom: 1rem; color: var(--success); }

/* Admin */
.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.status-list {
  list-style: none;
  margin: 1rem 0;
}

.status-list li {
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.done { background: var(--success); }
.status-dot.pending { background: var(--border); }

.password-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font);
  width: 200px;
}

.password-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

.analysis-stream {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1rem;
  white-space: pre-wrap;
  font-size: 0.9rem;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  color: var(--text);
}

/* Results — Beamer-optimized */
.results-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.results-container h1 { font-size: 2.2rem; margin-bottom: 2rem; }
.results-container h2 { font-size: 1.6rem; margin-top: 2rem; margin-bottom: 1rem; }
.results-container h3 { font-size: 1.3rem; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.results-container p { font-size: 1.15rem; line-height: 1.8; margin-bottom: 1.25rem; }

.results-status {
  text-align: center;
  padding-top: 20vh;
  color: var(--text-muted);
  font-size: 1.3rem;
}

.results-status .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.75rem;
  vertical-align: middle;
}

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

/* Streaming cursor */
.streaming::after {
  content: '|';
  animation: blink 0.8s infinite;
  color: var(--accent);
  font-weight: 300;
}

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

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 1rem; }
  h1 { font-size: 1.4rem; }
  .message { max-width: 92%; }
  .chat-input-area { padding: 0.75rem; }
  .results-container { padding: 1.5rem 1rem; }
  .results-container p { font-size: 1rem; }
}
