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

:root {
  --pink: #ffb7c5;
  --pink-dark: #e08da0;
  --pink-light: #ffe4ec;
  --pink-xlight: #fff0f4;
  --cream: #fff9fa;
  --ink: #1f2a1b;
  --ink-muted: #6b7c68;
  --ink-faint: #a8b5a4;
  --white: #ffffff;
  --border: #f0dde3;
  --shadow: 0 2px 16px rgba(224,141,160,0.12);
  --radius: 16px;
  --font: 'Poppins', sans-serif;
}

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

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.back-link {
  color: var(--pink-dark);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.back-link:hover { opacity: 0.7; }
.nav-badge {
  background: var(--pink-light);
  color: var(--pink-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.screen { display: none; }
.screen.active { display: block; }

.hero {
  text-align: center;
  padding: 48px 24px 32px;
}
.hero-icon { font-size: 2.8rem; margin-bottom: 12px; }
.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.hero p { color: var(--ink-muted); font-size: 1rem; max-width: 480px; margin: 0 auto; }

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.api-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 20px;
}
.api-bar label { font-size: 0.82rem; font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
.api-bar input {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.api-bar input:focus { border-color: var(--pink); }
.api-saved { font-size: 0.78rem; color: #6dbf8a; font-weight: 600; }
.hidden { display: none !important; }

.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.setup-sub { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 24px; }

.setup-grid { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group > label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.option-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 7px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover { border-color: var(--pink); color: var(--pink-dark); }
.pill.active {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--ink);
  font-weight: 700;
}

.error-box {
  background: #fff0f4;
  border: 1.5px solid var(--pink);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #c0395a;
  margin-top: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 13px 28px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(224,141,160,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(224,141,160,0.45);
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Chat screen */
.chat-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.btn-ghost-sm {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-ghost-sm:hover { border-color: var(--pink-dark); color: var(--pink-dark); }

.chat-header-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}
.interviewer-avatar { font-size: 1.6rem; }
.chat-header-title { font-weight: 700; font-size: 0.92rem; }
.progress-label { font-size: 0.75rem; color: var(--ink-muted); }

.progress-dots { display: flex; gap: 6px; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.dot.done { background: var(--pink-dark); }
.dot.active { background: var(--pink); }

.chat-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: calc(100vh - 240px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bubble-row {
  display: flex;
  gap: 10px;
}
.bubble-row.interviewer { align-items: flex-start; }
.bubble-row.user { flex-direction: row-reverse; align-items: flex-start; }

.bubble-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.bubble-avatar.iv { background: var(--pink-light); }
.bubble-avatar.usr { background: var(--cream); border: 1.5px solid var(--border); }

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.65;
}
.bubble.interviewer {
  background: var(--pink-light);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.bubble.user {
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
.bubble.feedback {
  background: var(--pink-xlight);
  border: 1px dashed var(--pink);
  color: var(--ink);
  border-radius: 12px;
  font-size: 0.85rem;
  font-style: italic;
}

.bubble-meta {
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 4px;
  padding: 0 4px;
}
.bubble-row.user .bubble-meta { text-align: right; }

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
}
.loading-center p { color: var(--ink-muted); font-size: 0.85rem; }

.chat-footer {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  left: 0;
  right: 0;
}
/* Sticky footer hack for wide screens */
@media (min-width: 700px) {
  .chat-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0;
    box-shadow: 0 -4px 20px rgba(224,141,160,0.12);
  }
}

#userInput {
  flex: 1;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--ink);
  outline: none;
  resize: none;
  transition: border-color 0.15s;
  line-height: 1.5;
}
#userInput:focus { border-color: var(--pink); }

.btn-send {
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(224,141,160,0.3);
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(224,141,160,0.4); }
.btn-send:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Report */
.report-score-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.score-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--pink);
  background: var(--pink-xlight);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.score-ring span { font-size: 2rem; font-weight: 800; color: var(--pink-dark); line-height: 1; }
.score-ring small { font-size: 0.75rem; color: var(--ink-muted); font-weight: 600; }
.score-verdict { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.score-sub { font-size: 0.88rem; color: var(--ink-muted); }

.report-section { margin-bottom: 20px; }
.report-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.strengths-title { color: #4a9e6d; }
.improve-title { color: #d46b6b; }
.tips-title { color: var(--pink-dark); }

.report-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.report-list li { padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; line-height: 1.55; }
.strengths-list li { background: #edf7f2; color: #2e6b45; }
.improve-list li { background: #fdf0f0; color: #9b3535; }
.tips-list li { background: var(--pink-xlight); color: var(--ink); }

.report-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--pink-light);
  border-top-color: var(--pink-dark);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Push content up above sticky footer on chat screen */
#screenChat .chat-body { padding-bottom: 100px; }
