.pilot-badge {
  position: fixed;
  z-index: 80;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 8px auto;
  align-items: center;
  column-gap: 8px;
  min-width: 128px;
  min-height: 46px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-2) 94%, transparent);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(54, 41, 26, 0.16);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.pilot-badge:hover {
  border-color: var(--red-2);
  transform: translateY(-1px);
}

.pilot-badge span:not(.pilot-dot) {
  font-weight: 700;
  line-height: 1.25;
}

.pilot-badge small {
  grid-column: 2;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.pilot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-tint);
}

.pilot-badge.is-full .pilot-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-tint);
}

.pilot-badge.is-expired .pilot-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-tint);
}

.pilot-wall {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(29, 26, 21, 0.4);
  backdrop-filter: blur(5px);
}

.pilot-wall.is-open {
  display: flex;
}

body.pilot-modal-open {
  overflow: hidden;
}

.pilot-card {
  position: relative;
  width: min(100%, 560px);
  max-height: min(88vh, 720px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--line-2);
  border-top: 4px solid var(--red);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.95), rgba(255, 253, 248, 0.95)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(163, 33, 20, 0.04) 28px);
  box-shadow: 0 28px 80px rgba(36, 25, 15, 0.28);
}

.pilot-kicker {
  margin-bottom: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.pilot-card h2 {
  padding-right: 36px;
  font-family: var(--kai);
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.24;
}

.pilot-sub {
  margin-top: 10px;
  color: var(--ink-2);
  line-height: 1.75;
}

.pilot-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.pilot-form {
  margin-top: 22px;
}

.pilot-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.pilot-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.pilot-code-row input {
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pilot-code-row button {
  min-width: 108px;
  height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.pilot-code-row button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.pilot-msg {
  min-height: 26px;
  margin: 9px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}

.pilot-msg.bad {
  color: var(--red);
}

.pilot-msg.ok {
  color: var(--green);
}

.pilot-note {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.pilot-note span {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 12px;
}

.pilot-demo-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--ink-3);
  font-size: 12px;
}

.pilot-reset-local {
  display: inline-block;
  min-height: 34px;
  margin-top: 17px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}

.pilot-reset-local[hidden] {
  display: none;
}

.pilot-reset-local + .pilot-demo-link {
  margin-left: 12px;
}

.pilot-rights {
  margin-top: 20px;
}

.pilot-rights dl {
  margin: 0;
  border-top: 1px solid var(--line);
}

.pilot-rights dl > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.pilot-rights dt {
  color: var(--ink-3);
}

.pilot-rights dd {
  margin: 0;
  font-weight: 650;
}

.boot-error {
  max-width: 36em;
  margin: 16vh auto;
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--paper-2);
}

@media (max-width: 700px) {
  .pilot-badge {
    top: auto;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    min-width: 116px;
    min-height: 42px;
    padding: 6px 10px;
  }

  .pilot-card {
    padding: 24px 20px;
    max-height: 92vh;
  }

  .pilot-code-row {
    grid-template-columns: 1fr;
  }

  .pilot-code-row button {
    width: 100%;
  }
}
