@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/space-grotesk.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/ibm-plex-mono.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #edf3ff;
  --surface: #ffffff;
  --ink: #0b1f4b;
  --muted: #52627e;
  --line: #c8d5ee;
  --primary: #2448ff;
  --primary-hover: #1734c9;
  --button-text: #ffffff;
  --link: #2448ff;
  --focus: #2448ff;
  --soft: #e6edff;
  --control-border: #9db0db;
  --selection: #e6edff;
  --success: #2c6848;
  --error: #983d4b;
  --warning: #8a5d15;
  --ivory: #edf3ff;
  --accent: #f05e3c;
  --accent-dark: #1734c9;
  --muted-on-dark: #b8bec7;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 44px;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--link);
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 1px;
}

.skip-link {
  background: var(--ink);
  color: #ffffff;
  left: 1rem;
  padding: 0.75rem 1rem;
  position: fixed;
  top: -5rem;
  z-index: 100;
}

.skip-link:focus {
  top: 1rem;
}

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

.app-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, var(--ink));
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: max-content;
}

.brand-mark {
  border-radius: 5px;
  display: block;
  height: 28px;
  width: 28px;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.product-name {
  background: var(--selection);
  border-radius: 4px;
  color: var(--primary);
  font-weight: 650;
  padding: 0.32rem 0.58rem;
}

.profile-chip {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: flex;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.42rem 0.65rem 0.42rem 0.45rem;
}

.profile-chip .avatar {
  background: var(--primary);
  border-radius: 4px;
}

.readonly-badge {
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  padding: 0.3rem 0.5rem;
  text-transform: uppercase;
}

.run-page {
  background: var(--ivory);
  color: var(--ink);
  min-height: calc(100vh - 72px);
  padding: 72px clamp(20px, 8vw, 120px);
}

.run-page > div { max-width: 900px; }
.run-page h1 { font-size: clamp(2rem, 5vw, 4.5rem); letter-spacing: -0.055em; line-height: 1; margin: 0 0 20px; }
.run-meta, .run-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.status { border: 1px solid var(--line); font: 600 0.7rem var(--mono); padding: 7px 10px; text-transform: uppercase; }
.status-finished { border-color: var(--success); color: var(--success); }
.run-instructions { font-size: 1.15rem; line-height: 1.65; max-width: 740px; }
.run-launches, .grade-view { border-top: 1px solid var(--line); margin-top: 38px; padding-top: 24px; }
.run-launches ul, .grade-view ul { display: grid; gap: 12px; list-style: none; padding: 0; }
.run-launches li { display: grid; gap: 5px; }
.run-launches code { overflow-wrap: anywhere; }
.grade-view li { background: #ffffff; border-left: 4px solid var(--error); padding: 14px 18px; }
.grade-view li.passed { border-color: var(--success); }
.grade-view p { color: var(--muted); margin: 5px 0 0; }
.run-error { background: #fff0f1; border-left: 4px solid var(--error); padding: 14px 18px; }

.avatar {
  align-items: center;
  background: var(--ink);
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  text-transform: uppercase;
  width: 32px;
}

.profile-copy {
  min-width: 0;
}

.profile-copy strong,
.profile-copy span {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy span {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
}

.button,
.icon-button,
.text-button {
  align-items: center;
  border: 1px solid transparent;
  display: inline-flex;
  font-weight: 600;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.55rem 0.9rem;
}

.button-primary {
  background: var(--primary);
  color: var(--button-text);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary,
.icon-button,
.text-button {
  background: var(--surface);
  border-color: var(--control-border);
}

.button-secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.text-button:hover:not(:disabled) {
  background: var(--soft);
}

.icon-button {
  min-width: 44px;
  padding: 0.55rem;
}

.icon-button svg {
  height: 18px;
  width: 18px;
}

.field,
.search-field {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 3px;
  padding: 0.6rem 0.75rem;
  width: 100%;
}

textarea.field {
  min-height: 110px;
  resize: vertical;
}

.mono,
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

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

.status-screen {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 300px;
  padding: 3rem 1rem;
  text-align: center;
}

.status-screen h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.status-screen p {
  color: var(--muted);
  margin: 0 auto 1rem;
  max-width: 48ch;
}

.spinner {
  animation: spin 0.8s linear infinite;
  border: 3px solid var(--line);
  border-radius: 50%;
  border-top-color: var(--primary);
  height: 28px;
  margin: 0 auto 1rem;
  width: 28px;
}

.toast-region {
  bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  max-width: min(380px, calc(100vw - 2rem));
  position: fixed;
  right: 1rem;
  z-index: 50;
}

.toast {
  background: var(--ink);
  border-left: 4px solid #8fbba1;
  color: #ffffff;
  padding: 0.8rem 1rem;
}

.toast.error {
  border-left-color: #e59ca7;
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 700px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
  }

  .app-header {
    padding: 0 1rem;
  }

  .profile-copy,
  .product-name {
    display: none;
  }
}
