.counter-screen {
  --counter-ink: #392020;
  --counter-wine: #691d24;
  --counter-red: #bd202a;
  --counter-border: #dfcfc1;
  --counter-paper: #fffcf5;
  color: var(--counter-ink);
  max-width: 74rem;
  margin-inline: auto;
  padding: clamp(1.1rem, 3.4vw, 3rem) clamp(1rem, 3.25vw, 2.6rem) 4rem;
  font-family: Poppins, Arial, sans-serif;
}
.counter-screen *, .counter-screen *::before, .counter-screen *::after { box-sizing: border-box; }
.counter-screen [hidden] { display: none; }
.counter-heading, .counter-access, .counter-pass-row { display: flex; align-items: center; gap: 1rem; }
.counter-heading { justify-content: space-between; flex-wrap: wrap; margin-block: 0 .95rem; }
.counter-title, .counter-subtitle, .counter-member h2, .counter-points strong {
  color: var(--counter-wine);
  font-family: 'Lilita One', 'Arial Rounded MT Bold', Georgia, serif;
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -.025em;
}
.counter-title { margin: 0; font-size: clamp(2.6rem, 7vw, 4.6rem); }
.counter-subtitle { margin: 0 0 1.1rem; font-size: clamp(1.65rem, 4.2vw, 2.05rem); }
.counter-mode {
  display: inline-flex; align-items: center; border: 1px solid #b6cfbc; border-radius: 5rem;
  background: #edf1dc; color: #28513e; font-size: .875rem; padding: .34rem .8rem; font-weight: 650;
}
.counter-body, .counter-wallet { display: grid; gap: 1.1rem; }
.counter-panel {
  background: var(--counter-paper); color: var(--counter-ink);
  padding: clamp(1.15rem, 2.8vw, 1.8rem); border: 1px solid var(--counter-border); border-radius: 1.2rem; min-width: 0;
}
.counter-gate { max-width: 32rem; }
.counter-note { font-size: 1rem; line-height: 1.5; color: #634e42; margin: 0; }
.counter-feedback {
  background: #edf4e7; color: #224c33; border: 1px solid #bdceb7; padding: .85rem 1rem;
  border-radius: .7rem; font-size: 1rem; line-height: 1.4; margin: 0 0 1rem;
}
.counter-feedback.counter-error { color: #8e1924; border-color: #e4b9b3; background: #fff1ec; }
.counter-form, .counter-field { display: grid; gap: .4rem; margin: 0; }
.counter-form { gap: 1rem; }
.counter-label { font-weight: 650; font-size: .9rem; line-height: 1.4; }
.counter-screen input { 
  display: block; width: 100%; min-width: 0; color: var(--counter-ink); background: white;
  border: 1px solid #bba898; border-radius: .65rem; font: inherit; font-size: 1rem; line-height: 1.4; padding: .72rem .85rem;
}
.counter-screen input::placeholder { color: #786960; opacity: 1; }
.counter-screen :is(button, input):focus-visible { outline: 3px solid #26744c; outline-offset: 3px; }
.counter-screen button { font-family: inherit; cursor: pointer; }
.counter-screen button:disabled { opacity: .64; cursor: wait; }
.counter-screen .counter-primary, .counter-screen .counter-secondary {
  display: inline-flex; justify-content: center; align-items: center; justify-self: start;
  min-height: 2.95rem; border-radius: .7rem; font-size: .95rem; font-weight: 650; line-height: 1.2;
  padding: .72rem 1.1rem; text-align: center; white-space: normal;
}
.counter-screen .counter-primary { color: white; border: 1px solid var(--counter-wine); background: var(--counter-wine); }
.counter-screen .counter-primary:hover { background: #88232a; }
.counter-screen .counter-secondary { background: var(--counter-paper); color: var(--counter-wine); border: 1px solid #bc9189; }
.counter-screen .counter-secondary:hover { background: #fff0df; }
.counter-link {
  border: 0; padding: .45rem 0; color: var(--counter-wine); background: transparent; font-size: .9rem; line-height: 1.35; 
  text-decoration: underline; text-underline-offset: .16em; text-decoration-thickness: 1px; font-weight: 650;
}
.counter-link:hover { color: var(--counter-red); }
.counter-find { display: grid; align-items: center; grid-template-columns: 1fr auto; }
.counter-find .counter-subtitle { margin-bottom: .45rem; }
.counter-switch { justify-self: end; padding-left: .75rem; }
.counter-find .counter-form { grid-column: 1 / -1; grid-template-columns: minmax(0,1fr) auto; align-items: end; margin-top: .6rem; }
.counter-sample { justify-self: start; grid-column: 1 / -1; margin-top: .45rem; }
.counter-member {
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; min-width: 0; 
  padding: clamp(1.15rem, 3vw, 1.8rem); border-radius: 1.2rem; color: #fff5da; background: var(--counter-wine);
}
.counter-member > div { min-width: 0; }
.counter-member-no { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; }
.counter-member h2 { color: inherit; overflow-wrap: anywhere; font-size: clamp(1.8rem, 5vw, 2.7rem); margin: 0; }
.counter-points { display: grid; text-align: right; flex: none; }
.counter-points strong { color: #ffe49b; font-size: clamp(2rem, 5.5vw, 3.25rem); }
.counter-points span { font-size: .9rem; }
.counter-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.1rem; }
.counter-claims { display: grid; gap: .75rem; padding: 0; margin: 0; list-style: none; }
.counter-claims li { display: grid; justify-items: start; gap: .35rem; padding-bottom: .75rem; border-bottom: 1px solid var(--counter-border); }
.counter-claims li:last-child { border: 0; padding-bottom: 0; }
.counter-code { color: #715744; font-family: ui-monospace, monospace; word-break: break-all; }
.counter-pass-row { margin-top: .75rem; align-items: stretch; }
.counter-pass-row input { flex: 1; }
.counter-pass-row button { flex: none; }
.counter-metrics {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 0; gap: 1px; 
  overflow: hidden; background: var(--counter-border); border-radius: 1rem; border: 1px solid var(--counter-border);
}
.counter-metrics div { padding: .85rem 1rem; display: flex; flex-direction: column-reverse; gap: .2rem; background: #fff4db; }
.counter-metrics dt { font-size: .85rem; font-weight: 550; line-height: 1.3; }
.counter-metrics dd { font-size: 1.7rem; color: var(--counter-wine); margin: 0; font-weight: 750; line-height: 1.2; }
@media (max-width: 42rem) {
  .counter-grid { grid-template-columns: 1fr; }
  .counter-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .counter-find { display: block; }
  .counter-switch { padding-left: 0; }
  .counter-find .counter-form { grid-template-columns: 1fr; }
  .counter-find .counter-form .counter-primary { justify-self: stretch; }
}
@media (max-width: 24rem) {
  .counter-pass-row { flex-direction: column; }
}
.counter-enter { margin-top: 1rem; }
.counter-field select {
  width: 100%; max-width: 100%; min-height: 44px; padding: .65rem 2.2rem .65rem .75rem;
  color: var(--counter-ink); background-color: #fff; border: 1px solid var(--counter-border); border-radius: .4rem;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, #715744 50%), linear-gradient(135deg, #715744 50%, transparent 50%);
  background-position: calc(100% - 17px) center, calc(100% - 12px) center; background-size: 5px 5px; background-repeat: no-repeat;
}
.counter-method-preview { color: var(--green); font-size: .9rem; }

.counter-form [hidden] { display: none; }

.counter-heading, .counter-access { min-width: 0; }
.counter-field, .counter-field select, .counter-claims li, .counter-pass-row { min-width: 0; }
.counter-field select { font: inherit; font-size: 1rem; }
.counter-screen :is(input, select, button):focus-visible { outline: 3px solid #26744c; outline-offset: 3px; }
.counter-link { min-height: 44px; }
.counter-metrics dd, .counter-claims strong, .counter-points strong { overflow-wrap: anywhere; }
.counter-metrics div { min-width: 0; }
.counter-keypad-open { grid-column: 1 / -1; margin-top: .8rem; }
.counter-feedback { scroll-margin-top: 1rem; }
.counter-wallet > .counter-feedback, .counter-grid > .counter-feedback { margin: 0; grid-column: 1 / -1; }

.counter-dialog {
  width: min(31rem, calc(100% - 2rem)); max-width: none;
  max-height: calc(100dvh - 2rem); overscroll-behavior: contain;
  color: var(--counter-ink); background: var(--counter-paper); border: 1px solid var(--counter-border);
}
.counter-dialog-content { padding: clamp(1.25rem, 4vw, 2rem); }
.counter-dialog .counter-subtitle { margin: 0; }
.counter-dialog .counter-note { margin: .65rem 0 1.25rem; }
.counter-dialog-error { color: #8e1924; font-size: 1rem; font-weight: 600; margin: 0; }
.counter-dialog-error:empty { display: none; }
.counter-dialog-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.counter-dialog-actions > * { flex: 1 1 7.5rem; }
.counter-review-list { margin: 1.1rem 0 1.2rem; }
.counter-review-list > div {
  display: grid; grid-template-columns: minmax(5.4rem, .75fr) minmax(0, 1.25fr);
  align-items: baseline; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--counter-border);
}
.counter-review-list dt { color: #705a4d; font-size: .9rem; }
.counter-review-list dd { margin: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.counter-review-list > div:last-child dd { color: var(--counter-wine); }
.counter-pin input { letter-spacing: .25em; }
.counter-dialog .counter-form .counter-note { margin: 0; }

.counter-keypad-dialog {
  width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0;
  background: #fbf7ed; box-shadow: none;
}
.counter-keypad-dialog::backdrop { background: #fbf7ed; }
.counter-keypad-dialog .counter-dialog-content {
  max-width: 29rem; margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}
.counter-keypad-logo { display: block; width: 5.5rem; height: 3.2rem; object-fit: contain; object-position: left; margin-bottom: 1rem; }
.counter-keypad-dialog .counter-subtitle { max-width: 24rem; font-size: clamp(2rem, 6vw, 3rem); }
.counter-keypad-dialog .counter-form { gap: .75rem; }
.counter-phone-display input {
  font: 600 clamp(1.15rem, 4.8vw, 1.5rem)/1.2 Poppins, Arial, sans-serif;
  font-variant-numeric: tabular-nums; min-height: 3.2rem;
}
.counter-digits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.counter-digit {
  min-height: 3.05rem; border: 1px solid var(--counter-border); border-radius: .65rem; background: #fffdf8;
  color: var(--counter-wine); font-size: 1.25rem; line-height: 1; font-weight: 650; touch-action: manipulation;
}
.counter-digit:active { background: #f0d8c3; }
.counter-keypad-dialog .counter-primary { width: 100%; }
.counter-keypad-dialog .counter-link { margin-top: .4rem; }
.counter-handback { display: grid; gap: .4rem; }
.counter-keypad-dialog .counter-dialog-error:not(:empty) { margin-top: .75rem; }
@media (max-width: 42rem) {
  .counter-screen { padding-top: .75rem; }
  .counter-panel { padding: 1rem; }
  .counter-heading { gap: .6rem; }
  .counter-access { flex-wrap: wrap; gap: .5rem; }
  .counter-find .counter-switch { justify-content: flex-start; margin: 0; }
  .counter-find .counter-form { margin-top: .55rem; }
  .counter-screen .counter-keypad-open, .counter-screen .counter-form > .counter-primary { width: 100%; }
  .counter-points { flex: 0 1 auto; }
  .counter-wallet, .counter-grid, .counter-body { gap: .9rem; }
}
@media (orientation: landscape) and (max-height: 32rem) and (min-width: 34rem) {
  .counter-keypad-dialog .counter-dialog-content { max-width: 52rem; padding-block: .75rem; }
  .counter-keypad-logo { width: 3.8rem; height: 2.1rem; margin-bottom: .4rem; }
  .counter-keypad-dialog .counter-subtitle { max-width: none; font-size: 1.75rem; }
  .counter-keypad-dialog .counter-note { margin: .25rem 0 .7rem; }
  .counter-keypad-dialog .counter-form { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .7rem 1.4rem; align-items: start; }
  .counter-keypad-dialog .counter-digits { grid-column: 2; grid-row: 1 / 4; }
  .counter-keypad-dialog .counter-form > .counter-primary { grid-column: 1; }
  .counter-digit { min-height: 44px; }
}
