/* Shared pieces, step 5U.1: glass panels with cut corners, buttons, badges, fields, switches, toasts, modals, keypad.
   Every tap target is at least 48 px. Pressed look = :active (no hover effects on a phone). */

/* ---- Panels: black glass, thin glowing outline, two cut corners ---- */
.panel {
  --ea: rgba(var(--cyan-rgb), 0.22);
  --eb: rgba(var(--cyan-rgb), 0.85);
  position: relative;
  isolation: isolate;
  padding: 14px;
  margin-bottom: var(--gap);
  background: linear-gradient(115deg, var(--ea), var(--eb) 45%, var(--ea) 90%);
  background-size: 300% 100%;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.panel::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  background: radial-gradient(130% 90% at 0% 0%, rgba(var(--cyan-rgb), 0.09), transparent 60%), var(--glass);
  box-shadow: inset 0 0 26px rgba(var(--cyan-rgb), 0.07);
  clip-path: polygon(calc(var(--cut) - 0.6px) 0, 100% 0, 100% calc(100% - var(--cut) + 0.6px), calc(100% - var(--cut) + 0.6px) 100%, 0 100%, 0 calc(var(--cut) - 0.6px));
}

.panel--green {
  --ea: rgba(var(--green-rgb), 0.2);
  --eb: rgba(var(--green-rgb), 0.85);
}

.panel--green::before {
  background: radial-gradient(130% 90% at 0% 0%, rgba(var(--green-rgb), 0.09), transparent 60%), var(--glass);
  box-shadow: inset 0 0 26px rgba(var(--green-rgb), 0.07);
}

.panel--red {
  --ea: rgba(var(--red-rgb), 0.25);
  --eb: rgba(var(--red-rgb), 0.9);
}

.panel--red::before {
  background: radial-gradient(130% 90% at 0% 0%, rgba(var(--red-rgb), 0.1), transparent 60%), var(--glass);
  box-shadow: inset 0 0 26px rgba(var(--red-rgb), 0.08);
}

.panel--orange {
  --ea: rgba(var(--orange-rgb), 0.25);
  --eb: rgba(var(--orange-rgb), 0.9);
}

.panel--orange::before {
  background: radial-gradient(130% 90% at 0% 0%, rgba(var(--orange-rgb), 0.1), transparent 60%), var(--glass);
  box-shadow: inset 0 0 26px rgba(var(--orange-rgb), 0.08);
}

/* A slowly moving glowing border, used on a few hero panels only (light on the phone). */
.glow {
  animation: edge-run 10s linear infinite;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel__head--plain {
  margin: 4px 2px 10px;
}

.h2 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.45);
  margin-bottom: 10px;
}

.panel__head .h2,
.panel__head--plain .h2 {
  margin-bottom: 0;
}

.h2--center {
  text-align: center;
}

.h3 {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--mute);
  margin: 14px 0 8px;
}

.label {
  display: block;
  font-family: var(--font-title);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--mute);
  margin-bottom: 6px;
}

.logo {
  font-family: var(--font-title);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(var(--cyan-rgb), 0.9), 0 0 22px rgba(var(--cyan-rgb), 0.55);
  white-space: nowrap;
}

.logo--sm {
  font-size: 14px;
}

.logo--xl {
  font-size: 25px;
  text-align: center;
}

/* ---- Buttons: dark glass with a colored outline and two cut corners ---- */
.btn {
  --c: var(--cyan-rgb);
  position: relative;
  isolation: isolate;
  min-height: 52px;
  min-width: 48px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(var(--c));
  background: rgba(var(--c), 0.9);
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(var(--c), 0.14), rgba(var(--c), 0.05)), var(--glass);
  clip-path: polygon(8.4px 0, 100% 0, 100% calc(100% - 8.4px), calc(100% - 8.4px) 100%, 0 100%, 0 8.4px);
  transition: background 0.15s;
}

.btn--green {
  --c: var(--green-rgb);
}

.btn--red {
  --c: var(--red-rgb);
}

.btn--orange {
  --c: var(--orange-rgb);
}

.btn--ghost {
  --c: var(--cyan-rgb);
  background: rgba(var(--c), 0.45);
}

.btn:active:not(:disabled)::before,
.btn.is-pressed::before {
  background: linear-gradient(rgba(var(--c), 0.3), rgba(var(--c), 0.3)), var(--glass);
}

.btn:active:not(:disabled) {
  transform: scale(0.975);
}

.btn:focus-visible {
  outline: none;
  filter: drop-shadow(0 0 6px rgba(var(--c), 0.9));
}

.btn__in {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
}

.btn__in > .icon {
  margin-bottom: 1px;
}

.btn__label {
  text-shadow: 0 0 8px rgba(var(--c), 0.5);
}

.btn__sub {
  font-family: var(--font-num);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--mute);
}

.btn__why {
  font-family: var(--font-num);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
}

.btn__why[hidden] {
  display: none;
}

.btn--wide {
  width: 100%;
  margin-top: 10px;
}

.btn--block {
  width: 100%;
}

.btn--chip {
  min-height: 48px;
  padding: 6px 12px;
  font-size: 11px;
}

.btn--quick .btn__label {
  font-size: 13.5px;
}

.btn--quick.is-selected {
  filter: drop-shadow(0 0 7px rgba(var(--c), 0.8));
}

.btn--quick.is-selected::before {
  background: linear-gradient(rgba(var(--c), 0.32), rgba(var(--c), 0.32)), var(--glass);
}

.btn--pct {
  min-height: 48px;
  padding: 6px 4px;
}

.btn:disabled,
.btn.is-disabled {
  --c: 110, 140, 148;
  opacity: 0.5;
  filter: none;
}

.btn.is-disabled .btn__why {
  opacity: 1;
}

/* loading / success / error */
.btn__spin,
.btn__mark {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.btn__spin::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(var(--c), 0.25);
  border-top-color: rgb(var(--c));
  animation: spin 0.8s linear infinite;
}

.btn.is-loading .btn__in,
.btn.is-success .btn__in,
.btn.is-error .btn__in {
  visibility: hidden;
}

.btn.is-loading .btn__spin {
  display: flex;
}

.btn.is-success {
  --c: var(--green-rgb);
}

.btn.is-success .btn__mark--ok {
  display: flex;
  color: var(--green);
}

.btn.is-error {
  --c: var(--red-rgb);
  animation: shake 0.45s;
}

.btn.is-error .btn__mark--bad {
  display: flex;
  color: var(--red);
}

.btn.is-loading:disabled,
.btn.is-success:disabled,
.btn.is-error:disabled {
  opacity: 1;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.grid2 > .panel,
.grid2 > .btn {
  margin-bottom: 0;
}

.grid2 > .btn--wide {
  grid-column: 1 / -1;
  margin-top: 0;
}

/* ---- Badges, orb, pulse ---- */
.badge {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.2em;
  padding: 7px 14px 7px 18px;
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--cyan);
  border: 1px solid rgba(var(--cyan-rgb), 0.8);
  background: rgba(var(--cyan-rgb), 0.12);
  text-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.8);
  box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.25), inset 0 0 12px rgba(var(--cyan-rgb), 0.12);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

.badge--live {
  color: var(--red);
  border-color: rgba(var(--red-rgb), 0.9);
  background: rgba(var(--red-rgb), 0.16);
  text-shadow: 0 0 10px rgba(var(--red-rgb), 0.9);
  box-shadow: 0 0 14px rgba(var(--red-rgb), 0.35);
}

.badge--sm {
  font-size: 11px;
  min-height: 28px;
  padding: 4px 10px 4px 14px;
}

.orb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  background: var(--green);
  box-shadow: 0 0 10px var(--green), 0 0 22px rgba(var(--green-rgb), 0.6);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.orb--off {
  background: var(--red);
  box-shadow: 0 0 10px var(--red), 0 0 22px rgba(var(--red-rgb), 0.55);
  animation: none;
}

.orb--wait {
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange), 0 0 22px rgba(var(--orange-rgb), 0.55);
}

.orb--lg {
  width: 54px;
  height: 54px;
  box-shadow: 0 0 18px var(--green), 0 0 50px rgba(var(--green-rgb), 0.55), inset 0 0 14px rgba(255, 255, 255, 0.4);
  background: radial-gradient(circle at 35% 30%, #d6ffd0, var(--green) 45%, #0f6b0a);
}

.orb--lg.orb--off {
  background: radial-gradient(circle at 35% 30%, #ffc9d3, var(--red) 45%, #6b0a1d);
  box-shadow: 0 0 18px var(--red), 0 0 50px rgba(var(--red-rgb), 0.5), inset 0 0 14px rgba(255, 255, 255, 0.3);
}

.orb--lg.orb--wait {
  background: radial-gradient(circle at 35% 30%, #ffe2b8, var(--orange) 45%, #7a4300);
  box-shadow: 0 0 18px var(--orange), 0 0 50px rgba(var(--orange-rgb), 0.5), inset 0 0 14px rgba(255, 255, 255, 0.3);
}

.pulse {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}

.pulse i {
  width: 3px;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  transform-origin: bottom;
  animation: eq 1.2s ease-in-out infinite;
}

.pulse i:nth-child(2) {
  animation-delay: 0.2s;
}

.pulse i:nth-child(3) {
  animation-delay: 0.45s;
}

.pulse i:nth-child(4) {
  animation-delay: 0.1s;
}

.pulse i:nth-child(5) {
  animation-delay: 0.35s;
}

/* ---- Fields, segmented buttons, switches, chips ---- */
.field {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(var(--cyan-rgb), 0.4);
  border-radius: 2px;
  font-size: 16px; /* 16 px stops the phone zooming in when a field is tapped */
  outline: none;
}

.field:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 14px rgba(var(--cyan-rgb), 0.35);
}

.field:disabled {
  opacity: 0.45;
}

.field--mono {
  font-family: var(--font-mono);
  font-size: 15px;
}

.field--small {
  text-align: center;
}

.field::placeholder {
  color: var(--dim);
}

.field-msg {
  min-height: 1.4em;
  margin: 6px 2px 4px;
  font-size: 12.5px;
  color: var(--mute);
}

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

.seg {
  display: flex;
  border: 1px solid rgba(var(--cyan-rgb), 0.45);
  background: rgba(0, 0, 0, 0.4);
}

.seg__btn {
  flex: 1;
  min-height: 48px;
  padding: 6px 4px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mute);
  transition: background 0.15s, color 0.15s;
}

.seg__btn + .seg__btn {
  border-left: 1px solid rgba(var(--cyan-rgb), 0.25);
}

.seg__btn.is-on {
  color: var(--bg);
  background: var(--cyan);
  text-shadow: none;
  box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.5);
}

.seg__btn:active {
  background: rgba(var(--cyan-rgb), 0.3);
}

.seg--big {
  margin-bottom: var(--gap);
}

.seg--big .seg__btn {
  font-size: 13px;
  letter-spacing: 0.2em;
}

.seg--five,
.seg--three {
  margin-bottom: var(--gap);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  border-top: 1px solid rgba(var(--cyan-rgb), 0.14);
}

.switch-row:first-of-type {
  border-top: 0;
}

.switch-row__label {
  font-weight: 600;
}

.switch-row__sub {
  font-size: 12px;
  color: var(--mute);
}

.switch {
  position: relative;
  flex: none;
  width: 68px;
  height: 48px;
  background: none;
}

.switch::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 10px;
  bottom: 10px;
  border-radius: 14px;
  border: 1px solid rgba(var(--cyan-rgb), 0.5);
  background: rgba(0, 0, 0, 0.5);
}

.switch__knob {
  position: absolute;
  top: 13px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.switch.is-on::before {
  border-color: var(--green);
  background: rgba(var(--green-rgb), 0.15);
}

.switch.is-on .switch__knob {
  transform: translateX(30px);
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.switch.is-wait .switch__knob {
  transform: translateX(15px);
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange);
}

.switch.is-wait::before {
  border-color: var(--orange);
}

.switch.is-loading {
  opacity: 0.6;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chip {
  padding: 8px 12px;
  border: 1px solid rgba(var(--cyan-rgb), 0.45);
  font-size: 13px;
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.08);
}

.chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip-row .btn {
  flex: 1;
  min-width: 90px;
}

.chip-row__label {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mute);
  width: 100%;
}

/* ---- Lines (label / value pairs) ---- */
.lines {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  font-size: 14px;
}

.lines dt {
  color: var(--mute);
}

.lines dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---- Toasts ---- */
.toasts {
  position: fixed;
  z-index: 200;
  left: 50%;
  top: calc(var(--banner-h) + 8px);
  width: min(92vw, 440px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  --c: var(--cyan-rgb);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(5, 12, 14, 0.96);
  border: 1px solid rgba(var(--c), 0.8);
  border-left-width: 4px;
  box-shadow: 0 0 18px rgba(var(--c), 0.35);
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
  transition: opacity 0.22s, transform 0.22s;
}

.toast .icon {
  color: rgb(var(--c));
}

.toast--ok {
  --c: var(--green-rgb);
}

.toast--bad {
  --c: var(--red-rgb);
}

.toast--warn {
  --c: var(--orange-rgb);
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast.is-out {
  opacity: 0;
  transform: translateY(-10px);
}

/* ---- Modal bottom sheet ---- */
.modal-root {
  position: relative;
  z-index: 100;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 4, 6, 0.74);
  opacity: 0;
  transition: opacity 0.22s;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - var(--banner-h) - 8px);
  overflow-y: auto;
  margin: 0;
  padding: 14px 14px calc(16px + var(--sa-b));
  transform: translateY(40px);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut));
}

.modal::before {
  clip-path: polygon(calc(var(--cut) - 0.6px) 0, 100% 0, 100% 100%, 0 100%, 0 calc(var(--cut) - 0.6px));
}

.modal-backdrop.is-open .modal {
  transform: none;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal__title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.modal__x {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -8px -8px -8px 0;
  color: var(--mute);
}

.modal__x[hidden] {
  display: none;
}

.modal__lead {
  color: var(--mute);
  font-size: 13.5px;
  margin-bottom: 12px;
}

.modal__note {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--orange);
  background: rgba(var(--orange-rgb), 0.08);
  border-left: 3px solid var(--orange);
}

.modal__body.is-swap {
  animation: screen-in 0.22s ease-out;
}

.demo-note {
  margin-top: 12px;
  font-size: 11.5px;
  text-align: center;
  color: var(--orange);
  letter-spacing: 0.02em;
}

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.result > .btn {
  width: 100%;
}

.result__mark {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.result__mark .icon {
  width: 40px;
  height: 40px;
  stroke-width: 2;
}

.result__mark--ok {
  color: var(--green);
  border: 2px solid var(--green);
  box-shadow: 0 0 22px rgba(var(--green-rgb), 0.55);
}

.result__mark--bad {
  color: var(--red);
  border: 2px solid var(--red);
  box-shadow: 0 0 22px rgba(var(--red-rgb), 0.55);
}

.result__text {
  text-align: center;
  font-size: 15px;
}

.spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(var(--cyan-rgb), 0.2);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
  margin: 10px 0;
}

/* ---- The tap keypad: square keys, thin cyan outline, dots in a bracket frame. No "show PIN". ---- */
.keypad-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-caption {
  font-family: var(--font-title);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--mute);
  text-align: center;
  margin-bottom: 10px;
}

.pin-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 4px;
}

.pin-bracket {
  font-family: var(--font-mono);
  font-size: 34px;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.7);
}

.pin-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 118px;
  min-height: 30px;
}

.pin-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.pin-caret {
  width: 2px;
  height: 20px;
  background: var(--cyan);
  animation: blink 1s steps(1) infinite;
}

.pin-frame.is-shake {
  animation: shake 0.5s;
}

.pin-frame.is-shake .pin-dots,
.pin-frame.is-shake .pin-bracket {
  color: var(--red);
}

.pin-status {
  min-height: 20px;
  margin-bottom: 8px;
  font-size: 13px;
  text-align: center;
  color: var(--mute);
}

.pin-status--bad {
  color: var(--red);
}

.pin-status--warn {
  color: var(--orange);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(100%, 320px);
}

.key {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 22px;
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.05);
  border: 1px solid rgba(var(--cyan-rgb), 0.6);
  border-radius: 2px;
  text-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.5);
  user-select: none;
  -webkit-user-select: none;
}

.key:active:not(:disabled) {
  background: rgba(var(--cyan-rgb), 0.28);
  transform: scale(0.96);
}

.key:disabled {
  opacity: 0.35;
}

.key--del {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--orange);
  border-color: rgba(var(--orange-rgb), 0.6);
}

.key--ok {
  color: var(--green);
  border-color: rgba(var(--green-rgb), 0.7);
  background: rgba(var(--green-rgb), 0.07);
}

.key--ok .icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.2;
}
