body {
  background: #0f172a;
  color: #e2e8f0;
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 700px;
  padding: 10px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
}

.card {
  background: #1e293b;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

.headerlabel {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
}

label {
  display: block;
  margin-bottom: 5px;
}

select {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: none;
}

.regions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.region {
  display: flex;
  flex-direction: column;
}

.region.disabled {
  opacity: 0.3;
}

canvas {
  width: 100%;
  height: auto;
  max-height: 70vh;
  border-radius: 10px;
  background: black;
}

.admin-wrapper {
  position: relative;
  width: 100%;
}

.admin-wrapper textarea {
  width: 100%;
  padding: 10px 44px 10px 10px; 
  resize: none;
  border-radius: 6px;
  border: none;
  box-sizing: border-box;
  display: block; 
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;

  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  opacity: 0.7;

  padding: 4px 6px;
  font-size: 14px;
  border-radius: 6px;

  min-width: unset;
  line-height: 25px;

  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: #1e293b;
  color: #e2e8f0;
  opacity: 100;
}

textarea {
  width: 100%;
  height: 80px;
  resize: none;
  border-radius: 6px;
  border: none;
  padding: 8px;
  box-sizing: border-box;
}

button {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  color: #e2e8f0;
  transition: all 0.15s ease;
  min-width: 90px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

button:hover {
  background: #334155;
  border-color: #475569;
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: transparent;
  border-color: #475569; 
}

button.subtle {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
}

button.subtle:hover,
button.primary:hover {
  background: #334155;
  color: #fff;
  border-color: #64748b;
  font-weight: 600;
}

#copyTooltip {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #22c55e;
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  opacity: 0;
  transition: 0.3s;
}

#copyTooltip.show {
  opacity: 1;
}

.button-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-row select {
  min-width: 180px;
}

.preset-container {
  position: relative;
  display: flex;
  align-items: center;
}

.preset-dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  left: auto;

  /* Grow to fit the longest row (e.g. "MOSS & STONE · DINOPAINTER"), but never
     off-screen. Anchored right so it expands leftward from the Presets button. */
  width: max-content;
  min-width: 100%;
  max-width: calc(100vw - 40px);

  max-height: 280px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  margin-top: 4px;
  z-index: 10;
}

.preset-dropdown div {
  padding: 6px 12px;
  cursor: pointer;
  margin: 3px 5px;
  border-radius: 6px;
  color: #fff;
  font-weight: bold;
  transition: background 0.15s ease;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-dropdown div:hover {
  filter: brightness(1.2);
}

.hidden {
  display: none;
}

.preset-display {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  user-select: none;

  text-align: center;
  transition: all 0.15s ease;

  display: inline-block;
  line-height: normal;
  font: inherit;

  flex: 1 1 0;
  min-width: 0;
  width: auto;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-display:hover {
  background: #334155;
  border-color: #475569;
  font-weight: 600;
}

.preset-display:active {
  transform: scale(0.97);
}

.searchable-dropdown {
  position: relative;
  width: 100%;
}

#dinoInput {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: white;
}

.dropdown-content {
  position: absolute;
  width: 100%;
  max-height: 300px; 
  overflow-y: auto;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  z-index: 100;
  margin-top: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.dropdown-item {
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #3b82f6;
}

.hidden {
  display: none;
}

.promo-banner {
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  position: relative;

  /* Consistent slot: creatives fill it, scaled/cropped to this ratio.
     Matches the ~714x400 server-promo banners, so there's no cropping in practice. */
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 714 / 400;

  background: #111827;

  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-banner::after {
  content: "";
  position: absolute;
  inset: 0;

  background: linear-gradient(
    to right,
    rgba(15,23,42,0.5),
    transparent 30%,
    transparent 70%,
    rgba(15,23,42,0.5)
  );

  pointer-events: none;
}

.promo-banner a {
  display: block;
  width: 100%;
  height: 100%;
}

.promo-banner img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;
}

.promo-banner:hover {
  filter: brightness(1.05);
}

.promo-cta {
  display: flex;
  justify-content: center;
  margin-top: -15px;
}

.canvas-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dino-title {
  width: 100%;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.flip {
  display: inline-block;
  transform: scaleX(-1);
}

.promo-rail {
  position: fixed;
  top: 120px;

  width: 160px;
  max-height: calc(100vh - 160px);
  overflow: hidden;

  opacity: 0;
  transition: opacity 0.4s ease;

  display: none;
  z-index: 2;
}

.promo-rail.left {
  left: 20px;
}

.promo-rail.right {
  right: 20px;
}

.promo-rail.loaded {
  opacity: 0.75;
}

.promo-rail:hover {
  opacity: 1;
}

.promo-rail-slot {
  display: block;
  width: 160px;
  min-height: 600px;

  border-radius: 12px;
  overflow: hidden;

  background: #1e293b;
  box-shadow: 0 0 12px rgba(0,0,0,0.35);
}

.promo-rail-slot:empty {
  display: none;
}

/* Hide on shorter displays */
@media (max-height: 700px) {
  .promo-rail {
    display: none !important;
  }
}

.site-nav {
  padding: 10px 14px;
}

.site-nav-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.site-nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.site-nav-links a:hover {
  background: #334155;
  color: #e2e8f0;
}




/* Responsive Design */
@media (max-width: 600px) {
  .promo-rail {
    display: none !important;
  }
  
  button .emoji {
    display: none;
  }

  .regions-grid {
  display: grid;
  grid-template-columns: repeat(2, 2fr);
  gap: 10px;
  }

  .button-row {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 4px;
  }

  .button-row button {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .preset-container {
    flex-shrink: 0;
  }

  .preset-display {
    min-width: 90px;
    padding: 6px 8px;
    font-size: 12px;
  }

    .site-nav {
    padding: 8px 10px;
  }

  .site-nav-links {
    gap: 6px;
  }

  .site-nav-links a {
    font-size: 12px;
    padding: 5px 8px;
  }
}


/* Only show on larger screens */
@media (min-width: 1400px) {
  .promo-rail {
    display: block;
  }

  .app {
    max-width: 820px;
  }

  .app.app-wide {
    max-width: 1100px;
  }
}


/* ---------- Gallery / design pages ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.gallery-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.gallery-card:hover {
  border-color: #64748b;
  transform: translateY(-2px);
}

.gallery-card-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #000;
  display: block;
}

.gallery-card-body {
  padding: 10px;
}

.gallery-card-title {
  font-weight: 600;
  font-size: 14px;
}

.gallery-card-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.swatch-strip {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.community-intro,
.community-card .button-row {
  margin-top: 0;
}

.community-intro {
  color: #cbd5e1;
  font-size: 14px;
  margin: 0 0 12px;
}

.design-regions {
  color: #94a3b8;
  font-size: 13px;
}

.design-credit {
  margin: -8px 0 16px;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}

/* Anchors that should look like the .primary / .subtle buttons */
.button-link {
  display: inline-block;
  background: transparent;
  border: 1px solid #334155;
  border-color: #475569;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.button-link.subtle {
  color: #94a3b8;
}

.button-link:hover {
  background: #334155;
  color: #fff;
  border-color: #64748b;
  font-weight: 600;
}


/* ---------- Modal (share-to-gallery, advertise request) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 18px;
  width: 100%;
  max-width: 360px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Stop the page behind the modal from scrolling. */
body.modal-open {
  overflow: hidden;
}

.modal-box h3 {
  margin: 0 0 8px;
}

.modal-note {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 14px;
}

.modal-box label {
  display: block;
  font-size: 13px;
  margin-bottom: 10px;
}

.modal-optional {
  color: #64748b;
}

.modal-box input {
  width: 100%;
  margin-top: 4px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  box-sizing: border-box;
}

.modal-result {
  min-height: 18px;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 6px;
}