
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--ui-radius-sm);
  font: 500 14px/1 var(--ui-font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  --b: var(--ui-accent); --bf: var(--ui-accent-fg); --bs: var(--ui-accent-soft);
}
.ui-btn:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.ui-btn[disabled], .ui-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.ui-btn-neutral { --b: var(--ui-fg); --bf: var(--ui-bg); --bs: var(--ui-subtle); }
.ui-btn-danger { --b: var(--ui-danger); --bf: #fff; --bs: var(--ui-danger-soft); }
.ui-btn-solid { background: var(--b); color: var(--bf); }
.ui-btn-solid:hover { background: color-mix(in srgb, var(--b) 88%, var(--ui-fg)); }
.ui-btn-soft { background: var(--bs); color: var(--b); }
.ui-btn-soft:hover { background: color-mix(in srgb, var(--bs) 80%, var(--b)); }
.ui-btn-outline { background: transparent; color: var(--b); border-color: var(--ui-border); }
.ui-btn-outline:hover { border-color: var(--b); background: var(--bs); }
.ui-btn-ghost { background: transparent; color: var(--b); }
.ui-btn-ghost:hover { background: var(--bs); }
.ui-btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.ui-btn-lg { height: 46px; padding: 0 22px; font-size: 16px; }
.ui-btn-full { display: flex; width: 100%; }
.ui-btn-spin { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ui-btn-spin .7s linear infinite; }
@keyframes ui-btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ui-btn-spin { animation-duration: 2s; } }


.ui-pinstep-host { display: contents; }
.ui-pinstep {
  box-sizing: border-box; inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: max(10px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom)); border: 0;
  overflow: hidden; background: var(--ui-bg); color: var(--ui-fg); font: 15px/1.4 var(--ui-font); overscroll-behavior: contain;
}
.ui-pinstep[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; }
.ui-pinstep::backdrop { background: var(--ui-overlay); }
html:has(.ui-pinstep[open]) { overflow: hidden; }
.ui-pinstep-top { display: grid; align-content: start; gap: 6px; min-height: 0; }
.ui-pinstep-top h2 { margin: 0; font-size: 19px; line-height: 1.25; text-align: center; outline: none; }
.ui-pinstep-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; padding: 8px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.ui-pinstep-facts dt { color: var(--ui-muted); }
.ui-pinstep-facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ui-pinstep-warn { margin: 0; color: var(--ui-warning); font-size: 13px; text-align: center; }
.ui-pinstep-mid { display: grid; align-content: center; justify-items: center; gap: 8px; min-height: 0; }
.ui-pinstep-dots { display: flex; gap: 12px; padding: 6px; }
.ui-pinstep-dots i { width: 14px; height: 14px; border: 2px solid var(--ui-strong); border-radius: 50%; }
.ui-pinstep-dots i.ui-pinstep-dot-on { border-color: var(--ui-accent); background: var(--ui-accent); }
.ui-pinstep-wrong .ui-pinstep-dots { animation: ui-pinstep-shake .3s; }
@keyframes ui-pinstep-shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.ui-pinstep-said { min-height: 20px; margin: 0; color: var(--ui-muted); font-size: 14px; text-align: center; }
.ui-pinstep-bad { color: var(--ui-danger); font-weight: 600; }
.ui-pinstep-clock { margin: 0; color: var(--ui-muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }
.ui-pinstep-low { color: var(--ui-warning); font-weight: 600; }
.ui-pinstep-end { display: grid; justify-items: center; gap: 10px; text-align: center; }
.ui-pinstep-end h3 { margin: 0; font-size: 19px; }
.ui-pinstep-end p { margin: 0; color: var(--ui-muted); }
.ui-pinstep-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 96px)); justify-content: center; gap: 8px 14px; margin: 0 auto; width: 100%; }
.ui-pinstep-pad[hidden] { display: none; }
.ui-pinstep-key {
  height: clamp(44px, 9.5dvh, 68px); padding: 0; border: 1px solid var(--ui-border); border-radius: 999px; background: var(--ui-surface); color: var(--ui-fg); font: 600 24px/1 var(--ui-font); font-variant-numeric: tabular-nums;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ui-pinstep-key:active { background: var(--ui-accent-soft); }
.ui-pinstep-key:disabled { opacity: .4; cursor: default; }
.ui-pinstep-key:focus-visible { outline: none; box-shadow: var(--ui-focus); }
.ui-pinstep-del { border-color: transparent; background: transparent; }
.ui-pinstep-foot { display: flex; justify-content: center; }
/* Sideways on a phone there is no height for a pad under the rest: they stand side by side. */
@media (orientation: landscape) and (max-height: 520px) {
  .ui-pinstep[open] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; column-gap: 16px; }
  .ui-pinstep-top { overflow-y: auto; }
  .ui-pinstep-mid { grid-column: 1; grid-row: 2; }
  .ui-pinstep-pad { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .ui-pinstep-key { height: clamp(44px, 20dvh, 56px); }
  .ui-pinstep-foot { grid-column: 1; }
}
/* A tablet's screen is not filled: it is a dialog in the middle. */
@media (min-width: 600px) and (min-height: 600px) {
  .ui-pinstep { inset: 0; width: min(440px, 92vw); height: auto; max-height: min(92dvh, 760px); margin: auto; padding: 22px 26px; border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 6px); box-shadow: var(--ui-shadow-lg); }
  .ui-pinstep[open] { grid-template-rows: auto auto auto; gap: 14px; }
}
@media (hover: hover) { .ui-pinstep-key:hover:not(:disabled) { background: var(--ui-subtle); } }
@media (prefers-reduced-motion: reduce) { .ui-pinstep-wrong .ui-pinstep-dots { animation: none; } }

