:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  --ink: #15221d;
  --muted: #607069;
  --paper: #f7f8f6;
  --surface: #ffffff;
  --line: #d7ddd9;
  --green: #17764e;
  --green-dark: #0f5839;
  --mint: #dff2e7;
  --coral: #d95f49;
  --yellow: #f4c95d;
  --focus: #1267aa;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 44px;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding:
    calc(10px + env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    10px
    max(18px, env(safe-area-inset-left));
  color: #ffffff;
  background: var(--ink);
  border-bottom: 3px solid var(--yellow);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  flex: 0 0 40px;
  border-radius: 6px;
}

.brand p {
  margin: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 750;
}

.brand-context {
  color: #c9d5cf;
  font-size: 0.75rem;
}

.runtime-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: #d4dfd9;
  font-size: 0.78rem;
  text-align: right;
}

.runtime-status span:last-child {
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--yellow);
}

.runtime-status.is-ready .status-dot {
  background: #5ddd98;
}

.runtime-status.is-offline .status-dot {
  background: var(--coral);
}

main {
  width: min(100%, 780px);
  margin: 0 auto;
  padding-bottom: calc(36px + env(safe-area-inset-bottom));
}

section {
  padding: 26px 20px;
  border-bottom: 1px solid var(--line);
}

.clock-band {
  background: var(--surface);
}

.run-heading-row,
.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-label {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.storage-label,
.event-count {
  flex: 0 0 auto;
  padding: 5px 7px;
  color: var(--muted);
  background: #eef1ef;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.field-label {
  display: block;
  margin: 22px 0 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #aeb9b3;
  border-radius: 5px;
}

input::placeholder {
  color: #89968f;
}

.run-name {
  font-weight: 650;
}

.elapsed {
  display: block;
  margin: 26px 0 22px;
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(2.65rem, 12vw, 4.5rem);
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}

.run-actions {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(90px, 1fr);
  gap: 10px;
}

.primary-command,
.secondary-command,
.mark-command,
.quick-marks button,
.text-command {
  border-radius: 5px;
  font-weight: 750;
}

.primary-command {
  color: #ffffff;
  background: var(--green);
  border: 1px solid var(--green);
}

.primary-command:hover {
  background: var(--green-dark);
}

.primary-command.is-running {
  background: var(--coral);
  border-color: var(--coral);
}

.secondary-command,
.quick-marks button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #aeb9b3;
}

.mark-band {
  background: #f0f5f2;
}

.mark-form {
  margin-top: 20px;
}

.mark-form .field-label {
  margin-top: 0;
}

.mark-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 9px;
}

.mark-command {
  color: #ffffff;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.quick-marks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.quick-marks button {
  min-width: 0;
  padding: 0 7px;
  overflow-wrap: anywhere;
}

.timeline-band {
  min-height: 210px;
  background: var(--surface);
}

.text-command {
  min-height: 36px;
  padding: 0;
  color: var(--green);
  background: transparent;
  border: 0;
}

.timeline {
  padding: 0;
  margin: 22px 0 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.timeline-elapsed {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: var(--green);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.timeline-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.timeline-clock {
  color: var(--muted);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.empty-timeline {
  margin: 28px 0 10px;
  color: var(--muted);
  text-align: center;
}

.runtime-band {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
  gap: 24px;
  background: #f3f0e7;
}

.runtime-facts {
  margin: 0;
}

.runtime-facts div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #d8d2c4;
}

.runtime-facts div:last-child {
  border-bottom: 0;
}

.runtime-facts dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.runtime-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (min-width: 700px) {
  body {
    padding: 28px 0;
  }

  .topbar {
    position: static;
    width: min(calc(100% - 40px), 780px);
    margin: 0 auto;
    border-radius: 6px 6px 0 0;
  }

  main {
    box-shadow: 0 12px 36px rgb(21 34 29 / 10%);
  }

  section {
    padding-right: 30px;
    padding-left: 30px;
  }
}

@media (max-width: 430px) {
  .runtime-status span:last-child {
    max-width: 92px;
  }

  .runtime-band {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .timeline-item {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .timeline-clock {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
