* {
  box-sizing: border-box;
}

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #1b1d21;
  --bg-panel: #22252a;
  --text: #e8eaed;
  --muted: #a9b0b7;
  --accent: #ff2a2a;
  --accent-2: #ff6b6b;
  --accent-3: #ff1a1a;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  --parallax-x: 0px;
  --parallax-y: 0px;
  background:
    linear-gradient(180deg, rgba(255, 140, 140, 0.16) 0%, rgba(30, 32, 36, 0.9) 52%, rgba(14, 15, 18, 0.98) 100%),
    radial-gradient(1400px 320px at 50% 52%, rgba(255, 120, 120, 0.35), transparent 70%),
    radial-gradient(1200px 800px at 70% -10%, rgba(255, 60, 60, 0.18), transparent 60%),
    radial-gradient(900px 700px at 10% 20%, rgba(255, 110, 110, 0.12), transparent 60%),
    var(--bg);
}

body::before {
  display: none;
}

body::after {
  display: none;
}

body > * {
  position: relative;
  z-index: 2;
}

.has-assistant::before,
.has-assistant::after {
  display: none;
}

.has-assistant {
  background: radial-gradient(1200px 600px at 50% 20%, rgba(255, 60, 60, 0.15), transparent 70%), var(--bg);
}

.assistant-3d {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.assistant-3d canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#page-root {
  position: relative;
  z-index: 2;
}

@keyframes gridDrift {
  0% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.6), calc(var(--parallax-y) * 0.6 - 40px), -160px)
      translateZ(0);
    opacity: 0.62;
  }
  50% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.6 + 6px), calc(var(--parallax-y) * 0.6 - 32px), -160px)
      translateZ(0);
    opacity: 0.62;
  }
  100% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.6), calc(var(--parallax-y) * 0.6 - 40px), -160px)
      translateZ(0);
    opacity: 0.62;
  }
}

@keyframes glowDrift {
  0% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.9), calc(var(--parallax-y) * 0.9 - 20px), -240px)
      translateZ(0);
    opacity: 0.48;
  }
  50% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.9 - 8px), calc(var(--parallax-y) * 0.9 - 30px), -240px)
      translateZ(0);
    opacity: 0.48;
  }
  100% {
    transform: perspective(1200px) rotateX(85deg)
      translate3d(calc(var(--parallax-x) * 0.9), calc(var(--parallax-y) * 0.9 - 20px), -240px)
      translateZ(0);
    opacity: 0.48;
  }
}

@keyframes hudFloat {
  0% {
    transform: perspective(1400px) rotateX(30deg) rotateY(-16deg) rotateZ(-2deg)
      translate3d(calc(var(--parallax-x) * 0.9), calc(var(--parallax-y) * 0.9 - 80px), -160px)
      translateZ(0);
  }
  50% {
    transform: perspective(1400px) rotateX(36deg) rotateY(-20deg) rotateZ(2deg)
      translate3d(calc(var(--parallax-x) * 0.9 + 6px), calc(var(--parallax-y) * 0.9 - 72px), -160px)
      translateZ(0);
  }
  100% {
    transform: perspective(1400px) rotateX(30deg) rotateY(-16deg) rotateZ(-2deg)
      translate3d(calc(var(--parallax-x) * 0.9), calc(var(--parallax-y) * 0.9 - 80px), -160px)
      translateZ(0);
  }
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1300;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(27, 29, 33, 0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: rgba(232, 234, 237, 0.7);
}

.brand-title {
  font-size: 18px;
  letter-spacing: 0.28em;
  color: var(--text);
  text-shadow: 0 0 16px rgba(255, 98, 180, 0.95), 0 0 34px rgba(255, 78, 160, 0.8), 0 0 56px rgba(255, 52, 140, 0.6);
}

.brand-link {
  color: rgba(232, 234, 237, 0.8);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.brand-link:hover {
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 98, 180, 0.95), 0 0 36px rgba(255, 78, 160, 0.85), 0 0 60px rgba(255, 52, 140, 0.65);
}

.brand-left,
.brand-right {
  white-space: nowrap;
}

.login,
.register,
.home {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #24272c;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.login:hover,
.register:hover,
.home:hover {
  background: #2d3137;
  border-color: rgba(255, 42, 42, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 42, 42, 0.2) inset, 0 0 18px rgba(255, 42, 42, 0.35);
}

.balance {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  border: none;
  box-shadow: none;
  animation: redGlow 4s ease-in-out infinite;
  z-index: 2;
}

.balance-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #2a2f37;
  border: 1px solid rgba(255, 42, 42, 0.45);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255, 42, 42, 0.2);
  overflow: visible;
}

.bonuses {
  position: static;
  width: 0;
}

.bonuses-popup {
  position: absolute;
  top: -1px;
  right: calc(100% - 6px);
  width: 240px;
  max-height: min(320px, calc(100vh - 28px));
  background: #2a2f37;
  border: 1px solid rgba(255, 42, 42, 0.45);
  border-radius: 12px;
  padding: 8px 10px 8px 12px;
  display: grid;
  gap: 4px;
  box-shadow: 0 0 18px rgba(255, 42, 42, 0.2);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px) scaleX(0.92);
  transform-origin: right center;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 10;
}

.balance-wrap:hover .bonuses-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scaleX(1);
}

.bonuses-popup::-webkit-scrollbar {
  width: 6px;
}

.bonuses-popup::-webkit-scrollbar-thumb {
  background: rgba(255, 42, 42, 0.35);
  border-radius: 999px;
}

.bonuses-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.bonuses-row:last-child {
  border-bottom: none;
}

.bonuses-empty {
  font-size: 12px;
  color: #9aa2aa;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.page-cards {
  display: block;
  min-height: 100vh;
  text-align: left;
  padding: 120px 20px 60px;
}

.page-home {
  display: block;
  min-height: 100vh;
  text-align: left;
  padding: 120px 20px 60px;
}

.home-stats {
  width: min(1280px, 96vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.stats-card {
  background: linear-gradient(165deg, #2a1f22 0%, #1b1c20 100%);
  border: 1px solid rgba(255, 70, 70, 0.45);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.45), 0 0 32px rgba(255, 70, 70, 0.18);
}

.home-stats .stats-card:nth-child(2) {
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.38);
}

.stats-filter-card {
  grid-column: 1 / -1;
  max-width: 340px;
}

.stats-card h1,
.stats-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  color: #fff4f4;
  letter-spacing: 0.01em;
}

.stats-subtitle {
  margin: 0 0 14px;
  font-size: 13px;
  color: #c7cbd2;
  line-height: 1.4;
}

#spendChart,
#countPieChart {
  width: 100%;
  display: block;
  min-height: 360px;
}

.chart-box {
  width: 100%;
  height: 360px;
}

.catalog-layout {
  width: min(1280px, 96vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.cards {
  width: 100%;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sort-panel {
  position: sticky;
  top: 96px;
  border: 2px solid rgba(255, 42, 42, 0.75);
  background: linear-gradient(165deg, #2a2529 0%, #201f24 100%);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.4), 0 0 22px rgba(255, 42, 42, 0.25);
}

.sort-panel-title {
  margin: 0 0 2px;
  font-size: 13px;
  color: #c7ced6;
  letter-spacing: 0.02em;
}

.sort-form {
  display: grid;
  gap: 8px;
}

.sort-label {
  font-size: 12px;
  color: #9ea7b1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sort-select {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 42, 42, 0.65);
  background: #252229;
  color: #f1f4f8;
  font-size: 13px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 42, 42, 0.12);
}

.sort-select:focus {
  border-color: rgba(255, 42, 42, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 42, 42, 0.2);
}

.card {
  background: #23272e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px;
  text-align: left;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 12px;
}

.card h2 {
  margin: 0;
  font-size: 20px;
}

.card-price {
  margin: 0;
  font-size: 18px;
  color: #ffd2d2;
  text-shadow: 0 0 10px rgba(255, 120, 200, 0.35);
}

.card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: #cfd5db;
}

.card-count {
  font-size: 12px;
  color: #b9c0c8;
}

.detail-tabs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.detail-tab {
  border: 1px solid rgba(255, 70, 70, 0.4);
  background: rgba(28, 24, 26, 0.9);
  color: #f0eaea;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.detail-tab.is-active {
  border-color: rgba(255, 70, 70, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), 0 0 16px rgba(255, 70, 70, 0.25);
  transform: translateY(-1px);
}

.detail-panels {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.detail-panel {
  display: none;
}

.detail-panel.is-active {
  display: block;
}

.detail-text {
  margin: 0 0 8px;
  color: #d7d1d1;
  font-size: 17px;
}

.detail-kicker {
  margin: 0 0 6px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 190, 190, 0.9);
}

.detail-lead {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
  color: #f4eeee;
}

.detail-list {
  margin: 10px 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.detail-list li {
  position: relative;
  padding-left: 18px;
  font-size: 17px;
  color: #d7d1d1;
}

.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 110, 110, 0.9), rgba(255, 42, 42, 0.9));
  box-shadow: 0 0 10px rgba(255, 70, 70, 0.6);
}

.detail-callout {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  color: #f2eaea;
  font-size: 17px;
}

.detail-block {
  display: grid;
  gap: 6px;
  margin: 6px 0 12px;
}

.detail-center {
  text-align: center;
  justify-items: center;
}

.detail-center .detail-list {
  justify-items: center;
}

.detail-center .detail-list li {
  padding-left: 0;
}

.detail-center .detail-list li::before {
  position: static;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.detail-overlay {
  position: relative;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.detail-center-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.detail-center-wrap .card {
  max-width: min(960px, 92vw);
}

.detail-help {
  margin: 8px 0 0;
  font-size: 12px;
  color: #a9b0b7;
}

.detail-input {
  width: min(420px, 100%);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 70, 70, 0.45);
  background: #221d20;
  color: #f1f4f8;
  font-size: 13px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 70, 70, 0.12);
}

.detail-input:focus {
  border-color: rgba(255, 70, 70, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 70, 70, 0.2);
}

.detail-input-hours {
  -moz-appearance: textfield;
}

.detail-input-hours::-webkit-outer-spin-button,
.detail-input-hours::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.detail-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-wrap: wrap;
}

.detail-input-row--spaced {
  margin-top: 14px;
}

.detail-hint {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 70, 70, 0.55);
  color: #f3ecec;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  cursor: help;
  background: rgba(28, 24, 26, 0.92);
  position: relative;
  flex: 0 0 auto;
}

.detail-tooltip {
  position: absolute;
  left: 0;
  top: 44px;
  background: rgba(20, 20, 24, 0.95);
  border: 1px solid rgba(255, 70, 70, 0.35);
  color: #f3ecec;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: 300px;
  z-index: 2;
}

.detail-hint:hover + .detail-tooltip,
.detail-hint:focus + .detail-tooltip {
  opacity: 1;
  transform: translateY(0);
}


.detail-sites {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-site {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 70, 70, 0.45);
  background: rgba(24, 20, 22, 0.9);
  color: #f3ecec;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.detail-site-remove {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 70, 70, 0.55);
  background: transparent;
  color: #f3ecec;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.detail-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-submit {
  border: 1px solid rgba(255, 70, 70, 0.7);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 180, 200, 0.95) 45%, rgba(255, 88, 120, 0.95) 100%);
  color: #2a0d14;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 120, 160, 0.35);
}

.detail-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.detail-status {
  font-size: 12px;
  color: #cdd4dc;
}

.card-accent {
  border-color: rgba(255, 120, 200, 0.35);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.4), 0 0 26px rgba(255, 120, 200, 0.2);
}

.card-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1200;
}

.card-modal.is-open {
  display: block;
}

.card-modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.card-modal-content {
  position: relative;
  width: min(1120px, 96vw);
  margin: 12vh auto 0;
  z-index: 1;
  transform: translateY(64px);
  opacity: 0;
  transition: transform 320ms ease, opacity 320ms ease;
}

.card-modal-body .card {
  margin: 0;
  box-shadow: 0 26px 44px rgba(0, 0, 0, 0.5);
}

.card-modal-close {
  position: absolute;
  top: -12px;
  right: -10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(18, 20, 26, 0.95);
  color: #f3f4f6;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}

.card-modal.is-open .card-modal-content {
  transform: translateY(0);
  opacity: 1;
}

.card-modal.is-open .card-modal-body .card {
  border: 2px solid rgba(255, 70, 70, 0.9);
  outline: 1px solid rgba(255, 70, 70, 0.35);
  outline-offset: 2px;
  box-shadow: 0 30px 52px rgba(0, 0, 0, 0.55), 0 0 28px rgba(255, 70, 70, 0.28);
}

.modal-open .cards,
.modal-open .sort-panel {
  display: none;
}

.card-wide {
  grid-column: span 2;
}

@media (max-width: 1240px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .sort-panel {
    position: static;
    order: -1;
    grid-template-columns: 1fr;
  }

  .home-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .card-wide {
    grid-column: auto;
  }
}
h1 {
  font-size: 48px;
  margin: 0;
}

.login-form {
  width: min(360px, 92vw);
  background: #22252a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  display: grid;
  gap: 14px;
  text-align: left;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.login-form h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

.message {
  margin: 0;
  padding: 8px 10px;
  background: rgba(255, 196, 0, 0.15);
  border: 1px solid rgba(255, 196, 0, 0.35);
  border-radius: 8px;
  font-size: 13px;
  color: #ffd27a;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.field input {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 15px;
  background: #1c1f24;
  color: var(--text);
}

.submit {
  margin-top: 6px;
  display: inline-block;
  border: none;
  background: #2b2f36;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border: 1px solid rgba(255, 42, 42, 0.35);
  box-shadow: 0 0 18px rgba(255, 42, 42, 0.25);
  animation: redGlow 5s ease-in-out infinite;
}

.submit:hover {
  background: #323844;
  box-shadow: 0 0 26px rgba(255, 42, 42, 0.45);
}

.links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.back {
  font-size: 13px;
  color: #a9b0b7;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

@keyframes redGlow {
  0% {
    box-shadow: 0 0 12px rgba(255, 42, 42, 0.2), 0 0 24px rgba(255, 106, 106, 0.15);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 42, 42, 0.45), 0 0 32px rgba(255, 106, 106, 0.25);
  }
  100% {
    box-shadow: 0 0 12px rgba(255, 42, 42, 0.2), 0 0 24px rgba(255, 106, 106, 0.15);
  }
}
