/* IPO Ready Learning brand system v1.3: navy leads, blue adds depth, gold is used
   sparingly for focus. Spacing follows the 8px rhythm; cards use a 16px radius and
   buttons 8px, as the brand system specifies. */
:root {
  --navy: #12355B;
  --blue: #3B6FB6;
  --gold: #F2B705;
  --neutral: #F8F7F4;
  --text: #2D3748;
  --teal: #0F766E;
  --orange: #C96A00;
  --line: #CBD5E1;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

/* Any rule that sets `display` beats the browser's own `[hidden] { display: none }`,
   so an element given `hidden` in script stays on screen. The dropzone did exactly
   that and sat under the course for the rest of the session. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--neutral);
  color: var(--text);
  font: 400 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body { display: flex; flex-direction: column; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- header ---------------------------------------------------------------- */

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--navy); color: var(--neutral);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.brand img { width: 28px; height: 28px; object-fit: contain; flex: 0 0 auto; }
.actions { display: flex; align-items: center; gap: 8px; }

.button {
  display: inline-block; cursor: pointer; border: 0; border-radius: 8px;
  padding: 10px 16px; font: inherit; font-weight: 700; font-size: 14px;
  background: var(--gold); color: var(--navy);
  /* 44px minimum target: this is used on phones and tablets. */
  min-height: 44px; line-height: 24px;
}
.button.ghost { background: transparent; color: var(--neutral); box-shadow: inset 0 0 0 2px rgba(248, 247, 244, .45); }
.button:hover { filter: brightness(1.05); }
.button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* --- layout ---------------------------------------------------------------- */

main {
  flex: 1; min-height: 0; display: grid; gap: 16px; padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  grid-template-columns: minmax(0, 1fr) 320px;
}
.stage { min-width: 0; min-height: 0; display: flex; }
iframe {
  flex: 1; width: 100%; border: 0; border-radius: 16px; background: var(--white);
  box-shadow: 0 1px 2px rgba(18, 53, 91, .12);
}

/* --- dropzone -------------------------------------------------------------- */

.dropzone {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; gap: 8px; padding: 32px 24px;
  border: 2px dashed var(--line); border-radius: 16px; background: var(--white);
}
.dropzone.hover { border-color: var(--gold); background: #FFFDF5; }
.dropzone h1 { margin: 0; font-size: 24px; line-height: 1.25; color: var(--navy); }
.dropzone p { margin: 0; max-width: 46ch; }
.note { font-size: 14px; opacity: .75; }
.error { color: var(--orange); font-weight: 700; min-height: 1.5em; }

/* --- the summary panel ------------------------------------------------------ */

.panel {
  min-width: 0; overflow-y: auto; padding: 16px; border-radius: 16px;
  background: var(--white); box-shadow: 0 1px 2px rgba(18, 53, 91, .12);
}
.panel h2 { margin: 0 0 16px; font-size: 18px; color: var(--navy); }
.panel h3 { margin: 24px 0 8px; font-size: 14px; text-transform: uppercase;
            letter-spacing: .04em; color: var(--blue); }

.stats { margin: 0; display: grid; gap: 8px; }
.stats > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.stats dt { font-size: 14px; opacity: .8; }
.stats dd { margin: 0; font-weight: 700; text-align: right; }
.stats dd[data-state="good"] { color: var(--teal); }
.stats dd[data-state="bad"] { color: var(--orange); }

.questions { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.questions li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px;
  align-items: start; font-size: 14px;
}
.questions .mark-result { font-weight: 700; line-height: 1.4; }
.questions li[data-result="correct"] .mark-result { color: var(--teal); }
.questions li[data-result="wrong"] .mark-result { color: var(--orange); }
.footnote { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* --- tablet and phone -------------------------------------------------------
   The course stops sharing a row with the panel and the panel moves underneath,
   because a 320px column beside a course is unreadable on a tablet held upright. */
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(60vh, 1fr) auto; }
  .panel { overflow-y: visible; }
}

@media (max-width: 560px) {
  main { padding: 8px; gap: 8px; }
  .bar { flex-wrap: wrap; }
  .actions { width: 100%; }
  .actions .button { flex: 1; text-align: center; }
  .dropzone h1 { font-size: 20px; }
  main { grid-template-rows: minmax(70vh, 1fr) auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .dropzone, .button { transition: background-color .15s ease, border-color .15s ease; }
}
