* { box-sizing: border-box; }

:root {
  --bg: #050608;
  --panel: #151515;
  --panel-2: #1a1a1a;
  --line: #2a2a2a;
  --text: #f6f6f6;
  --muted: #8f8f95;
  --blue: #2ea3ff;
  --blue-soft: rgba(46, 163, 255, 0.12);
  --green: #20c55a;
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --radius: 18px;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: #111111;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

body {
  background: #111111;
  border-top: 12px solid #353535;
}

.pixel {
  font-family: "Press Start 2P", monospace;
  letter-spacing: .02em;
}

.is-hidden { display: none !important; }

.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #040506;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.loader-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s ease;
}
.loader-logo {
  width: min(330px, 62vw);
  display: block;
  margin: 0 auto 28px;
  filter: grayscale(1) brightness(.52) contrast(1.05);
  opacity: .8;
}
.loader-ring {
  width: 48px;
  height: 48px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.16);
  border-top-color: #ffffff;
  animation: spin 1s linear infinite;
}
.loader-text {
  font-size: 12px;
  color: #9f9fa8;
  line-height: 1.9;
}

.app-shell {
  width: 100%;
  min-height: calc(100vh - 12px);
  margin: 0;
  padding: 68px 24px 54px;
  background: #111111;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.store-header {
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 0 18px;
}
.brand-logo {
  width: min(190px, 38vw);
  max-width: 190px;
  display: block;
  image-rendering: auto;
  margin: 0 auto 2px;
}
.server-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 12px;
  background: linear-gradient(180deg, #232323, #151515);
  border: 1px solid #262626;
  box-shadow: 0 6px 0 #0d0d0d;
  font-size: 14px;
  color: white;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.server-pill:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #292929, #191919);
  border-color: #353535;
}
.server-pill:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #0d0d0d;
}

.status-message {
  max-width: 860px;
  margin: 22px auto 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid #2c2c2f;
  color: #cfd0d8;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
}
.status-message.error {
  border-color: rgba(255, 90, 90, .28);
  background: rgba(255, 90, 90, .08);
  color: #ffc9c9;
}

.store-content {
  width: min(980px, 100%);
  margin: 38px auto 0;
}

.category-section {
  margin-top: 58px;
}
.category-title {
  font-size: 18px;
  text-align: center;
  margin: 0 0 26px;
  color: #f4f6fb;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
}

.product-card {
  max-width: 320px;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #1b1b1d, #171718);
  border: 1px solid #2f2f33;
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.product-image-wrap {
  min-height: 120px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.product-image {
  max-width: 140px;
  max-height: 110px;
  object-fit: contain;
  image-rendering: auto;
}
.product-fallback {
  width: 104px;
  height: 104px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(46,163,255,.2), rgba(46,163,255,.08));
  border: 1px solid rgba(46,163,255,.32);
  color: #f4faff;
  font-size: 38px;
  font-weight: 900;
}
.product-title {
  font-size: 18px;
  line-height: 1.45;
  margin: 6px 0 12px;
  color: white;
  text-align: left;
}
.product-features {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  color: #a5a7af;
  font-size: 13px;
  line-height: 1.75;
  min-height: 98px;
}
.product-features li::marker {
  color: var(--blue);
}
.product-divider {
  margin: 16px 0 14px;
  height: 1px;
  background: #292a2e;
}
.buy-row {
  margin-top: auto;
}
.buy-button {
  width: 100%;
  min-height: 50px;
  border-radius: 11px;
  background: rgba(28, 66, 105, .18);
  border: 1px solid rgba(46, 163, 255, .28);
  color: #31a6ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .18s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.buy-button:hover {
  background: rgba(46, 163, 255, .16);
}
.buy-price {
  font-size: 17px;
}
.buy-suffix {
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  color: #d6d8de;
  font-weight: 700;
}

.empty-state {
  max-width: 780px;
  margin: 60px auto 0;
  text-align: center;
  padding: 34px 24px;
  border-radius: 18px;
  border: 1px dashed #2d2d2d;
  color: #9d9ea6;
}
.empty-state strong {
  display: block;
  margin-bottom: 10px;
  color: white;
}

.store-footer {
  width: min(980px, 100%);
  text-align: center;
  margin: 70px auto 0;
  color: #7f8088;
  font-size: 12px;
  line-height: 1.7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0,0,0,.72);
  display: none;
  place-items: center;
  padding: 20px;
}
.modal-backdrop.open { display: grid; }
.purchase-modal {
  width: min(430px, 100%);
  background: linear-gradient(180deg, #171719, #131314);
  border: 1px solid #2b2b2f;
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  position: relative;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #2e2e31;
  background: #1a1a1b;
  color: #d8d8da;
  font-size: 23px;
  cursor: pointer;
}
.modal-logo {
  width: 64px;
  margin-bottom: 8px;
}
.purchase-modal h2 {
  margin: 10px 0 10px;
  font-size: 18px;
  line-height: 1.6;
}
.modal-subtitle {
  color: #96979f;
  margin: 0 0 12px;
  line-height: 1.7;
  font-size: 13px;
}
.modal-price {
  font-size: 17px;
  color: #31a6ff;
  margin: 0 0 22px;
}
.form-label {
  display: block;
  text-align: left;
  font-size: 11px;
  margin-bottom: 10px;
}
.username-control {
  position: relative;
}
#minecraftUsername {
  width: 100%;
  height: 50px;
  border-radius: 11px;
  border: 1px solid #2d2e34;
  background: #111214;
  color: white;
  padding: 0 48px 0 14px;
  outline: none;
  font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
#minecraftUsername:focus {
  border-color: rgba(46, 163, 255, .62);
  box-shadow: 0 0 0 3px rgba(46, 163, 255, .08);
}
.username-control.valid #minecraftUsername {
  border-color: rgba(39, 199, 105, .62);
}
.username-control.invalid #minecraftUsername {
  border-color: rgba(255, 88, 88, .68);
}
.username-indicator {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
}
.username-control.valid .username-indicator {
  display: flex;
  color: #0a2515;
  background: #27c769;
}
.username-control.valid .username-indicator::before {
  content: "✓";
}
.username-control.invalid .username-indicator {
  display: flex;
  color: #2a0808;
  background: #ff6262;
}
.username-control.invalid .username-indicator::before {
  content: "×";
}
.username-feedback {
  text-align: left;
  color: #898b94;
  margin: 9px 0 13px;
  line-height: 1.55;
  font-size: 12px;
}
.username-feedback.valid {
  color: #76daa0;
}
.username-feedback.invalid {
  color: #ff9a9a;
}
.verification-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 17px;
  border: 1px solid rgba(46, 163, 255, .22);
  border-radius: 11px;
  background: rgba(46, 163, 255, .07);
  text-align: left;
}
.verification-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(46, 163, 255, .18);
  color: #57b9ff;
  font-size: 12px;
  font-weight: 900;
}
.verification-note p {
  margin: 0;
  color: #a5a8b1;
  font-size: 11px;
  line-height: 1.55;
}
.verification-note strong {
  color: #e9edf4;
}
.checkout-button {
  width: 100%;
  min-height: 50px;
  border-radius: 11px;
  border: 1px solid rgba(46,163,255,.35);
  background: rgba(46,163,255,.14);
  color: white;
  cursor: pointer;
  font-size: 14px;
}
.checkout-button.is-loading {
  opacity: .75;
  pointer-events: none;
}
.checkout-button:disabled {
  cursor: not-allowed;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(120%);
  min-width: min(500px, calc(100% - 24px));
  max-width: min(500px, calc(100% - 24px));
  background: #111214;
  border: 1px solid #2b2b30;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  z-index: 130;
  transition: transform .25s ease;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast strong {
  font-size: 12px;
  display: block;
  margin-bottom: 7px;
}
.toast p {
  margin: 0;
  color: #a3a5ac;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-word;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@media (max-width: 640px) {
  body { border-top-width: 8px; }
  .app-shell {
    width: 100%;
    min-height: calc(100vh - 8px);
    margin: 0;
    padding: 38px 12px 40px;
  }
  .loader-text { font-size: 10px; }
  .brand-logo { width: min(150px, 48vw); max-width: 150px; }
  .server-pill { font-size: 11px; min-height: 44px; padding: 0 14px; }
  .category-title { font-size: 15px; line-height: 1.8; }
  .card-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .product-card {
    max-width: 100%;
    min-height: 340px;
  }
  .product-title { font-size: 16px; }
  .product-features { font-size: 12px; min-height: 0; }
}
