/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #212121;
  --bg-elevated: #2f2f2f;
  --bg-input:    #2f2f2f;
  --border:      #3f3f3f;
  --text:        #ececec;
  --text-muted:  #8e8ea0;
  --text-dim:    #565869;
  --accent:      #FFD700;
  --accent-dark: #c9a900;
  --user-bubble: #2f2f2f;
  --radius:      12px;
  --radius-lg:   16px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --topbar-h:    56px;
  --inputbar-h:  110px;
}

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

/* ── Landing / Index / Complete ──────────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.landing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.landing-logo {
  margin-bottom: 20px;
}

.landing-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.landing-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.7;
}

.landing-subtitle strong {
  color: var(--text);
}

/* ── Form ─────────────────────────────────────────────────────────────── */
.field-group {
  text-align: left;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.field-input:focus {
  border-color: var(--accent);
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #1a1a1a;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  justify-content: center;
}

.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-arrow { flex-shrink: 0; }

/* ── App Layout ───────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: #171717;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pid-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-pip-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.pip-done   { background: #4caf50; }
.pip-active { background: var(--accent); }

/* ── Chat area ────────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 20px 20px;
  scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar       { width: 6px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Task card (yellow box) ───────────────────────────────────────────── */
.task-card-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.task-card {
  background: var(--accent);
  color: #1a1a1a;
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(255, 215, 0, 0.18);
  animation: slideDown 0.35s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-card-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(26,26,26,0.7);
  margin-bottom: 10px;
}

.task-card-body {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
  color: #1a1a1a;
  margin-bottom: 14px;
}

.task-card-instruction {
  font-size: 12px;
  color: rgba(26,26,26,0.6);
  border-top: 1px solid rgba(26,26,26,0.15);
  padding-top: 10px;
}

/* ── Chat messages ────────────────────────────────────────────────────── */
.chat-messages {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  padding: 0 8px;
}

.hidden {
  display: none !important;
}

/* ── Demo conversation (tasks 4–6) ───────────────────────────────────── */
.demo-conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto 28px;
  padding: 0 12px;
  overflow: visible;
}

.demo-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
}

.demo-row-user {
  align-self: flex-end;
  justify-content: flex-end;
  margin-right: 2px;
}

.demo-row-ai {
  align-self: flex-start;
  justify-content: flex-start;
  margin-left: 2px;
}

.demo-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  padding-bottom: 14px;
}

.msg-bubble {
  max-width: 680px;
  width: fit-content;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  animation: bubbleIn 0.25s ease;
}

.msg-demo {
  position: relative;
  background: var(--accent);
  color: #1a1a1a;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.15);
}

.msg-demo-user {
  border-bottom-right-radius: 4px;
}

.msg-demo-user::after {
  content: '';
  position: absolute;
  right: -9px;
  bottom: 14px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid var(--accent);
}

.msg-demo-ai {
  border-bottom-left-radius: 4px;
}

.msg-demo-ai::after {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 14px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 10px solid var(--accent);
}

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

.msg-user {
  background: var(--user-bubble);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-end;
}

/* ── Rating tasks ─────────────────────────────────────────────────────── */
.rating-panel {
  max-width: 680px;
  width: 100%;
  margin: 0 auto 28px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.rating-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.rating-question {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.rating-question:last-of-type {
  border-bottom: none;
  padding-bottom: 16px;
}

.rating-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.rating-label > span:not(.question-number) {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.question-number {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 6px;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 10px;
}

.rating-option {
  position: relative;
}

.rating-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.rating-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rating-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1a1a;
}

.rating-textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  outline: none;
}

.rating-textarea:focus {
  border-color: rgba(255,215,0,0.65);
}

.rating-submit-btn {
  width: 100%;
  max-width: 220px;
  align-self: flex-end;
  margin-top: 4px;
}

/* ── Typing indicator ─────────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 24px;
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Input bar ────────────────────────────────────────────────────────── */
.input-bar {
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 20px 10px;
}

.input-box-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px 10px 16px;
  max-width: 760px;
  margin: 0 auto;
  transition: border-color 0.2s;
}

.input-box-wrapper:focus-within {
  border-color: rgba(255,215,0,0.5);
}

.prompt-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

.prompt-textarea::placeholder { color: var(--text-dim); }

.prompt-textarea::-webkit-scrollbar       { width: 4px; }
.prompt-textarea::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.send-btn {
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  height: 36px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1a1a1a;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
}

.send-btn:hover:not(:disabled)  { background: var(--accent-dark); }
.send-btn:active:not(:disabled) { transform: scale(0.93); }

.send-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Next-task banner ─────────────────────────────────────────────────── */
.next-task-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 20px 8px;
  animation: bubbleIn 0.3s ease;
}

.next-banner-msg {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #1a1a1a;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-next:hover:not(:disabled)  { background: var(--accent-dark); }
.btn-next:active:not(:disabled) { transform: scale(0.98); }
.btn-next:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Complete page ────────────────────────────────────────────────────── */
.complete-card { max-width: 440px; }

.complete-icon {
  margin-bottom: 20px;
}

.complete-note {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-top: 20px;
}

/* ── Error toast ──────────────────────────────────────────────────────── */
.error-toast {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: #c0392b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: fadeSlideUp 0.2s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .landing-card           { padding: 28px 20px; }
  .task-card              { padding: 18px 18px; }
  .topbar-meta .progress-text { display: none; }
}
