/* Dark theme */
:root { color-scheme: dark; }

/* Supply font */
@font-face {
  font-family: 'Supply';
  src: url('/static/fonts/Supply.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html, body { height: 100%; }
body {
  margin: 0; padding: 1.25rem 1rem 2rem;
  background: #020202; color: #e5e7eb;
  font-family: 'Supply', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
header { max-width: 920px; margin: 0 auto 1rem; display:flex; align-items:center; justify-content:space-between; gap: 12px; }
header h1 { margin: 0; font-size: 1.4rem; line-height: 1; }
main { max-width: 920px; margin: 0 auto; display: grid; gap: 1rem; }
.uploader { 
  display: grid; 
  grid-template-columns: 1fr auto; 
  gap: .5rem .75rem; 
  align-items: center; 
  justify-items: start; /* prevent stretch */
}
#file { color: #e5e7eb; }
/* grid placement */
.uploader #file { grid-column: 1; grid-row: 1; }
.uploader #convert { grid-column: 2; grid-row: 1; }
.uploader #toggleUrl { grid-column: 1; grid-row: 2; justify-self: start; }
.uploader #urlTools { grid-column: 1; grid-row: 3; }
.uploader #convertUrl { grid-column: 2; grid-row: 3; }
.uploader #status { grid-column: 1 / -1; grid-row: 4; }

/* Clean button style (inspired by provided example) */
.button-19 {
  appearance: button;
  position: relative;
  background-color: #1899D6;
  border: solid transparent;
  border-radius: 16px;
  border-width: 0 0 4px;
  box-sizing: border-box;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .7px;
  line-height: 18px;
  margin: 0;
  outline: none;
  padding: 11px 14px;
  text-align: center;
  text-transform: uppercase;
  transform: translateZ(0);
  transition: filter .2s;
  vertical-align: middle;
  white-space: nowrap;
  width: auto;
  text-decoration: none;
}
.button-19:after {
  background-clip: padding-box;
  background-color: #1CB0F6;
  border: solid transparent;
  border-radius: 16px;
  border-width: 0 0 4px;
  bottom: -4px;
  content: "";
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: -1;
}
.button-19:hover:not(:disabled) { filter: brightness(1.1); }
.button-19:disabled { cursor: auto; opacity: .6; }
.button-19:active { border-width: 4px 0 0; background: none; }

button[disabled] { opacity: .5; cursor: not-allowed; }
.viewer { }
#status { color: #9ca3af; min-height: 1.2rem; }
.viewer-canvas { width: 100%; height: 460px; background: #111; border: 1px solid #333; border-radius: 8px; position: relative; }
/* When section is fullscreen, stretch canvas to viewport */
.viewer:fullscreen { width: 100vw; height: 100vh; }
.viewer:fullscreen .viewer-canvas { width: 100vw; height: 100vh; }
.hidden { display: none !important; }
.result.hidden { display: none; }
.result { display: flex; gap: .75rem; align-items: center; }
footer { max-width: 920px; margin: 1rem auto 0; color: #6b7280; font-size: .85rem; }

/* Tabs */
.tabs { display: flex; gap: .5rem; margin-bottom: .5rem; }
.tab { background: transparent; border: 1px solid #2d2d34; color: #e5e7eb; padding: .4rem .7rem; border-radius: 8px; cursor: pointer; font-weight: 700; letter-spacing: .6px; }
.tab.active { background: #111217; }
.badge { font-size: 10px; background: #f59e0b; color: #0b0b0c; padding: 2px 6px; border-radius: 999px; margin-left: .4rem; text-transform: none; }
.panel { }

.spacer { flex: 1 1 auto; }
.icon-btn { 
  border: 1px solid #2d2d34; 
  background: #121214; 
  color: #e5e7eb; 
  border-radius: 8px; 
  width: 36px; 
  height: 36px; 
  padding: 0; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
}
.url-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#urlField {
  background: #121214; color: #e5e7eb; border: 1px solid #2d2d34; border-radius: 6px; padding: .45rem .6rem; min-width: 320px;
}

/* Drag & drop highlight */
.drop-target { border-color: #2563eb !important; box-shadow: 0 0 0 3px rgba(37,99,235,.4) inset; }

/* Viewer overlay buttons */
.viewer { position: relative; }
.viewer-btn { position: absolute; z-index: 5; border: 1px solid #2d2d34; background: rgba(18,18,20,.9); color: #e5e7eb; width: 32px; height: 32px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; }
.viewer-btn:hover { filter: brightness(1.15); }
.fs-btn { right: 8px; bottom: 8px; }
.egg-btn { left: 8px; bottom: 8px; }

/* Retrowave animated background (fallback) */
@keyframes retrowaveGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.retro-bg { 
  background: linear-gradient(135deg, #1a002b, #37003b, #5e0052, #b3005f, #ff3f7f) !important;
  background-size: 400% 400% !important;
  animation: retrowaveGradient 18s ease infinite !important;
}
/* When retrowave is active, remove the border to blend */
.retro-bg { border-color: transparent !important; }

/* Rich retrowave overlay */
.retro-overlay { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.retro-overlay .retro-sky { position:absolute; inset:0; background: linear-gradient(#0b0012 0%, #15001e 35%, #1a0030 100%); opacity:.95; }
@keyframes starTwinkle { 0%{opacity:.2} 50%{opacity:.5} 100%{opacity:.2} }
.retro-overlay .retro-stars { position:absolute; inset:0; background-image:
  radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.7), transparent 60%),
  radial-gradient(1.5px 1.5px at 60% 20%, rgba(255,255,255,.6), transparent 60%),
  radial-gradient(1.5px 1.5px at 80% 70%, rgba(255,255,255,.6), transparent 60%),
  radial-gradient(2px 2px at 35% 75%, rgba(255,255,255,.8), transparent 60%);
  background-repeat: no-repeat;
  animation: starTwinkle 4s ease-in-out infinite;
}
@keyframes sunPulse { 0%{transform:translate(-50%,0) scale(1); filter:brightness(1)} 100%{transform:translate(-50%,0) scale(1.05); filter:brightness(1.2)} }
.retro-overlay .retro-sun { position:absolute; left:50%; bottom:42%; width:28vh; height:28vh; border-radius:50%;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,174,0,.9) 0 40%, rgba(255,0,132,.7) 70%, rgba(255,0,132,0) 71%),
    repeating-linear-gradient(to bottom, rgba(255,145,145,.8) 0 3px, rgba(255,145,145,0) 3px 9px);
  mix-blend-mode: screen;
  transform: translateX(-50%);
  animation: sunPulse 6s ease-in-out infinite alternate;
}
@keyframes gridMove { 0%{ background-position: 0 0, 0 0; } 100%{ background-position: 0 40px, 80px 0; } }
.retro-overlay .retro-grid { position:absolute; left:0; right:0; bottom:-2%; height:60%;
  background-image: linear-gradient(rgba(255,255,255,.55) 2px, transparent 2px), linear-gradient(90deg, rgba(255,255,255,.35) 2px, transparent 2px);
  background-size: 100% 40px, 80px 100%;
  transform-origin: center bottom;
  transform: perspective(700px) rotateX(65deg);
  animation: gridMove 6s linear infinite;
  opacity:.85;
}
/* Simple full-cover overlays for other backdrops */
.img-overlay, .green-overlay { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.img-overlay { background: url('/static/images/BAYC.png') center center / cover no-repeat; }
.green-overlay { background: #00ff00; }
/* Hide border when any backdrop is active */
.backdrop-active { border-color: transparent !important; }

/* Toast */
.toast { position: fixed; top: 12px; right: 12px; background: #1f2937; color: #e5e7eb; border: 1px solid #374151; padding: .5rem .75rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.4); font-weight: 700; letter-spacing: .4px; }
.url-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#urlField {
  background: #121214; color: #e5e7eb; border: 1px solid #2d2d34; border-radius: 6px; padding: .45rem .6rem; min-width: 320px;
}

/* ensure form controls use Supply font */
input, button, select, textarea { font-family: 'Supply', ui-sans-serif, system-ui; }
input[type=\"file\"]::-webkit-file-upload-button { font-family: 'Supply', ui-sans-serif, system-ui; }
input[type=\"file\"]::file-selector-button { font-family: 'Supply', ui-sans-serif, system-ui; }
