:root {
  --navy: #05274f;
  --blue: #005bea;
  --coral: #d94d3c;
  --green: var(--blue);
  --ink: var(--navy);
  --muted: #52657d;
  --line: #d5e1f0;
  --cream: #ffffff;
  color: var(--ink);
  background: #f7faff;
}

.brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
#speaking-modes {
  margin: 18px 0;
  padding: 16px;
  border: 2px solid #52657d;
  border-radius: 12px;
  min-width: 0;
}
#speaking-modes legend {
  font-weight: 700;
  padding: 0 6px;
}
#speaking-modes label {
  display: block;
  margin: 12px 0 6px;
}
#speaking-modes input:not([type='checkbox']),
#speaking-modes select {
  width: 100%;
  min-height: 44px;
  border: 2px solid #52657d;
  border-radius: 8px;
  padding: 8px;
  background: white;
  color: var(--navy);
  font: inherit;
}
#speaking-modes .checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.speaking-session {
  border: 2px solid #52657d;
  border-left: 6px solid var(--coral);
  padding: 12px 16px;
  border-radius: 12px;
  background: #eaf2ff;
  margin-top: 12px;
}
#speaking-session-status {
  font-weight: 700;
}
#speaking-question {
  line-height: 1.5;
}
.brand-logo {
  display: block;
  width: 250px;
  max-width: 100%;
  height: auto;
}
.brand small {
  margin-left: 13px;
  color: var(--muted);
}
.pill {
  border-color: var(--line);
  color: var(--navy);
}
.welcome {
  gap: 8%;
}
.intro h1 {
  font-size: clamp(32px, 3.6vw, 48px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  text-wrap: balance;
}
.intro h1 em {
  display: inline;
  font-style: italic;
  font-weight: inherit;
  white-space: nowrap;
}
.intro .philosophy {
  font-size: 1rem;
  line-height: 1.5;
  margin: 18px 0;
}
.platform-vision {
  font-weight: 400;
  font-size: 1rem;
  color: var(--muted);
  margin: 12px 0 0;
}
.journey small {
  display: block;
  color: #52657d;
  margin-top: 6px;
}
.learning-panel button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.learning-panel {
  padding: 8px 0;
}
.learning-panel > h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.learning-card {
  border: 2px solid #52657d;
  border-radius: 18px;
  background: white;
  padding: 20px;
  margin: 18px 0;
}
.learning-card h2,
.learning-card h3 {
  font-size: 22px;
  margin-top: 0;
}
.learning-card small {
  display: block;
  margin-top: 10px;
  color: #52657d;
  line-height: 1.5;
}
.practice-activity-grid {
  display: grid;
  gap: 14px;
}
.practice-activity-grid > article {
  background: #eaf2ff;
  border: 1px solid #52657d;
  padding: 16px;
  border-radius: 12px;
}
.practice-activity-grid p {
  margin-bottom: 8px;
  line-height: 1.5;
}
.practice-activity-grid button:disabled {
  opacity: 1;
  background: white;
  color: #52657d;
  border-color: #52657d;
  cursor: not-allowed;
}
.activity-symbol {
  display: inline-block;
  margin-right: 8px;
  font-size: 24px;
  vertical-align: middle;
}
#practice-origin,
#chat-practice-origin {
  overflow-wrap: anywhere;
  line-height: 1.5;
}
#explore-panel #use-topic {
  margin: 16px 0;
}
@media (max-width: 380px) {
  .learning-card {
    padding: 14px;
  }
}
.entry-card,
.prompt-card {
  background: #eaf2ff;
  border-color: var(--line);
  box-shadow: 0 14px 50px #05274f08;
}
.entry-card {
  border-top: 5px solid var(--coral);
}
.entry-symbol {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: #fff;
  color: var(--blue);
  margin-bottom: 22px;
  padding: 12px;
}
.entry-symbol svg,
.journey svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.entry-symbol svg {
  width: 100%;
  height: 100%;
}
.journey {
  border: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 0;
  margin: 32px 0 24px;
}
.journey > span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 6px;
  text-align: center;
}
.journey svg {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  color: var(--blue);
}
.journey > span:nth-child(2) svg {
  color: #b13c2e;
}
.journey > span:nth-child(3) svg {
  color: var(--navy);
}
.journey b {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0;
}
.intro > .fine {
  font-size: 1rem;
}
input[type='password'],
select,
textarea,
.secondary {
  border-color: #a9bfdc;
}
input[type='password'] {
  min-height: 50px;
}
.check {
  font-size: 1rem;
}
.check input {
  width: 20px;
  height: 20px;
}
.primary {
  min-height: 50px;
}
.primary:hover {
  background: #0045b8;
}
.entry-card .primary {
  font-size: 1rem;
}
.privacy-note {
  margin-top: 22px;
  font-size: 1rem;
  color: var(--muted);
}
.privacy-note summary {
  cursor: pointer;
  padding: 5px 0;
}
.privacy-note p {
  margin-top: 12px;
}
.teacher-note {
  margin-top: 18px;
  max-width: 450px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}
.teacher-note summary {
  cursor: pointer;
  padding: 5px 0;
}
.teacher-note p {
  margin: 12px 0 0;
}
.login-area {
  min-width: 0;
}
.login-area .teacher-note {
  max-width: none;
}
.testing-note {
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 12px;
}
.starter {
  border-color: var(--line);
}
blockquote {
  border-color: var(--coral);
}
.error {
  color: #a12e21;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline-color: var(--blue);
}
.access-code-field {
  position: relative;
  margin-bottom: 20px;
}
.access-code-field #access-code {
  width: 100%;
  margin-bottom: 0;
  padding: 13px 58px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--cream);
  color: var(--ink);
}
.access-code-toggle {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
}
.access-code-toggle:hover {
  background: #005cff12;
}
.student-workspace {
  display: block;
}
.student-setup {
  display: block;
  max-width: 440px;
  margin: 32px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--cream);
}
.student-setup .primary {
  width: 100%;
}
.student-interaction {
  max-width: 760px;
  margin: 14px auto;
}
.student-interaction .answer-card {
  border: 2px solid #52657d;
  border-radius: 20px;
  padding: 20px;
  margin-top: 18px;
  background: #e4edf9;
}
.student-interaction textarea {
  border: 2px solid #52657d;
  min-height: 160px;
  background: #ffffff;
  color: var(--navy);
  caret-color: var(--navy);
}
.student-interaction textarea::placeholder {
  color: #52657d;
  opacity: 1;
}
.student-interaction textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-color: var(--navy);
}
#practice select {
  border: 2px solid #52657d;
  background: #ffffff;
  color: var(--navy);
}
#practice .secondary {
  border-color: #52657d;
}
.student-interaction .answer-heading {
  justify-content: flex-end;
  margin-bottom: 12px;
  min-height: 24px;
}
.student-interaction #answer.drag-over {
  border-color: var(--blue);
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}
#practice #answer {
  min-height: clamp(240px, 32vh, 360px);
}
#session-notice:empty,
#storage-status:empty {
  display: none;
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.conversation-options {
  margin-top: 20px;
  color: var(--muted);
  font-size: 1rem;
}
.conversation-options summary {
  cursor: pointer;
}
.student-interaction #ideas {
  margin-top: 16px;
}
.student-interaction #record-status:not(:empty) {
  display: block;
  margin-top: 12px;
}
.student-interaction .voice-controls audio {
  display: none;
}
.write-message-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.speaker-button {
  min-width: 48px;
  min-height: 48px;
  font-size: 23px;
}
.speaker-button svg {
  display: block;
}
.transcript-tools {
  text-align: center;
  margin-top: 8px;
}
.chat-practice-tools {
  text-align: center;
}
.homework-tools {
  margin-top: 14px;
  border: 1px solid #52657d;
  border-radius: 12px;
  padding: 8px 14px;
  background: #e4edf9;
}
.homework-tools summary {
  min-height: 40px;
  padding: 8px 0;
  cursor: pointer;
  color: var(--navy);
  font-weight: 650;
}
.homework-tools input[type='file'] {
  max-width: 100%;
  margin: 8px 0;
}
.homework-tools label {
  display: block;
  margin-top: 12px;
}
#learning-goals label[for='learning-subject'],
#learning-goals label[for='content-goal'],
#learning-goals label[for='language-goal'] {
  font-weight: 700;
}
.homework-tools button {
  margin: 6px 6px 6px 0;
  min-height: 44px;
}
.homework-tools textarea {
  margin-top: 8px;
}
.homework-tools input[type='text'],
.homework-tools select {
  width: 100%;
  margin-top: 6px;
}
.homework-tools input[type='text'] {
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  border: 2px solid #52657d;
  border-radius: 8px;
}
.homework-tools[dir='rtl'] input[type='text']:placeholder-shown,
#answer[data-page-language='ar']:placeholder-shown {
  direction: rtl;
  text-align: right;
}
.homework-tools small {
  display: block;
  margin: 6px 0 12px;
}
.organizer-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.organizer-node {
  flex: 1 1 180px;
  border: 2px solid #52657d;
  border-radius: 12px;
  padding: 12px;
  background: #eaf2ff;
}
.organizer-node label {
  display: block;
  font-weight: 650;
}
.organizer-node textarea {
  width: 100%;
  min-height: 100px;
  margin-top: 8px;
}
#learning-summary {
  white-space: pre-line;
}
#counter {
  direction: ltr;
  unicode-bidi: isolate;
}
body[dir='rtl'] .voice-controls > label:not(:first-child) {
  flex-direction: column;
  align-items: stretch;
  min-width: 140px;
}
select[translate='no'] {
  direction: ltr;
}
#end-session-dialog {
  max-height: 90vh;
  overflow-y: auto;
}
#student-feedback-form {
  padding: 14px;
  margin: 12px 0;
  border: 2px solid #52657d;
  border-radius: 12px;
  background: #eaf2ff;
}
#student-feedback-form label {
  display: block;
  margin-top: 10px;
}
#student-feedback-form select,
#student-feedback-form textarea {
  width: 100%;
  margin: 6px 0 10px;
}
#learning-task {
  margin: 12px 0;
  padding: 14px;
  border: 2px solid #52657d;
  border-radius: 12px;
  background: #eaf2ff;
}
.homework-drop {
  margin: 14px 0;
  padding: 22px 16px;
  border: 2px dashed #52657d;
  border-radius: 14px;
  text-align: center;
  background: #eaf2ff;
}
.homework-drop p {
  margin-top: 0;
  font-weight: 650;
}
.homework-drop.drag-over {
  border-style: solid;
  border-color: var(--blue);
  background: #dceaff;
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.homework-drop:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.chat-practice-tools button {
  min-height: 44px;
  font-size: 1rem;
  padding: 8px 12px;
}
.chat-practice-tools button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.conversation-transcript {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 18px;
}
.conversation-transcript h2 {
  font-size: 24px;
}
.conversation-transcript ol {
  list-style: none;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.conversation-transcript li {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 1rem;
}
.conversation-transcript li p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0;
}
#end-session-dialog {
  max-width: 460px;
  width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  color: var(--navy);
}
#end-session-dialog::backdrop {
  background: #05274f66;
}
.end-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.session-summary {
  padding: 12px;
  border-radius: 12px;
  background: #f0f5fc;
  font-size: 1rem;
}
.session-summary #session-summary-text,
#end-session-summary {
  white-space: pre-line;
  line-height: 1.6;
}
.transcript-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.page-language-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 5%;
  background: #e4edf9;
  color: var(--navy);
}
.page-language-bar label {
  margin: 0;
  font-size: 1rem;
}
.page-language-bar select {
  width: auto;
  max-width: 100%;
  padding: 7px 10px;
  min-height: 36px;
  border: 2px solid #52657d;
  background: white;
  font-size: 1rem;
}
.page-language-bar small {
  font-size: 1rem;
  flex-basis: 100%;
  text-align: right;
}
.practice-header-tools {
  flex-shrink: 0;
  text-align: right;
}
#practice-clock {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
#toggle-clock {
  padding: 3px 0;
  font-size: 1rem;
  min-height: 28px;
}
#practice .practice-heading {
  align-items: flex-start;
}
@media (max-width: 420px) {
  #practice .practice-heading {
    gap: 10px;
  }
  #practice .practice-heading h1 {
    font-size: 26px;
  }
  #practice-clock {
    font-size: 1rem;
  }
}
.end-session-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--coral);
  border-radius: 12px;
  background: var(--coral);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}
.end-session-button:hover {
  background: #ff8879;
}
.end-session-button svg {
  flex-shrink: 0;
}
@media (max-width: 420px) {
  body:has(#practice:not([hidden])) .header .pill {
    display: none;
  }
  .end-session-button {
    gap: 6px;
    padding: 10px;
  }
}
.talk-mode .write-message-actions {
  display: none;
}
.mode-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 190px;
  height: 66px;
  margin: 0 auto 12px;
  border: 1px solid var(--blue);
  border-radius: 18px;
  background: var(--blue);
  color: white;
  font-size: 1rem;
  font-weight: 650;
}
.mode-switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body:has(#practice[hidden]) #switch-learner {
  display: none;
}
#reply-help {
  margin-top: 12px;
}
#reply-help > section,
#report-response {
  margin-top: 12px;
}
#memory-controls {
  margin-top: 16px;
}
.understand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
#understand-help {
  margin: 12px 0;
}
#understand-reply {
  border-inline-start: 3px solid var(--blue);
  padding: 10px 14px;
  white-space: pre-wrap;
}
.student-interaction #toggle-ideas {
  display: block;
  margin: 18px auto 0;
  min-height: 60px;
  padding: 14px 22px;
  border: 1px solid var(--coral);
  border-radius: 16px;
  background: var(--coral);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 650;
}
.student-interaction #toggle-ideas:hover {
  background: #ff8879;
}
.mic-button {
  display: grid;
  place-items: center;
  width: 144px;
  height: 144px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 60px;
}
.mic-button[aria-pressed='true'] {
  background: #b33434;
  border-color: #b33434;
}
.mic-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mic-button #record-stop-icon {
  fill: currentColor;
  stroke: none;
}
.talk-mode #answer,
.talk-mode .answer-heading,
.talk-mode #coach-submit {
  display: none;
}
.talk-mode .composer-actions {
  justify-content: center;
  padding: 25px 0;
}
.talk-mode #record-status {
  text-align: center;
}
.talk-mode .answer-card {
  min-height: 260px;
}
.talk-indicator {
  display: none;
  text-align: center;
  color: var(--navy);
}
.talk-mode .talk-indicator {
  display: block;
}
.talk-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  height: 32px;
}
.talk-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--navy);
}
.talk-indicator p {
  margin: 5px 0 10px;
  font-size: 1rem;
}
.talk-indicator[data-state='thinking'] .talk-dots span {
  animation: elvi-think 1.2s ease-in-out infinite;
}
.talk-indicator[data-state='speaking'] .talk-dots span {
  background: var(--coral);
  animation: elvi-speak 0.6s ease-in-out infinite alternate;
}
.talk-indicator .talk-dots span:nth-child(2) {
  animation-delay: 0.18s;
}
.talk-indicator .talk-dots span:nth-child(3) {
  animation-delay: 0.36s;
}
.talk-mode [data-talk-state='listening'] .mic-button {
  animation: elvi-listen 2s ease-in-out infinite;
}
@keyframes elvi-think {
  0%,
  70%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  35% {
    opacity: 1;
    transform: scale(1.15);
  }
}
@keyframes elvi-speak {
  from {
    transform: translateY(3px) scaleY(0.75);
  }
  to {
    transform: translateY(-5px) scaleY(1.3);
  }
}
@keyframes elvi-listen {
  0%,
  100% {
    box-shadow:
      0 0 0 5px #005bea16,
      0 0 14px #005bea30;
  }
  50% {
    box-shadow:
      0 0 0 12px #005bea0d,
      0 0 24px #005bea50;
  }
}
@media (prefers-reduced-motion: reduce) {
  .talk-indicator .talk-dots span,
  .talk-mode [data-talk-state='listening'] .mic-button {
    animation: none;
  }
  .talk-mode [data-talk-state='listening'] .mic-button {
    box-shadow: 0 0 0 7px #005bea25;
  }
}
body:has(#practice:not([hidden])) .header {
  padding-top: 10px;
  padding-bottom: 10px;
}
body:has(#practice:not([hidden])) .brand-logo {
  width: 155px;
}
body #practice {
  padding-top: 16px;
  padding-bottom: 24px;
}
#practice .practice-heading {
  margin-bottom: 12px;
}
#practice .practice-heading h1 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
}
#practice #session-notice,
#practice #storage-status {
  margin: 4px 0;
  line-height: 1.45;
}
@media (max-height: 800px) {
  .student-interaction .answer-card {
    padding: 14px;
    margin-top: 10px;
  }
  .student-interaction textarea {
    min-height: 120px;
  }
  .conversation-options {
    margin-top: 12px;
  }
  .talk-mode .answer-card {
    min-height: 210px;
  }
  .talk-mode .composer-actions {
    padding: 12px 0;
  }
  .student-interaction #toggle-ideas {
    margin-top: 12px;
  }
}
.sidebar #level {
  margin-bottom: 9px;
}
.sidebar #level-note {
  margin-bottom: 25px;
}
@media (max-width: 600px) {
  .sidebar label[for='grade'],
  .sidebar #grade,
  .sidebar #level-note {
    grid-column: 1/-1;
  }
  .sidebar label[for='grade'] {
    grid-row: 2;
  }
  .sidebar #grade {
    grid-row: 3;
  }
  .sidebar label[for='level'],
  .sidebar label[for='language'] {
    grid-row: 4;
  }
  .sidebar #level,
  .sidebar #language {
    grid-row: 5;
  }
  .sidebar #level-note {
    grid-row: 6;
  }
}

@media (max-width: 600px) {
  .brand-logo {
    width: 190px;
  }
  .brand small {
    font-size: 1rem;
  }
  .intro h1 {
    font-size: clamp(30px, 7.8vw, 40px);
  }
  .journey {
    gap: 8px;
    margin-top: 24px;
  }
  .journey > span {
    padding: 15px 4px;
    border-radius: 15px;
  }
  .journey svg {
    width: 45px;
    height: 45px;
    margin-bottom: 12px;
  }
  .journey b {
    font-size: 1rem;
  }
  .entry-symbol {
    width: 58px;
    height: 58px;
    float: right;
    margin: 0 0 12px 12px;
  }
}
#teaching-point {
  white-space: pre-line;
  unicode-bidi: plaintext;
}
#language-help {
  margin-block: 12px;
}
#language-help summary {
  cursor: pointer;
  min-height: 44px;
  padding-block: 10px;
}
#language-help .check {
  margin-block: 12px 0;
  min-height: 44px;
  align-items: center;
}
#stop-speaking {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  min-width: 190px;
  margin: 12px auto;
  font-size: 1rem;
  border-width: 2px;
}
#elvi-caption,
#recognized-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid currentColor;
  border-radius: 10px;
}
#speech-caption-panel {
  margin-block: 12px;
}
#speech-repair-panel textarea {
  display: block !important;
  min-height: 100px;
  margin-block: 10px;
}
#speech-repair-panel button,
#send-reviewed-speech {
  min-height: 44px;
  margin: 6px;
}
#connection-recommendation button,
#connection-followup button {
  min-height: 44px;
  margin: 5px;
}
#connection-recommendation {
  margin-block: 16px;
}
#human-step-panel {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}
#more-practice > summary {
  min-height: 44px;
  padding-block: 12px;
  cursor: pointer;
  font-weight: 650;
}
#connection-followup h2 {
  font-size: 22px;
}
.talk-mode [data-talk-state='listening'] .mic-button {
  box-shadow: 0 0 0 8px #005bea40;
}

#welcome :is(p, label, input, button, select, textarea, summary, small, .journey, .journey b, h2) {
  font-size: 1rem;
  line-height: 1.5;
}
#welcome h2 {
  font-weight: 650;
  letter-spacing: normal;
}
#welcome .entry-card h2 {
  font-size: 2rem;
  line-height: 1.2;
}

body:has(#welcome:not([hidden])) .header {
  padding-top: 10px;
  padding-bottom: 10px;
}
body:has(#welcome:not([hidden])) .brand-logo {
  width: 180px;
}
body:has(#welcome:not([hidden])) .page-language-bar {
  padding-top: 4px;
  padding-bottom: 4px;
}
body:has(#welcome:not([hidden])) footer {
  padding-top: 12px;
  padding-bottom: 12px;
}
#welcome {
  padding-top: 40px;
  padding-bottom: 24px;
  align-items: start;
  gap: 24px 6%;
}
#welcome .intro h1 {
  margin-bottom: 14px;
}
#welcome .philosophy {
  margin: 12px 0;
}
#welcome .journey {
  margin-top: 20px;
  margin-bottom: 0;
}
#welcome .journey > span {
  padding: 14px 6px;
}
#welcome .journey svg {
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
}
#welcome .entry-card {
  padding: 22px;
}
#welcome .entry-symbol {
  width: 40px;
  height: 40px;
  float: right;
  padding: 7px;
  margin: 0 0 8px 12px;
  border-radius: 12px;
}
#welcome .entry-card h2 {
  margin-bottom: 20px;
}
#welcome .teacher-note {
  margin-top: 10px;
}
@media (max-width: 600px) {
  body:has(#welcome:not([hidden])) .brand-logo {
    width: 140px;
  }
  #welcome {
    padding-top: 32px;
    padding-bottom: 16px;
    gap: 20px;
  }
  #welcome .entry-card {
    padding: 20px;
  }
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
#practice #switch-mode {
  display: inline-flex;
  gap: 4px;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 4px;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
}
#practice #switch-mode button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
#practice #switch-mode button[aria-pressed='true'] {
  background: #005bea;
  color: #fff;
}
#session-tools {
  position: relative;
}
#session-tools > summary {
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.session-menu-actions {
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  z-index: 20;
  display: grid;
  gap: 8px;
  padding: 12px;
  width: min(300px, 80vw);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px #0002;
}
.session-menu-actions button {
  width: 100%;
  text-align: start;
  min-height: 44px;
}
#practice #record {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  line-height: 1.3;
}
#record-label {
  max-width: 120px;
  font-size: 1rem;
  font-weight: 600;
}
#practice #choose-homework {
  min-width: 48px;
  min-height: 48px;
  padding: 8px;
}
#practice .composer-actions {
  flex-wrap: wrap;
}
#practice.talk-mode .composer-actions {
  justify-content: space-between;
}
#practice .talk-mode .composer-actions {
  justify-content: space-between;
}
#practice .talk-mode .write-message-actions {
  display: flex;
}
#practice .talk-mode #hear-reply {
  display: none;
}
#practice .talk-mode .composer-actions {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) auto minmax(48px, 1fr);
  align-items: center;
}
#practice .talk-mode .record-row {
  grid-column: 2;
  justify-self: center;
}
#practice .talk-mode .write-message-actions {
  grid-column: 3;
  justify-self: end;
}
.attachment-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
}
#attachment-name {
  flex: 1 1 140px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}
#attachment-state {
  color: var(--muted);
}
#attachment-chip button {
  min-height: 44px;
}
#attachment-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: 85dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: var(--cream);
  color: var(--ink);
}
#attachment-dialog::backdrop {
  background: #05274f88;
}
.attachment-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#attachment-dialog h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: normal;
  line-height: 1.3;
}
#attachment-dialog textarea {
  width: 100%;
  min-height: 180px;
  margin: 8px 0 12px;
}
#homework-drop {
  padding: 12px;
}
#practice-form.drag-over {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
#speech-caption-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
#recognized-text {
  margin-top: 0;
}
#composer-options {
  margin-top: 12px;
}
@media (max-width: 420px) {
  #practice #switch-mode button {
    font-size: 1.25rem;
    padding: 10px;
  }
  #practice #switch-mode svg {
    width: 22px;
    height: 22px;
  }
  .composer-toolbar {
    gap: 8px;
  }
  #session-tools > summary {
    padding: 10px 8px;
  }
}
/* One chat box contains message history above its composer. */
#practice #chat-history {
  max-height: 45dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 4px 4px 16px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
#practice #chat-history[hidden] {
  display: none;
}
#practice .talk-mode #chat-history {
  display: none;
}
#practice #chat-box > #practice-form {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#practice #chat-box:has(#chat-history:not([hidden])) #answer {
  min-height: 72px;
  height: 88px;
}
#chat-messages {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  margin: 0;
}
#practice .chat-message {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 18px;
  overflow-wrap: anywhere;
}
#practice .chat-message-you {
  align-self: flex-end;
  background: #005bea;
  color: white;
  border-end-end-radius: 5px;
}
#practice .chat-message-elvi {
  align-self: flex-start;
  background: var(--coral);
  color: #05274f;
  border: 1px solid var(--coral);
  border-end-start-radius: 5px;
}
#practice .chat-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}
#practice .chat-message p {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.5;
}
#practice .chat-message small {
  display: block;
  margin-top: 6px;
}
#practice #chat-box #feedback {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}
#practice
  #chat-box
  #feedback
  > :is(.eyebrow, h2, #feedback-learning-link, #acknowledgment, #focused-teaching) {
  display: none;
}
#practice #chat-box #feedback .retry-bar > p {
  display: none;
}
@media (max-width: 600px) {
  #practice .chat-message {
    max-width: 92%;
  }
}
#practice #speaking-modes {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}
#practice #speaking-modes[hidden] {
  display: none;
}
#practice .speaking-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#practice .speaking-mode-buttons button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
#practice .speaking-mode-buttons button[aria-pressed='true'] {
  background: #005bea;
  color: white;
  border-color: #005bea;
}
#practice .speaking-mode-buttons button:disabled {
  opacity: 0.65;
  cursor: default;
}
.session-menu-actions {
  max-height: none;
  overflow: visible;
}
#practice .activity-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
#practice .activity-buttons button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 10px 6px;
  text-align: center;
  white-space: normal;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
}
#practice .activity-buttons button:hover {
  border-color: #005bea;
}
#practice .activity-buttons button:disabled {
  opacity: 0.6;
}
.session-menu-actions hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
#activity-topic-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: var(--cream);
  color: var(--ink);
}
#activity-topic-dialog::backdrop {
  background: #05274f88;
}
#activity-topic-dialog h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
}
#activity-topic-dialog input {
  width: 100%;
  margin: 8px 0 16px;
}
.activity-topic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#practice #session-tools .session-menu-actions button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: start;
  text-decoration: none;
  box-shadow: none;
  white-space: normal;
}
#practice #session-tools .session-menu-actions button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--cream) 92%, #005bea);
  border-color: #005bea;
  text-decoration: none;
}
#practice #session-tools .session-menu-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
#practice #session-tools .activity-buttons button {
  min-height: 88px;
  padding: 10px 6px;
  justify-content: center;
  text-align: center;
}
#practice #session-tools .session-menu-actions {
  background: #fff;
  color: #000;
  border-color: #cfd8e3;
}
#practice #session-tools .session-menu-actions button {
  color: #000;
  background: #fff;
  border-color: #cfd8e3;
  opacity: 1;
}
#practice #session-tools .session-menu-actions button:disabled {
  color: #000;
  opacity: 1;
  cursor: not-allowed;
}
#practice #session-tools .session-menu-actions button:hover:not(:disabled) {
  background: #edf4ff;
}
.message-reaction-picker > summary::-webkit-details-marker {
  display: none;
}
.message-reaction-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.message-reaction-picker {
  position: relative;
}
.message-reaction-picker > summary {
  display: grid;
  place-items: center;
  list-style: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.4rem;
}
.message-reaction-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 6px;
}
#end-session-dialog button:disabled {
  opacity: 1;
  filter: none;
}
#practice .message-reaction-choices button {
  width: 36px;
  min-height: 36px;
  padding: 4px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: #05274f;
  font-size: 1.2rem;
  cursor: pointer;
}
#practice .message-reaction-choices button[aria-pressed='true'] {
  outline: 2px solid #05274f;
}

/* Keep the active chat within the viewport; messages scroll inside the box. */
body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden])) {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  & .page-language-bar {
    flex-shrink: 0;
    padding: 3px 5%;
    gap: 6px;
  }
  & .page-language-bar select {
    width: 260px;
    min-height: 34px;
    padding: 4px 8px;
  }
  & .header {
    width: 100%;
    max-width: none;
    margin: 0;
    flex-shrink: 0;
    padding: 10px 5%;
    gap: 12px;
  }
  & .brand-logo {
    width: 180px;
  }
  & .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  & .brand small {
    margin: 1px 0 0 13px;
  }
  & main {
    flex: 1;
    min-height: 0;
  }
  & #practice {
    height: 100%;
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  & #practice .practice-heading {
    flex-shrink: 0;
    align-items: center;
    margin-bottom: 6px;
  }
  & #practice .practice-heading h1 {
    margin: 0;
    font-size: 28px;
  }
  & .practice-header-tools {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  & #practice-clock {
    margin: 0;
  }
  & #practice .workspace {
    flex: 1;
    min-height: 0;
    min-width: 0;
  }
  & #practice .student-interaction {
    height: 100%;
    width: 100%;
    max-width: none;
    min-height: 0;
    min-width: 0;
    margin-block: 0;
  }
  & #chat-panel {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  & #chat-panel > p:empty {
    display: none;
  }
  & .composer-toolbar {
    flex-shrink: 0;
    margin: 0;
  }
  & #practice #switch-mode button {
    min-height: 44px;
    padding: 6px 14px;
  }
  & #practice #chat-box {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    overscroll-behavior: contain;
  }
  & #practice #chat-history {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    margin-bottom: 6px;
    padding-bottom: 8px;
  }
  & #practice #practice-form {
    flex-shrink: 0;
  }
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history[hidden]) > #practice-form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history[hidden]) #answer {
    flex: 1 1 0;
    min-height: 64px;
    max-height: none;
  }
  & #practice #answer,
  & #practice #chat-box:has(#chat-history:not([hidden])) #answer {
    min-height: 64px;
    height: clamp(64px, 12dvh, 160px);
    max-height: 22dvh;
    resize: none;
  }
  & #practice .answer-heading {
    min-height: 20px;
    margin-bottom: 10px;
  }
  & #practice .composer-actions {
    margin: 6px 0;
    padding: 0;
  }
  & #interaction:not(.talk-mode) #chat-box:has(#chat-history:not([hidden])) .composer-actions {
    float: inline-end;
    margin-inline-start: 12px;
  }
  & #interaction:not(.talk-mode) #chat-box:has(#chat-history:not([hidden])) #practice-form::after {
    content: '';
    display: table;
    clear: both;
  }
  &
    #interaction:not(.talk-mode)
    #chat-box:has(#chat-history:not([hidden]))
    #practice-form
    > .check {
    margin-top: 14px;
  }
  & #practice #practice-form > .check {
    display: inline-flex;
    margin: 4px 14px 4px 0;
  }
  & #composer-options {
    display: inline-block;
    margin: 4px 0;
    vertical-align: top;
  }
  & #composer-options[open] {
    display: block;
  }
  & #practice .talk-mode #practice-form > label:has(#bilingual-support) {
    display: none;
  }
  & #practice .talk-mode #composer-options {
    display: block;
    margin: auto 0 0;
    padding-top: 6px;
  }
  & #practice .talk-mode #composer-options > summary {
    width: fit-content;
    margin-inline: 0;
  }
  & #practice-form > :is(p, span):empty {
    display: none;
  }
  & #practice #speaking-modes {
    flex-shrink: 0;
    align-self: center;
    width: max-content;
    max-width: 90vw;
    margin: 0;
    padding: 6px 10px;
    max-height: 30dvh;
    overflow: auto;
  }
  & #practice #speaking-modes > legend {
    padding-inline: 0;
  }
  & #practice .talk-indicator[data-state='ready'] {
    display: none;
  }
  & #practice .talk-mode #practice-form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-block: 0;
  }
  & #practice .talk-mode #chat-box {
    position: relative;
    padding-block: 8px;
    container-type: size;
  }
  & #practice .talk-mode .composer-actions {
    position: absolute;
    inset-inline: 12px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
  }
  & #practice .talk-mode #record {
    --mic-size: clamp(80px, calc(100cqh - 20px), 168px);
    width: var(--mic-size);
    height: var(--mic-size);
    gap: clamp(4px, 4cqh, 8px);
    border: 3px solid #ffc3b8;
    background: linear-gradient(145deg, #ff9a87, #ff705d 65%, #f45e4d);
    color: #05274f;
    box-shadow:
      0 0 0 6px #ff705d18,
      0 8px 20px #ff705d30;
  }
  & #practice .talk-mode #record-label {
    max-width: min(132px, calc(var(--mic-size) - 12px));
    font-size: clamp(14px, 16cqh, 18px);
    font-weight: 700;
    line-height: 1.25;
  }
  & .talk-mode #record svg {
    width: clamp(28px, 32cqh, 60px);
    height: clamp(28px, 32cqh, 60px);
  }
  & #practice .talk-mode #record:hover:not(:disabled) {
    background: linear-gradient(145deg, #ffad9d, #ff806e 65%, #ff705d);
    box-shadow:
      0 0 0 8px #ff705d20,
      0 10px 24px #ff705d40;
  }
  & #practice .talk-mode #record[aria-pressed='true'] {
    background: #b33434;
    border-color: #ffc1ba;
    color: #fff;
  }
  & #practice #chat-box #feedback {
    flex-shrink: 0;
    max-height: 25dvh;
    overflow: auto;
    margin-top: 6px;
  }
  & #reply-tools {
    flex-shrink: 0;
    margin-top: 6px;
  }
  & #reply-tools:has(#feedback[hidden]) {
    display: none;
  }
  & #reply-tools > summary {
    cursor: pointer;
    padding: 4px 0;
  }
  & #practice .talk-dots {
    height: 12px;
  }
  & .talk-indicator[data-state='ready'] .talk-dots {
    display: none;
  }
  & #practice .talk-indicator p {
    margin: 2px 0 4px;
  }
  & .chat-footer-tools {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  & #practice #toggle-ideas {
    align-self: center;
    margin: 0;
    min-height: 60px;
    padding: 14px 22px;
  }
  & .chat-practice-tools {
    margin: 0;
  }
  & #homework-tools {
    margin: 0;
    padding: 8px 14px;
  }
  & #homework-tools > summary {
    min-height: 40px;
    padding: 8px 0;
  }
  & #homework-tools[open] {
    padding: 8px 14px;
  }
  & footer {
    flex-shrink: 0;
    margin: 0;
    padding: 4px 5%;
    font-size: 1rem;
    gap: 4px;
  }
  & .session-menu-actions {
    max-height: none;
    overflow: visible;
  }
}

/* Expanded help can use the page below the compact main screen. */
body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden])):is(
    :has(#reply-help[open]),
    :has(
      .talk-mode
        #speaking-modes
        > :is(#test-options, #companion-options, #roleplay-options, #presentation-options):not(
          [hidden]
        )
    )
  ) {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
  & main {
    flex: none;
  }
  & #practice,
  & #chat-panel,
  & #practice .student-interaction {
    height: auto;
  }
  & #practice #interaction:not(.talk-mode) #chat-box {
    flex: none;
    min-height: 360px;
    overflow: visible;
  }
  & #practice #chat-history {
    flex: none;
    max-height: 35dvh;
  }
  & #practice #chat-box #feedback {
    max-height: none;
    overflow: visible;
  }
}

/* Let the tools menu show all actions without an internal scrollbar. */
#practice #session-tools .session-menu-actions {
  max-height: none;
  overflow: visible;
}
#learning-goals-title {
  font: inherit;
  font-weight: 700;
  margin: 16px 0 12px;
}

/* Keep an accessible screen title without a visible chat heading. */
body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden]))
  #screen-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden]))
  .practice-header-tools {
  margin-inline-start: auto;
}

#practice #learning-goals :is(#content-goal-example, #language-goal-example) {
  color: var(--muted);
}

#practice #homework-details > :is(summary, p.fine) {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Interface icons share the outline treatment used by Write and Talk. */
.ui-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#practice .speaking-mode-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#practice .attachment-button .ui-icon {
  width: 26px;
  height: 26px;
}
.theme-toggle .ui-icon {
  margin-inline-end: 0;
}
#practice .activity-symbol .ui-icon {
  width: 36px;
  height: 36px;
}

#practice #hear-reply {
  color: #005bea;
}

#practice #toggle-ideas .ui-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  stroke-width: 1.8;
}

#practice #toggle-ideas {
  background: #005bea;
  border-color: #005bea;
  color: #fff;
}
#practice #toggle-ideas:hover {
  background: #004bc2;
  border-color: #004bc2;
}

#practice #interaction:not(.talk-mode) #answer:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--coral) 70%, transparent);
  outline-offset: 2px;
}

html[data-theme='dark'] #practice #session-tools .session-menu-actions {
  background: #17263b;
  color: #edf4ff;
  border-color: #71849e;
  box-shadow: 0 8px 24px #0005;
}
html[data-theme='dark'] #practice #session-tools .session-menu-actions button {
  background: #22364f;
  color: #edf4ff;
  border-color: #71849e;
}
html[data-theme='dark'] #practice #session-tools .session-menu-actions button:disabled {
  background: #22364f;
  color: #edf4ff;
  opacity: 1;
}
html[data-theme='dark'] #practice #session-tools .session-menu-actions button:hover:not(:disabled) {
  background: #2b4564;
  border-color: #8dbbff;
}

/* Keep the login card’s coral outline in dark mode. */
html[data-theme='dark'] #login-form.entry-card {
  border-color: var(--coral);
}

/* Make the full login card outline visible against the light page. */
html:not([data-theme='dark']) #login-form.entry-card {
  border: 2px solid #ff705d;
  border-top-width: 5px;
  box-shadow:
    0 0 0 3px #ff705d12,
    0 12px 30px #05274f14;
}

/* Coaching represents ELVI in the landing-page journey. */
#welcome .journey > span:nth-child(2) > svg {
  color: var(--coral);
  stroke: currentColor;
}

#practice-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#practice-clock-controls:not([hidden]) {
  display: flex;
  align-items: center;
}
#practice-clock .ui-icon {
  flex-shrink: 0;
  margin: 0;
}
#practice-clock:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 3px;
}

.profile-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  text-decoration: none;
}
.profile-icon-button .ui-icon {
  margin: 0;
}
.profile-icon-button .switch-arrow-blue {
  stroke: var(--blue);
}
.profile-icon-button .switch-arrow-coral {
  stroke: var(--coral);
}
.profile-icon-button[hidden] {
  display: none;
}

html[data-theme='dark'] #welcome #access-code:focus {
  border-color: var(--blue);
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* Keep the footer divider across the viewport in both landing and chat layouts. */
body > footer {
  width: 100%;
  max-width: none;
}

/* Spend short-window space on the composer, keeping readable type and controls. */
@media (max-height: 740px), (max-width: 600px) {
  body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden])) {
    & .header {
      padding-block: 4px;
    }
    & .brand-logo {
      width: 140px;
    }
    & #chat-panel {
      gap: 4px;
    }
    & #practice .practice-heading {
      margin-bottom: 2px;
    }
    & #practice #chat-box {
      padding: 8px;
    }
    & #practice .answer-heading {
      margin-bottom: 6px;
    }
    & #practice .composer-actions {
      margin-block: 2px;
    }
    & .chat-footer-tools {
      gap: 4px;
    }
    & #practice #homework-tools {
      padding-block: 2px;
    }
    & #practice #homework-tools > summary {
      min-height: 36px;
      padding-block: 4px;
    }
    & #practice #toggle-ideas {
      min-height: 44px;
      padding-block: 6px;
    }
    & footer {
      padding-block: 2px;
    }
  }
}

/* Keep contextual practice beside Ideas when a short desktop needs the row. */
@media (max-height: 740px) and (min-width: 640px) {
  body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden])) {
    & .chat-footer-tools {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      align-items: center;
      gap: 4px 12px;
    }
    & #homework-tools {
      grid-column: 1 / -1;
    }
    & #practice #toggle-ideas {
      justify-self: end;
    }
    & .chat-practice-tools {
      justify-self: start;
    }
    & .chat-practice-tools:has(> button[hidden]) {
      display: none;
    }
    & .chat-footer-tools:has(#open-chat-practice[hidden]) #toggle-ideas {
      grid-column: 1 / -1;
      justify-self: center;
    }
  }
}

/* Let the landing layout use the browser's space, with a natural overflow
   fallback for expanded disclosures, zoom, and exceptionally small windows. */
body:has(#welcome:not([hidden])) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  & .page-language-bar,
  & .header,
  & footer {
    flex-shrink: 0;
  }
  & .header {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  & main {
    display: flex;
    flex: 1;
    min-width: 0;
  }
  & #welcome {
    flex: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-block: clamp(12px, 3dvh, 40px);
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 96px);
    align-items: center;
  }
  & #welcome .intro,
  & #welcome .login-area {
    min-width: 0;
  }
  & #welcome .intro h1 {
    font-size: clamp(32px, 3.6vw, 72px);
    overflow-wrap: anywhere;
  }
  & footer {
    width: 100%;
    margin: 0;
  }
}

@media (max-height: 740px), (max-width: 680px) {
  body:has(#welcome:not([hidden])) {
    & .header {
      padding-block: 4px;
    }
    & .brand-logo {
      width: 140px;
    }
    & .page-language-bar {
      padding-block: 3px;
      gap: 6px;
    }
    & .page-language-bar select {
      min-width: 0;
      max-width: 70%;
    }
    & #welcome {
      padding-block: 12px;
    }
    & #welcome .entry-card {
      padding: 14px;
    }
    & #welcome .entry-card h2 {
      font-size: 1.75rem;
      margin-bottom: 12px;
    }
    & #welcome label {
      margin-bottom: 6px;
    }
    & #welcome .access-code-field {
      margin-bottom: 12px;
    }
    & #welcome #access-code {
      min-height: 44px;
      padding-block: 8px;
    }
    & #welcome .check {
      line-height: 1.35;
      margin-bottom: 12px;
    }
    & #welcome .primary {
      min-height: 44px;
      padding-block: 8px;
    }
    & #welcome .privacy-note {
      margin-top: 10px;
    }
    & #welcome .privacy-note summary,
    & #welcome .teacher-note summary {
      padding-block: 3px;
    }
    & #welcome .teacher-note {
      margin-top: 6px;
    }
    & footer {
      padding-block: 4px;
    }
  }
}

@media (max-width: 680px) {
  body:has(#welcome:not([hidden])) {
    & .header {
      padding-inline: 14px;
      gap: 8px;
    }
    & .header-right {
      flex-wrap: nowrap;
      gap: 6px;
    }
    & .brand-logo {
      width: 110px;
    }
    & #welcome {
      grid-template-columns: minmax(0, 1fr);
      gap: 8px;
      align-content: center;
      padding: 8px 14px;
    }
    & #welcome .intro h1 {
      font-size: clamp(26px, 6.8vw, 36px);
      line-height: 1.14;
      margin-bottom: 8px;
    }
    & #welcome .philosophy {
      line-height: 1.35;
      margin-block: 6px;
    }
    & #welcome .journey {
      margin-block: 8px 0;
      gap: 6px;
    }
    & #welcome .journey > span {
      padding: 4px;
      border-radius: 12px;
    }
    & #welcome .journey svg {
      width: 24px;
      height: 24px;
      margin-bottom: 4px;
    }
    & #welcome .journey b {
      line-height: 1.25;
    }
    & footer {
      font-size: 0.875rem;
      gap: 8px;
    }
  }
}

@media (max-width: 680px) and (max-height: 800px) {
  body:has(#welcome:not([hidden])) {
    & .brand-logo {
      width: 110px;
    }
    & #welcome {
      gap: 8px;
      padding-block: 8px;
    }
    & #welcome .journey svg {
      width: 24px;
      height: 24px;
    }
  }
}

/* Local assignment-photo preview inside the existing review dialog. */
#homework-photo-preview {
  display: block;
  max-width: 100%;
  max-height: 30dvh;
  object-fit: contain;
  margin: 12px auto;
}

/* A stable speaking stage keeps expanded help below the microphone. */
.talk-composer-stage {
  display: contents;
}
body:has(#practice:not([hidden]) #interaction:not([hidden]) #chat-panel:not([hidden])) {
  & #interaction.talk-mode[data-stable-talk] #chat-box {
    flex: none;
    height: auto;
    min-height: 0;
    container-type: normal;
    overflow: visible;
  }
  & #interaction.talk-mode[data-stable-talk] #practice-form {
    flex: none;
    display: flex;
    flex-direction: column;
  }
  & #interaction.talk-mode[data-stable-talk] .talk-composer-stage {
    display: block;
    flex: none;
    height: max(200px, calc(100dvh - var(--talk-reserved-height, 432px) - 52px));
    position: relative;
  }
  & #interaction.talk-mode[data-stable-talk] .composer-actions {
    position: absolute;
    inset: 0;
    height: 100%;
    top: 0;
    transform: none;
    padding: 0;
    margin: 0;
  }
  & #interaction.talk-mode[data-stable-talk] #composer-options {
    flex: none;
    margin: 0;
    padding-top: 6px;
  }
  & #interaction.talk-mode[data-stable-talk] #record {
    --mic-size: clamp(120px, 24dvh, 168px);
    width: var(--mic-size);
    height: var(--mic-size);
    gap: 8px;
  }
  & #interaction.talk-mode[data-stable-talk] #record-label {
    font-size: 18px;
  }
  & #interaction.talk-mode[data-stable-talk] #record svg {
    width: 60px;
    height: 60px;
  }
  & #speaking-test-hint {
    display: block;
    margin: 4px 0 0;
  }
}

html:has(#practice:not([hidden]) .talk-mode) {
  scrollbar-gutter: stable;
}

/* Write is a message thread first; the composer must not consume its history. */
body:has(
  #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
) {
  & #practice #chat-box {
    overflow: hidden;
    min-height: 300px;
  }
  & #practice #chat-history {
    flex: 1 1 0;
    min-height: 160px;
    max-height: none;
    padding: 6px 4px 10px;
  }
  & #practice #chat-box > #practice-form {
    flex: 0 0 auto;
  }
  & #practice #chat-box:has(#chat-history:not([hidden])) #answer {
    height: 48px;
    min-height: 48px;
    max-height: 96px;
    padding: 9px 12px;
    line-height: 1.4;
  }
  & #practice .answer-heading {
    min-height: 18px;
    margin-bottom: 3px;
  }
  & #practice #reply-tools {
    margin-top: 2px;
  }
  & #practice #reply-tools > summary {
    padding-block: 2px;
  }
  & .chat-footer-tools {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
  }
  & #homework-tools {
    flex: 1 1 220px;
    grid-column: auto;
    padding: 8px 12px;
  }
  & #homework-tools[open] {
    flex-basis: 100%;
  }
  & #practice #toggle-ideas {
    min-height: 44px;
    padding: 8px 14px;
    margin: 0;
    font-size: 1rem;
  }
  & .chat-practice-tools {
    margin: 0;
  }
  & .chat-practice-tools button {
    padding-block: 8px;
  }
  & #chat-messages {
    gap: 8px;
  }
  & #practice .chat-message {
    position: relative;
    max-width: min(80%, 42rem);
    padding: 8px 40px 8px 12px;
    border-radius: 16px;
  }
  & #practice .chat-message strong {
    margin-bottom: 2px;
  }
  & #practice .chat-message p {
    line-height: 1.4;
  }
  & .message-reaction-tools {
    position: absolute;
    inset-block-start: 4px;
    inset-inline-end: 6px;
    margin: 0;
  }
  & .message-reaction-picker > summary {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  & .message-reaction-choices {
    position: absolute;
    top: 28px;
    right: 0;
    width: 180px;
    z-index: 5;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--cream);
  }
}
@media (max-height: 600px), (max-width: 600px) {
  body:has(
    #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
  ) {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
    & #practice #chat-box {
      flex: none;
      height: max(360px, 65dvh);
    }
  }
}

/* Plain bubbles: authors remain available to assistive technology and exports. */
#practice .chat-message .message-reaction-tools:not(.has-reaction) {
  opacity: 0;
}
#practice .chat-message:hover .message-reaction-tools,
#practice .chat-message:focus-within .message-reaction-tools {
  opacity: 1;
}

/* The writing area has a usable default and a native vertical resize handle. */
body:has(
  #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
) {
  & #practice #chat-box {
    overflow: auto;
  }
  & #practice #interaction:not(.talk-mode) #chat-box #answer,
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history[hidden]) #answer,
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history:not([hidden])) #answer {
    flex: 0 0 auto;
    height: clamp(96px, 14dvh, 144px);
    min-height: 80px;
    max-height: max(160px, 35dvh);
    resize: vertical;
    overflow: auto;
  }
}

/* Prioritize the real message window, including the full page chrome. */
body:has(
  #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
) {
  & .page-language-bar {
    padding-block: 1px;
  }
  & .page-language-bar select {
    min-height: 28px;
    padding-block: 2px;
  }
  & .header {
    padding-block: 4px;
  }
  & .header .brand-logo {
    width: 104px;
  }
  & .header .primary {
    min-height: 40px;
    padding: 7px 12px;
  }
  & .header .pill {
    padding-block: 5px;
  }
  & #practice .practice-heading {
    margin-bottom: 0;
    min-height: 28px;
  }
  & #practice .practice-header-tools .profile-icon-button {
    min-height: 28px;
    padding-block: 2px;
  }
  & #practice .composer-toolbar {
    margin: 0;
  }
  & #practice #chat-box {
    overflow: hidden;
    padding: 8px;
    min-height: 360px;
  }
  & #practice #chat-history {
    flex: 1 1 0;
    min-height: 240px;
    max-height: none;
  }
  & #practice #interaction:not(.talk-mode) #chat-box #answer,
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history[hidden]) #answer,
  & #practice #interaction:not(.talk-mode) #chat-box:has(#chat-history:not([hidden])) #answer {
    height: 96px;
    min-height: 96px;
    max-height: 240px;
  }
  & #practice .composer-actions {
    margin-block: 2px;
  }
  & #practice .composer-actions .icon-button {
    min-height: 40px;
    width: 40px;
    height: 40px;
    padding: 7px;
  }
  & #practice .answer-heading {
    margin-bottom: 1px;
    min-height: 16px;
  }
  & #practice #reply-tools > summary {
    padding-block: 0;
  }
  & #practice #homework-tools > summary {
    min-height: 28px;
    padding-block: 3px;
  }
  & footer {
    padding-block: 1px;
  }
}
@media (min-width: 640px) {
  body:has(
    #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
  ) {
    & #practice #chat-box > #practice-form {
      display: grid;
      position: relative;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 4px 10px;
    }
    & #practice #chat-box #answer {
      grid-column: 1;
      grid-row: 1;
    }
    & #practice #chat-box .composer-actions {
      grid-column: 2;
      grid-row: 1;
      float: none;
      margin: 0;
      align-self: center;
    }
    & #practice #chat-box .answer-heading {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: 0;
      overflow: hidden;
      clip-path: inset(50%);
    }
    & #practice #chat-box #practice-form::after {
      display: none;
    }
    & #practice #chat-box #practice-form > .check {
      grid-column: 1;
      grid-row: 2;
      margin: 2px 0;
    }
    & #practice #chat-box #composer-options {
      grid-column: 2;
      grid-row: 2;
      margin: 2px 0;
    }
    & #practice #chat-box #composer-options[open] {
      grid-column: 1 / -1;
    }
    & #practice #chat-box #practice-form:has(#composer-options[open]) > .check {
      grid-row: 3;
    }
    & #practice #chat-box #practice-form > p {
      grid-column: 1 / -1;
    }
  }
}
@media (min-width: 640px) {
  body:has(
    #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
  ) {
    &
      #practice
      #interaction:not(.talk-mode)
      #chat-box:has(#chat-history:not([hidden]))
      #practice-form
      > .check {
      margin: 2px 0;
    }
    &
      #practice
      #interaction:not(.talk-mode)
      #chat-box:has(#chat-history:not([hidden]))
      #practice-form::after {
      display: none;
    }
    & #practice .composer-actions :is(#choose-homework, #hear-reply, #coach-submit) {
      min-height: 40px;
      width: 40px;
      height: 40px;
      padding: 7px;
    }
  }
}
/* The outer conversation window can also be made taller by dragging its corner. */
body:has(
    #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-panel:not([hidden])
  )
  #practice
  #chat-box {
  resize: vertical;
}
body:has(
  #practice:not([hidden]) #interaction:not(.talk-mode):not([hidden]) #chat-box[style*='height']
) {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
  & main {
    flex: none;
  }
  & #practice,
  & #practice .student-interaction,
  & #chat-panel {
    height: auto;
  }
  & #practice #chat-box {
    flex: none;
    min-height: 440px;
  }
}

#practice .reply-pending {
  display: flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 10px 14px;
  margin-top: 8px;
}
.reply-pending-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: reply-pulse 1.2s ease-in-out infinite;
}
.reply-pending-dot:nth-of-type(3) {
  animation-delay: 0.15s;
}
.reply-pending-dot:nth-of-type(4) {
  animation-delay: 0.3s;
}
@keyframes reply-pulse {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .reply-pending-dot {
    animation: none;
    opacity: 0.7;
  }
}

/* Empty and populated conversations share one stable message-first layout. */
#practice #chat-history {
  position: relative;
}
.chat-empty-state {
  display: none;
  position: absolute;
  top: 42%;
  inset-inline: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0;
}
#practice
  #chat-history:has(#chat-messages:empty):not(:has(#reply-pending:not([hidden])))
  .chat-empty-state {
  display: block;
}

/* Captions and recording controls may exceed one screen in Talk mode. */
body:has(#practice:not([hidden]) #interaction.talk-mode:not([hidden]) #chat-panel:not([hidden])) {
  height: auto;
  min-height: 100dvh;
  overflow-y: auto;
  & main {
    flex: none;
  }
  & #practice,
  & #practice .student-interaction,
  & #chat-panel {
    height: auto;
  }
  & #practice #chat-box {
    flex: none;
    overflow: visible;
  }
}

#hear-again {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  align-self: flex-start;
  width: fit-content;
  min-height: 40px;
  padding: 7px 12px;
  margin: 4px 0 10px;
  color: #005bea;
}

/* Playback state changes must not insert/remove rows above Talk captions. */
.talk-playback-bar {
  display: contents;
}
#practice .talk-mode .talk-playback-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 48px;
  height: 48px;
  min-height: 48px;
}
#practice .talk-mode .talk-playback-bar .talk-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  min-height: 40px;
  text-align: start;
}
#practice .talk-mode .talk-playback-bar .talk-indicator[data-state='ready'] {
  visibility: hidden;
}
#practice .talk-mode .talk-playback-bar .talk-dots {
  display: flex;
  height: 12px;
}
#practice .talk-mode .talk-playback-bar #stop-speaking {
  display: inline-flex;
  height: 40px;
  min-height: 40px;
  min-width: 140px;
  margin: 0;
  padding: 7px 12px;
}
#practice .talk-mode .talk-playback-bar #stop-speaking[hidden] {
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}
#practice .talk-mode #voice-controls audio {
  display: block;
  height: 40px;
}
#practice .talk-mode #voice-controls audio[hidden] {
  display: block !important;
  visibility: hidden;
}

/* Direct reply supports, without an extra feedback accordion. */
#practice #chat-box #feedback > details {
  margin-block: 6px;
}
#practice #chat-box #feedback > details > summary {
  cursor: pointer;
  padding-block: 3px;
}

/* Shared SMS-style composer: typing and dictation use the same draft and thread. */
#practice .unified-chat .composer-toolbar {
  justify-content: flex-end;
}
#practice .unified-chat #chat-box .composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
#practice .unified-chat #chat-box .write-message-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
#practice .unified-chat #chat-box #record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 7px;
  border: 1px solid #52657d;
  border-radius: 8px;
  background: transparent;
  color: var(--blue);
  box-shadow: none;
}
#practice .unified-chat #chat-box #record:hover:not(:disabled) {
  background: #005bea12;
  box-shadow: none;
}
#practice .unified-chat #chat-box #record[aria-pressed='true'] {
  background: var(--coral, #ff705d);
  color: #05274f;
  border-color: #ff705d;
}
#practice .unified-chat #chat-box #record svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
}
#practice .unified-chat #chat-box #record-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#practice .unified-chat #chat-box #practice-form #record-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.875rem;
}
#practice .unified-chat #chat-box #speech-caption-panel,
#practice .unified-chat #chat-box #elvi-caption,
#practice .unified-chat #chat-box #hear-again {
  display: none;
}
#practice .unified-chat #speaking-modes {
  width: auto;
  max-width: 100%;
  margin: 10px 0;
}
#practice .unified-chat .speaking-mode-buttons {
  flex-wrap: wrap;
}
@media (max-width: 639px) {
  #practice .unified-chat #chat-box .composer-actions {
    float: none;
    margin: 5px 0;
  }
  #practice .unified-chat #chat-box #answer {
    width: 100%;
  }
}

/* Practice modes stay discoverable without becoming a second conversation view. */
#practice .unified-chat .composer-toolbar {
  justify-content: space-between;
}
#speaking-mode-menu {
  position: relative;
}
#speaking-mode-menu > summary {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  min-height: 40px;
}
#practice .unified-chat #speaking-mode-menu #speaking-modes {
  position: absolute;
  z-index: 30;
  inset-inline-start: 0;
  top: 100%;
  width: min(540px, 85vw) !important;
  max-width: 85vw !important;
  max-height: min(440px, 60dvh) !important;
  padding: 12px;
  margin: 4px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 0 10px 28px #05274f26;
}
#speaking-mode-menu .speaking-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
html[data-theme='dark'] #practice .unified-chat #speaking-mode-menu #speaking-modes {
  background: #19293d;
  color: #e7eef9;
}

/* Reply supports stay visible; only the teacher/report tools remain collapsible. */
#practice #chat-box > #understand-help {
  flex: 0 0 auto;
  margin: 2px 0;
}
#practice #chat-box > #understand-help .understand-actions {
  margin: 4px 0;
  gap: 8px;
}
#practice #chat-box > #understand-help :is(#understand-status, #understand-reply):empty {
  display: none;
}

/* Composer icons retain clear boxes and contrast, including before the first reply. */
#practice
  #interaction.unified-chat
  #chat-box
  .write-message-actions
  :is(#choose-homework, #record, #hear-reply, #coach-submit) {
  min-width: 40px;
}
#practice #interaction.unified-chat #chat-box :is(#record, #hear-reply) {
  color: var(--blue);
  border-color: #52657d;
  opacity: 1;
  filter: none;
}
#practice #interaction.unified-chat #chat-box :is(#record, #hear-reply):disabled {
  cursor: not-allowed;
  opacity: 1;
}
#practice #interaction.unified-chat #chat-box #record[aria-pressed='true'] {
  color: #05274f;
  border-color: #ff705d;
}
html[data-theme='dark'] #practice #interaction.unified-chat #chat-box :is(#record, #hear-reply) {
  border-color: #71849e;
}

/* A visible corner grip marks the native conversation-window resize handle. */
#practice #interaction.unified-chat #chat-box {
  position: relative;
}
#practice #interaction.unified-chat #chat-box::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  z-index: 4;
  pointer-events: none;
  color: var(--muted);
  background: repeating-linear-gradient(
    135deg,
    transparent 0 3px,
    currentColor 3px 4.5px,
    transparent 4.5px 7px
  );
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Stronger light-mode coral, with readable ink on coral-filled controls/bubbles. */
html:not([data-theme='dark']) {
  --coral-ink: #08131f;
}
html:not([data-theme='dark']) #practice .chat-message-elvi,
html:not([data-theme='dark'])
  #practice
  #interaction.unified-chat
  #chat-box
  #record[aria-pressed='true'] {
  color: var(--coral-ink);
}
html:not([data-theme='dark']) .end-session-button {
  background: #ff705d;
  border-color: #ff705d;
  color: var(--navy);
}
html:not([data-theme='dark']) .end-session-button:hover {
  background: #ff8879;
}
html:not([data-theme='dark']) #login-form.entry-card {
  border-color: var(--coral);
  box-shadow:
    0 0 0 3px #d94d3c12,
    0 12px 30px #05274f14;
}
html:not([data-theme='dark']) #practice #interaction:not(.talk-mode) #answer:focus-visible {
  outline-color: var(--coral);
}
html:not([data-theme='dark'])
  #practice
  #interaction.unified-chat
  #chat-box
  #record[aria-pressed='true'] {
  border-color: var(--coral);
}
