:root {
  --na-navy: #0c2d4a;
  --na-blue: #1565a8;
  --na-blue-light: #e8f2fa;
  --na-bg: #f4f7fb;
  --surface: #fff;
  --border: #d4e0ec;
  --ink: #1a2b3c;
  --muted: #5a7085;
  --ok: #15803d;
  --ok-bg: #ecfdf5;
  --warn: #a16207;
  --warn-bg: #fefce8;
  --miss: #b91c1c;
  --miss-bg: #fef2f2;
  --grammar: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  background: var(--na-bg);
  color: var(--ink);
}

body {
  display: flex;
  flex-direction: column;
  max-width: 580px;
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--na-blue);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { height: 38px; width: auto; max-width: 170px; object-fit: contain; }

.btn-ghost {
  background: var(--na-blue-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--na-blue);
  cursor: pointer;
}

.btn-ghost:hover:not(:disabled) { background: var(--na-blue); color: #fff; }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.msg {
  max-width: 94%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.55;
  word-break: break-word;
}

.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg.user { align-self: flex-end; background: var(--na-blue-light); border: 1px solid #b8d4ea; white-space: pre-wrap; }
.msg.system { align-self: center; font-size: 0.8rem; color: var(--muted); background: transparent; border: none; }
.msg.task { border-left: 4px solid var(--na-blue); }
.msg.error { background: var(--miss-bg); border: 1px solid #fca5a5; color: var(--miss); }
.msg.typing { color: var(--muted); font-style: italic; }

.msg.feedback h4 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--na-blue);
  margin: 0.85rem 0 0.4rem;
}
.msg.feedback h4:first-child { margin-top: 0; }

.score-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.score-pill { background: var(--na-blue-light); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.score-pill.main { background: var(--na-navy); color: #fff; font-size: 1.1rem; font-weight: 700; border: none; }

.checklist { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.25rem; }
.check-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.5rem 0.65rem; border-radius: 8px; font-size: 0.88rem; border-left: 4px solid transparent; }
.check-item.status-mentioned { background: var(--ok-bg); border-left-color: var(--ok); }
.check-item.status-partial { background: var(--warn-bg); border-left-color: var(--warn); }
.check-item.status-missing { background: var(--miss-bg); border-left-color: var(--miss); }
.check-icon { flex-shrink: 0; font-weight: 700; }
.check-item.status-mentioned .check-icon { color: var(--ok); }
.check-item.status-partial .check-icon { color: var(--warn); }
.check-item.status-missing .check-icon { color: var(--miss); }
.badge-important { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; background: var(--na-navy); color: #fff; padding: 0.1rem 0.35rem; border-radius: 4px; margin-left: 0.35rem; }

.grammar-list { list-style: none; margin-top: 0.25rem; }
.grammar-list li { margin-bottom: 0.45rem; padding: 0.45rem 0.55rem; background: var(--miss-bg); border-radius: 6px; font-size: 0.88rem; }
.grammar-err { color: var(--grammar); font-weight: 600; text-decoration: underline wavy var(--grammar); cursor: help; }

.example-steps { list-style: none; margin-top: 0.35rem; }
.example-steps li { margin-bottom: 0.35rem; font-size: 0.9rem; line-height: 1.45; }
.fb-list { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.fb-list li { margin-bottom: 0.25rem; font-size: 0.9rem; }

.composer {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 2px solid var(--border);
  padding: 0.65rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.pronunciation-praise { color: var(--ok); font-weight: 500; margin-bottom: 0.35rem; }
.pronunciation-tips { margin-top: 0.25rem; }

.text-row { display: flex; align-items: flex-end; gap: 0.4rem; width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 0.35rem 0.4rem 0.35rem 0.65rem; background: var(--na-bg); }
.text-row:focus-within { border-color: var(--na-blue); }
#text-input { flex: 1; border: none; background: transparent; font-family: inherit; font-size: 0.9rem; resize: none; max-height: 80px; line-height: 1.4; outline: none; }

.btn-send { flex-shrink: 0; width: 34px; height: 34px; border: none; border-radius: 8px; background: var(--na-blue); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-mic {
  width: 100%; max-width: 300px; min-height: 76px; border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--na-navy), var(--na-blue)); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  cursor: pointer; box-shadow: 0 4px 18px rgba(12, 45, 74, 0.28); font-family: inherit;
}
.btn-mic:hover:not(:disabled) { filter: brightness(1.06); }
.btn-mic:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-mic.recording { background: linear-gradient(135deg, #991b1b, #dc2626); animation: pulse 1.2s ease infinite; }
.btn-mic-label { font-size: 0.88rem; font-weight: 700; }
@keyframes pulse { 50% { opacity: 0.88; } }

.composer-hint { font-size: 0.72rem; color: var(--muted); min-height: 1rem; text-align: center; }

.mic-permission-banner {
  background: var(--na-blue-light);
  border: 1px solid var(--na-blue);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
  text-align: center;
}

.mic-permission-banner p {
  font-size: 0.82rem;
  color: var(--na-navy);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.btn-mic-permit {
  background: var(--na-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
}

.btn-mic-permit:active { filter: brightness(0.95); }
.btn-next-task { margin-top: 0.85rem; width: 100%; padding: 0.7rem; border: none; border-radius: 10px; background: var(--na-blue); color: #fff; font-family: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer; }
.btn-next-task:hover { background: var(--na-navy); }
.transcript-box { margin-top: 0.5rem; padding: 0.55rem 0.65rem; background: var(--na-bg); border-radius: 8px; font-size: 0.9rem; line-height: 1.55; }
