:root {
  --bg: #f5f5f5;
  --card: #eceff1;
  --card-hover: #e0e0e0;
  --control: #e0e0e0;
  --control-hover: #cfd8dc;
  --ink: #212121;
  --muted: #757575;
  --faint: #bdbdbd;
  --line: #e0e0e0;
  --header: 64px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--control);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
  padding: 0 20px 0 22px;
}

.brand {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 100%;
  margin: 0;
  padding: 0;
}

.nav-btn,
.lang-btn,
.close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  transition: background-color 0.2s ease;
}

.nav-btn:hover {
  background: var(--card);
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.lang-btn {
  min-width: 36px;
  min-height: 40px;
  padding: 8px 4px;
  letter-spacing: 0.08em;
  color: var(--faint);
  transition: color 0.2s ease;
}

.lang-btn:hover,
.lang-btn[aria-pressed="true"] {
  color: var(--ink);
}

.lang-btn[aria-pressed="true"] {
  font-weight: 500;
}

.slash {
  color: var(--faint);
  user-select: none;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.side {
  background: var(--bg);
}

.folders {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.folder {
  border: 0;
  background: transparent;
  padding: 14px 18px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.folder:hover,
.folder[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
}

.main {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 292px;
  padding: 32px 20px 20px;
  background: var(--card);
  cursor: pointer;
  transition: background-color 0.22s ease, transform 0.22s ease;
}

.card:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
}

.card-open {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.flag {
  display: block;
  width: min(148px, 70%);
  aspect-ratio: 3 / 2;
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(33, 33, 33, 0.12);
}

.flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

.name {
  margin-bottom: 12px;
  font-size: 1.7rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  line-height: 1;
}

.price {
  margin-bottom: 24px;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
}

.buy {
  width: 100%;
  height: 44px;
  margin-top: auto;
  border: 0;
  background: var(--control);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.card:hover .buy,
.buy:hover {
  background: var(--control-hover);
}

.buy:active,
.modal-buy:active {
  background: #c5ced4;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-buy {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border: 0;
  background: var(--control);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cart-count {
  min-width: 1.1rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cart-list {
  background: var(--card);
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-top: 1px solid rgba(33, 33, 33, 0.08);
}

.cart-row:first-child {
  border-top: 0;
}

.cart-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.account {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account[hidden] {
  display: none;
}

.account .modal-buy {
  margin-top: 4px;
}

.form-error {
  margin: 0;
  color: #616161;
  font-size: 13px;
}

.modal-buy:hover {
  background: var(--control-hover);
}

.pay-meta {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.14em;
}

.pay-amount {
  margin: 0 0 18px;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1;
}

.methods {
  display: flex;
  flex-direction: column;
}

.methods[hidden],
.invoice[hidden],
.processing[hidden] {
  display: none;
}

.method {
  height: 48px;
  border: 0;
  border-top: 1px solid rgba(33, 33, 33, 0.08);
  background: var(--card);
  text-align: left;
  padding: 0 14px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.method:first-child {
  border-top: 0;
}

.method:hover,
.method[aria-pressed="true"] {
  background: var(--control);
}

.method:disabled {
  cursor: default;
}

.method:disabled:not([aria-pressed="true"]) {
  opacity: 0.4;
}

.method:disabled:hover {
  background: var(--card);
}

.method:disabled[aria-pressed="true"]:hover {
  background: var(--control);
}

.order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.order-label {
  margin: 0;
}

.qty {
  display: inline-flex;
  align-items: center;
  background: var(--card);
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.qty-btn:disabled {
  color: var(--faint);
  cursor: default;
}

#qty-value {
  min-width: 1.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.order-total {
  margin: 8px 0 0;
  text-align: right;
  letter-spacing: 0.04em;
}

.pay-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

#pay {
  width: min(480px, calc(100vw - 32px));
}

.invoice {
  margin-top: 16px;
}

.timer {
  margin: 0 0 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.address {
  margin: 0;
  padding: 12px 14px;
  background: var(--card);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.copy {
  height: 40px;
  margin-top: 8px;
  padding: 0 14px;
  border: 0;
  background: var(--control);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.copy:hover {
  background: var(--control-hover);
}

.pay-email {
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.pay-email.is-invalid {
  box-shadow: inset 0 0 0 1px #9e9e9e;
}

.pay-hint {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.processing:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 36px 0 12px;
}

.processing p {
  margin: 0;
  letter-spacing: 0.04em;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.invoice.is-expired .address,
.invoice.is-expired .pay-amount,
.invoice.is-expired .copy {
  opacity: 0.35;
}

#pay-renew {
  margin-top: 12px;
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

.modal {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    overlay 0.22s ease allow-discrete,
    display 0.22s allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: translateY(0);
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(8px);
  }
}

.modal::backdrop {
  background: rgba(33, 33, 33, 0.18);
  opacity: 0;
  transition:
    opacity 0.22s ease,
    overlay 0.22s ease allow-discrete,
    display 0.22s allow-discrete;
}

.modal[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .modal[open]::backdrop {
    opacity: 0;
  }
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.kind {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: left;
}

.modal-top h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: 0.16em;
}

.close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  transition: background-color 0.2s ease;
}

.close:hover {
  background: var(--card);
}

.close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.slots {
  display: flex;
  flex-direction: column;
  max-height: min(420px, calc(100vh - 250px));
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  counter-reset: slot;
  background: var(--card);
  scrollbar-width: thin;
  scrollbar-color: #cfd8dc transparent;
}

.slots li {
  counter-increment: slot;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 11px 14px;
  background: transparent;
  border-top: 1px solid rgba(33, 33, 33, 0.08);
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.slots li:first-child {
  border-top: 0;
}

.slots li::before {
  content: counter(slot);
  flex: 0 0 1.4rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slots li:empty::after {
  content: "—";
  color: var(--faint);
  font-weight: 300;
}

.muted {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 11px 12px;
  background: var(--card);
  color: var(--muted);
  font-weight: 300;
}

.noscript {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 20px;
  color: var(--muted);
}

@media (min-width: 720px) {
  .layout {
    grid-template-columns: 168px minmax(0, 1fr);
  }

  .side {
    position: sticky;
    top: var(--header);
    min-height: calc(100vh - var(--header));
    border-right: 1px solid var(--line);
  }

  .folders {
    flex-direction: column;
    border-bottom: 0;
    padding-top: 12px;
  }

  .folder {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .main {
    padding-inline: 28px;
  }

  .bar {
    padding-inline: 28px;
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (max-width: 420px) {
  .nav-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .bar {
    padding-inline: 12px;
  }

  .nav {
    gap: 2px;
  }

  .brand {
    font-size: 1.15rem;
    letter-spacing: 0.12em;
  }

  .name {
    letter-spacing: 0.14em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card,
  .buy,
  .nav-btn,
  .lang-btn,
  .folder,
  .close,
  .modal,
  .modal::backdrop {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}
