:root {
  color-scheme: light;
  font-size: 100%;
}
body {
  font-size: 1rem;
  line-height: 1.5;
}
.theme-toggle {
  min-height: 44px;
  border: 0;
  padding: 8px 4px;
  background: transparent;
  color: #005bea;
  font: inherit;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
  cursor: pointer;
}
.header-right,
header nav {
  flex-wrap: wrap;
}
html[data-theme='dark'] {
  color-scheme: dark;
  --navy: #edf4ff;
  --blue: #8dbbff;
  --coral: #ff8f7d;
  --green: #8dbbff;
  --ink: #edf4ff;
  --muted: #b6c6dc;
  --line: #71849e;
  --cream: #17263b;
  color: #edf4ff;
  background: #101b2a;
}
html[data-theme='dark'] body {
  color: #edf4ff;
  background: #101b2a;
}
html[data-theme='dark']
  :is(
    .entry-card,
    .prompt-card,
    .sidebar,
    .student-setup,
    .answer-card,
    .feedback-card,
    .learning-card,
    .homework-tools,
    .panel,
    .conversation-panel,
    .signin,
    dialog
  ) {
  color: #edf4ff;
  background: #17263b;
  border-color: #71849e;
  box-shadow: none;
}
html[data-theme='dark']
  :is(
    .session-summary,
    .page-language-bar,
    .practice-activity-grid > article,
    .organizer-node,
    .homework-drop,
    .speaking-session,
    .notice,
    .model-status,
    .message.elvi,
    .journey > span,
    .entry-symbol,
    #learning-task,
    #student-feedback-form
  ) {
  color: #edf4ff;
  background: #22364f;
  border-color: #71849e;
}
html[data-theme='dark']
  :is(
    input:not([type='checkbox']):not([type='radio']),
    textarea,
    select,
    #practice select,
    #practice-form textarea,
    .homework-tools input[type='text'],
    .voice-controls select
  ) {
  color: #edf4ff;
  background: #101b2a;
  border-color: #71849e;
  caret-color: #edf4ff;
}
html[data-theme='dark'] :is(input, textarea)::placeholder {
  color: #b6c6dc;
  opacity: 1;
}
html[data-theme='dark'] :is(button, .secondary) {
  color: #edf4ff;
  background: #22364f;
  border-color: #71849e;
}
html[data-theme='dark'] .practice-activity-grid button:disabled {
  color: #b6c6dc;
  background: #22364f;
  border-color: #71849e;
}
html[data-theme='dark'] :is(.primary, .mode-switch, .mic-button) {
  color: white;
  background: #2363c7;
  border-color: #8dbbff;
}
html[data-theme='dark'] :is(.primary, .mode-switch, .mic-button):hover:not(:disabled) {
  background: #174da1;
}
html[data-theme='dark'] :is(.end-session-button, #toggle-ideas) {
  color: #10213b;
  background: #ff8f7d;
  border-color: #ff8f7d;
}
html[data-theme='dark'] :is(a, .text-button, .link-button, .theme-toggle, .eyebrow, h1 em) {
  color: #8dbbff;
}
html[data-theme='dark'] .eyebrow {
  color: #8dbbff !important;
}
html[data-theme='dark'] :is(.text-button, .link-button, .theme-toggle, .access-code-toggle) {
  background: transparent;
}
html[data-theme='dark']
  :is(
    .fine,
    .small,
    .lede,
    .privacy-note,
    .teacher-note,
    .conversation-options,
    .empty,
    .sources,
    footer,
    .brand small,
    .heading p,
    .panel p,
    .guidance p,
    .signin p,
    .learning-card small,
    .journey small
  ) {
  color: #b6c6dc;
}
html[data-theme='dark']
  :is(h1, h2, h3, label, summary, .pill, .badge, .journey b, .homework-tools summary) {
  color: #edf4ff;
}
html[data-theme='dark'] :is(.error, [role='alert']) {
  color: #ffb7a9;
}
html[data-theme='dark']
  :is(header, footer, .journey, .guidance, .message, .item-list li, blockquote, .starter) {
  border-color: #71849e;
}
html[data-theme='dark'] :is(header img, .brand-logo) {
  background: #f7faff;
  padding: 8px;
  border-radius: 8px;
}
html[data-theme='dark'] dialog::backdrop {
  background: #000a;
}
html[data-theme='dark'] :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid #ffcf66;
  outline-offset: 3px;
}
@media (max-width: 560px) {
  .header-right,
  header nav {
    gap: 10px;
  }
  .theme-toggle {
    font-size: 1rem;
  }
}

#practice
  :is(p, label, legend, summary, small, button, input, select, option, textarea, .fine, .small) {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}
#practice :is(label, legend, summary, select, option) {
  font-weight: 400;
}

#practice summary.elvi-section-toggle {
  font:
    400 1rem/1.5 ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--ink);
  letter-spacing: normal;
  text-transform: none;
}
#practice summary.elvi-section-toggle > span {
  font-size: inherit;
  line-height: inherit;
}

#practice #switch-mode,
#practice #toggle-ideas {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Icon-only theme control; use the native hover title and shared focus tooltip. */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 8px;
  text-decoration: none;
}

/* Native hover titles share translated text with a keyboard-focus tooltip. */
.control-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px 10px;
  border-radius: 6px;
  background: #10213b;
  color: #fff;
  font:
    400 0.875rem/1.4 system-ui,
    sans-serif;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.control-tooltip[hidden] {
  display: none;
}
html[data-theme='dark'] .control-tooltip {
  background: #edf4ff;
  color: #10213b;
}

/* Preserve the original artwork while clipping only the baked-in tagline. */
.logo-without-tagline {
  display: inline-block;
  line-height: 0;
  vertical-align: middle;
  border-radius: 8px;
  overflow: hidden;
}
.logo-without-tagline > img {
  display: block;
  clip-path: polygon(0 0, 100% 0, 100% 71%, 36% 71%, 36% 100%, 0 100%) content-box;
}
.saved-chat-brand > .logo-without-tagline,
html[data-theme='dark'] .logo-without-tagline {
  background: #f7faff;
}

/* Apply the same contrast-safe coral to the teacher interface in light mode. */
html:not([data-theme='dark']) {
  --coral: #d94d3c;
}
html:not([data-theme='dark']) :is(.notice, .message.elvi) {
  border-left-color: var(--coral);
}

/* One control typography across learner/teacher views. Layered !important
   deliberately wins legacy per-button overrides; Aa scales this 13px size once. */
@layer elvi-control-type {
  :is(button, summary, select, input[type='button'], input[type='submit'], input[type='reset']) {
    font: 400 13px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    letter-spacing: normal !important;
  }
  :is(button, summary) :is(span, b, strong, small):not([aria-hidden='true']) {
    font: inherit !important;
    letter-spacing: inherit !important;
  }
}
