/* Stuart Web UI — dark theme matching the landing page */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: #0f1018;
  color: #c3c8d4;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

#app {
  width: 100%;
  max-width: 680px;
}

/* ---------- utility ---------- */

.hidden {
  display: none !important;
}

/* ---------- onboard card ---------- */

.card {
  background: #171826;
  border: 1px solid #282b3d;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
}

.card h1 {
  font-size: 2rem;
  color: #e8ebf2;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}

.tagline {
  color: #6a7085;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card input,
.card button {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #282b3d;
  outline: none;
  width: 100%;
}

.card input {
  background: #1a1c2b;
  color: #e8ebf2;
}

.card input::placeholder {
  color: #6a7085;
}

.card input:focus {
  border-color: #7aa7d8;
}

.card button {
  background: #7aa7d8;
  color: #0f1018;
  border: none;
  cursor: pointer;
  font-weight: 600;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.card button:hover {
  background: #91b8e4;
}

.disclaimer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #6a7085;
  line-height: 1.5;
}

/* ---------- chat layout ---------- */

#chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
  background: #171826;
  border: 1px solid #282b3d;
  border-radius: 12px;
  overflow: hidden;
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #282b3d;
  background: #171826;
  flex-shrink: 0;
}

#topic-display {
  font-weight: 600;
  color: #e8ebf2;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0.5rem;
}

#close-btn {
  background: transparent;
  border: 1px solid #282b3d;
  color: #d87a7a;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

#close-btn:hover {
  background: rgba(216, 122, 122, 0.1);
}

/* ---------- messages area ---------- */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.msg p {
  margin-bottom: 0.5em;
}

.msg p:last-child {
  margin-bottom: 0;
}

.stu-msg {
  align-self: flex-start;
  background: #1a1c2b;
  border-left: 3px solid #7aa7d8;
}

.student-msg {
  align-self: flex-end;
  background: #1e2030;
  border-right: 3px solid #d4a843;
  text-align: right;
}

/* typing indicator */
.typing {
  align-self: flex-start;
  color: #6a7085;
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

.typing::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}

/* inline markdown styles */
.msg strong {
  color: #e8ebf2;
}

.msg em {
  color: #a0a8bf;
}

.msg code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  background: #0f1018;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.88em;
}

/* choices (calibration multiple-choice) */
.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.choice-btn {
  background: #1a1c2b;
  border: 1px solid #282b3d;
  color: #c3c8d4;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s;
}

.choice-btn:hover {
  border-color: #7aa7d8;
  background: #1e2030;
}

/* ready button (between teaching block and check) */
.ready-btn {
  background: #7aa7d8;
  color: #0f1018;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.ready-btn:hover {
  background: #91b8e4;
}

/* correct/incorrect indicators */
.correct-indicator {
  color: #7eb87e;
  font-weight: 600;
  margin-top: 0.25rem;
}

.incorrect-indicator {
  color: #d87a7a;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* error and crisis cards */
.error-card {
  background: rgba(216, 122, 122, 0.08);
  border: 1px solid #d87a7a;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #d87a7a;
  font-size: 0.9rem;
  align-self: flex-start;
  max-width: 85%;
}

.crisis-card {
  background: rgba(216, 122, 122, 0.1);
  border: 1px solid #d87a7a;
  border-radius: 10px;
  padding: 1rem;
  color: #e8ebf2;
  align-self: flex-start;
  max-width: 90%;
  line-height: 1.6;
}

/* summary card */
.summary-card {
  background: #171826;
  border: 1px solid #282b3d;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.summary-card h2 {
  color: #7eb87e;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.summary-card p {
  margin-bottom: 0.5rem;
}

.summary-card .muted {
  color: #6a7085;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.summary-card button {
  background: #7aa7d8;
  color: #0f1018;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 1.5rem;
  transition: background 0.15s;
}

.summary-card button:hover {
  background: #91b8e4;
}

/* ---------- input area ---------- */

#input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #282b3d;
  background: #171826;
  flex-shrink: 0;
}

#answer-input {
  flex: 1;
  background: #1a1c2b;
  border: 1px solid #282b3d;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: #e8ebf2;
  font-size: 0.95rem;
  outline: none;
}

#answer-input::placeholder {
  color: #6a7085;
}

#answer-input:focus {
  border-color: #7aa7d8;
}

#answer-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#send-btn {
  background: #7aa7d8;
  color: #0f1018;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s;
}

#send-btn:hover:not(:disabled) {
  background: #91b8e4;
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- mobile responsive ---------- */

@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }

  .card {
    padding: 1.5rem 1rem;
    border-radius: 8px;
  }

  .card h1 {
    font-size: 1.6rem;
  }

  #chat {
    height: calc(100vh - 1rem);
    border-radius: 8px;
  }

  .msg {
    max-width: 92%;
  }

  #input-area {
    padding: 0.5rem;
  }
}

/* ---------- scrollbar styling ---------- */

#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: #282b3d;
  border-radius: 3px;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: #3a3e55;
}
