/* The OTP website shell: one centred column and, at the bottom, a floating bar with the four places (OTP, Numbers, Records, Account). Everything else (cards,
   buttons, inputs, the sign-in screen) is the shared stylesheet. */
.site { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.site-main { width: 100%; max-width: 860px; margin: 0 auto; padding: 22px 16px calc(112px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }
.site-page { display: flex; flex-direction: column; gap: 16px; }
.site-page[hidden] { display: none; }
.site-title { margin: 0; font-size: 1.6rem; letter-spacing: .02em; }
.logo-tile { display: inline-grid; place-items: center; flex: none; background: var(--brand-grad); color: #fff; } /* the official mark: the gradient tile with the white bubbles */
@media (min-width: 1024px) {
  .site-main { max-width: 980px; padding-top: 32px; }
}

/* Switching to English changes only the words: the frame stays as it is (the bar, cards, buttons, icons). Each piece of text reads in its own direction. */
html[lang="en"] :is(p, h1, h2, h3, h4, label, button, span, div, a) { unicode-bidi: plaintext; }
html[lang="en"] :is(p, .muted, .dialog-text, .setrow-t, .field-label) { text-align: right; }
/* What is typed in a box (and its hint) starts at the left in English, so a long hint is never cut at its beginning; the box itself stays where it is. */
html[lang="en"] :is(input, textarea) { direction: ltr; text-align: left; }

/* Account: the picture in a gradient ring, the name and the email. */
.acct-card { display: flex; align-items: center; gap: 16px; min-width: 0; }
.acct-ring { flex: none; display: inline-grid; padding: 3px; border-radius: 50%; background: var(--brand-grad); box-shadow: 0 16px 36px -14px rgba(240, 80, 159, .65); }
.acct-ring .avatar { border: 3px solid var(--bg); }
.acct-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-name { font-weight: 800; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-mail { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The way around the site: one round gradient button with the logo at the bottom in the middle. It opens the four places as a fan of circles above it, over a soft dark
   veil. The open place has the gradient. A dot on a place (in the open fan) says something there needs a look; the button itself carries only the logo, with a light shadow. */
.dock { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.dock-scrim { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .2s; background: radial-gradient(120% 70% at 50% 100%, rgba(122, 86, 255, .3), rgba(6, 6, 12, .9) 65%); }
.dock.is-open .dock-scrim { opacity: 1; pointer-events: auto; }
.dock-main { position: absolute; z-index: 2; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 60px; height: 60px; margin-left: -30px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--brand-grad); cursor: pointer; pointer-events: auto;
  box-shadow: 0 6px 12px -4px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06), inset 0 1.5px 0 rgba(255, 255, 255, .38), inset 0 -6px 10px rgba(90, 10, 100, .22); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.dock-main:active { transform: scale(.9); }
.dock-main-ic { display: grid; place-items: center; }
.dock-fan { position: absolute; z-index: 1; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px) + 30px); width: 0; height: 0; }
.dock-place { position: absolute; left: -26px; top: -26px; width: 52px; padding: 0; border: 0; background: none; color: #dcdce9; font: inherit; visibility: hidden; pointer-events: none; }
.dock.is-open .dock-place { visibility: visible; pointer-events: auto; }
.dock.is-leaving .dock-place { visibility: visible; }
.dock-circle { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #181826; border: 1px solid #36365a; box-shadow: 0 16px 24px -10px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .09); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.dock-place:active .dock-circle { transform: scale(.9); }
.dock-circle svg { stroke-width: 1.8; }
.dock-place.is-current .dock-circle { color: #fff; background: var(--brand-grad); border-color: transparent; box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .5), inset 0 1.5px 0 rgba(255, 255, 255, .38); }
.dock-circle svg { transform-origin: center; }
.dock-lb { position: absolute; top: 58px; left: 50%; width: 88px; margin-left: -44px; text-align: center; font-size: .76rem; font-weight: 700; line-height: 1.2; color: #ececf8; text-shadow: 0 2px 10px rgba(0, 0, 0, .9); }
.dock-place.is-current .dock-lb { color: #fff; font-weight: 800; }
.dock-dot { position: absolute; top: -2px; inset-inline-end: -2px; width: 12px; height: 12px; border-radius: 50%; background: #ff3b6b; box-shadow: 0 0 0 2px #181826; }
.toasts { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
.otp-empty .btn { align-self: flex-start; }

/* A number's card and its QR picture. A card that was just added glows for a moment; the QR sits in a frame with the brand's gradient edge. */
.otp-sender { transform-origin: 50% 0; }
.otp-sender.is-new { animation: otp-glow 1.8s ease-out; }
@keyframes otp-glow {
  from { box-shadow: 0 0 0 6px rgba(240, 80, 159, .38), 0 34px 70px -18px rgba(122, 86, 255, .65); border-color: #f0509f; }
  to { box-shadow: 0 0 0 0 rgba(240, 80, 159, 0), 0 0 0 0 rgba(122, 86, 255, 0); }
}
.copyrow.otp-add .btn { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background .15s, border-color .15s; }
.copyrow.otp-add .btn:active { transform: scale(.94); }

.qr-frame { position: relative; width: min(264px, 100%); aspect-ratio: 1; padding: 3px; border-radius: 24px; background: var(--brand-grad); box-shadow: 0 22px 50px -22px rgba(240, 80, 159, .6), 0 0 0 1px rgba(255, 255, 255, .05); }
.qr-tile { position: relative; width: 100%; height: 100%; padding: 10px; border-radius: 21px; background: #fff; overflow: hidden; }
.qr-img { display: block; width: 100%; height: 100%; border-radius: 12px; }

/* While the code is being made: a sketch of a QR (three corner marks and dots) with a light passing over it. */
.qr-sketch { position: absolute; inset: 10px; border-radius: 12px; overflow: hidden; background: radial-gradient(circle, #d8d8e8 36%, transparent 40%) 0 0 / 12px 12px; }
.qr-sketch::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .95) 50%, transparent 70%) 0 0 / 260% 100%; animation: qr-shimmer 1.7s linear infinite; }
@keyframes qr-shimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.qr-f { position: absolute; width: 24%; aspect-ratio: 1; border: 6px solid #d2d2e2; border-radius: 7px; background: linear-gradient(#d2d2e2, #d2d2e2) center / 46% 46% no-repeat, #fff; }
.qr-f.a { top: 0; left: 0; }
.qr-f.b { top: 0; right: 0; }
.qr-f.c { bottom: 0; left: 0; }

/* The scan line: it leads the picture as it is drawn, then keeps sweeping slowly while the code waits to be scanned. */
.qr-scan { position: absolute; inset-inline: 10px; top: 10px; height: 3px; border-radius: 3px; background: var(--brand-grad); box-shadow: 0 0 16px 2px rgba(240, 80, 159, .7); opacity: 0; pointer-events: none; }
.qr-scan.loop { opacity: .85; animation: qr-sweep 2.8s cubic-bezier(.45, .05, .55, .95) infinite alternate; }
@keyframes qr-sweep { from { top: 10px; } to { top: calc(100% - 13px); } }

/* The mark in the middle: small enough (about a twentieth of the picture) that the code still reads, because the code is made with a high error correction. */
.qr-mark { position: absolute; inset: 0; margin: auto; width: 15%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 26%; background: var(--brand-grad); color: #fff; box-shadow: 0 0 0 4px #fff, 0 8px 18px rgba(122, 86, 255, .35); }
.qr-mark svg { width: 66%; height: 66%; }
.qr-frame.is-waiting .qr-mark { animation: qr-breathe 2.2s ease-in-out infinite; }
@keyframes qr-breathe { 50% { transform: scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
  .otp-sender.is-new, .qr-sketch::after, .qr-scan.loop, .qr-frame.is-waiting .qr-mark { animation: none; }
}

/* The API key: the list of keys, and the card that shows a new key once. */
.key-reveal { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.key-badge { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--brand-grad); box-shadow: 0 16px 34px -10px rgba(240, 80, 159, .75), 0 0 0 7px rgba(240, 80, 159, .14); }
.key-card { width: 100%; padding: 2px; border-radius: 18px; background: var(--brand-grad); box-shadow: 0 22px 50px -24px rgba(240, 80, 159, .6); }
.key-card-in { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.key-text { direction: ltr; text-align: left; padding: 12px 14px; border-radius: 12px; background: #080810; border: 1px dashed var(--line-3); color: var(--fg); font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.7; letter-spacing: .03em; word-break: break-all; user-select: all; min-height: 3.2em; }
.key-card .btn.is-done { background: #fff; color: #0a0a12; border-color: #fff; }
@media (prefers-reduced-motion: reduce) { .otp-key.is-new { animation: none; } }

.api-host:empty { display: none; }

/* Settings is small on purpose: slim cards, a one-piece field to make a key, and one short row for each key. */
.site-page.is-compact { gap: 12px; }
.site-page.is-compact .card-head { padding: 14px 16px 0; gap: 10px; }
.site-page.is-compact .card-title { font-size: 1rem; gap: 10px; }
.site-page.is-compact .ci { width: 32px; height: 32px; border-radius: 10px; }
.site-page.is-compact .card-body { padding: 14px 16px; }
.site-page.is-compact .card-head + .card-body { padding-top: 12px; }
.site-page.is-compact .seg { padding: 3px; border-radius: 11px; }
.site-page.is-compact .seg-item { padding: 4px 12px; font-size: .85rem; }
.site-page.is-compact .btn-block { height: 44px; }
.acct-card { gap: 12px; }
.acct-ring { padding: 2px; box-shadow: 0 10px 24px -12px rgba(240, 80, 159, .65); }
.acct-ring .avatar { border-width: 2px; }
.acct-name { font-size: 1rem; }
.acct-mail { font-size: .84rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row-t { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.set-row-t svg { color: var(--muted); }

.key-make { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); transition: border-color .15s; }
.key-make:focus-within { border-color: var(--brand-text); }
.key-make .input { flex: 1; min-width: 0; height: 36px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; font-size: .9rem; }
.key-make .btn { flex: none; height: 36px; padding: 0 14px; border-radius: 10px; font-size: .85rem; }

.otp-key { display: flex; align-items: center; gap: 10px; padding: 9px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.otp-key:first-child { border-top: 0; padding-top: 2px; }
.otp-key.is-revoked { opacity: .5; }
.otp-key.is-new { animation: otp-flash 1.8s ease-out; }
@keyframes otp-flash { from { background: rgba(240, 80, 159, .16); } to { background: rgba(240, 80, 159, 0); } }
.otp-key-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--brand-text); background: var(--surface-3); }
.otp-key-main { flex: 1; min-width: 0; }
.otp-key-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.otp-key-name { font-size: .92rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otp-key-prefix { flex: none; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; letter-spacing: 0; color: var(--muted); }
.otp-key-sub { font-size: .76rem; color: var(--muted); line-height: 1.4; }
.otp-key .btn-icon { flex: none; color: var(--muted); }
.otp-key .btn-icon:hover { color: #ff6b8a; }
