
/* Tool page: force the same dark theme as the homepage (wins over any legacy styles) */
:root{
  --bg0:#070a12;
  --bg1:#0b1022;
  --card: rgba(255,255,255,.06);
  --stroke: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);
  --accent1:#ff5a2b;
  --accent2:#ff9b2f;
}

html,body{height:100%}
body{
  background:
    radial-gradient(1200px 700px at 70% 20%, rgba(255,140,60,.20), transparent 60%),
    radial-gradient(900px 500px at 30% 30%, rgba(110,150,255,.18), transparent 60%),
    radial-gradient(700px 400px at 50% 85%, rgba(255,90,43,.14), transparent 65%),
    linear-gradient(180deg, var(--bg0), var(--bg1)) !important;
  color: var(--text) !important;
}

/* Header always dark */
.site-header{
  background: rgba(6,10,20,.55) !important;
  border-bottom: 1px solid rgba(255,255,255,.06) !important;
}

/* Kill any legacy light-theme backgrounds */
.tool-wrap, .tool-wrap *{
  box-shadow: none;
}

.tool-wrap{
  padding: 26px 0 60px !important;
}

.tool-wrap .card,
.tool-wrap .panel,
.tool-wrap .box{
  background: rgba(15,20,35,.65) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 18px !important;
  box-shadow: 0 18px 60px rgba(0,0,0,.45) !important;
}

.tool-wrap h1, .tool-wrap h2, .tool-wrap h3, .tool-wrap label{
  color: rgba(255,255,255,.90) !important;
  text-shadow: 0 14px 40px rgba(0,0,0,.35);
}

.tool-wrap p, .tool-wrap .muted, .tool-wrap small, .tool-wrap .help, .tool-wrap .hint{
  color: rgba(255,255,255,.68) !important;
}

/* Improve readability of the legacy tool header section */
.tool-wrap .card > h1{
  margin: 0 0 10px !important;
  font-size: 22px !important;
  letter-spacing: -.3px;
}

/* Two-column layout for controls + preview (works with existing DOM) */
.tool-wrap .card{
  padding: 18px !important;
}

#vid, #c{
  width: 100% !important;
  border-radius: 18px !important;
  background: rgba(0,0,0,.35) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}

#thumbs{
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  gap: 10px !important;
}

.tool-wrap input[type="text"],
.tool-wrap input[type="url"],
.tool-wrap input[type="number"],
.tool-wrap textarea,
.tool-wrap select{
  width: 100% !important;
  background: rgba(0,0,0,.35) !important;
  color: rgba(255,255,255,.92) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 14px !important;
  padding: 11px 12px !important;
  outline: none !important;
}

.tool-wrap input::placeholder,
.tool-wrap textarea::placeholder{
  color: rgba(255,255,255,.45) !important;
}

.tool-wrap textarea{min-height: 120px !important}

/* Buttons */
.tool-wrap button{
  cursor:pointer;
  border-radius: 12px !important;
  font-weight: 900 !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  padding: 10px 14px !important;
  background: rgba(255,255,255,.08) !important;
  color: rgba(255,255,255,.92) !important;
}

#loadBtn, #recordBtn, #recordMusicBtn, #recordMicBtn, #previewBtn, #recordScreenBtn{
  background: linear-gradient(135deg, var(--accent1), var(--accent2)) !important;
  color: #140a08 !important;
  box-shadow: 0 18px 40px rgba(255,90,43,.20) !important;
}

#stopBtn{
  background: rgba(255,255,255,.10) !important;
}

/* Pills */
.tool-wrap .badge, .tool-wrap .pill, .tool-wrap .chip{
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  color: rgba(255,255,255,.75) !important;
}

/* Links */
.tool-wrap a{ color: rgba(255,255,255,.92) !important; }
.tool-wrap a:hover{ color: rgba(255,155,47,1) !important; }

/* Remove ugly selection look */
::selection{ background: rgba(255,155,47,.25); }



/* ---- Tool polish ---- */
.tool-wrap .row{display:flex !important; gap:14px !important; flex-wrap:wrap !important;}
.tool-wrap .row > div{flex:1 1 260px !important; min-width:260px !important;}
.tool-wrap .grid{display:grid !important; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)) !important; gap:10px !important;}

.preview-row > div{
  padding: 14px !important;
}
.preview-head{
  font-weight: 900;
  margin-bottom: 10px;
  color: rgba(255,255,255,.86) !important;
}

.preview-canvas, .preview-video{
  width: 100% !important;
  max-width: 380px !important;
  aspect-ratio: 9/16;
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  background: rgba(0,0,0,.35) !important;
}

.download-btn{
  margin-left: auto;
  text-decoration:none;
  align-self:center;
  min-width: 180px;
  justify-content:center;
}
.download-btn.ready{
  animation: glowPulse 1.2s ease-in-out infinite;
}
@keyframes glowPulse{
  0%{ box-shadow: 0 0 0 rgba(255,90,43,0); filter: brightness(1); }
  50%{ box-shadow: 0 0 28px rgba(255,90,43,.35); filter: brightness(1.05); }
  100%{ box-shadow: 0 0 0 rgba(255,90,43,0); filter: brightness(1); }
}

/* Make top action row feel like homepage */
.tool-wrap button, .tool-wrap .btn{height: 44px;}
.tool-wrap button.secondary{background: rgba(255,255,255,.08) !important;}

/* Improve readability of small hints */
.tool-wrap .muted{line-height:1.5;}



/* --- Further tool usability polish --- */
.tool-section-title{margin:0 0 6px; font-size:22px; font-weight:900;}
.tool-section-lead{margin:0 0 14px; color: rgba(255,255,255,.64) !important; line-height:1.5;}
.tool-subhead{margin:18px 0 10px; font-size:14px; letter-spacing:.08em; text-transform:uppercase; color: rgba(255,255,255,.65) !important;}

.tool-details{padding:12px 14px !important; margin:12px 0;}
.tool-details > summary{font-weight:900;}
.tool-details-body{padding-top:10px;}

.tool-layout{display:grid; grid-template-columns: 1.05fr .95fr; gap:14px; align-items:start;}
.tool-left .card{padding:18px !important;}
.tool-right .tool-output{padding:14px !important;}
@media (max-width: 980px){
  .tool-layout{grid-template-columns:1fr;}
  .download-btn{width:100%;}
}

/* Make selects/inputs not comically wide */
.tool-wrap .row > div{max-width: 520px;}
.tool-wrap select, .tool-wrap input[type="number"]{max-width: 520px;}





/* Thumbnail grid: clean wrapped layout (no scroll box) */
#thumbs{
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}
#thumbs img{
  display:block;
  width: 100%;
  height: 96px;
  object-fit: cover;
}
@media (min-width: 980px){
  #thumbs{ display:grid !important; grid-template-columns: repeat(5, minmax(0,1fr)) !important; gap:10px !important; }
}
@media (max-width: 979px){
  #thumbs{ display:grid !important; grid-template-columns: repeat(3, minmax(0,1fr)) !important; gap:10px !important; }
}


/* Download overlay */
.dl-overlay{ position:fixed; inset:0; z-index:9999; }
.dl-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.65); backdrop-filter: blur(8px); }
.dl-modal{
  position:relative;
  width:min(560px, 92vw);
  margin: 10vh auto 0;
  padding: 16px !important;
}
.dl-top{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.dl-title{font-weight:900; font-size:18px; color: rgba(255,255,255,.92) !important;}
.dl-close{
  width:40px; height:40px; border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
}
.dl-actions{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px;}
.dl-actions .download-btn{flex:1 1 240px; justify-content:center;}
.dl-actions .btn.ghost{flex:1 1 140px; justify-content:center;}


/* Processing spinner */
.spinner-wrap{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:14px 4px;}
.spinner{
  width:44px; height:44px;
  border-radius:50%;
  border:4px solid rgba(255,255,255,.14);
  border-top-color: rgba(255,155,47,1);
  animation: spin 1s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg);}}

/* Overlay safety */
.dl-overlay{z-index:9999 !important;}
.dl-overlay[style*="display:none"]{display:none !important;}
