/* Free Bottleneck Check. Self-contained: tokens copied from the landing page. */

:root {
  --bg: #F6F2EA;
  --surface: #FFFDF8;
  --ink: #17150F;
  --muted: #5A544A;
  --hairline: #E2DACB;
  --saffron: #E0A21B;
  --saffron-deep: #C98D0C;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --section-y: 112px;
  --gutter: 24px;

  /* Paper on ink, as solid colours so contrast is measurable:
     75% = #BEBBB3 (9.5:1), 62% = #A19E97 (6.8:1). */
  --paper-75: #BEBBB3;
  --paper-dim: #A19E97;
  --paper-line: rgba(246, 242, 234, .14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ol {
  margin: 0;
}

p {
  text-wrap: pretty;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 500;
  text-wrap: balance;
}

h1 {
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 15px;
  line-height: 1.5;
}

.lead {
  max-width: 62ch;
  font-size: 20px;
  line-height: 1.55;
  color: var(--muted);
}

/* Wordmark */

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

/* Buttons: the landing .btn, exactly */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 6px;
  background: var(--saffron);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}

.btn:hover {
  background: var(--saffron-deep);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

/* The one secondary style: ink text, hairline underline */

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: text-decoration-color 150ms ease;
}

.link:hover {
  text-decoration-color: currentColor;
}

.link--paper {
  color: var(--bg);
  text-decoration-color: var(--paper-line);
}

.link--paper:focus-visible {
  outline-color: var(--bg);
}

/* States: one screen at a time */

.screen {
  display: none;
}

body[data-state="ready"] [data-screen="ready"],
body[data-state="finished"] [data-screen="finished"],
body[data-state="broke"] [data-screen="broke"] {
  display: block;
  animation: screen-in 240ms ease-out both;
}

body[data-state="running"] [data-screen="running"] {
  display: grid;
  animation: screen-in 240ms ease-out both;
}

body[data-state="running"] {
  overflow: hidden;
}

body[data-state="running"] .page-header {
  display: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Centred pages: ready, finished, broke */

.page-header {
  border-bottom: 1px solid var(--hairline);
}

.page-header__inner {
  display: flex;
  align-items: center;
  max-width: 800px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.screen--page {
  max-width: 800px;
  margin: 0 auto;
  padding: 72px var(--gutter) 96px;
}

.screen--page > * + * {
  margin-top: 24px;
}

.screen--page h1 {
  margin-top: 16px;
}

.card {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.screen--page > .card {
  margin-top: 40px;
}

.screen--page > .card + .card {
  margin-top: 16px;
}

.card > .label + * {
  margin-top: 12px;
}

.card__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  text-wrap: balance;
}

.card__title + .muted {
  margin-top: 8px;
}

.card--small {
  max-width: 360px;
  padding: 24px;
}

.steps,
.events {
  list-style: none;
  padding: 0;
}


.screen--page > .steps {
  margin-top: 40px;
}

.steps li,
.events li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
}

.steps li:last-child {
  border-bottom: 1px solid var(--hairline);
}

.events li {
  grid-template-columns: 64px 1fr;
}

.events li:first-child {
  border-top: 0;
  padding-top: 8px;
}

.events li:last-child {
  padding-bottom: 0;
}

.steps__num,
.events__time {
  color: var(--muted);
}

.action {
  margin-top: 40px;
}

.screen--page > .action {
  margin-top: 32px;
}

.screen--page > .action + .card {
  margin-top: 56px;
}

.action__note {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.5;
}

.action--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}

.next {
  margin-top: 64px !important;
  padding-top: 48px;
  border-top: 1px solid var(--hairline);
}

.next > * + * {
  margin-top: 16px;
}

.next p {
  max-width: 62ch;
}

.next .action {
  margin-top: 32px;
}

.sample-note {
  color: var(--muted);
  font-size: 12px;
}

.screen--page > .sample-note {
  margin-top: 40px;
}

.screen--page > .sample-note + .card {
  margin-top: 12px;
}

.paused__left {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.paused__reason {
  margin-top: 8px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Running: the app */

.app {
  height: 100vh;
  height: 100dvh;
  grid-template-rows: 64px minmax(0, 1fr);
}

.bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  min-width: 0;
}

.bar__brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex: none;
}

.wordmark--bar {
  font-size: 20px;
}

.bar__label {
  color: var(--muted);
  font-size: 12px;
}

.bar__problem {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.bar__clock {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: none;
  margin-left: auto;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.timer__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--saffron);
  animation: pulse 1s ease-in-out infinite;
}

.timer__time {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.timer.is-low .timer__time {
  color: var(--ink);
  font-weight: 600;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.app__main {
  display: flex;
  min-height: 0;
}

/* Whiteboard */

.board {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background-color: var(--surface);
  background-image: radial-gradient(circle, var(--hairline) 1px, transparent 1.5px);
  background-size: 24px 24px;
  background-position: 12px 12px;
}

.board__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.board[data-tool="eraser"] .board__canvas {
  cursor: cell;
}

.board__hint {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 48px);
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 17px;
  text-align: center;
  pointer-events: none;
  text-wrap: pretty;
  transition: opacity 300ms ease;
}

.board.has-ink .board__hint {
  opacity: 0;
}

.tools {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
}

.tool {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.tool:hover {
  background: var(--bg);
}

.tool.is-active {
  background: var(--ink);
  color: var(--bg);
}

.tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.tool:hover::after,
.tool:focus-visible::after {
  opacity: 1;
  transition-delay: 300ms;
}

/* Interviewer rail */

.rail {
  display: flex;
  flex-direction: column;
  width: 380px;
  flex: none;
  min-height: 0;
  background: var(--ink);
  color: var(--bg);
}

.rail :focus-visible {
  outline-color: var(--bg);
}

.rail__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--paper-line);
}

.rail__close {
  display: none;
  margin-left: auto;
}

.listening {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.listening__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.listening__bars i {
  width: 2px;
  height: 100%;
  background: var(--paper-dim);
  transform-origin: bottom;
  animation: level 900ms ease-in-out infinite;
}

.listening__bars i:nth-child(2) { animation-delay: -300ms; }
.listening__bars i:nth-child(3) { animation-delay: -600ms; }

@keyframes level {
  0%, 100% { transform: scaleY(.3); }
  50% { transform: scaleY(1); }
}

.cutins {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 16px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 242, 234, .24) transparent;
}

.cutins__list {
  list-style: none;
  padding: 0;
}

.rail__problem {
  display: none;
  padding: 16px 24px 20px;
  border-bottom: 1px solid var(--paper-line);
}

.rail__problem .label {
  color: var(--paper-dim);
  font-size: 12px;
  margin-bottom: 4px;
}

.rail__problem p:last-child {
  font-size: 16px;
  line-height: 1.5;
}

.cutin {
  padding: 16px 24px 16px 21px;
  border-left: 3px solid transparent;
  color: var(--paper-75);
  animation: cutin-in 200ms ease-out both;
}

.cutin.is-new {
  border-left-color: var(--saffron);
  color: var(--bg);
}

.cutin__time {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}

.cutin__text {
  display: block;
  text-wrap: pretty;
  font-size: 17px;
  line-height: 1.5;
}

@keyframes cutin-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rail__foot {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--paper-line);
  color: var(--paper-dim);
  font-size: 15px;
  line-height: 1.5;
}

/* Phone: pinned newest cut-in, bottom sheet */

.peek,
.probrow,
.scrim {
  display: none;
}

/* Motion off */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .btn:hover,
  .btn:active {
    transform: none;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 20px;
  }

  .br-desk {
    display: none;
  }

  body {
    font-size: 17px;
  }

  h1 {
    font-size: 36px;
    line-height: 1.08;
  }

  h2 {
    font-size: 28px;
  }

  .lead {
    font-size: 17px;
  }

  .page-header__inner {
    min-height: 60px;
  }

  .wordmark {
    font-size: 20px;
  }

  .screen--page {
    padding: 40px var(--gutter) 72px;
  }

  .card {
    padding: 24px 20px;
  }

  .btn {
    display: flex;
    width: 100%;
  }

  .action--row {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .action--row .link {
    align-self: center;
    padding: 8px 0;
  }

  /* Running */

  .app {
    grid-template-rows: 56px auto auto minmax(0, 1fr);
  }

  .bar {
    gap: 12px;
    padding: 0 16px;
  }

  .bar__label,
  .bar__problem {
    display: none;
  }

  .bar__clock {
    gap: 16px;
  }

  .timer__time {
    font-size: 20px;
  }

  .bar .link {
    padding: 8px 0;
  }

  .probrow {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
  }

  .probrow__label {
    flex: none;
    font-size: 11px;
  }

  .probrow__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
  }

  .probrow:focus-visible {
    outline-offset: -3px;
  }

  .peek {
    display: block;
    width: auto;
    margin: 0;
    padding: 12px 16px 12px 13px;
    border: 0;
    border-left: 3px solid var(--saffron);
    border-radius: 0;
    background: var(--ink);
    color: var(--bg);
    text-align: left;
    cursor: pointer;
  }

  .peek:focus-visible {
    outline-color: var(--bg);
    outline-offset: -3px;
  }

  .peek__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
    color: var(--paper-dim);
  }

  .peek__head .label {
    font-size: 11px;
  }

  .peek__more {
    margin-left: auto;
    text-decoration: underline;
    text-decoration-color: var(--paper-line);
    text-underline-offset: 3px;
  }

  .peek__text {
    display: -webkit-box;
    text-wrap: pretty;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.45;
  }

  .app__main {
    position: relative;
  }

  .rail__problem {
    display: block;
  }

  .tools {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
  }

  .tool {
    width: 44px;
    height: 44px;
  }

  .tool::after {
    top: auto;
    bottom: calc(100% + 8px);
  }

  .rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: auto;
    height: 75dvh;
    border-radius: 10px 10px 0 0;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 240ms ease-out, visibility 0s linear 240ms;
  }

  .rail.is-open {
    transform: none;
    visibility: visible;
    transition: transform 240ms ease-out;
  }

  .rail__close {
    display: inline;
  }

  .rail__foot {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(23, 21, 15, .4);
  }
}
