/* Teacher Demo: a thin guide around the real game. The game is in the frame;
   this sheet only draws the bar above it, in the game's own colours. */
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  font-family: var(--mt-font, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 15px;
  color: var(--mt-ink, #0f1720);
  background: var(--mt-bg, #f4f6f8);
}

.td-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 9px 20px;
  background: var(--mt-navy, #0f1720);
  color: var(--mt-on-navy, #ffffff);
}
.td-top__brand { font-weight: 700; letter-spacing: 0.01em; }
.td-top__brand span { color: var(--mt-accent-bright, #2fc3b1); }
.td-top__title { margin: 0; font-size: 17px; font-weight: 700; }
.td-top__note { margin: 0; color: var(--mt-on-navy-muted, rgba(255, 255, 255, 0.78)); font-size: 14px; }

.td-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--mt-line, #dfe4ea);
}
.td-step {
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--mt-line-strong, #c9d1db);
  border-radius: 999px;
  background: #ffffff;
  color: var(--mt-ink, #0f1720);
  cursor: pointer;
}
.td-step__n {
  display: inline-block;
  min-width: 18px;
  margin-right: 6px;
  color: var(--mt-ink-muted, #5b6672);
  font-variant-numeric: tabular-nums;
}
.td-step[aria-current="step"] { background: var(--mt-accent, #0e8a7c); border-color: transparent; color: #ffffff; }
.td-step[aria-current="step"] .td-step__n { color: rgba(255, 255, 255, 0.85); }
.td-step:focus-visible, .td-btn:focus-visible, .td-role:focus-visible { outline: 3px solid var(--mt-accent, #0e8a7c); outline-offset: 2px; }

.td-caption {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--mt-line, #dfe4ea);
}
.td-caption__text { flex: 1 1 520px; margin: 0; line-height: 1.4; }
.td-caption__tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.td-roles { display: inline-flex; border: 1px solid var(--mt-line-strong, #c9d1db); border-radius: 8px; overflow: hidden; }
.td-roles[hidden] { display: none; }
.td-role {
  font: inherit;
  font-weight: 600;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid var(--mt-line-strong, #c9d1db);
  background: #ffffff;
  color: var(--mt-ink, #0f1720);
  cursor: pointer;
}
.td-role:last-child { border-right: 0; }
.td-role[aria-pressed="true"] { background: var(--mt-navy, #0f1720); color: #ffffff; }

/* The Questions step: the teacher form's course list, and its note for the
   chosen course on its own line under the caption. A long course name is cut
   short in the closed list; the open list shows every name whole. */
.td-caption__note { display: block; margin-top: 2px; font-size: 14px; color: var(--mt-ink-muted, #5b6672); }
.td-course { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.td-course[hidden] { display: none; }
.td-course__select {
  width: 250px;
  max-width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 6px 8px;
  border: 1px solid var(--mt-line-strong, #c9d1db);
  border-radius: 8px;
  background: #ffffff;
  color: var(--mt-ink, #0f1720);
  text-overflow: ellipsis;
  cursor: pointer;
}
.td-course__select:focus-visible { outline: 3px solid var(--mt-accent, #0e8a7c); outline-offset: 2px; }

.td-btn {
  font: inherit;
  font-weight: 700;
  padding: 7px 16px;
  border: 1px solid var(--mt-line-strong, #c9d1db);
  border-radius: 8px;
  background: #ffffff;
  color: var(--mt-ink, #0f1720);
  cursor: pointer;
}
.td-btn--primary { background: var(--mt-accent, #0e8a7c); border-color: transparent; color: #ffffff; }
.td-btn[disabled] { opacity: 0.45; cursor: default; }

.td-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #e6eaee; }
.td-frame { display: block; width: 100%; height: 100%; border: 0; background: #ffffff; }

/* The phone story (built by teacher-demo.js only on a phone) never shows on a
   laptop, and the short note is the phone's. */
.td-story, .td-top__note--short { display: none; }

/*
 * A phone (teachers look at the demo in the evening): no buttons to step
 * through. The seven steps stand one under another and the teacher scrolls:
 * each has its title, its whole caption and a window on the real game that
 * loads as it comes into view. A window only watches (the thumb scrolls the
 * page, never the game) until Try it; Done gives the page back. The student
 * desk, laptop-only in class, is the laptop screen scaled to fit.
 * The laptop layout above is not touched: these rules only apply under 700 px
 * wide or 500 px tall.
 */
@media (max-width: 700px), (max-height: 500px) {
  html, body { height: auto; }
  body { display: block; min-height: 100%; }

  .td-steps, .td-caption, .td-stage { display: none !important; }

  .td-top { position: sticky; top: 0; z-index: 5; flex-wrap: nowrap; gap: 10px; padding: 8px 14px; }
  .td-top__brand, .td-top__note { display: none; }
  .td-top__title { font-size: 15px; white-space: nowrap; }
  .td-top__note--short {
    display: block;
    min-width: 0;
    margin: 0;
    font-size: 13px;
    color: var(--mt-on-navy-muted, rgba(255, 255, 255, 0.78));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .td-story { display: block; padding: 4px 0 calc(24px + env(safe-area-inset-bottom, 0px)); }
  .td-story__intro { margin: 12px 14px 4px; font-size: 14.5px; line-height: 1.45; color: var(--mt-ink-muted, #5b6672); }

  .td-card { padding: 16px 12px 8px; border-bottom: 1px solid var(--mt-line, #dfe4ea); }
  .td-card__title { display: flex; align-items: center; gap: 8px; margin: 0 2px 6px; font-size: 18px; font-weight: 700; }
  .td-card__n {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--mt-accent, #0e8a7c);
    color: #ffffff;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }
  .td-card__caption { margin: 0 2px 10px; font-size: 14.5px; line-height: 1.45; }
  .td-card .td-roles { display: flex; width: 100%; margin-bottom: 10px; }
  .td-card .td-role { flex: 1 1 0; padding: 8px 4px; font-size: 14px; }
  .td-card .td-course { display: flex; width: 100%; margin-bottom: 10px; font-size: 14px; }
  .td-card .td-course__select { flex: 1 1 auto; width: auto; min-width: 0; min-height: 40px; font-size: 14px; }
  .td-card .td-caption__note { margin-top: 4px; font-size: 13.5px; }

  .td-window {
    position: relative;
    height: min(76vh, 620px);
    overflow: hidden;
    border: 1px solid var(--mt-line-strong, #c9d1db);
    border-radius: 12px;
    background: #e6eaee;
  }
  .td-window__wait {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    font-size: 14px;
    color: var(--mt-ink-muted, #5b6672);
  }
  .td-window__frame { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 0; background: #ffffff; pointer-events: none; }
  .td-window--live { outline: 3px solid var(--mt-accent, #0e8a7c); outline-offset: 2px; }
  .td-window--live .td-window__frame { pointer-events: auto; }
  .td-window__try {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--mt-navy, #0f1720);
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(15, 23, 32, 0.25);
    cursor: pointer;
  }
  .td-window--live .td-window__try { background: var(--mt-accent, #0e8a7c); }
  .td-card__note { margin: 8px 2px 0; font-size: 13px; line-height: 1.4; color: var(--mt-ink-muted, #5b6672); }
  .td-card__open { display: inline-block; margin: 10px 2px 0; font-size: 14px; font-weight: 700; color: var(--mt-accent, #0e8a7c); }

  .td-story__end { margin: 18px 14px 0; font-size: 14.5px; line-height: 1.45; }
  .td-story__top { display: inline-block; margin: 10px 14px 0; font-weight: 700; color: var(--mt-accent, #0e8a7c); }

  .td-card .td-role:focus-visible, .td-window__try:focus-visible { outline: 3px solid var(--mt-accent, #0e8a7c); outline-offset: 2px; }
}

/* A phone on its side: the windows keep most of the short screen. */
@media (max-height: 500px) {
  .td-top { padding: 5px 14px; }
  .td-window { height: 78vh; }
}
