:root {
  --ink: #15202b;
  --muted: #607080;
  --line: #d8e1e8;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --blue: #114f8c;
  --blue-2: #0d6f92;
  --green: #19764a;
  --red: #a13b32;
  --amber: #8a5c00;
  --shadow: 0 18px 45px rgba(28, 51, 74, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
select,
textarea,
a {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  background: #0f2f46;
  color: white;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  margin-bottom: 10px;
}

.brand-footer {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-logo-footer {
  width: 150px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #050505;
  display: block;
  margin: 0 auto;
  opacity: 0.92;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 1.65rem;
  margin-bottom: 0;
}

h3 {
  font-size: 1.2rem;
  line-height: 1.35;
}

.eyebrow {
  color: #9dbad0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
}

.panel label,
.answer-box label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.answer-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.answer-label-row label {
  margin-bottom: 0;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats div {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
}

.stats span {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
}

.stats small {
  color: #c1d4e2;
}

.tabs {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.tab,
button {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #eef6fb;
  color: #0f4f76;
  border: 1px solid #cfe0eb;
  padding: 8px 11px;
}

.icon-button.listening {
  background: #ffecec;
  color: var(--red);
  border-color: #efb5ae;
}

.tab {
  text-align: left;
  background: transparent;
  color: #d7e8f5;
}

.tab.active {
  background: #e8f4ff;
  color: #0f2f46;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.actions,
.answer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary {
  background: var(--blue);
  color: white;
}

.secondary {
  background: white;
  color: var(--blue);
  border: 1px solid var(--line);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.question-card,
.answer-box,
.feedback,
.study-card,
.rubric-card,
.download-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.download-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.download-strip h3 {
  margin-bottom: 4px;
}

.download-strip p {
  color: var(--muted);
  margin-bottom: 0;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--green);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.question-card {
  padding: 24px;
  margin-bottom: 18px;
}

.question-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.question-meta span,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eaf3f8;
  color: #315a73;
  font-size: 0.84rem;
  font-weight: 700;
}

.question-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.answer-box,
.feedback {
  padding: 20px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.mic-status {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.feedback {
  line-height: 1.5;
}

.feedback-score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.feedback-score strong {
  font-size: 2.45rem;
}

.bar {
  height: 10px;
  background: #e8eef2;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0 18px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.muted {
  color: var(--muted);
}

.complete-note {
  border-left: 4px solid var(--green);
  background: #edf8f2;
  color: #165f3d;
  padding: 11px 12px;
  margin: 16px 0 0;
}

.study-grid,
.rubric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.study-card,
.rubric-card {
  padding: 20px;
}

.study-card ul,
.rubric-card ul,
.feedback ul {
  padding-left: 18px;
  margin-bottom: 0;
}

.study-card li,
.rubric-card li,
.feedback li {
  margin: 8px 0;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(720px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(10, 26, 39, 0.45);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-head button {
  font-size: 1.4rem;
  background: transparent;
  color: var(--ink);
}

#summaryContent {
  padding: 22px;
  line-height: 1.55;
  max-height: 74vh;
  overflow: auto;
}

.verdict {
  font-size: 3rem;
  font-weight: 800;
  margin: 0;
}

.weak-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 18px;
}

.weak-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.weak-item h4 {
  font-size: 1rem;
  line-height: 1.35;
  margin: 10px 0 8px;
}

@media (max-width: 920px) {
  .shell,
  .answer-grid,
  .study-grid,
  .rubric-grid {
    grid-template-columns: 1fr;
  }

  .side {
    min-height: auto;
  }

  .tabs {
    margin-top: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-strip {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .workspace,
  .side {
    padding: 18px;
  }

  h2 {
    font-size: 1.35rem;
  }

  .actions,
  .answer-actions {
    width: 100%;
  }

  .actions button,
  .answer-actions button,
  .icon-button {
    width: 100%;
    justify-content: center;
  }

  .answer-label-row {
    align-items: stretch;
    flex-direction: column;
  }
}
