:root {
  color-scheme: light;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142037;
  background: #f5f8fd;
  font-synthesis: none;
  --ink: #142037;
  --muted: #52627a;
  --blue: #234fdb;
  --border: #dce5f2;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 18rem; min-height: 100vh; margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #4c78ff; outline-offset: 4px; }

.header {
  background: #fff;
  border-bottom: 1px solid #e2e9f5;
}

.header-inner {
  width: min(100% - 3rem, 71rem);
  min-height: 4.5rem;
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 770;
  letter-spacing: -.055em;
  text-decoration: none;
}

.brand-icon, .section-icon {
  display: grid;
  place-items: center;
  flex: none;
}

.brand-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .7rem;
  background: var(--blue);
  color: white;
  box-shadow: 0 3px 8px #224cce30;
}

.help-button {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: white;
  color: #364964;
  font-size: .875rem;
  font-weight: 640;
}

.help-button:hover { background: #f2f6ff; }
.help-icon {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: .66rem;
  line-height: 1;
}

.page {
  padding: clamp(3rem, 7vw, 6rem) 1.5rem 4rem;
  background:
    radial-gradient(ellipse 30rem 16rem at 50% 1%, #e7efff, transparent),
    radial-gradient(#bccae34a 1px, transparent 1px) center top / 18px 18px;
}

.intro { text-align: center; margin: 0 auto 2.5rem; }
.intro h1 {
  margin: 0 0 .75rem;
  font-size: clamp(2.1rem, 5.5vw, 3.65rem);
  font-weight: 780;
  letter-spacing: -.068em;
  line-height: 1.09;
}
.intro p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 1.0625rem; }

.generator {
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  width: min(100%, 61rem);
  margin-inline: auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9e3f2;
  border-radius: 1.35rem;
  box-shadow: 0 1.1rem 3.6rem #203a6612, 0 .25rem .65rem #203a6609;
}

.setup { padding: clamp(1.5rem, 4.2vw, 2.5rem); }
.section-icon {
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.12rem;
  border-radius: .85rem;
  color: var(--blue);
  background: #eaf0ff;
}

.setup h2, .dialog-body h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -.04em;
}
.setup > p, .dialog-body p, .dialog-body li {
  line-height: 1.55;
  color: var(--muted);
}
.setup > p { margin: .55rem 0 1.45rem; max-width: 24rem; }

#key-form label {
  display: block;
  margin-bottom: .5rem;
  font-size: .875rem;
  font-weight: 650;
}

.input-wrap { position: relative; }
#secret {
  display: block;
  width: 100%;
  padding: .85rem 3.25rem .85rem .9rem;
  min-height: 3.125rem;
  border: 1px solid #c6d3e7;
  border-radius: .7rem;
  background: #f8faff;
  color: var(--ink);
}
#secret::placeholder { color: #62748d; }
#secret:focus { border-color: #416cf2; outline: 3px solid #416cf22b; outline-offset: 0; }
#secret[aria-invalid="true"] { border-color: #b42338; }

.visibility {
  position: absolute;
  top: .25rem;
  bottom: .25rem;
  right: .25rem;
  width: 2.55rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: .45rem;
  background: none;
  color: #4a5d79;
}
.visibility:hover { background: #e8effb; }

.field-error { margin: .55rem 0 0; font-size: .875rem; color: #a71d32; }
.generate {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin-top: .85rem;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: .7rem;
  background: var(--blue);
  color: white;
  font-size: .9375rem;
  font-weight: 680;
  box-shadow: 0 3px 8px #234fdb2b;
  transition: background-color .15s;
}
.generate:hover { background: #1741c5; }
.generate:active { background: #1538aa; }

.setup-actions {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
}

.text-button {
  padding: .2rem 0;
  border: 0;
  background: transparent;
  font-size: .875rem;
  font-weight: 670;
}
.text-button:not(:disabled):hover { text-decoration: underline; text-underline-offset: .2em; }
.demo { color: #2049c7; }
.clear { color: #52627a; }
.clear:disabled { visibility: hidden; }

.result {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4.2vw, 2.5rem);
  background:
    linear-gradient(#b9d5ff0b 1px, transparent 1px) center / 24px 24px,
    linear-gradient(90deg, #b9d5ff0b 1px, transparent 1px) center / 24px 24px,
    radial-gradient(ellipse at 100% 0%, #243d71, transparent 80%),
    #111f3b;
  color: #f6f9ff;
}

.result-header {
  min-height: 1.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.result-header h2 {
  margin: 0;
  color: #e9f0ff;
  font-size: 1rem;
  font-weight: 670;
  letter-spacing: -.01em;
}
.demo-badge {
  padding: .25rem .55rem;
  border-radius: .375rem;
  background: #2d4676;
  color: #e1eaff;
  font-size: .8125rem;
  font-weight: 630;
}

.code { display: block; margin: .9rem 0 1.4rem; }
.digits {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(.25rem, 1vw, .5rem);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.digits span {
  display: grid;
  min-height: clamp(3.1rem, 7vw, 4.6rem);
  place-items: center;
  border: 1px solid #89a5df36;
  border-radius: .7rem;
  background: #9abbfd15;
  color: #a5b8dd;
  font-size: clamp(1.4rem, 3.5vw, 2.7rem);
  line-height: 1;
  font-weight: 650;
}
.result[data-active] .digits span { color: #f5f9ff; border-color: #a9c3ff61; background: #a1bbff22; }
.digits span:nth-child(3) { margin-right: .15rem; }

.timing-row { display: flex; justify-content: space-between; gap: .4rem; color: #cbd8f0; font-size: .875rem; }
#next-code { margin-left: .3rem; color: #f0f5ff; font-variant-numeric: tabular-nums; font-weight: 650; }
.countdown { color: #d2e0ff; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.track {
  height: .375rem;
  margin-top: .6rem;
  border-radius: 100px;
  overflow: hidden;
  background: #b0c9ff2b;
}
.track span {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: #87aaff;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-top: 1.4rem;
}
.result-actions button {
  display: flex;
  gap: .55rem;
  justify-content: center;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: .35rem;
  border: 1px solid #a7bff665;
  border-radius: .65rem;
  color: #f1f6ff;
  background: #b0c9ff12;
  font-size: .875rem;
  font-weight: 650;
}
.result-actions button:hover:not(:disabled) { background: #a2beff35; }
.result-actions button:focus-visible { outline-color: #bed0ff; }
.result-actions button:disabled { color: #a8b9d8; border-color: #a7bff63b; }
.result-actions .share-button { grid-column: 1 / -1; }
.result-actions .share-button:not(:disabled) {
  border-color: #a9c3ff85;
  background: #a1bbff29;
}
.result-actions .share-button:not(:disabled):hover { background: #a2beff42; }

.privacy {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .5rem;
  margin: 1.3rem auto 0;
  max-width: 61rem;
  text-align: center;
  font-size: .875rem;
  line-height: 1.5;
  color: #465b79;
}
.privacy .icon-lock { flex: none; align-self: center; }

dialog {
  width: min(100% - 2rem, 29rem);
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: white;
  color: var(--ink);
  box-shadow: 0 1rem 4rem #12224140;
}
dialog::backdrop { background: #0b183bb3; }
.dialog-body { padding: clamp(1.25rem, 4vw, 2rem); }
.dialog-body ol { padding-left: 1.35rem; }
.dialog-body li + li { margin-top: .55rem; }
.dialog-body .generate { margin-top: 1.25rem; }
.dialog-close {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin-top: .65rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
}
.dialog-close:hover { background: #f2f6ff; }
.share-manual { margin-top: 1rem; }
.share-manual label { display: block; margin-bottom: .45rem; font-size: .875rem; font-weight: 650; }
#share-url {
  width: 100%;
  min-height: 2.75rem;
  padding: .5rem .65rem;
  border: 1px solid #c6d3e7;
  border-radius: .65rem;
  background: #f8faff;
  color: var(--ink);
}
.share-status { margin: .6rem 0 0; font-size: .875rem; }
.share-status:empty { margin: 0; }
.qr-body { text-align: center; }
#qr-canvas {
  display: block;
  margin: 0 auto;
  width: min(100%, 15rem);
  height: auto;
  image-rendering: pixelated;
}

.icon {
  position: relative;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: none;
}
.icon::before, .icon::after { content: ""; position: absolute; }
.icon-lock::before {
  width: .45rem; height: .5rem; top: .02rem; left: .275rem;
  box-sizing: border-box; border: 1.5px solid; border-radius: .35rem .35rem 0 0;
}
.icon-lock::after {
  width: .75rem; height: .58rem; left: .125rem; bottom: .02rem;
  box-sizing: border-box; border: 1.5px solid; border-radius: .15rem;
}
.icon-key { transform: rotate(-45deg) scale(1.2); }
.icon-key::before { width: .4rem; height: .4rem; box-sizing: border-box; top: .3rem; right: .01rem; border: 1.5px solid; border-radius: 50%; }
.icon-key::after { width: .55rem; height: .12rem; left: .04rem; top: .44rem; background: currentColor; box-shadow: -.05rem .1rem 0 -.018rem currentColor; }
.icon-eye::before { inset: .18rem .06rem; border: 1.5px solid; border-radius: 65% 35%; transform: rotate(45deg); }
.icon-eye::after { width: .3rem; height: .3rem; left: .35rem; top: .35rem; border-radius: 50%; background: currentColor; }
.visibility[data-shown] .icon-eye::after { width: 1.05rem; height: 1.5px; top: .45rem; left: 0; border-radius: .1rem; transform: rotate(-45deg); box-shadow: 0 -2px #f8faff; }
.icon-copy::before, .icon-copy::after { width: .57rem; height: .67rem; border: 1.4px solid; border-radius: .14rem; }
.icon-copy::before { top: .02rem; right: .035rem; border-left-color: transparent; border-bottom-color: transparent; }
.icon-copy::after { bottom: .01rem; left: .035rem; }
.icon-link { transform: rotate(-45deg); }
.icon-link::before, .icon-link::after {
  top: .32rem;
  width: .42rem;
  height: .36rem;
  box-sizing: border-box;
  border: 1.4px solid;
  border-radius: .24rem;
}
.icon-link::before { left: .04rem; }
.icon-link::after { right: .04rem; }
.icon-link {
  background: linear-gradient(currentColor, currentColor) center / .37rem 1.4px no-repeat;
}
.icon-qr {
  background:
    linear-gradient(currentColor 0 0) .72rem .73rem / .12rem .12rem no-repeat,
    linear-gradient(currentColor 0 0) .86rem .87rem / .12rem .12rem no-repeat;
}
.icon-qr::before {
  top: .06rem; left: .04rem; width: .18rem; height: .18rem; border: 1.4px solid;
  box-shadow: .54rem 0 0 -.084rem, 0 .54rem 0 -.084rem;
}
.icon-qr::after { width: .18rem; height: .18rem; top: .06rem; right: .06rem; border: 1.4px solid; }
.icon-qr { border-bottom: 1px dotted currentColor; }

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

@media (max-width: 46rem) {
  .generator { max-width: 33rem; grid-template-columns: 1fr; }
  .intro { margin-bottom: 1.85rem; }
  .page { padding-inline: 1rem; }
  .header-inner { width: calc(100% - 2rem); min-height: 4rem; }
  .result { padding-block: 1.5rem; }
  .privacy { max-width: 33rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
