@font-face {
  font-family: "Lapline Display";
  src: url("forced_square.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --lapline-ink: #101311;
  --lapline-panel: rgba(24, 28, 25, 0.96);
  --lapline-panel-raised: #222823;
  --lapline-line: rgba(239, 244, 230, 0.11);
  --lapline-text: #f1f3ed;
  --lapline-soft: #a5ada4;
  --lapline-faint: #737d73;
  --lapline-accent: #c9f27a;
  --lapline-blue: #9cd3ff;
  --lapline-danger: #ffb58f;
  --lapline-ease: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input {
  font: inherit;
}

.lapline-shell {
  position: fixed;
  z-index: 1000000;
  inset: 0;
  color: var(--lapline-text);
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
}

.lapline-shell button,
.lapline-shell a {
  pointer-events: auto;
}

.lapline-launcher,
.quick-checkpoint {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(238, 244, 230, 0.13);
  color: var(--lapline-text);
  background: rgba(18, 22, 19, 0.84);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: transform 150ms ease-out, border-color 150ms ease, background-color 150ms ease;
}

.lapline-launcher:hover,
.quick-checkpoint:hover:not(:disabled) {
  border-color: rgba(201, 242, 122, 0.46);
  background: rgba(31, 37, 32, 0.94);
}

.lapline-launcher:active,
.quick-checkpoint:active:not(:disabled),
.lapline-shell .button:active:not(:disabled),
.icon-button:active {
  transform: scale(0.97);
}

.lapline-launcher:focus-visible,
.quick-checkpoint:focus-visible,
.lapline-shell button:focus-visible,
.lapline-shell a:focus-visible {
  outline: 2px solid var(--lapline-accent);
  outline-offset: 3px;
}

.lapline-launcher {
  left: max(16px, env(safe-area-inset-left));
  gap: 10px;
  height: 44px;
  padding: 5px 9px 5px 6px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lapline-launcher img {
  width: 31px;
  height: 31px;
  border-radius: 10px;
}

.launcher-count {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  margin-left: 2px;
  border-radius: 7px;
  color: #182016;
  background: var(--lapline-accent);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.quick-checkpoint {
  right: max(16px, env(safe-area-inset-right));
  gap: 9px;
  height: 44px;
  padding: 0 11px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.quick-checkpoint:disabled {
  opacity: 0;
  pointer-events: none;
}

.quick-checkpoint kbd {
  padding: 3px 5px;
  border: 1px solid rgba(241, 243, 237, 0.16);
  border-radius: 5px;
  color: #b9c2b7;
  font-size: 9px;
  font-weight: 650;
  line-height: 1;
}

.checkpoint-pip,
.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lapline-accent);
  box-shadow: 0 0 12px rgba(201, 242, 122, 0.56);
}

.lapline-panel {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 54px));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  width: min(372px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 82px - env(safe-area-inset-top)));
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(232, 239, 225, 0.14);
  border-radius: 23px;
  background: var(--lapline-panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(22px) saturate(125%);
  pointer-events: auto;
  transform-origin: top right;
  animation: panel-in 180ms var(--lapline-ease) both;
}

.lapline-panel[hidden] {
  display: none;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-header,
.brand-lockup,
.run-card-top,
.section-heading,
.run-stats,
.action-row,
.file-actions,
.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-lockup {
  justify-content: flex-start;
  gap: 11px;
}

.brand-lockup > img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(201, 242, 122, 0.13);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--lapline-faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.17em;
  line-height: 1.2;
}

.brand-lockup h1,
.section-heading h2,
.run-card h2 {
  margin: 0;
  font-family: "Lapline Display", Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.brand-lockup h1 {
  font-size: 21px;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--lapline-line);
  border-radius: 11px;
  color: #b6beb5;
  background: transparent;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  transition: color 150ms ease, border-color 150ms ease, transform 150ms ease-out;
}

.icon-button:hover {
  color: white;
  border-color: rgba(241, 243, 237, 0.28);
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 16px 0 12px;
  padding: 0 10px;
  border: 1px solid rgba(201, 242, 122, 0.15);
  border-radius: 10px;
  color: #c4d4b0;
  background: rgba(201, 242, 122, 0.055);
  font-size: 10px;
  font-weight: 620;
}

.status-dot {
  width: 6px;
  height: 6px;
}

.status-frame {
  margin-left: auto;
  color: #8d9988;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.status-strip[data-state="waiting"] .status-dot {
  background: #859183;
  box-shadow: none;
}

.status-strip[data-state="replaying"] .status-dot {
  background: var(--lapline-blue);
  box-shadow: 0 0 12px rgba(156, 211, 255, 0.5);
}

.status-strip[data-state="watching"] .status-dot {
  background: #e6c47c;
  box-shadow: 0 0 12px rgba(230, 196, 124, 0.42);
}

.status-strip[data-state="error"] .status-dot {
  background: var(--lapline-danger);
  box-shadow: 0 0 12px rgba(255, 181, 143, 0.42);
}

.run-card {
  padding: 14px 13px 12px;
  border: 1px solid var(--lapline-line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(43, 51, 43, 0.56), rgba(29, 34, 29, 0.55));
}

.run-card-top {
  align-items: flex-start;
  gap: 10px;
}

.run-card h2 {
  max-width: 205px;
  overflow: hidden;
  color: #eff3e9;
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-chip {
  flex: 0 0 auto;
  padding: 5px 7px 4px;
  border: 1px solid rgba(201, 242, 122, 0.21);
  border-radius: 6px;
  color: #badb85;
  background: rgba(201, 242, 122, 0.08);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.recording-chip[data-recording="true"] {
  color: #ffbc95;
  border-color: rgba(255, 161, 117, 0.25);
  background: rgba(255, 161, 117, 0.09);
}

.recording-chip[data-recording="true"]::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 5px 1px 0;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

.run-stats {
  justify-content: flex-start;
  gap: 0;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid rgba(239, 244, 230, 0.08);
}

.run-stats > div {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  gap: 5px;
}

.run-stats > div + div {
  padding-left: 13px;
  border-left: 1px solid rgba(239, 244, 230, 0.08);
}

.run-stats span {
  color: #899389;
  font-size: 9px;
}

.run-stats strong {
  color: #e8ede3;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 690;
}

.run-stats strong small {
  color: #9ca69a;
  font-size: 9px;
  font-weight: 550;
}

.action-row {
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.lapline-shell .button {
  display: inline-flex;
  width: 100%;
  min-height: 41px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.01em;
  transition: transform 150ms ease-out, background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.lapline-shell .button:disabled {
  opacity: 0.39;
  cursor: not-allowed;
}

.button-primary {
  color: #1b2314;
  background: var(--lapline-accent);
}

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

.button-plus {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 6px;
  color: #233018;
  background: rgba(30, 43, 20, 0.1);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

.button-secondary {
  color: #c8d1c6;
  border-color: var(--lapline-line) !important;
  background: rgba(255, 255, 255, 0.025);
}

.button-secondary:hover:not(:disabled) {
  color: white;
  border-color: rgba(241, 243, 237, 0.21) !important;
  background: rgba(255, 255, 255, 0.055);
}

.button-icon {
  font-size: 15px;
  line-height: 1;
}

.checkpoint-section {
  display: flex;
  min-height: 100px;
  flex: 1 1 auto;
  flex-direction: column;
  margin-top: 19px;
  overflow: hidden;
}

.section-heading {
  flex: 0 0 auto;
  margin-bottom: 9px;
}

.section-heading h2 {
  font-size: 15px;
  line-height: 1.1;
}

.section-count {
  display: grid;
  min-width: 29px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--lapline-line);
  border-radius: 8px;
  color: #a6b19f;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.checkpoint-list {
  min-height: 42px;
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-color: #515a50 transparent;
  scrollbar-width: thin;
}

.empty-state {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px dashed rgba(239, 244, 230, 0.12);
  border-radius: 12px;
}

.empty-mark {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #badb85;
  background: rgba(201, 242, 122, 0.09);
  font-size: 20px;
}

.empty-state p {
  margin: 0;
  color: #929c90;
  font-size: 9px;
  line-height: 1.55;
}

.checkpoint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  margin-bottom: 5px;
}

.checkpoint-select,
.checkpoint-delete {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #dfe5dc;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.checkpoint-select {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 6px 9px;
  text-align: left;
}

.checkpoint-select:hover,
.checkpoint-delete:hover {
  border-color: rgba(239, 244, 230, 0.15);
  background: rgba(255, 255, 255, 0.065);
}

.checkpoint-select[aria-pressed="true"] {
  border-color: rgba(201, 242, 122, 0.32);
  color: #eaffcf;
  background: rgba(201, 242, 122, 0.075);
}

.checkpoint-index {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid rgba(201, 242, 122, 0.18);
  border-radius: 7px;
  color: #badb85;
  font-size: 8px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.checkpoint-label {
  overflow: hidden;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkpoint-frame {
  color: #929b90;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.checkpoint-delete {
  display: grid;
  place-items: center;
  color: #9ca69a;
  font-size: 15px;
}

.checkpoint-delete:hover {
  color: var(--lapline-danger);
  border-color: rgba(255, 181, 143, 0.2);
}

.resume-area {
  flex: 0 0 auto;
  margin-top: 10px;
}

.button-resume {
  color: #d8e5c7;
  border-color: rgba(201, 242, 122, 0.18) !important;
  background: linear-gradient(110deg, rgba(201, 242, 122, 0.12), rgba(201, 242, 122, 0.055));
}

.button-resume:hover:not(:disabled) {
  color: #efffde;
  border-color: rgba(201, 242, 122, 0.42) !important;
  background: rgba(201, 242, 122, 0.14);
}

.text-button {
  border: 0;
  color: #b7d78a;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
  transition: color 140ms ease;
}

.text-button:hover {
  color: #deffae;
}

.text-button-muted {
  color: #919a8e;
}

.resume-area > .text-button {
  display: block;
  margin: 8px auto 0;
}

.resume-progress {
  padding: 9px 1px 0;
}

.progress-copy {
  color: #aab4a4;
  font-size: 9px;
}

.progress-copy strong {
  color: #d0dfbc;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--lapline-blue);
  transition: width 100ms linear;
}

.panel-footer {
  flex: 0 0 auto;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(239, 244, 230, 0.085);
}

.file-actions {
  justify-content: flex-start;
  gap: 15px;
}

.panel-footer p {
  margin: 8px 0 0;
  color: #778175;
  font-size: 8px;
  line-height: 1.5;
}

.panel-footer a {
  color: #a8c87b;
  text-decoration-color: rgba(168, 200, 123, 0.35);
  text-underline-offset: 2px;
}

.panel-footer a:hover {
  color: #dbff9d;
}

.lapline-toast {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: min(340px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(239, 244, 230, 0.15);
  border-radius: 12px;
  color: #eaf1e4;
  background: rgba(22, 27, 23, 0.96);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
  font-size: 10px;
  line-height: 1.4;
  pointer-events: none;
}

.lapline-toast[hidden] {
  display: none;
}

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

@media (max-width: 560px) {
  .lapline-launcher {
    left: max(10px, env(safe-area-inset-left));
    height: 40px;
    border-radius: 13px;
  }

  .lapline-launcher img {
    width: 29px;
    height: 29px;
  }

  .quick-checkpoint {
    right: max(10px, env(safe-area-inset-right));
    height: 40px;
    gap: 7px;
    padding: 0 9px;
    font-size: 9px;
  }

  .quick-checkpoint kbd {
    display: none;
  }

  .lapline-panel {
    top: max(58px, calc(env(safe-area-inset-top) + 50px));
    right: max(10px, env(safe-area-inset-right));
    width: min(372px, calc(100vw - 20px));
    max-height: calc(100dvh - 72px - env(safe-area-inset-top));
    padding: 15px;
    border-radius: 19px;
  }
}

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