:root {
  --bg: #0b0b0b;
  --fg: #f4f4f4;
  --subtle: #bdbdbd;
  --accent: #00e0ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--fg);
  background: linear-gradient(180deg, #0b0b0b 0%, #111 100%);
}
.banner { width: 100%; background: #000; }
.banner { position: relative; display: flex; justify-content: center; align-items: center; background: #000; overflow: hidden; min-height: 200px; }
.banner img { width: 100%; height: auto; max-height: 65vh; display: block; object-fit: contain; z-index: 1; image-rendering: -webkit-optimize-contrast; }

/* Twinkling stars to fill side space */
.banner::before,
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* layer 1: dense, small stars */
.banner::before {
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.9) 0 1px, transparent 1.5px),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,0.8) 0 0.75px, transparent 1.2px),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,255,255,0.8) 0 0.75px, transparent 1.2px),
    radial-gradient(2px 2px at 85% 60%, rgba(255,255,255,0.85) 0 1px, transparent 1.5px),
    radial-gradient(1.5px 1.5px at 15% 80%, rgba(255,255,255,0.75) 0 0.75px, transparent 1.2px),
    radial-gradient(2px 2px at 55% 45%, rgba(255,255,255,0.9) 0 1px, transparent 1.5px);
  animation: twinkleA 4s ease-in-out infinite alternate;
  opacity: 0.6;
}

/* layer 2: fewer, larger stars */
.banner::after {
  background-image:
    radial-gradient(3px 3px at 10% 15%, rgba(255,255,255,0.9) 0 1.5px, transparent 2px),
    radial-gradient(2.5px 2.5px at 90% 30%, rgba(255,255,255,0.85) 0 1.25px, transparent 1.8px),
    radial-gradient(3px 3px at 30% 85%, rgba(255,255,255,0.9) 0 1.5px, transparent 2px),
    radial-gradient(2.5px 2.5px at 80% 75%, rgba(255,255,255,0.85) 0 1.25px, transparent 1.8px);
  animation: twinkleB 5.5s ease-in-out infinite alternate;
  opacity: 0.5;
}

@keyframes twinkleA {
  0% { opacity: 0.35; filter: brightness(0.8); }
  50% { opacity: 0.7; filter: brightness(1); }
  100% { opacity: 0.5; filter: brightness(0.9); }
}

@keyframes twinkleB {
  0% { opacity: 0.25; filter: brightness(0.7); }
  50% { opacity: 0.8; filter: brightness(1.1); }
  100% { opacity: 0.45; filter: brightness(0.85); }
}
.container { max-width: 1000px; margin: 0 auto; padding: 24px; }

/* Navigation */
.main-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px;
  background: #121212;
  border-bottom: 1px solid #272727;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.main-nav::-webkit-scrollbar {
  height: 4px;
}

.main-nav::-webkit-scrollbar-track {
  background: #0b0b0b;
}

.main-nav::-webkit-scrollbar-thumb {
  background: #272727;
  border-radius: 2px;
}

.main-nav::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

.nav-link {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover {
  background: #1a1a1a;
  color: var(--accent);
}

.nav-link:active {
  transform: translateY(1px);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(0, 224, 255, 0.1);
  border: 1px solid var(--accent);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .main-nav {
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-link {
    padding: 8px 14px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .main-nav {
    gap: 8px;
    padding: 12px;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Contract address section */
.contract-section {
  margin: 24px 0 32px;
}

.contract-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: #121212;
  border: 1px solid #272727;
  border-radius: 12px;
}

.contract-label {
  color: var(--subtle);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contract-address {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 15px;
  color: var(--accent);
  background: #0b0b0b;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #272727;
  word-break: break-all;
  user-select: all;
  cursor: text;
}

.copy-button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.copy-button:hover {
  background: var(--accent);
  color: #061318;
  transform: translateY(-1px);
}

.copy-button.copied {
  border-color: #00ff88;
  color: #00ff88;
}

.copy-button.copied:hover {
  background: #00ff88;
  color: #061318;
}

.hero { text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 40px; margin: 0 0 8px; letter-spacing: 0.5px; }
.hero p { color: var(--subtle); margin: 0; }
.refs h2, .generator h2 { margin: 24px 0 12px; font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
figure { margin: 0; background: #151515; border: 1px solid #272727; border-radius: 12px; overflow: hidden; }
figure img { display: block; width: 100%; height: auto; }
figcaption { padding: 8px 12px; font-size: 13px; color: var(--subtle); }
.note { color: var(--subtle); font-size: 13px; margin-top: 8px; }
label { display: block; margin-bottom: 8px; color: var(--subtle); }
textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #2a2a2a; background: #121212; color: var(--fg); resize: vertical; }
button {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px; border: 0; font-weight: 600; letter-spacing: 0.2px; cursor: pointer;
  background: linear-gradient(90deg, #00e0ff, #2b8cff);
  color: #061318;
}
.result { margin-top: 20px; }
.result.hidden { display: none; }
.result img { max-width: 100%; display: block; border-radius: 12px; border: 1px solid #272727; }
.result a { display: inline-block; margin-top: 10px; color: var(--fg); text-decoration: underline; }
.footer { margin-top: 40px; text-align: center; color: var(--subtle); font-size: 13px; }

/* Chat interface styles */
.chat {
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 300px);
  min-height: 500px;
  max-height: 800px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #121212;
  border: 1px solid #272727;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-track {
  background: #0b0b0b;
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb {
  background: #272727;
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  word-wrap: break-word;
}

.user-message {
  align-items: flex-end;
}

.user-message .message-header {
  color: var(--accent);
}

.user-message .message-content {
  background: linear-gradient(90deg, #00e0ff, #2b8cff);
  color: #061318;
  border-bottom-right-radius: 4px;
  max-width: 75%;
}

.optimus-message {
  align-items: flex-start;
}

.optimus-message .message-header {
  color: #ff6b35;
}

.optimus-message .message-content {
  background: #1a1a1a;
  border: 1px solid #272727;
  color: var(--fg);
  border-bottom-left-radius: 4px;
  max-width: 85%;
}

.message.loading .message-content {
  color: var(--subtle);
  font-style: italic;
  position: relative;
}

.message.loading .message-content::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.chat-form input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #121212;
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, background-color 0.2s;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: #151515;
}

.chat-form input::placeholder {
  color: #555;
}

.chat-form button {
  margin-top: 0;
  padding: 14px 24px;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 224, 255, 0.3);
}

.chat-form button:active {
  transform: translateY(0);
}

.chat-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Gallery Preview Section */
.gallery-preview-section {
  margin: 48px 0;
  padding: 32px 0;
  border-top: 1px solid #272727;
  border-bottom: 1px solid #272727;
}

.gallery-preview-header {
  text-align: center;
  margin-bottom: 32px;
}

.gallery-preview-header h2 {
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}

.gallery-preview-header p {
  color: var(--subtle);
  margin: 0 0 20px;
  font-size: 16px;
}

.gallery-link-btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  background: linear-gradient(90deg, #00e0ff, #2b8cff);
  color: #061318;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all 0.2s;
}

.gallery-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 224, 255, 0.3);
}

.gallery-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.gallery-preview-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #272727;
  background: #121212;
  cursor: pointer;
  transition: all 0.3s;
}

.gallery-preview-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 16px rgba(0, 224, 255, 0.2);
}

.gallery-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-preview-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-preview-item:hover::after {
  opacity: 1;
}

.gallery-preview-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 1;
}

.gallery-preview-item:hover .gallery-preview-label {
  opacity: 1;
  transform: translateY(0);
}

.gallery-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--subtle);
}

.gallery-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #ff6b6b;
}

.info-section {
  margin: 48px 0;
  padding: 32px;
  background: #121212;
  border: 1px solid #272727;
  border-radius: 12px;
}

.info-content {
  max-width: 800px;
  margin: 0 auto;
}

.info-content h2 {
  font-size: 28px;
  margin: 0 0 20px;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.5px;
}

.info-content p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--fg);
  margin: 0 0 20px;
}

.info-content p:last-of-type {
  margin-bottom: 0;
}

.info-content strong {
  color: var(--accent);
  font-weight: 600;
}

.info-tagline {
  margin-top: 24px !important;
  padding-top: 24px;
  border-top: 1px solid #272727;
  font-style: italic;
  color: var(--subtle);
  text-align: center;
}
