#ifd-iphone-mac-lab {
  --iphone-navy: #10253f;
  --iphone-blue: #176a88;
  --iphone-cyan: #1e9fc4;
  --iphone-pale: #eaf5f8;
  --iphone-line: #d4dde5;
  --iphone-text: #1d2b38;
  background: #e8edf1;
  color: var(--iphone-text);
  font-size: 16px;
  left: 50%;
  margin: -1.2rem 0 0 -50vw;
  min-height: calc(100vh - 4.7rem);
  position: relative;
  width: 100vw;
}

.md-main__inner:has(#ifd-iphone-mac-lab),
.md-content:has(#ifd-iphone-mac-lab),
.md-content__inner:has(#ifd-iphone-mac-lab) { margin: 0; max-width: none; padding: 0; }
.md-content__inner:has(#ifd-iphone-mac-lab)::before { display: none; }
#ifd-iphone-mac-lab *, #ifd-iphone-mac-lab *::before, #ifd-iphone-mac-lab *::after { box-sizing: border-box; }
#ifd-iphone-mac-lab button, #ifd-iphone-mac-lab input { font: inherit; }
#ifd-iphone-mac-lab button { cursor: pointer; }
#ifd-iphone-mac-lab button:disabled { cursor: not-allowed; opacity: .48; }
#ifd-iphone-mac-lab button:focus-visible, #ifd-iphone-mac-lab a:focus-visible,
#ifd-iphone-mac-lab input:focus-visible, #ifd-iphone-mac-lab [tabindex="-1"]:focus { outline: 3px solid #f0b429; outline-offset: 2px; }

.iphone-lab-top {
  align-items: center;
  background: var(--iphone-navy);
  color: white;
  display: flex;
  gap: 1.25rem;
  min-height: 74px;
  padding: .65rem 1.35rem;
}
.iphone-lab-top > div:first-child { display: grid; margin-right: auto; }
.iphone-lab-top a { color: #9ee5f5; font-size: .76rem; font-weight: 700; width: fit-content; }
.iphone-lab-top span { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.iphone-lab-top strong { font-size: 1rem; }
.iphone-lab-top > button { background: transparent; border: 1px solid #85a0b7; border-radius: .3rem; color: white; padding: .45rem .65rem; }
.iphone-overall-progress { display: grid; min-width: 62px; text-align: center; }
.iphone-overall-progress strong { font-size: 1.05rem; }

.iphone-workspace { display: grid; grid-template-columns: minmax(0, 62fr) minmax(360px, 38fr); height: calc(100vh - 4.7rem - 74px); min-height: 660px; }
.iphone-device-pane { min-height: 0; min-width: 0; overflow: auto; padding: 1.2rem; }
.iphone-task-pane { background: white; border-left: 1px solid #c6d0d8; min-height: 0; min-width: 0; overflow: hidden; }
.iphone-mobile-switch { display: none; }
.iphone-stage { align-items: center; display: flex; flex-wrap: wrap; gap: clamp(1rem, 4vw, 4rem); justify-content: center; min-height: 100%; padding: 1rem; }
#ifd-iphone-mac-lab [data-router-slot] { max-width: 360px; width: 100%; } /* scoped: unscoped it squashed every router page on the site to 360px (ASK #2184) */
#ifd-iphone-mac-lab [data-router-slot]:empty { display: none; }
/* The engine phone supplies its own controls panel; the exercise has its own Reset. */
#ifd-iphone-mac-lab .phone-controls { display: none; }
#ifd-iphone-mac-lab .phone-explorer-shell { display: block; min-height: 0; background: transparent; }
#ifd-iphone-mac-lab .phone-stage { padding: 0; }
#ifd-iphone-mac-lab .ifd-phone-explorer { flex: 0 0 auto; }

.record-launch { background: var(--iphone-blue); border: 0; border-radius: .4rem; color: white; font-weight: 700; padding: .7rem 1rem; }
.router-record { background: #071426; border: 1px solid #27435e; border-radius: .8rem; box-shadow: 0 1rem 2.5rem rgba(8,19,31,.2); color: #e6ecf5; max-width: 360px; overflow: hidden; width: 100%; }
.router-record header { background: #102a44; display: grid; padding: .9rem 1rem; }
.router-record header span { color: #9eddeb; font-size: .62rem; letter-spacing: .09em; }
.router-record header strong { font-size: 1.05rem; }
.router-record dl { margin: 0; }
.router-record dl > div { border-bottom: 1px solid #243b52; display: grid; gap: .5rem; grid-template-columns: 1fr 1.5fr; padding: .75rem 1rem; }
.router-record dt { color: #a9b8c5; font-size: .7rem; }
.router-record dd { font-size: .76rem; margin: 0; overflow-wrap: anywhere; }
.router-record code { color: #f5f9ff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; font-weight: 700; }
/* Reset MkDocs inline-code pills inside the dark router record, without changing phone Settings values. */
#ifd-iphone-mac-lab .router-record code { background: transparent; border: 0; box-shadow: none; padding: 0; }
#ifd-iphone-mac-lab .router-record dl > div:nth-child(2) code { color: #fff; font-size: .86rem; font-weight: 800; }
.router-record > p { color: #90a3b3; font-size: .62rem; margin: 0; padding: .65rem 1rem; }

.iphone-task-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.iphone-task-progress { background: #f5f8fa; border-bottom: 1px solid var(--iphone-line); display: grid; gap: .35rem; padding: .8rem 1.2rem; }
.iphone-task-progress span { color: #607483; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.iphone-task-progress progress { accent-color: var(--iphone-cyan); height: 6px; width: 100%; }
.iphone-task-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 1.2rem 1.3rem 2rem; }
.iphone-task-scroll h1, #ifd-iphone-mac-lab h1.iphone-task-title { color: var(--iphone-navy); font-size: 1.45rem; line-height: 1.2; margin: 0 0 1rem; }
.iphone-task-scroll p, .iphone-task-scroll li { font-size: .86rem; line-height: 1.55; }
.iphone-task-scroll a { color: #075f80; font-weight: 700; }
.iphone-task-callout { background: var(--iphone-pale); border-left: 4px solid var(--iphone-cyan); margin: 1.2rem 0; padding: .8rem 1rem; }
.iphone-task-callout h3 { color: var(--iphone-navy); font-size: .78rem; letter-spacing: .06em; margin: 0 0 .35rem; text-transform: uppercase; }
.iphone-task-callout p { margin: .25rem 0; }
.iphone-task-question { border-top: 1px solid var(--iphone-line); margin-top: 1rem; padding-top: 1rem; }
.iphone-task-question fieldset { border: 0; margin: 0; padding: 0; }
.iphone-task-question legend { font-size: .86rem; line-height: 1.5; margin-bottom: .65rem; }
.iphone-task-question.choices label { align-items: flex-start; border: 1px solid var(--iphone-line); border-radius: .35rem; display: flex; gap: .55rem; margin: .45rem 0; padding: .65rem; }
.iphone-task-question.choices input { margin-top: .2rem; }
.iphone-task-question.choices label span { font-size: .82rem; line-height: 1.45; }
.iphone-task-question > button { background: var(--iphone-blue); border: 0; border-radius: .3rem; color: white; font-weight: 700; margin-top: .7rem; padding: .55rem .75rem; }
.iphone-task-feedback { background: #edf7ef; border-left: 4px solid #3f8a52; font-size: .84rem; margin-top: .8rem; padding: .75rem .9rem; }
.iphone-task-feedback.retry { background: #fff6e3; border-color: #d38c1a; }
.iphone-task-feedback p { margin: .3rem 0; }
.iphone-task-nav { align-items: center; background: white; border-top: 1px solid var(--iphone-line); display: flex; gap: .65rem; justify-content: space-between; padding: .8rem 1rem; }
.iphone-task-nav button { background: white; border: 1px solid #8799a7; border-radius: .3rem; color: var(--iphone-navy); font-weight: 700; min-width: 90px; padding: .55rem .75rem; }
.iphone-task-nav button.primary { background: var(--iphone-blue); border-color: var(--iphone-blue); color: white; margin-left: auto; }
.iphone-completion-card { background: var(--iphone-pale); border-top: 4px solid var(--iphone-cyan); padding: 1rem; }
.iphone-completion-card > span { color: #58707e; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }

@media (max-width: 1050px) {
  .iphone-workspace { grid-template-columns: minmax(0, 57fr) minmax(350px, 43fr); }
  .iphone-stage { gap: 1rem; padding: .5rem; }
  .router-record { max-width: 300px; }
}

@media (max-width: 800px) {
  #ifd-iphone-mac-lab { min-height: calc(100vh - 4.7rem); }
  .iphone-lab-top { min-height: 68px; padding: .55rem .8rem; }
  .iphone-lab-top > button, .iphone-overall-progress span { display: none; }
  .iphone-mobile-switch { background: white; border-bottom: 1px solid var(--iphone-line); display: grid; grid-template-columns: 1fr 1fr; padding: .4rem; }
  .iphone-mobile-switch button { background: white; border: 0; border-bottom: 3px solid transparent; padding: .5rem; }
  .iphone-mobile-switch button[aria-pressed="true"] { border-color: var(--iphone-cyan); color: var(--iphone-navy); font-weight: 800; }
  .iphone-workspace { display: block; height: calc(100vh - 4.7rem - 68px - 50px); min-height: 590px; }
  .iphone-device-pane, .iphone-task-pane { display: none; height: 100%; }
  .iphone-device-pane.is-mobile-active, .iphone-task-pane.is-mobile-active { display: block; }
  .iphone-device-pane { padding: .3rem; }
  .iphone-stage { align-items: flex-start; flex-direction: column; justify-content: flex-start; min-height: 100%; overflow-y: auto; padding: .6rem; }
  .router-record, .record-launch { margin: 0 auto .8rem; max-width: 334px; width: 100%; }
  .iphone-task-scroll { padding: 1rem 1rem 1.5rem; }
}

@media (max-width: 430px) {
  .iphone-lab-top strong { font-size: .8rem; }
  .iphone-lab-top a { font-size: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  #ifd-iphone-mac-lab * { scroll-behavior: auto !important; transition: none !important; }
}

body.ifd-iphone-mac-lab-active { background: #e8edf1; overflow: hidden; }
body.ifd-iphone-mac-lab-active .md-header,
body.ifd-iphone-mac-lab-active .md-tabs,
body.ifd-iphone-mac-lab-active .md-sidebar,
body.ifd-iphone-mac-lab-active .md-footer,
body.ifd-iphone-mac-lab-active .ifd-modebar { display: none !important; }
body.ifd-iphone-mac-lab-active .md-main,
body.ifd-iphone-mac-lab-active .md-main__inner,
body.ifd-iphone-mac-lab-active .md-content,
body.ifd-iphone-mac-lab-active .md-content__inner { height: 100vh; margin: 0; max-width: none; padding: 0; }
body.ifd-iphone-mac-lab-active .md-content__inner::before,
body.ifd-iphone-mac-lab-active .md-content__inner > h1,
body.ifd-iphone-mac-lab-active .md-content__inner > .headerlink { display: none; }
body.ifd-iphone-mac-lab-active #ifd-iphone-mac-lab {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  inset: 0;
  left: 0;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  position: fixed;
  width: 100vw;
  z-index: 40;
}
body.ifd-iphone-mac-lab-active .iphone-lab-top,
body.ifd-iphone-mac-lab-active .iphone-mobile-switch { flex: 0 0 auto; }
body.ifd-iphone-mac-lab-active .iphone-workspace { flex: 1; height: auto !important; min-height: 0; overflow: hidden; }
