:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  --page-bg: #11131a;
  --card-bg: #1b1f2a;
  --text: #f4f7fb;
  --muted: #a8b2c4;
  --border: #32394a;
  --accent: #8177ff;
  --danger: #ff7a70;
  --success: #7ee09a;
  --success-bg: #f0eee9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  transition: background-color 180ms ease;
}

body.authorized {
  background: var(--success-bg);
}

body.shop-open {
  background: #11131a;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

body.shop-open .page {
  display: block;
}

.auth-card,
.success-card,
.photo-card {
  width: min(520px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgb(0 0 0 / 34%);
}

.auth-card {
  padding: 22px 24px 26px;
  border-top: 4px solid var(--accent);
}

.brand-pill {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  background: #212634;
}

.brand-mark,
.button-logo {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffdb4d;
  color: #111111;
  font-weight: 700;
}

.brand-mark {
  box-shadow: inset 0 0 0 6px #fff1b8;
  color: transparent;
}

.auth-form {
  margin-top: 22px;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.auth-text {
  margin: 18px 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.field {
  display: block;
  margin-bottom: 14px;
  color: #d9e1ef;
  font-size: 14px;
  font-weight: 700;
}

.field span {
  display: block;
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #111620;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(115 103 255 / 16%);
}

.message {
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 14px;
}

.submit-button {
  width: 100%;
  height: 48px;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 6px solid #2a3141;
  border-radius: 14px;
  background: #050506;
  color: #ffffff;
  font: 700 14px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.submit-button:hover {
  background: #141418;
}

.submit-button:active {
  transform: translateY(1px);
}

.button-logo {
  background: #f53d24;
  color: #ffffff;
}

.avatar {
  justify-self: end;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 60% 40%, #f5edd6 0 20%, transparent 21%),
    radial-gradient(circle at 36% 64%, #6f5a36 0 18%, transparent 19%),
    linear-gradient(135deg, #d7c39a, #6d644f);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 28%);
}

.success-card {
  padding: 42px 28px;
  text-align: center;
  background: var(--success-bg);
  color: #182034;
  border-color: rgb(24 32 52 / 16%);
}

.success-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgb(24 32 52 / 8%);
  color: #2d8c4a;
  font-size: 30px;
  font-weight: 700;
}

.loader {
  height: 6px;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(24 32 52 / 12%);
}

.loader::before {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: #8177ff;
  animation: loading-bar 800ms ease-in-out infinite;
}

.photo-card {
  overflow: hidden;
  background: var(--success-bg);
  border-color: rgb(24 32 52 / 16%);
}

.piglet-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, filter 130ms ease;
}

.piglet-button:hover {
  filter: brightness(1.04);
}

.piglet-button:active {
  transform: translateY(5px) scale(0.985);
  box-shadow: inset 0 8px 24px rgb(24 32 52 / 22%);
}

.piglet-button img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.shop-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  color: var(--text);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 24px 0 8px;
}

.shop-kicker {
  margin: 0 0 8px;
  color: #c8c0ff;
  font-size: 14px;
  font-weight: 700;
}

.shop-header h1 {
  font-size: 34px;
}

.cart-badge {
  min-width: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1b1f2a;
  color: var(--muted);
}

.cart-badge strong {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.catalog-top {
  margin-bottom: 16px;
}

.catalog-top h2,
.cart-panel h2 {
  margin: 0;
  font-size: 20px;
}

.catalog-top p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.product-card,
.cart-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1b1f2a;
  box-shadow: 0 16px 36px rgb(0 0 0 / 24%);
}

.product-card {
  overflow: hidden;
}

.product-visual {
  position: relative;
  height: 170px;
  overflow: hidden;
  background: #f7f7f7;
}

.product-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.product-body {
  padding: 14px;
}

.product-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.product-body p {
  min-height: 42px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.add-button,
.checkout-button,
.qty-button {
  border: 0;
  border-radius: 7px;
  font-weight: 700;
  cursor: pointer;
}

.add-button,
.checkout-button {
  min-height: 38px;
  padding: 0 13px;
  background: var(--accent);
  color: #ffffff;
}

.add-button:hover,
.checkout-button:hover {
  background: #9289ff;
}

.cart-panel {
  position: sticky;
  top: 24px;
  padding: 16px;
}

.cart-items {
  display: grid;
  gap: 12px;
  min-height: 98px;
  margin: 16px 0;
}

.empty-cart,
.cart-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.cart-item {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cart-item-top,
.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-item-title {
  color: #ffffff;
  font-weight: 700;
}

.cart-item-price {
  color: var(--muted);
  font-size: 14px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-button {
  width: 30px;
  height: 30px;
  background: #2a3141;
  color: #ffffff;
}

.qty-button:hover {
  background: #384154;
}

.cart-total {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 18px;
}

.checkout-button {
  width: 100%;
  margin: 16px 0 10px;
}

@keyframes loading-bar {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(250%);
  }
}

@media (max-width: 480px) {
  .page {
    padding: 16px;
  }

  .auth-card {
    padding: 18px 16px 20px;
  }

  .auth-text {
    font-size: 15px;
  }

  .shop-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .shop-header h1 {
    font-size: 28px;
  }

  .shop-layout,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (min-width: 481px) and (max-width: 900px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-panel {
    position: static;
  }
}
