﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  --bg:           #0f0f0f;
  --surface:      #161616;
  --surface-2:    #1e1e1e;
  --surface-3:    #252525;
  --border:       rgba(255,255,255,0.07);
  --border-mid:   rgba(255,255,255,0.12);
  --text-primary:   #f0ede8;
  --text-secondary: #a09890;
  --text-muted:     #5a5550;
  --amber:        #d4952a;
  --amber-dim:    rgba(212,149,42,0.12);
  --amber-border: rgba(212,149,42,0.35);
  --green:        #3d9970;
  --green-dim:    rgba(61,153,112,0.10);
  --red:          #c0392b;
  --red-dim:      rgba(192,57,43,0.08);
  --indigo:       #5b6af0;
  --indigo-dim:   rgba(91,106,240,0.10);
  --font-body:    'Inter', system-ui, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 780px;
  margin: 0 auto;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand span { color: var(--amber); font-weight: 400; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-body);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover { color: var(--text-secondary); border-color: rgba(255,255,255,0.2); }

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgIn 0.2s ease;
  max-width: 100%;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user { flex-direction: row-reverse; }

.bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  max-width: 78%;
}

.msg.bot .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-top-left-radius: 3px;
}

.msg.user .bubble {
  background: var(--amber);
  color: #1a1100;
  font-weight: 500;
  border-top-right-radius: 3px;
  max-width: 72%;
}

.typing-dots { display: flex; gap: 5px; align-items: center; padding: 2px 0; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 1.3s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%           { opacity: 1;   transform: scale(1.1); }
}

.input-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#user-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}

#user-input::placeholder { color: var(--text-muted); }
#user-input:focus { border-color: var(--amber-border); }

#send-btn {
  width: 42px; height: 42px;
  background: var(--amber);
  border: none;
  border-radius: var(--radius);
  color: #1a1100;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
  font-weight: 600;
}

#send-btn:hover { opacity: 0.88; }
#send-btn:disabled { opacity: 0.35; cursor: default; }

/* Report */

.report-bubble {
  max-width: 96% !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}

.report-card-top {
  background: linear-gradient(135deg, #1a1500 0%, #1c1810 100%);
  border-bottom: 1px solid var(--amber-border);
  padding: 20px 24px 18px;
}

.report-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}

.report-priority {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.3;
  color: var(--text-primary);
  font-style: italic;
}

.report-body-sections {
  padding: 0 24px 8px;
  display: flex;
  flex-direction: column;
}

.rs {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.rs:last-of-type { border-bottom: none; }

.rs-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.rs-body {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.rs-body.primary { color: var(--text-primary); font-size: 14px; }
.rs-body.italic  { font-style: italic; }

.rs.accent-green  { background: var(--green-dim);  border-radius: var(--radius-sm); padding: 14px 16px; margin: 6px 0; border-left: 2px solid var(--green);  border-bottom: none; }
.rs.accent-amber  { background: var(--amber-dim);  border-radius: var(--radius-sm); padding: 14px 16px; margin: 6px 0; border-left: 2px solid var(--amber);  border-bottom: none; }
.rs.accent-indigo { background: var(--indigo-dim); border-radius: var(--radius-sm); padding: 14px 16px; margin: 6px 0; border-left: 2px solid var(--indigo); border-bottom: none; }
.rs.accent-red    { background: var(--red-dim);    border-radius: var(--radius-sm); padding: 14px 16px; margin: 6px 0; border-left: 2px solid var(--red);    border-bottom: none; }

.avoid-item, .alt-item {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 3px 0;
  display: flex;
  gap: 8px;
}

.report-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-high    { background: rgba(61,153,112,0.15); color: #5dba94; border: 1px solid rgba(61,153,112,0.25); }
.badge-medium  { background: rgba(212,149,42,0.12); color: #d4952a; border: 1px solid rgba(212,149,42,0.25); }
.badge-low     { background: rgba(192,57,43,0.10);  color: #e07060; border: 1px solid rgba(192,57,43,0.20); }
.badge-conf    { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-mid); }
.badge-risk-low    { background: rgba(61,153,112,0.12); color: #5dba94; border: 1px solid rgba(61,153,112,0.2); }
.badge-risk-medium { background: rgba(212,149,42,0.12); color: #d4952a; border: 1px solid rgba(212,149,42,0.2); }
.badge-risk-high   { background: rgba(192,57,43,0.10);  color: #e07060; border: 1px solid rgba(192,57,43,0.2); }
.badge-time    { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }

.report-cta { padding: 20px 24px 16px; }

.btn-cta {
  display: block;
  width: 100%;
  background: var(--amber);
  color: #1a1100;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 13px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity 0.15s;
  letter-spacing: -0.01em;
}

.btn-cta:hover { opacity: 0.88; }

.btn-restart {
  display: block;
  width: calc(100% - 48px);
  margin: 0 24px 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}

.btn-restart:hover { color: var(--text-secondary); border-color: var(--border-mid); }

/* Auth */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card .brand { font-size: 18px; margin-bottom: 4px; }

.tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -6px;
  margin-bottom: 6px;
  line-height: 1.5;
}

.auth-card input {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.auth-card input::placeholder { color: var(--text-muted); }
.auth-card input:focus { border-color: var(--amber-border); }

.btn-primary {
  background: var(--amber);
  color: #1a1100;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}

.btn-primary:hover { opacity: 0.88; }

.switch-link { font-size: 13px; color: var(--text-muted); text-align: center; }
.switch-link a { color: var(--amber); text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

.message { font-size: 13px; min-height: 18px; color: var(--text-muted); text-align: center; }
.message.error   { color: #e07060; }
.message.success { color: #5dba94; }

.italic { font-style: italic; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
/* Welcome screen */

#welcome-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
}

.welcome-inner {
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.welcome-logo {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.welcome-logo span { color: var(--amber); font-weight: 400; }

.welcome-headline {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.2;
  color: var(--text-primary);
  font-style: italic;
  letter-spacing: -0.01em;
}

.welcome-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: -12px;
}

.welcome-points {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}

.wp {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.wp-icon {
  color: var(--amber);
  font-size: 10px;
  margin-top: 4px;
  flex-shrink: 0;
}

.btn-start {
  background: var(--amber);
  color: #1a1100;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 24px;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
  letter-spacing: -0.01em;
}

.btn-start:hover { opacity: 0.88; }

.welcome-reassure {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

/* Hidden utility */

.hidden { display: none !important; }

#chat-screen { height: 100vh; }
#chat-screen .app-layout { height: 100%; }
