* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #fff;
  min-height: 100vh;
}

.top-bar {
  background: #111;
  border-bottom: 1px solid #222;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #e20702;
}

.stats {
  font-size: 14px;
  color: #888;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.stats strong { color: #e20702; }

.canvas-wrap {
  display: flex;
  justify-content: center;
  padding: 20px;
  position: relative;
}

#gridCanvas {
  width: 100%;
  max-width: 1000px;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
  border: 1px solid #222;
  cursor: pointer;
  background: #0a0a0a;
}

.tooltip {
  display: none;
  position: fixed;
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  z-index: 50;
  border: 1px solid #e20702;
}

.footer {
  text-align: center;
  padding: 30px;
  color: #444;
  font-size: 13px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 30px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-sm { max-width: 380px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
}
.modal-close:hover { color: #e20702; }

.modal h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #e20702;
}

.modal label {
  display: block;
  font-size: 13px;
  color: #999;
  margin: 12px 0 4px;
}

.modal input[type="text"],
.modal input[type="url"],
.modal input[type="email"],
.modal input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  background: #000;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  outline: none;
}
.modal input:focus { border-color: #e20702; }

.modal input[type="file"] {
  padding: 8px;
  font-size: 13px;
}

.modal-total {
  margin: 20px 0 12px;
  font-size: 18px;
  color: #e20702;
}

.btn-buy {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: #e20702;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: .2s;
}
.btn-buy:hover { background: #c00600; }
.btn-buy:disabled { opacity: .5; cursor: not-allowed; }

.modal-error {
  color: #e20702;
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

.modal-loading {
  display: none;
  text-align: center;
  padding: 30px;
}
.modal-loading.active { display: block; }

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid #333;
  border-top-color: #e20702;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}

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

#infoContent {
  text-align: center;
}
#infoContent img {
  max-width: 200px;
  border-radius: 8px;
  margin: 12px 0;
}
#infoContent a {
  display: block;
  color: #e20702;
  margin: 8px 0;
  word-break: break-all;
}
#infoContent p {
  color: #aaa;
  font-size: 14px;
}
