:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --dim: #7a7a7a;
  --line: #262626;
  --warn: #facc15;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --fg: #0a0a0a;
    --dim: #8a8a8a;
    --line: #e3e3e3;
    --warn: #a16207;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

form {
  width: 100%;
  max-width: 360px;
}

form.done,
.view {
  width: 100%;
  max-width: 480px;
}

.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.head h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.head span {
  flex: none;
  font-size: 13px;
  color: var(--dim);
}

.alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--warn);
  border-radius: 12px;
  color: var(--warn);
  font-size: 13px;
}

.view .note {
  margin-top: 28px;
}

.none {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.row {
  display: flex;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.row:focus-within {
  border-color: var(--fg);
}

input {
  flex: 1;
  min-width: 0;
  padding: 0 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

input.mono {
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  text-overflow: ellipsis;
}

.row button {
  position: relative;
  flex: none;
  min-width: 52px;
  padding: 0 18px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.row button:hover,
.row button:focus-visible {
  background: var(--fg);
  color: var(--bg);
  outline: 0;
}

.done .row button {
  display: none;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: 1px solid var(--fg);
  border-radius: 12px;
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.15s ease, transform 0.05s ease;
}

.cta[hidden] {
  display: none;
}

.cta:hover {
  opacity: 0.88;
}

.cta:active {
  transform: scale(0.99);
}

.cta:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.cta svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cta .i-ok,
.cta.ok .i-copy {
  display: none;
}

.cta.ok .i-ok {
  display: block;
}

.cta.ok,
.cta.ok:hover {
  background: #22c55e;
  border-color: #22c55e;
  color: #052e16;
  opacity: 1;
}

.busy .row button {
  pointer-events: none;
  color: transparent;
  background: transparent;
}

.busy .row button::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--fg);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

#m {
  height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--dim);
}

.note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}

.note h2 {
  margin: 32px 0 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.note h2:first-child {
  margin-top: 16px;
}

.note .must {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid var(--warn);
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.note .must i {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--warn);
  color: #0a0a0a;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
}

.note .must + h2 {
  margin-top: 26px;
}

.note p {
  margin: 12px 0;
}

.note strong {
  font-weight: 600;
  color: var(--fg);
}

.note dl,
.note ul {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.note dl > div,
.note li {
  display: grid;
  grid-template-columns: 152px 1fr;
  column-gap: 14px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.note dt {
  color: var(--fg);
}

.note .apps dt {
  color: var(--dim);
}

.note .apps dd {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.note .spec dt {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.note .modes li {
  grid-template-columns: 20px 58px 1fr;
  column-gap: 12px;
  align-items: center;
}

.note .modes svg {
  display: block;
}

.note .modes b {
  font-weight: 500;
  color: var(--fg);
}

.note .warn {
  margin-top: 32px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.note .warn p {
  margin: 0;
}

@media (max-width: 420px) {
  .note dl > div {
    grid-template-columns: 136px 1fr;
    column-gap: 12px;
  }
}

.no .row {
  border-color: var(--fg);
  animation: nudge 0.28s ease;
}

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

@keyframes nudge {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .no .row {
    animation: none;
  }
}
