/* =============================================================
   TOKENBURNERS BIOPIC GENERATOR
   ============================================================= */

@font-face {
  font-family: 'Tektur';
  src: url('assets/fonts/Tektur.ttf') format('truetype-variations');
  font-weight: 400 900;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/InterVariable.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/InterVariable-Italic.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono.ttf') format('truetype-variations');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --black:  #0B0B0B;
  --ink:    #050505;
  --soot:   #141414;
  --smoke:  #1C1C1C;
  --ash:    #2A2A2A;
  --fog:    #3D3D3D;
  --steel:  #6B6B6B;
  --pearl:  #B8B8B8;
  --bone:   #E8E8E8;
  --white:  #FFFFFF;
  --lime:   #03FF00;
  --cyan:   #00E5FF;

  --font-d: 'Tektur', system-ui, sans-serif;
  --font-s: 'Inter', system-ui, sans-serif;
  --font-m: 'JetBrains Mono', ui-monospace, monospace;

  --glow:   0 0 20px rgba(3,255,0,0.4);
  --t:      140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-s);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* grid pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
  z-index: 0;
}

/* ── App shell ── */
.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  flex-shrink: 0;
  height: 44px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ash);
}
.hd-left {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-m);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hd-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 6px var(--lime);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.hd-brand { color: var(--bone); }
.hd-brand .sl { color: var(--lime); }
.hd-label { color: var(--steel); }
.hd-right {
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
}
.hd-right .sl { color: var(--lime); }

/* ── Main layout ── */
main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 256px 1fr;
  gap: 0;
}

/* ── Sidebar ── */
.sidebar {
  border-right: 1px solid var(--ash);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: none;
}
.sidebar-inner::-webkit-scrollbar { display: none; }

/* ── Upload zone ── */
.upload-zone {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px dashed var(--fog);
  border-radius: 4px;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t), background var(--t);
  flex-shrink: 0;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--lime);
  background: rgba(3,255,0,0.025);
}
.upload-zone.has-photo {
  border-style: solid;
  border-color: var(--ash);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.upload-ph svg { color: var(--fog); }
.upload-ph span {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
  text-align: center;
  line-height: 1.6;
}
.upload-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.upload-zone.has-photo .upload-img { display: block; }
.upload-zone.has-photo .upload-ph { display: none; }
.upload-swap {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 6px;
  background: rgba(5,5,5,0.88);
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime);
  text-align: center;
  opacity: 0;
  transition: opacity var(--t);
}
.upload-zone.has-photo:hover .upload-swap { opacity: 1; }

/* ── Section heading ── */
.s-head {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.s-head::before { content: "//"; color: var(--lime); font-weight: 700; }

/* ── Option pills ── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  padding: 5px 11px;
  border: 1px solid var(--ash);
  border-radius: 3px;
  background: transparent;
  color: var(--steel);
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--t), color var(--t), background var(--t);
  white-space: nowrap;
}
.pill:hover { border-color: var(--fog); color: var(--pearl); }
.pill.on {
  border-color: var(--lime);
  color: var(--lime);
  background: rgba(3,255,0,0.06);
}

/* ── Sidebar download section ── */
.sidebar-foot {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--ash);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--lime);
  color: var(--black);
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t);
}
.btn-dl:hover { background: #4DFF4D; box-shadow: var(--glow); }
.btn-dl:active { background: #00CC00; }
.btn-dl:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }
.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--steel);
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--ash);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}
.btn-copy:hover { border-color: var(--fog); color: var(--pearl); }

/* ── Preview area ── */
.preview-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.canvas-wrap {
  position: relative;
  width: min(calc(100vh - 160px), 420px);
  aspect-ratio: 1;
  flex-shrink: 0;
}
.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 2px;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
.canvas-drag-hint {
  position: absolute;
  bottom: -22px;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  display: none;
}
.canvas-drag-hint.visible { display: block; }

.canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.canvas-empty svg { color: var(--fog); }
.canvas-empty span {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
}

/* ── Upload error ── */
.upload-error {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff4d4d;
  margin-top: 6px;
  line-height: 1.5;
  min-height: 0;
}

/* ── Camera button ── */
.btn-cam {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 7px 12px;
  background: transparent;
  color: var(--steel);
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--ash);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}
.btn-cam:hover { border-color: var(--lime); color: var(--lime); }

/* ── Camera modal ── */
.cam-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5,5,5,0.88);
  align-items: center;
  justify-content: center;
}
.cam-modal.open { display: flex; }
.cam-inner {
  background: var(--soot);
  border: 1px solid var(--ash);
  border-radius: 4px;
  width: min(90vw, 480px);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.cam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ash);
}
.cam-title {
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}
.cam-close {
  background: transparent;
  border: none;
  color: var(--steel);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color var(--t);
}
.cam-close:hover { color: var(--white); }
.cam-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--ink);
  overflow: hidden;
}
.cam-preview-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}
.cam-capture {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px;
  padding: 11px 16px;
  background: var(--lime);
  color: var(--black);
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t);
}
.cam-capture:hover { background: #4DFF4D; box-shadow: var(--glow); }
.cam-capture:active { background: #00CC00; }

/* ── Slider row ── */
.s-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.s-val {
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lime);
}
.tb-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--ash);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.tb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  cursor: pointer;
  box-shadow: 0 0 6px var(--lime);
}
.tb-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 6px var(--lime);
}

/* ── Zoom control ── */
.zoom-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-left: 20px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}
.zoom-control.visible {
  opacity: 1;
  pointer-events: auto;
}
.zoom-label {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
}
.zoom-track-wrap {
  position: relative;
  width: 20px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-range {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 2px;
  background: var(--ash);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transform: rotate(-90deg);
  transform-origin: center;
}
.zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  cursor: pointer;
  box-shadow: 0 0 6px var(--lime);
}
.zoom-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 6px var(--lime);
}
.zoom-val {
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--lime);
}

/* ── Footer ── */
footer {
  flex-shrink: 0;
  height: 36px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--ash);
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel);
}
footer .sl { color: var(--lime); }

/* ── Privacy bar ── */
.privacy-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 24px;
  background: rgba(3,255,0,0.05);
  border-bottom: 1px solid rgba(3,255,0,0.18);
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--steel);
  text-transform: uppercase;
}
.privacy-ok {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--fog);
  color: var(--steel);
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}
.privacy-ok:hover { border-color: var(--lime); color: var(--lime); }

/* ── Mobile ── */
@media (max-width: 680px) {
  /* unlock fixed-viewport layout → page scrolls */
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100dvh;
  }

  main {
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  /* canvas area on top */
  .preview-area {
    order: 1;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 12px;
    overflow: visible;
    /* no flex:1 / min-height:0 needed — page scrolls */
  }

  .canvas-wrap {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    flex-shrink: 0;
  }

  .canvas-drag-hint { font-size: 9px; bottom: -16px; }

  /* zoom: horizontal bar below canvas */
  .zoom-control {
    flex-direction: row;
    align-items: center;
    padding-left: 0;
    gap: 8px;
    width: calc(100vw - 32px);
    flex-shrink: 0;
  }
  .zoom-track-wrap {
    flex: 1;
    width: auto;
    height: 20px;
    display: flex;
    align-items: center;
  }
  .zoom-range {
    position: static;
    width: 100%;
    height: 2px;
    transform: none;
  }
  .zoom-val { flex-shrink: 0; }

  /* sidebar flows below canvas, no height cap */
  .sidebar {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--ash);
    overflow: visible;
    max-height: none;
  }

  .sidebar-inner {
    overflow: visible;
    max-height: none;
    padding: 14px 16px;
    gap: 14px;
  }

  /* compact upload zone */
  .upload-zone {
    aspect-ratio: auto !important;
    height: 72px !important;
  }
  .upload-ph span { display: none; }

  /* download buttons: sticky bottom strip */
  .sidebar-foot {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--soot);
    flex-direction: row;
    padding: 10px 16px;
    gap: 8px;
    border-top: 1px solid var(--ash);
  }
  .btn-dl   { flex: 1; padding: 9px 8px; font-size: 11px; }
  .btn-copy { flex: 0 0 auto; }

  /* header: hide dimension label */
  .hd-right { display: none; }

  /* privacy bar: tighter padding */
  .privacy-bar { padding: 7px 16px; gap: 10px; }
}
