:root {
  --bg: #FF1100;
  --card: #000000;
  --btn-dim: rgba(0, 0, 0, 0.28);
  --white: #FFFFFF;
  --white-dim: rgba(255, 255, 255, 0.45);
  --white-faint: rgba(255, 255, 255, 0.3);
  --radius: 28px;
  --radius-row: 24px;
  --mono: 'JetBrains Mono', ui-monospace, "SF Mono", monospace;
  --serif: 'Times New Roman', Times, Georgia, serif;
}

* { box-sizing: border-box; }

:focus-visible { outline: 2px solid var(--card); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--card);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Header */
.topbar { position: relative; padding: 44px 24px 8px; text-align: center; }
.topbar h1 { margin: 0; }
.about-link {
  position: absolute; right: 24px; top: 44px; height: 40px;
  display: flex; align-items: center;
  background: none; border: none; padding: 0;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--card); cursor: pointer;
}
.about-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.wordmark-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.topbar .wordmark {
  display: block;
  margin: 0 auto;
  width: auto;
  height: 40px;
}

main {
  flex: 1;
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  padding: 36px 24px 24px;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed rgba(0, 0, 0, 0.5);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.32);
  padding: 68px 24px;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone.drag { border-color: rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.5); }
.drop-icon { display: inline-block; width: 48px; height: 48px; color: var(--white-dim); }
.drop-icon svg { display: block; width: 100%; height: 100%; }
.drop-format {
  font-size: 13px; margin: 22px 0 0;
  color: var(--white-dim); font-weight: 600;
}
.drop-title {
  font-size: 14px; margin: 12px 0 8px;
  color: var(--white); font-weight: 700;
}
.drop-sub { margin: 0; color: var(--white-dim); font-size: 14px; font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--white);
  cursor: pointer; font-size: inherit; font-family: inherit; padding: 0;
  font-weight: 700;
}

/* Editor */
.editor { margin-top: 48px; }

/* While rendering, the whole settings area (format, faders, transparency) drops back hard */
.editor.busy .seg,
.editor.busy .cards-grid { opacity: .3; pointer-events: none; transition: opacity .15s; }
.seg, .cards-grid { transition: opacity .15s; }

/* Figma drop shadow: X0 Y16 blur 64 #000 at 25% — on every tile from the format row down */
.seg-btn, .ctl-card, .action-btn, .file-row { box-shadow: 0 16px 64px rgba(0, 0, 0, 0.25); }

/* Format buttons */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.seg-btn {
  background: var(--btn-dim);
  border: none;
  color: var(--white);
  border-radius: var(--radius);
  height: 84px;
  cursor: pointer;
  font-size: 14px; font-weight: 700; font-family: inherit;
  transition: background .12s;
}
.seg-btn:hover { background: rgba(0, 0, 0, 0.4); }
.seg-btn.active {
  background: var(--card);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.25), 0 0 0 3px var(--bg), 0 0 0 4.5px var(--card);
}

/* Control cards */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}
.ctl-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 26px 30px;
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 230px;
}
.ctl-label { font-size: 14px; font-weight: 700; color: var(--white); }
.ctl-value {
  font-size: 74px;
  font-weight: 100;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 10px 0 22px;
  color: var(--white);
  white-space: nowrap;
}

/* Faders — outlined pill track, white fill */
.fader {
  position: relative;
  height: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 100px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  margin-top: auto;
}
.fader-fill {
  position: absolute;
  left: 3px; top: 3px; bottom: 3px;
  width: calc((100% - 6px) * var(--fader-pct, 0));
  background: var(--white);
  border-radius: 100px;
  pointer-events: none;
}
.fader:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.fader.disabled { opacity: .35; pointer-events: none; }

/* Transparency card */
.alpha-card {
  border: none;
  cursor: pointer;
  font-family: inherit;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.alpha-card .switch {
  display: block; position: relative;
  width: 92px; height: 46px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  transition: border-color .15s;
}
.alpha-card .switch-knob {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: 5px;
  width: 32px; height: 32px;
  background: var(--white);
  border-radius: 50%;
  transition: left .18s;
}
.alpha-card.on .switch { border-color: rgba(255, 255, 255, 0.9); }
.alpha-card.on .switch-knob { left: calc(100% - 37px); }
.alpha-card .alpha-label { font-size: 14px; font-weight: 700; color: var(--white); }
.alpha-card:not(.on) .alpha-label { opacity: .55; }
.alpha-card.unavailable { opacity: .35; pointer-events: none; }

/* Action buttons */
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
}
.action-btn {
  background: var(--btn-dim);
  border: none;
  color: var(--white);
  border-radius: var(--radius);
  height: 84px;
  cursor: pointer;
  font-size: 14px; font-weight: 700; font-family: inherit;
  transition: background .12s, opacity .12s;
}
.action-btn:hover:not(:disabled) { background: rgba(0, 0, 0, 0.4); }
.action-btn.primary { background: var(--card); }
.action-btn.primary:hover:not(:disabled) { background: #1a1a1a; }
.action-btn:disabled { opacity: .3; cursor: not-allowed; }

/* File rows */
.file-list { display: flex; flex-direction: column; gap: 24px; margin-top: 24px; }
.file-row {
  background: var(--card);
  border-radius: var(--radius-row);
  padding: 22px 24px;
  color: var(--white);
}
.fr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fr-name {
  font-size: 14px; font-weight: 700; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.fr-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.fr-controls { display: flex; align-items: center; gap: 14px; flex: none; }
.row-remove, .row-pause {
  background: transparent; border: none; color: var(--white); cursor: pointer;
  font-size: 13px; font-weight: 700; padding: 0 2px; line-height: 1; font-family: inherit;
}
.row-pause svg, .row-remove svg { display: block; }
.row-remove:hover, .row-pause:hover { color: var(--bg); }
.fr-mid {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 8px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden;
}
.fr-src { color: var(--white-dim); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.fr-arrow { color: var(--white-dim); flex: none; }
.fr-out { color: rgba(255, 255, 255, 0.85); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.fr-status { margin-left: auto; color: var(--bg); font-weight: 700; flex: none; padding-left: 8px; }
.fr-status.err { color: var(--white); }
.fr-progress {
  height: 9px;
  border-radius: 100px;
  background: var(--bg);
  overflow: hidden;
  margin-top: 16px;
}
.fr-progress .fill { height: 100%; width: 0%; background: var(--white); border-radius: 100px; transition: width .2s; }
.fr-bottom { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.fr-bottom .row-dl { min-width: 0; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.row-dl {
  display: inline-block;
  background: var(--bg);
  color: var(--white);
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  transition: filter .12s;
}
.row-dl:hover { filter: brightness(1.08); }

.alpha-note {
  font-size: 11px; color: var(--white-dim); line-height: 1.5; font-weight: 500;
  margin-top: 12px;
}

/* About popup */
.about-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.about-card {
  background: #E9E9EC; color: #1B1B1F;
  border-radius: 24px;
  max-width: 560px; width: 100%;
  padding: 26px 28px 30px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.25);
}
.about-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.wm-small { display: block; height: 17px; width: auto; }
.about-close {
  width: 36px; height: 36px; flex: none;
  border: 1.5px solid rgba(0, 0, 0, 0.55); border-radius: 50%;
  background: none; color: #1B1B1F; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.about-close:hover { background: rgba(0, 0, 0, 0.07); }
.about-card p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.7; font-weight: 500; }
.about-card p:last-child { margin-bottom: 0; }

/* Preview viewer */
.viewer-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.viewer-card {
  background: var(--card); color: var(--white);
  border-radius: 24px;
  width: min(860px, 100%);
  padding: 18px 20px 20px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.25);
}
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.viewer-name { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.viewer-tag {
  flex: none; font-size: 10px; font-weight: 700;
  background: var(--bg); color: var(--white);
  border-radius: 6px; padding: 3px 7px;
}
.viewer-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-tools { display: flex; align-items: center; gap: 12px; flex: none; }
.viewer-close {
  width: 34px; height: 34px; flex: none;
  border: 1.5px solid rgba(255, 255, 255, 0.55); border-radius: 50%;
  background: none; color: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.viewer-close:hover { background: rgba(255, 255, 255, 0.12); }
.viewer-stage {
  border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 240px; max-height: 62vh;
  background: #808080;
}
.viewer-stage.checker {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #D4D4D4 25%, transparent 25%),
    linear-gradient(-45deg, #D4D4D4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #D4D4D4 75%),
    linear-gradient(-45deg, transparent 75%, #D4D4D4 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.viewer-stage video, .viewer-stage img { display: block; max-width: 100%; max-height: 62vh; }
.viewer-noplay { margin: 0; padding: 24px; font-size: 12px; font-weight: 600; color: rgba(0,0,0,.75); text-align: center; }

.footer {
  max-width: 750px; width: 100%;
  margin: 0 auto; padding: 8px 24px 36px;
  font-size: 11px; font-weight: 600;
  color: rgba(0, 0, 0, 0.55);
  text-align: center;
}

@media (max-width: 560px) {
  .ctl-value { font-size: 54px; }
  .seg, .actions { gap: 12px; }
  .cards-grid { gap: 12px; }
}
