:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef1f4;
  --text: #17202a;
  --muted: #5d6875;
  --border: #d8dde3;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(23, 32, 42, 0.08);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html.i18n-pending body {
  visibility: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

@media screen {
  /* Keep the browser canvas dark during viewport resizing and overscroll. */
  :root:has(> body.home-page, > body.shop-theme) {
    color-scheme: dark;
    background-color: #050209;
    overscroll-behavior-y: none;
  }

  body.home-page,
  body.shop-theme {
    min-height: 100vh;
    min-height: 100svh;
  }
}

body.shop-theme {
  color-scheme: dark;
  --bg: #050209;
  --surface: rgba(5, 7, 14, 0.9);
  --surface-muted: rgba(255, 255, 255, 0.055);
  --text: #f5f7fb;
  --muted: #a9b5c7;
  --border: rgba(0, 245, 225, 0.28);
  --accent: #9d18ff;
  --accent-strong: #7b13d1;
  --danger: #ff5a76;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42), 0 0 28px rgba(157, 24, 255, 0.14);
  background:
    radial-gradient(ellipse at 18% 42%, rgba(73, 14, 96, 0.38), transparent 35rem),
    radial-gradient(ellipse at 86% 18%, rgba(126, 18, 180, 0.38), transparent 34rem),
    radial-gradient(ellipse at 92% 62%, rgba(71, 10, 104, 0.66), transparent 40rem),
    linear-gradient(105deg, #050209 0%, #090313 34%, #11051e 66%, #210033 100%) #050209;
  background-attachment: fixed;
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

.site-header,
.admin-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

body.shop-theme .site-header,
body.shop-theme .admin-header {
  background: linear-gradient(180deg, rgba(3, 4, 8, 0.98), rgba(3, 4, 8, 0.78));
  backdrop-filter: blur(16px);
  border-bottom-color: rgba(0, 245, 225, 0.2);
}

.header-inner,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

body.shop-theme .header-inner,
body.shop-theme .page {
  width: min(1180px, calc(100% - 32px));
}

.header-inner {
  min-height: 120px;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: inline-grid;
  width: fit-content;
  font-weight: 700;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 680px;
  max-width: 100%;
  height: auto;
}

body.shop-theme .brand,
body.shop-theme .nav a {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: 1 1 360px;
  flex-wrap: wrap;
}

.site-header .nav,
.admin-header .nav {
  transform: translateY(6px);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
}

body.shop-theme .nav a:hover {
  color: #00f5e1;
}

.language-toggle {
  min-height: 34px;
  padding: 6px 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.language-toggle:hover {
  background: var(--surface-muted);
}

body.shop-theme .language-toggle {
  border-color: rgba(0, 245, 225, 0.34);
  background: rgba(255, 255, 255, 0.94);
  color: #050209;
  font-weight: 900;
}

body.shop-theme .language-toggle:hover {
  background: #fff;
}

@media (max-width: 1080px) {
  .brand-logo {
    width: 440px;
  }
}

@media (max-width: 800px) {
  .header-inner {
    min-height: 0;
    padding: 12px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand {
    max-width: 100%;
  }

  .brand-logo {
    width: 280px;
  }

  .nav {
    /* A desktop flex basis becomes vertical space in a column header. */
    flex: 0 1 auto;
    width: 100%;
    justify-content: flex-start;
    gap: 4px 16px;
  }

  .site-header .nav,
  .admin-header .nav {
    transform: none;
  }

  .header-inner .nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .header-inner .language-toggle {
    min-height: 44px;
  }
}

@media screen and (max-width: 800px), screen and (pointer: coarse) {
  /* Fixed background layers can expose unpainted areas on mobile browsers. */
  body.home-page,
  body.shop-theme {
    background-attachment: scroll;
  }
}

.header-icon-link {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.header-icon-link:hover {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

body.shop-theme .header-icon-link {
  border-color: rgba(0, 245, 225, 0.28);
  background: rgba(255, 255, 255, 0.035);
}

body.shop-theme .header-icon-link:hover {
  border-color: #00f5e1;
  background: rgba(0, 245, 225, 0.1);
}

.header-icon-link img {
  width: 24px;
  height: 24px;
  display: block;
  transition: filter 160ms ease, transform 160ms ease;
}

.header-icon-link .account-login-icon {
  width: 28px;
  height: 28px;
}

.nav a.cart-nav.has-items {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-weight: 700;
  animation: cart-nav-alert-pulse 1.15s ease-in-out infinite;
}

.nav a.cart-nav.has-items:hover {
  color: var(--danger);
}

.cart-nav-badge {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  padding: 2px 6px;
  place-items: center;
  color: #fff;
  background: var(--danger);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.cart-nav.has-items img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(52%) saturate(734%) hue-rotate(127deg) brightness(91%) contrast(90%);
}

.cart-nav.is-cart-added {
  animation: cart-link-pop 700ms ease;
}

.cart-nav.is-cart-added img {
  animation: cart-icon-pop 700ms ease;
}

.page {
  padding: 32px 0;
}

.page-title {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.2;
}

body.shop-theme .page-title {
  color: #fff;
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.page-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.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;
}

.panel,
.product-card,
.admin-table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body.shop-theme .panel,
body.shop-theme .product-card,
body.shop-theme .admin-table-shell,
body.shop-theme .cart-row,
body.shop-theme .account-card,
body.shop-theme .account-order {
  background: rgba(0, 0, 0, 0.68);
  border-color: rgba(0, 245, 225, 0.28);
  box-shadow: inset 0 0 32px rgba(157, 24, 255, 0.08), var(--shadow);
}

.panel {
  padding: 24px;
}

.button,
button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface-muted);
}

body.shop-theme .button.secondary {
  border-color: rgba(0, 245, 225, 0.28);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

body.shop-theme .button.secondary:hover {
  border-color: #00f5e1;
  background: rgba(0, 245, 225, 0.1);
}

.button.is-disabled,
.button.is-disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
}

body.shop-theme input,
body.shop-theme select,
body.shop-theme textarea {
  color: var(--text);
  background: rgba(0, 0, 0, 0.48);
  border-color: rgba(0, 245, 225, 0.28);
}

body.shop-theme input:focus,
body.shop-theme select:focus,
body.shop-theme textarea:focus {
  border-color: #00f5e1;
  box-shadow: 0 0 0 3px rgba(0, 245, 225, 0.14);
  outline: 0;
}

label,
.password-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 48px;
}

.password-input input::-ms-reveal {
  display: none;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  width: 44px;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -4px;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

body.shop-theme .empty-state {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(0, 245, 225, 0.26);
}

@keyframes cart-link-pop {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.35);
  }

  45% {
    box-shadow: 0 0 0 8px rgba(15, 118, 110, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0);
  }
}

@keyframes cart-icon-pop {
  0% {
    transform: scale(1) rotate(0deg);
  }

  35% {
    transform: scale(1.22) rotate(-8deg);
  }

  70% {
    transform: scale(0.96) rotate(4deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes cart-nav-alert-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.42;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
