:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f2f0f1;
  background: #101113;
  --muted: #c3c0c6;
  --line: #3a3b42;
  --surface: #191a1e;
  --accent: #ff7665;
  --action: #ff775f;
  --ink-on-action: #180608;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.6; }
::selection { background: #a32c37; color: white; }
:focus-visible { outline: 2px solid #ff9fa5; outline-offset: 4px; }
h1:focus, h2[tabindex]:focus, legend[tabindex]:focus, .message[tabindex]:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; }
h1 { letter-spacing: -.035em; }
p { max-inline-size: 65ch; }
button, input, textarea { font: inherit; }

.shell {
  width: min(100% - 3rem, 69rem);
  margin-inline: auto;
  padding-bottom: 4rem;
}
.masthead {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding-block: 1.3rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
  font-weight: 650;
}
.masthead img { object-fit: contain; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  margin-top: clamp(1.5rem, 5vw, 4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #211d21;
}
.hero-content { padding: clamp(1.3rem, 4vw, 3rem); }
.hero h1 { font-size: clamp(2.5rem, 5.3vw, 4.5rem); line-height: 1; text-wrap: wrap; }
.hero h1 span { color: var(--accent); white-space: nowrap; }
.hero-lead { margin-top: 1.25rem; max-inline-size: 38ch; color: var(--muted); font-size: 1.15rem; }
.hero-photo { display: block; width: 100%; height: auto; }
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1.25rem;
  margin-top: 1.5rem;
}
button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
  line-height: 1.3;
}
.primary { background: var(--action); color: var(--ink-on-action); }
.primary:hover:not(:disabled) { background: #ff957e; }
.primary:active:not(:disabled) { background: #f56a58; }
.secondary { background: var(--surface); border-color: var(--line); }
.secondary:hover { background: #26272d; }
button:disabled { background: #28292d; color: #bdbac1; cursor: default; }
.arrow {
  position: relative;
  height: 2px;
  width: 14px;
  flex: none;
  background: currentColor;
}
.arrow::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  right: 0;
  top: 50%;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.case { margin-top: 2.25rem; }
.case-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.case-heading h1 { font-size: clamp(1.8rem, 4vw, 3.15rem); }
.case-tracker { flex: 0 1 10rem; }
.case-tracker .position { font-size: .875rem; }
.case-tracker progress { margin: .35rem 0 0; }
.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15.5rem, 28%);
  grid-template-areas: "chat request" "decision request";
  align-items: start;
  gap: 1rem;
}
.conversation, .request {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 2vw, 1.35rem);
  background: #15161a;
}
.conversation { grid-area: chat; min-width: 0; }
.conversation h2, .request h2, .case-feedback h2 { font-size: 1.125rem; }
.messages { display: grid; gap: .6rem; margin: .75rem 0 0; padding: 0; list-style: none; }
.message {
  justify-self: start;
  max-inline-size: min(88%, 34rem);
  padding: .6rem .8rem;
  background: #24252b;
  border-radius: 12px 12px 12px 4px;
}
.message-author { color: var(--muted); font-size: .8rem; font-weight: 700; }
.message p { margin-top: .14rem; overflow-wrap: anywhere; }
.message img { display: block; width: min(100%, 15rem); height: auto; margin-top: .6rem; border-radius: 7px; }
.message[data-author="manager"] {
  justify-self: end;
  border-radius: 12px 12px 4px 12px;
  background: #352129;
}
.message[data-author="manager"] .message-author { color: #ffb7bd; }
.message[data-author="team"] { background: #20232c; border-radius: 12px; }
.message[data-author="team"] .message-author { color: #bfcaff; }
.chat-history { margin-top: .75rem; border-bottom: 1px solid var(--line); padding-bottom: .55rem; }
summary { min-height: 44px; padding-block: .6rem; cursor: pointer; font-weight: 700; }
.chat-history summary { color: var(--muted); font-size: .875rem; }
.chat-history[open] .messages { margin-block: 0 .5rem; }

.request { grid-area: request; position: sticky; top: 1rem; }
.request-status {
  display: inline-block;
  margin-top: .6rem;
  padding: .18rem .55rem;
  border-radius: 6px;
  background: #352129;
  color: #ffb7bd;
  font-size: .82rem;
  font-weight: 750;
}
.request-status[data-complete="true"] { background: #24392f; color: #bce9cb; }
.request-fields { margin: .75rem 0 0; }
.request-fields > div { border-top: 1px solid var(--line); padding: .53rem 0; }
.request-fields > div:last-child { padding-bottom: 0; }
.request-fields dt { color: var(--muted); font-size: .8rem; }
.request-fields dd { margin: .1rem 0 0; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.request-fields [data-pending="true"] dd { font-weight: 400; color: var(--muted); }
.field-updated dd { animation: field-confirmed 850ms ease-out; }
@keyframes field-confirmed { from { color: #ffaab2; } }

.case-decision { grid-area: decision; min-width: 0; }
.case-tools { border-bottom: 1px solid var(--line); }
.text-button { padding-inline: 0; font-size: .9rem; text-decoration: underline; text-underline-offset: .25em; }
.text-button:hover { color: var(--accent); }
#case-form fieldset { margin-top: 1rem; }
#case-prompt { padding: 0 0 .8rem; font-size: 1.25rem; font-weight: 750; line-height: 1.35; }
.case-feedback {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid #63414b;
  border-radius: var(--radius);
  background: #291e24;
}
.case-feedback p { margin-top: .55rem; color: #f1dce2; }
.case-feedback .actions { margin-top: .95rem; }
.lesson-summary, .explanation { color: var(--muted); margin-top: .65rem; }
.lesson-lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 34%); align-items: center; gap: .85rem 1.5rem; }
.lesson-art { display: block; width: min(100%, 19rem); height: auto; justify-self: end; }
.question-context { margin-bottom: .45rem; color: var(--muted); }
#quiz .question-context + h1 { font-size: clamp(1.45rem, 3.5vw, 2.2rem); text-wrap: pretty; }
.quiz-photo { display: block; width: min(100%, 35rem); height: auto; margin-top: .9rem; border-radius: 10px; }
.lesson-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  gap: 1rem 1.5rem;
  margin-top: 1.1rem;
}
.lesson-notes section { padding: .85rem 0; }
.lesson-notes h2 { font-size: 1.125rem; }
.lesson-notes p { margin-top: .45rem; }
.lesson-notes .lesson-example {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.lesson-example p { color: var(--muted); }
.lesson-details { margin-top: 1rem; border-block: 1px solid var(--line); }
.lesson-details p { margin: 0 0 .65rem; color: var(--muted); }
.topic-review, .strengths { margin-top: 2rem; }
.strengths ul { margin: .65rem 0 0; padding-inline-start: 1.35rem; }
.topic-review ul {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  list-style: none;
  padding: 0;
  margin: .85rem 0 0;
}
.topic-review button { text-align: left; }
.breakdown { list-style: none; padding: 0; margin-block: 1.25rem; }

.task { width: min(100%, 46rem); margin: 2.5rem auto 0; }
.lesson { width: min(100%, 52rem); }
.task h1 { font-size: 2.35rem; }
.position, .score { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 750; }
progress {
  display: block;
  width: 100%;
  height: .4rem;
  margin: .6rem 0 1.6rem;
  border: 0;
  border-radius: 6px;
  background: #33343b;
  overflow: hidden;
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: #33343b; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
fieldset { border: 0; margin: 1.5rem 0 0; padding: 0; min-inline-size: 0; }
.options { display: grid; gap: .65rem; }
.option {
  min-height: 52px;
  padding: .8rem .95rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.option:hover { background: #24252b; }
.option:has(:checked) { border-color: var(--accent); background: #2d1c22; }
.option:has(:focus-visible) { outline: 2px solid #ff9fa5; outline-offset: 3px; }
.option input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
.quiz-hud {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .3rem .9rem;
  padding-block: .45rem;
  background: #101113;
}
.quiz-lives { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .825rem; font-weight: 750; }
.life {
  width: 22px;
  height: 22px;
  background: #494348;
  clip-path: path('M11 20C10 20 1 14 1 8A5 5 0 0 1 11 5A5 5 0 0 1 21 8C21 14 12 20 11 20Z');
}
.life[data-filled="true"] { background: var(--accent); }
.life-lost { animation: life-lost .58s cubic-bezier(.19, 1, .22, 1); }
@keyframes life-lost {
  0% { transform: scale(1); background: var(--accent); }
  36% { transform: scale(1.28) rotate(12deg); background: #ffc0a9; }
  68% { transform: scale(.64) rotate(-14deg); }
  100% { transform: scale(1); }
}
#life-count { margin-inline-start: .35rem; }
#quiz-rules { margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
#choices:disabled .option { cursor: default; }
.option[data-verdict="correct"] { border-color: #649d7e; background: #192c24; }
.option[data-verdict="incorrect"] { border-color: #b76862; background: #321f22; }
.quiz-feedback {
  margin-top: 1rem;
  padding: 1.15rem;
  border: 1px solid #72504b;
  border-radius: var(--radius);
  background: #2a1f24;
}
.quiz-feedback[data-correct="true"] { border-color: #416555; background: #192b25; }
.quiz-feedback h2 { font-size: 1.2rem; scroll-margin-top: 4rem; }
.quiz-feedback p, .quiz-feedback button { margin-top: .75rem; }
.quiz-feedback #play-correction { color: #ffd0c5; }

.live-intro { margin-bottom: 1.1rem; color: var(--muted); }
.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 32%); grid-template-areas: "chat request"; align-items: start; gap: 1rem; }
.live-chat .request { position: static; }
.live-product { display: flex; align-items: center; gap: .9rem; margin: .85rem 0; }
.live-product img { flex: none; display: block; width: clamp(4.75rem, 16vw, 6.5rem); height: auto; border-radius: 8px; }
.live-product figcaption { display: grid; gap: .15rem; font-size: .9rem; line-height: 1.4; }
.live-product figcaption span, .live-product a { color: var(--muted); }
.live-product a { text-underline-offset: .2em; }
#live-product-price { color: #ffab9e; }
.live-chat .request .position { margin-top: .4rem; font-size: .85rem; }
.live-chat #live-back { flex: none; }
#live-messages { max-block-size: min(48vh, 29rem); overflow: auto; scrollbar-color: #76636a #191a1e; padding-inline-end: .25rem; }
.live-status { margin-top: .75rem; min-height: 1.5rem; color: var(--muted); font-size: .875rem; }
#live-form label, .live-card-field label { display: block; font-size: .9rem; font-weight: 700; }
#live-form label { margin-top: .75rem; }
#live-input, .live-card-field input { width: 100%; margin-top: .35rem; padding: .65rem .7rem; border: 1px solid #66606a; border-radius: 8px; background: #101113; color: inherit; }
#live-input { resize: vertical; }
#live-input::placeholder { color: #aaa5af; }
.live-chat .actions { margin-top: .75rem; }
.live-chat .text-button { padding-inline: .4rem; background: transparent; }
.live-hint, .live-review { margin-top: .9rem; color: var(--muted); }
.live-review p, #live-restart { margin-top: .75rem; }
.live-jump { display: none; align-items: center; min-height: 44px; color: var(--muted); font-size: .875rem; text-underline-offset: .2em; }
.live-card-form { display: grid; gap: .85rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.live-card-field input { min-height: 44px; }
.live-card-field input[inputmode="numeric"] { font-variant-numeric: tabular-nums; }
.live-card-field input[aria-invalid="true"] { border-color: #d87e79; }
.live-card-field .form-message { margin-top: .3rem; color: #ffc4b9; font-size: .875rem; }
.live-card-actions .form-message { margin-bottom: .5rem; color: var(--muted); font-size: .875rem; }
.live-card-actions button { width: 100%; }
.form-message:empty { display: none; }
.live-pricing { padding-top: .15rem; }
.live-pricing summary { color: #ffb8ad; cursor: pointer; font-size: .875rem; font-weight: 700; }
.quote-costs { margin: .5rem 0 0; font-size: .875rem; }
.quote-costs div { display: flex; justify-content: space-between; gap: .5rem 1rem; padding-block: .2rem; }
.quote-costs dt { color: var(--muted); }
.quote-costs dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-hint { margin-top: .55rem; }
.quote-hint p { margin-top: .3rem; color: var(--muted); font-size: .875rem; }

.course-complete { border: 1px solid #665052; border-radius: var(--radius); padding: clamp(1.25rem, 6vw, 3rem); background: #211d21; }
.complete-mark { display: block; margin: 0 0 .8rem -.45rem; color: var(--accent); }
.course-complete h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); text-wrap: pretty; }
.complete-message { margin-top: .85rem; color: var(--muted); }
.complete-results { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.4rem 0 0; padding-block: .9rem; border-block: 1px solid var(--line); }
.complete-results dt, .complete-note { color: var(--muted); font-size: .875rem; }
.complete-results dd { margin: .18rem 0 0; font-weight: 750; line-height: 1.35; }
.complete-note { margin-top: 1rem; }

.result-summary { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.5rem; }
.score { color: var(--accent); margin-bottom: .55rem; }
#result-message { color: var(--muted); margin-top: .65rem; }
#breakdown-title { margin-top: 2rem; }
.breakdown li { border-top: 1px solid var(--line); padding-block: 1rem; }
.breakdown h3 { margin-block: .4rem .6rem; }
.verdict { color: #ff9fa5; font-size: .9rem; font-weight: 750; }
.verdict[data-correct="true"] { color: #a8ddbd; }
.correct-answer { font-weight: 650; margin-top: .65rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 690px) {
  .lesson-lead { grid-template-columns: minmax(0, 1fr); }
  .lesson-art { width: min(100%, 16rem); justify-self: start; }
  .lesson-notes { grid-template-columns: minmax(0, 1fr); }
  .live-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chat" "request"; gap: .75rem; }
  .live-jump { display: inline-flex; }
  .live-request-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .25rem .75rem; }
  .case-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chat" "decision" "request";
    gap: .75rem;
  }
  .case-layout:has(.case-feedback[data-passed="true"]:not([hidden])) { grid-template-areas: "chat" "request" "decision"; }
  .request { position: static; }
  .request-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: .85rem; }
  .request-fields > div { padding-block: .35rem; }
}

@media (max-width: 600px) {
  .shell { width: calc(100% - 2rem); padding-bottom: 2.5rem; }
  .masthead { padding-block: .8rem; }
  .hero { margin-top: 1rem; }
  .hero-lead { font-size: 1.05rem; }
  .case { margin-top: 1rem; }
  .case-heading { display: block; }
  .live-chat #live-back { margin-top: .75rem; }
  .case-tracker { margin-top: .65rem; }
  .case-tracker progress { width: min(100%, 11rem); }
  .conversation, .request { padding: .8rem; }
  .message { max-inline-size: 96%; }
  .message img { width: min(100%, 10rem); }
  .request-fields dd { font-size: .925rem; }
  .task { margin-top: 1.35rem; }
  .task h1 { font-size: 1.7rem; }
}

@media (max-width: 420px) {
  .lesson-actions { flex-direction: column; align-items: stretch; }
  .complete-results { grid-template-columns: 1fr; gap: .65rem; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .hero { margin-top: 1rem; }
  .hero-content { padding: 1.3rem; }
  .hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
  .hero-lead { margin-top: .85rem; font-size: 1rem; }
  .hero .actions { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .field-updated dd, .life-lost { animation: none; }
}

@media (forced-colors: active) {
  button, .option, progress { border: 1px solid ButtonText; }
  .option:has(:checked) { outline: 2px solid Highlight; }
  .primary:disabled { color: GrayText; }
  .life { forced-color-adjust: none; background: GrayText; }
  .life[data-filled="true"] { background: Highlight; }
  .option[data-verdict="correct"] { outline: 2px solid Highlight; }
}
