@font-face {
  font-family: Onest;
  src: url(fonts/onest.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #ececea;
  --surface: #f9f9f7;
  --surface-hover: #fff;
  --tonal: #e7e7e3;
  --tonal-hover: #ddddd8;
  --text: #21211f;
  --muted: #565652;
  --line: #d7d7d2;
  --primary: #272725;
  --on-primary: #fcfcfa;
  --focus: #5b5475;
  --error: #a22927;
  --outer: 28px;
  --inner: 8px;
  --gap: 4px;
  --ease: cubic-bezier(.2,.75,.25,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171716;
    --surface: #242423;
    --surface-hover: #2c2c2b;
    --tonal: #343432;
    --tonal-hover: #42423f;
    --text: #f4f4ee;
    --muted: #bebeb7;
    --line: #3d3d39;
    --primary: #e9e9e2;
    --on-primary: #262624;
    --focus: #c6b9f5;
    --error: #ffb9b5;
  }
}

* { box-sizing: border-box; }

.card-checkout {
  width: min(100% - 32px, 440px);
  margin: 48px auto;
  padding: 24px;
  border-radius: var(--outer);
  background: var(--surface);
}

.card-checkout input {
  display: block;
  width: 100%;
  margin: 8px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--inner);
  font: inherit;
}

.card-checkout button {
  padding: 12px 16px;
  border: 0;
  border-radius: var(--inner);
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  cursor: pointer;
}

.card-checkout a { color: var(--text); }

.public-info { width: min(100% - 32px, 720px); }

.checkout-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
[hidden] { display: none !important; }
body {
  margin: 0;
  padding: 0 0 calc(94px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Onest, system-ui, sans-serif;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(36px, 7vw, 66px); font-weight: 630; line-height: 1; letter-spacing: -.065em; }
h2 { font-size: clamp(21px, 3vw, 31px); font-weight: 640; line-height: 1.12; letter-spacing: -.045em; }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, input { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.shell { width: min(1000px, calc(100% - 56px)); margin-inline: auto; }
header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: calc(8px + env(safe-area-inset-top)) 8px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  font-size: 18px;
  font-weight: 690;
  letter-spacing: -.035em;
  white-space: nowrap;
}
.brand-mark { flex: none; width: 30px; height: 30px; filter: grayscale(1) brightness(.24); }
@media (prefers-color-scheme: dark) {
  .brand-mark { filter: grayscale(1); }
}
.pill, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 620;
  line-height: 1.25;
  transition: background-color .2s, border-radius .3s var(--ease), scale .2s var(--ease);
}
.pill { background: var(--tonal); }
.primary { background: var(--primary); color: var(--on-primary); }
.pill:disabled, .primary:disabled { opacity: .62; }
@media (hover: hover) {
  .pill:not(:disabled):hover { background: var(--tonal-hover); }
  .primary:not(:disabled):hover { border-radius: 15px; }
}
.pill:active:not(:disabled), .primary:active { scale: .97; border-radius: 14px; }

.hero { padding: clamp(44px, 8vw, 96px) 2px clamp(30px, 5vw, 56px); }
.hero h1 { font-size: clamp(42px, 8.3vw, 90px); font-weight: 610; letter-spacing: -.06em; }
.hero p { margin-top: 14px; color: var(--muted); font-size: clamp(15px, 2vw, 18px); }

.catalog-panel { scroll-margin-block-start: 14px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-inline: 2px;
}
.section-head .pill { flex: none; }
.section-head .pill span { font-size: 18px; line-height: 1; }

.countries, .orders, .details {
  display: grid;
  gap: var(--gap);
  border-radius: var(--outer);
  overflow: hidden;
}
.countries { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.country {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto auto;
  grid-template-areas: "flag arrow" "name name" "price price";
  justify-items: start;
  align-items: start;
  gap: 7px 12px;
  min-height: 190px;
  min-width: 0;
  padding: 19px 21px;
  border-radius: var(--inner);
  background: var(--surface);
  text-align: left;
  transition: border-radius .34s var(--ease), background-color .2s, scale .2s var(--ease);
}
.country:focus-visible { outline-offset: -4px; }
.flag, .details-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--tonal);
  font-size: 23px;
}
.flag { grid-area: flag; transition: border-radius .34s var(--ease); }
.country strong {
  grid-area: name;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 620;
  letter-spacing: -.045em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.country-price { grid-area: price; color: var(--muted); font: 600 14px/1.25 ui-monospace, monospace; }
.country-arrow {
  grid-area: arrow;
  justify-self: end;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  transition: transform .3s var(--ease);
}
.country:disabled strong { color: var(--muted); }
.country:disabled .flag { filter: grayscale(.8); }
.country:disabled .country-arrow { visibility: hidden; }
@media (hover: hover) {
  .country:not(:disabled):hover { border-radius: var(--outer); background: var(--surface-hover); }
  .country:not(:disabled):hover .country-arrow { transform: translate(2px, -2px); }
  .country:not(:disabled):hover .flag { border-radius: 50%; }
}
.country:not(:disabled):active { scale: .98; border-radius: 20px; }

.details {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  margin-top: 14px;
}
.details-card, .empty, .order {
  min-width: 0;
  padding: 18px 20px;
  border-radius: var(--inner);
  background: var(--surface);
}
.details-card { display: flex; align-items: flex-start; gap: 13px; }
.details-icon { width: 37px; height: 37px; flex: none; border-radius: 12px; font-size: 18px; }
.details-card h2 { margin: 1px 0 4px; font-size: 16px; letter-spacing: -.02em; }
.details-card p, .empty, .order p, label, footer { color: var(--muted); }
.details-card p, #shop-guest .empty { font-size: 14px; }
#shop-guest .empty { height: 100%; }
.empty { grid-column: 1 / -1; }
.empty .primary { margin-top: 10px; }
#wallet > .empty { border-radius: var(--outer); }
footer { margin: 15px 2px 0; font-size: 14px; }
footer a:hover, .order a:hover { text-decoration: underline; }

.dock {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  gap: 3px;
  max-width: calc(100% - 16px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 6px 25px #0001;
}
.dock button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 7px clamp(10px, 3vw, 16px);
  border-radius: 99px;
  background: transparent;
  font-size: 14px;
  white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.dock button[aria-current] { background: var(--primary); color: var(--on-primary); }
@media (hover: hover) {
  .dock button:not([aria-current]):hover { background: var(--tonal); }
}

#orders > .section-head, #wallet > h1 { margin-block: 28px 18px; }
.orders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.order p { overflow-wrap: anywhere; }
.order code, .order a { color: var(--text); }
.order a { display: inline-block; margin-top: 6px; text-decoration: underline; }

.wallet-card {
  display: grid;
  gap: 6px;
  padding: 24px clamp(20px, 5vw, 36px);
  margin-bottom: var(--gap);
  border-radius: var(--outer) var(--outer) var(--inner) var(--inner);
  background: var(--primary);
  color: var(--on-primary);
}
.wallet-card strong { font-size: clamp(32px, 7vw, 60px); line-height: 1; letter-spacing: -.055em; }
#topup-panel { background: var(--surface); border-radius: var(--inner) var(--inner) var(--outer) var(--outer); padding: 20px; }
.amounts, .form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
#topup { margin-top: 22px; }
#invoice, #logout { margin-top: 14px; }
#invoice p { margin-top: 5px; color: var(--muted); font-size: 14px; }
input { min-width: 0; width: 135px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
dialog {
  width: min(430px, calc(100% - 24px));
  max-height: 90%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--outer);
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: #10101080; }
dialog h2 { padding-right: 44px; overflow-wrap: anywhere; }
dialog p { margin-block: 10px; }
.close { position: absolute; top: 11px; right: 11px; min-width: 44px; padding: 0; font-size: 23px; }
#checkout-error { color: var(--error); }
.toast {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(79px + env(safe-area-inset-bottom));
  translate: -50% 0;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--primary);
  color: var(--on-primary);
}

@media (max-width: 660px) {
  .shell { width: calc(100% - 28px); }
  header { min-height: 60px; }
  .hero { padding: 32px 2px 26px; }
  .hero p { margin-top: 9px; }
  .section-head { margin-bottom: 8px; }
  .section-head .pill { padding-inline: 12px; }
  .countries, .orders, .details { grid-template-columns: minmax(0, 1fr); }
  .country {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas: "flag name arrow" "flag price arrow";
    align-content: center;
    align-items: center;
    min-height: 81px;
    padding: 12px 15px;
    row-gap: 4px;
  }
  .country strong { font-size: 21px; }
  .country-arrow { font-size: 18px; }
  .flag { width: 42px; height: 42px; font-size: 21px; }
  #balance { padding-inline: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .page:not([hidden], #shop), dialog[open] { animation: enter .28s var(--ease); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@keyframes enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
