:root {
  color-scheme: light;
  --navy: #0b1f3a;
  --navy-light: #173f70;
  --navy-soft: #e8f1ff;
  --ink: #172033;
  --muted: #667085;
  --paper: #ffffff;
  --panel: #f2f4f7;
  --border: #d0d5dd;
  --red: #e53935;
  --red-dark: #b71c1c;
  --green: #1b8f3a;
  --green-dark: #0f5f27;
  --yellow: #ffca28;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0, rgba(36, 92, 151, 0.95), transparent 38rem),
    var(--navy);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.page-shell {
  width: min(940px, calc(100% - 32px));
  margin: 22px auto;
}

.app-header {
  padding: 28px 30px 0;
  overflow: hidden;
  color: white;
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 55%),
    var(--navy);
  box-shadow: var(--shadow);
}

.site-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: -6px 0 18px;
}

.site-navigation a,
.site-navigation button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #d7e8ff;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.site-navigation a:hover,
.site-navigation button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.site-navigation a[aria-current="page"] {
  color: var(--navy);
  border-color: white;
  background: white;
}

.site-navigation .site-navigation-donate {
  color: #08203c;
  border-color: #ffe59a;
  background: var(--yellow);
}

.site-navigation .site-navigation-donate:hover {
  color: #08203c;
  background: #ffdc69;
}

.site-navigation a:focus-visible,
.site-navigation button:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.portal-header .site-navigation {
  margin: 0;
}

.header-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 15px;
}

.baseball-mark {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  object-fit: cover;
  object-position: center;
}

.brand-kicker,
.coach-credit,
.header-copy,
.brand-lockup h1 {
  margin: 0;
}

.brand-kicker {
  margin-bottom: 3px;
  color: #9fc3ee;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-lockup h1 {
  font-size: clamp(27px, 5vw, 43px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(215, 232, 255, 0.3);
  border-radius: 999px;
  color: #d7e8ff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-note span,
.online-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #70db8b;
  box-shadow: 0 0 0 4px rgba(112, 219, 139, 0.12);
}

.header-copy {
  max-width: 680px;
  margin-top: 22px;
  color: #d7e8ff;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.5;
}

.header-copy em {
  color: white;
  font-weight: 800;
}

.coach-credit {
  margin-top: 10px;
  color: #9fc3ee;
  font-size: 12px;
  font-weight: 700;
}

.mode-switch {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px 13px 0 0;
  color: #c2d9f4;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mode-tab.is-active {
  color: var(--navy);
  background: var(--paper);
}

.mode-tab span {
  margin-right: 6px;
  color: var(--red);
}

.app-surface {
  overflow: hidden;
  min-height: 580px;
  border-radius: 0 0 24px 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.scorebox {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  text-align: center;
}

.scorebox span,
.scorebox strong {
  display: block;
}

.scorebox span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.scorebox strong {
  font-size: 17px;
}

.quiz-content {
  padding: 30px;
}

.category-tag {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  color: #164c8f;
  background: var(--navy-soft);
  font-size: 12px;
  font-weight: 850;
}

.quiz-question {
  max-width: 820px;
  margin: 16px 0 24px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.quiz-answers {
  display: grid;
  gap: 12px;
}

.answer-button {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
  transition: transform 100ms ease, border-color 150ms ease, background 150ms ease;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #8795a8;
  background: #f9fafb;
}

.answer-button.is-correct {
  color: var(--green-dark);
  border-color: var(--green);
  background: #e8f8ee;
  font-weight: 800;
}

.answer-button.is-wrong {
  color: var(--red-dark);
  border-color: var(--red);
  background: #ffecec;
  font-weight: 800;
}

.answer-button:disabled {
  cursor: default;
}

.quiz-feedback {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.5;
  animation: rise-in 180ms ease-out;
}

.quiz-feedback.is-correct {
  color: var(--green-dark);
  border-color: #a6e3b9;
  background: #e8f8ee;
}

.quiz-feedback.is-wrong {
  color: #744609;
  border-color: #ffd37a;
  background: #fff4df;
}

.quiz-feedback strong {
  font-size: 18px;
}

.quiz-feedback p {
  margin: 8px 0 0;
}

.feedback-answer {
  font-weight: 800;
}

.quiz-coach-response {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  color: #164c8f;
  border: 1px solid #b9d2f0;
  border-radius: 14px;
  background: #f4f8ff;
  animation: rise-in 180ms ease-out;
}

.quiz-coach-response > img {
  width: 46px;
  height: 46px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(11, 31, 58, 0.18);
  object-fit: cover;
}

.quiz-coach-response-copy,
.quiz-coach-response p {
  min-width: 0;
  margin: 0;
}

.quiz-coach-response-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.coach-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #6d98cc;
}

.quiz-coach-response[data-phase="thinking"] .coach-status-dot,
.quiz-coach-response[data-phase="loading"] .coach-status-dot,
.quiz-coach-response[data-phase="speaking"] .coach-status-dot {
  background: var(--green);
  animation: coach-pulse 1.1s ease-in-out infinite;
}

.quiz-coach-response.is-error {
  color: var(--red-dark);
  border-color: #f2b8b5;
  background: #fff5f5;
}

.quiz-coach-response.is-error .coach-status-dot {
  background: var(--red);
  animation: none;
}

.quiz-replay-answer {
  min-height: 38px;
  padding: 0 14px;
  color: #164c8f;
  border: 1px solid #9bbce3;
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.quiz-replay-answer:hover {
  background: #e8f1ff;
}

.quiz-replay-answer:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.quiz-controls,
.answered-actions,
.finish-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-controls {
  justify-content: space-between;
  margin-top: 24px;
}

.button,
.record-button,
.send-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.button {
  padding: 0 18px;
}

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

.button-primary:hover {
  background: var(--red-dark);
}

.button-secondary {
  color: #344054;
  background: #eef2f6;
}

.button-secondary:hover {
  background: #dde3ea;
}

.button-coach {
  color: #164c8f;
  border: 1px solid #b9d2f0;
  background: #e8f1ff;
}

.button-coach:hover {
  background: #d7e8ff;
}

.quiz-finish {
  padding: 46px 30px;
  text-align: center;
}

.finish-icon {
  font-size: 64px;
}

.finish-kicker {
  margin: 14px 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiz-finish h2 {
  margin: 0;
  font-size: clamp(30px, 6vw, 48px);
}

.quiz-finish > p:not(.finish-kicker) {
  max-width: 580px;
  margin: 14px auto;
  color: var(--muted);
  line-height: 1.6;
}

.finish-time {
  font-size: 13px;
}

.finish-video {
  display: block;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  margin: 24px auto 0;
  border: 0;
  border-radius: 16px;
  background: var(--navy);
  box-shadow: 0 14px 34px rgba(11, 31, 58, 0.2);
  object-fit: contain;
}

.finish-actions {
  justify-content: center;
  margin-top: 25px;
}

.coach-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  color: white;
  background: linear-gradient(120deg, var(--navy-light), var(--navy));
}

.coach-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--navy);
  background: white;
  border: 3px solid #d7e8ff;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 900;
}

.coach-bar h2,
.coach-bar p {
  margin: 0;
}

.coach-bar h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
}

.coach-bar p {
  margin-top: 3px;
  color: #bcd6f3;
  font-size: 12px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #d7e8ff;
  font-size: 12px;
  font-weight: 750;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 260px;
  max-height: 470px;
  padding: 28px 28px 14px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message {
  width: fit-content;
  max-width: min(680px, 88%);
  padding: 15px 18px;
  border-radius: 18px;
  line-height: 1.55;
  animation: rise-in 180ms ease-out;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.message-label {
  margin-bottom: 5px;
  color: #1f5e9f;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-coach {
  align-self: flex-start;
  border: 1px solid #d9e1eb;
  border-bottom-left-radius: 5px;
  background: #f5f7fa;
}

.message-player {
  align-self: flex-end;
  color: white;
  border-bottom-right-radius: 5px;
  background: var(--navy-light);
}

.message-player .message-label {
  color: #c6ddf7;
}

.play-answer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid #b9d2f0;
  border-radius: 999px;
  color: #164c8f;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.play-answer:hover {
  background: var(--navy-soft);
}

.starter-prompts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 28px 18px;
}

.starter-prompts > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.starter-prompts button {
  padding: 8px 12px;
  border: 1px solid #c8d8eb;
  border-radius: 999px;
  color: #164c8f;
  background: #f3f7fc;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.starter-prompts button:hover {
  border-color: var(--navy-light);
  background: var(--navy-soft);
}

.composer {
  margin: 0 20px 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
  box-shadow: 0 8px 24px rgba(11, 31, 58, 0.08);
}

.composer:focus-within {
  border-color: #5a8dc2;
  box-shadow: 0 0 0 3px rgba(23, 63, 112, 0.1);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  resize: vertical;
  padding: 8px 9px 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #8c96a3;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.record-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  color: var(--red-dark);
  border: 1px solid #f2c6c0;
  border-radius: 12px;
  background: #fff0ed;
  touch-action: none;
  user-select: none;
}

.record-button:hover {
  background: #ffe7e2;
}

.record-button.is-recording {
  color: white;
  border-color: var(--red);
  background: var(--red);
  animation: record-pulse 1.2s ease-in-out infinite;
}

.mic-icon {
  position: relative;
  width: 11px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.mic-icon::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  left: -5px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 10px 10px;
  content: "";
}

.send-button {
  margin-left: auto;
  padding: 0 17px;
  color: white;
  border-radius: 12px;
  background: var(--navy);
}

.send-button:hover {
  background: var(--navy-light);
}

.record-button:disabled,
.send-button:disabled,
.starter-prompts button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.key-hint {
  color: #86909c;
  font-size: 11px;
}

.status {
  min-height: 22px;
  padding: 0 28px 16px;
  color: var(--muted);
  font-size: 13px;
}

.status.is-error {
  color: var(--red-dark);
  font-weight: 750;
}

.gear-ad {
  margin: 18px auto 0;
  padding: 20px;
  color: var(--navy);
  border-radius: 18px;
  background: white;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.gear-ad-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gear-ad a {
  display: inline-flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  color: var(--navy);
  font-size: clamp(21px, 4vw, 35px);
  font-weight: 900;
  line-height: 1.15;
  text-decoration: none;
}

.gear-ad a:hover span {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.gear-ad img {
  display: block;
  width: min(90%, 600px);
  height: auto;
  border-radius: 14px;
}

.gear-ad-disclosure {
  max-width: 600px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.safety-strip {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 0;
  color: #c4d4e8;
  font-size: 13px;
}

.safety-strip strong {
  color: white;
}

footer {
  max-width: 760px;
  margin: 28px auto;
  color: #93abc8;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.donate-dialog {
  width: min(620px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: white;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.46);
}

.donate-dialog::backdrop {
  background: rgba(3, 14, 29, 0.78);
  backdrop-filter: blur(5px);
}

.donate-dialog-card {
  display: grid;
  max-height: calc(100vh - 24px);
  grid-template-rows: auto auto auto auto;
}

.donate-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 8px;
}

.donate-dialog-heading p,
.donate-dialog-heading h2,
.donate-dialog-description,
.donate-dialog-footer {
  margin: 0;
}

.donate-dialog-heading p {
  color: #2c6b59;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.donate-dialog-heading h2 {
  margin-top: 4px;
  color: var(--navy);
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.donate-dialog-close {
  flex: 0 0 42px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--navy);
  background: white;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.donate-dialog-close:hover {
  background: var(--panel);
}

.donate-dialog-description {
  padding: 0 22px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.donate-payment-panel {
  display: grid;
  min-height: 150px;
  padding: 26px 22px;
  place-items: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(145deg, #f4f8fc, #fff);
}

.donate-payment-panel stripe-buy-button {
  display: block;
  max-width: 100%;
}

.donate-dialog-footer {
  padding: 12px 20px 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.donate-dialog-footer a {
  color: var(--navy-light);
  font-weight: 850;
}

body.donate-dialog-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes coach-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes record-pulse {
  50% { box-shadow: 0 0 0 6px rgba(229, 57, 53, 0.18); }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 20px, 940px);
    margin: 10px auto 20px;
  }

  .app-header {
    padding: 22px 18px 0;
    border-radius: 18px 18px 0 0;
  }

  .site-navigation {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 18px;
  }

  .site-navigation a,
  .site-navigation button {
    min-height: 42px;
    padding: 0 8px;
  }

  .header-topline {
    display: block;
  }

  .privacy-note {
    margin-top: 18px;
  }

  .baseball-mark {
    width: 48px;
    height: 48px;
  }

  .mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mode-tab {
    padding: 0 10px;
    font-size: 12px;
  }

  .donate-dialog-heading {
    padding: 16px 16px 7px;
  }

  .donate-dialog-description {
    padding: 0 16px 12px;
  }

  .donate-payment-panel {
    min-height: 140px;
    padding: 22px 14px;
  }

  .app-surface {
    min-height: 520px;
    border-radius: 0 0 18px 18px;
  }

  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
    padding: 14px;
  }

  .quiz-content {
    padding: 22px 18px;
  }

  .quiz-controls {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .answered-actions {
    display: grid;
  }

  .quiz-coach-response {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .quiz-replay-answer {
    grid-column: 1 / -1;
    width: 100%;
  }

  .button {
    width: 100%;
  }

  .coach-bar,
  .conversation {
    padding-right: 18px;
    padding-left: 18px;
  }

  .online-pill {
    font-size: 0;
  }

  .starter-prompts {
    padding-right: 18px;
    padding-left: 18px;
  }

  .message {
    max-width: 94%;
  }

  .composer {
    margin-right: 10px;
    margin-left: 10px;
  }

  .composer-actions {
    flex-wrap: wrap;
  }

  .key-hint {
    display: none;
  }

  .send-button {
    flex: 1;
  }

  .safety-strip {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
